The repo contain 3 main contracts
This contract implement is a boilerplate for lossless betting contracts for football 1X2. Contract has an owner to settle the bet, to be replaced by Chainlink.
Process
- Owner creates contract, sets
matchStartBlock
andmatchFinishBlock
: Players can place bets beforematchStartBlock
and owner can settle the game after `matchFinishBlock. - Before matchStartBlock player can pick a side ( Home, Draw, Away), choose an amount and place a bet.
- After placing a bet the player win points proportional to the
amount
andblocks remaining before matchStartBlock
. - The chance of winning for the player is proportional to his points.
- The money deposited for bets is then lent to a protocol and earns yield : Lending logic should be implemented in the contract that inherits this one.
- After game is finished and owner sets winning team, contract pick randomly a winner who bet on the right side.
- Winner wins the yield generated, and other players are refunded.
Params
matchStartBlock
: Block at which game is supposed to start.matchFinishBlock
: Block after which game should have ended.
This contract implement is a lossless betting contracts for football 1X2 that use Aave to generate yield. Contract has an owner to settle the bet, to be replaced by Chainlink
Process
- Contract inherits from
Lossless.sol
. - Owner creates contract, sets
token
andlendingpool
: token for betting and lending pool to use.. - Contract can also be sponsored : someone deposit without participating in betting.
- Players can place bets before
matchStartBlock
. - Betting money is then deposited into Aave to earn yield.
- Owner can settle the game after
matchFinishBlock
, a winner is then randomly picked he wins the yield generated.
Anyone can
- Sponsor the contract.
- Place bets before
matchStartBlock
.
Admin/Owner can
- Set winning team after
matchFinishBlock
.
Params
2. token
: ERC20 token address used for betting.
3. lendingPool
: Aave lending pool address.
4. winner
:Winning player address.
5. sponsorDeposit
: Amount deposited by sponsors to the contract.
Similar to AaveLossless.sol
, not implemented yet
All tests/scripts are written with brownie
.
Local testing using mainnet-fork.
No unit test yet, deployed contract on mainnet-fork and tested theAaveLossless.sol
process with a script end to end using the weth
token. Worked fine.
- Node JS (everything was tested under
v14.18.1
) - Brownie - ( the version used is
v1.17.2
) - Ganache CLI ( the version used is
v6.12.2
)
Contracts are written in solidity v0.6.x
and SafeMath have not been implemented yet.