Ready for Sale
Deterministic weighted random lottery
- minEntry: sets minimum amount of eth (in wei) to be able to enter the lottery
- maxEntry: maximum amount of eth (in wei) to be able to enter the lottery
- minParticipants: minimum number of distinct addresses that need to participate (hardcoded to a minimum of 2, because if not you would be playing by yourself #foreveralone)
- payoutPercentage: a int from 1 to 100 and it represents the percentage of the lottery the winner gets (the rest goes to the owner, to pay fees and such)
- isRunning gets the token symbol
- chooseWinner gets the token standard; ussually ERC20
- startLottery gets the token name
- stopLottery gets number of token decimals
- minEntry: 1000000000000000000
- maxEntry: 20000000000000000000
- minParticipants: 5
- payoutPercentage: 60
The winner is chosen randomly but weighted by the amount of ETH he/she sent.
For example, if A sent 4 ETH, B sent 5 ETH anc C sent 1 ETH, A has a 40% chance of winning, B 50% and C 10% of whatever percentage is given to the winnner.
- only the owner can start the lottery,
- when the lottery is stopped all participants are refunded (the fees are paid by the owner when he/she stops the lottery),
- the participants should send funds from a regular ETH address, not a contract address,
- the randomness part is a deterministic random (because you basically cannot predict the timestamp at which the block is mined, nor the block number),
- only owner can say when the lottery pays a winner."