Ready for Sale


Custom purpose

Deterministic weighted random lottery


  1. minEntry: sets minimum amount of eth (in wei) to be able to enter the lottery
  2. maxEntry: maximum amount of eth (in wei) to be able to enter the lottery
  3. 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)
  4. 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)

Exposed methods

  1. fallback
  2. isRunning gets the token symbol
  3. chooseWinner gets the token standard; ussually ERC20
  4. startLottery gets the token name
  5. stopLottery gets number of token decimals


  1. minEntry: 1000000000000000000
  2. maxEntry: 20000000000000000000
  3. minParticipants: 5
  4. 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.

##Other information:

  • 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."
Reviewed by Modex

Copyright © Modex Marketplace