Skip to content

A very simple yet fun and incentivized lottery game on ICON blockchain network.

License

Notifications You must be signed in to change notification settings

duyyudus/megaloop-lottery

Repository files navigation

ICONVIET MEGALOOP - Lightpaper

A very simple yet fun and incentivized lottery game on ICON blockchain network.

Unlike other gamble or lottery Dapps, this game utilizes and features

  • Very simple rule, no multiple rounds running simultaneously, only one

  • Subsidy funded by ICONVIET in launch phase, which is very attractive and incentivizing early participants

  • Probabilistic pseudorandom selection algorithm in smart contract environment, which allows players taking greater risk with big bets, and rewards them accordingly as well.

Given such simplicity, this game just needs a very simple UI to display a few neccessary information about on-going lottery round.

In order to play this game, you only need to know and do one thing : send ICX, the chance of winning is proportional to the size of ICX deposit.

If you are interested in contract API, see here

Definitions

Internal variables

PLAYERS : a record of players ( mapping between ICX addresses and deposit size )

JACKPOT : accumulated amount of ICX deposited to this lottery contract in one single round

LAST_SETTLEMENT_BH : the height of block in which previous winner selection procedure was executed

LAST_WINNER : address of the winner in previous round

TOP_DEPOSIT : highest recorded ICX amount transferred by a single player in current round

External variables

DEPOSIT_BH : the height of block which contains the transaction of ICX deposit to this lottery contract by a certain player

TX_HASH : the hash of winner selection transaction

Governance parameters

MAX_SUBSIDY: determine the maximum amount of ICX held in the contract for subsidizing the final prize to reach POT_LIMIT for each round. Must not be greater than POT_LIMIT

POT_LIMIT : the limit of JACKPOT, it helps to prevent huge loss in case of contract bug and hack

COMMISSION : ICX amount in JACKPOT to be tranferred to PROFIT_HOLDER after each round, in form of percentage, e.g. 5%

PROFIT_HOLDER : address that hold profit from commission

Rule

  1. Players can send their ICX to the contract whenever they want, sender’s addresses are included in PLAYERS list of the contract. Here we have NEW_DEPOSIT as tranferred ICX amount

    • If JACKPOT + NEW_DEPOSIT exceeds POT_LIMIT, transaction will fail

  2. When draw_winner function of the contract is called by some external_agent ( contract cannot trigger itself )

    • There must be at least 2 players in current round

    • The settlement procedure is executed

    • The winner is chosen

    • PLAYERS record and other relevant variables are also reset

    • COMMISSION percentage of JACKPOT is transferred to PROFIT_HOLDER, and the rest to the winner.
      For instance, assume COMMISSION is 5%, we have

      • 5% of JACKPOT is transferred to PROFIT_HOLDER

      • 95% to the prize

    • If MAX_SUBSIDY is greater than zero and JACKPOT still less than POT_LIMIT, then

      • FINAL_PRIZE = JACKPOT + MAX_SUBSIDY

      • If FINAL_PRIZE is greater than POT_LIMIT, it will be cut down to POT_LIMIT

  3. If LAST_SETTLEMENT_BH and DEPOSIT_BH is the same, and if ICX deposit transaction is executed after the winner drawing transaction, that sender will be in PLAYERS list of the next round.

  4. For each player, the probability of being chosen as winner is proportional to the size of ICX deposit.

  5. Winner is chosen by a pseudo-random function with random seed composed of TX_HASH ` `number of PLAYERS` ` JACKPOT ( string concatenation )

Fairness and transparency

The winner selection procedure is

  • Based on pseudo-random function, hence no one is able to manipulate and game the system ( assume there is no bug )

  • Contract code is public and can be audited by anyone

Roadmap and the role of ICONVIET

Phase 0

  • All governance parameters are set by ICONVIET, including

    • MAX_SUBSIDY is 400 ICX, funded by ICONVIET

    • POT_LIMIT is 1000 ICX per day

    • COMMISSION is 0%

  • Winner selection is triggered by ICONVIET for approximately each 43200 blocks period ( daily )

This phase will last for at least one month, to keep bugs under control ( if any ), as well as gathering insights for further development.

Phase 1

To be decided…​

About

A very simple yet fun and incentivized lottery game on ICON blockchain network.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published