How to play:





  • Play with a website and Metamask.
  • Play directly with no intermediary using geth.




  • Play with a website and Metamask:

    1 - If you haven't already, download and install Metamask.
    2 - Enable the extension and sign in to your Metamask account.
    3 - Using the Chrome browser visit our BET page.
    4 - Choose the lottery pool you want to bet in.
    5 - Then choose the ticket amount you want to purchase, 1 minimum.
    6 - Click buy then confirm your purchase with the Metamask popup.
    7 - Good luck!




  • Play directly with no intermediary using geth:

    To play with geth, we provide a js library to simplify the contracts calls.
    You can download ETH_geth.js and PoolManager.js.

    ETH_geth.js is a wrapper for web3 calls, used by PoolManager.js
    PoolManager.js provides methods to access the contract directly in an easy way.

    USING POOLMANAGER IN GETH:

    1 - Open your geth console as usual.

    2 - Load the scripts :
    on Linux :
    loadScript('path/to/scripts/ETH.js');
    loadScript('path/to/scripts/PoolManager.js');
    on Windows: (note the double '\')
    loadScript('path\\to\\scripts\\ETH.js');
    loadScript('path\\to\\scripts\\PoolManager.js');


    3 - Load the pools :
    Then you can call in your console
    PoolManager.init()
    You'll see the active and ended pools

    4 - Buy tickets for a pool (replace poolIndex and ticketCount):
    PoolManager.buyTickets(poolIndex, ticketCount)
    This will send the transaction to the contract with the correct amount (ticketCount * ticketPrice)
    NB : your account need to be unlocked (personal.unlockAccount(), more info here)
    Wait a bit (maximum 30 secs) for the transaction to be mined before refreshing the pools (see other commands below)

    OTHER COMMANDS:
    - Refresh the pools
    PoolManager.loadPools()
    This will refresh all the pools info (active and ended)
    or you can refresh only one pool with its index:
    var pool = PoolManager.getPool(index); // for an active pool
    pool.load();

    or
    var poolDone = PoolManager.getPoolDone(index); // for an ended pool
    poolDone.load

    each call to the load method will refresh the info

    - Check for a win
    When a pool is ended, it goes into the pool done array, and the winner is picked 1 hour later
    After PoolManager.init() or PoolManager.loadPools(), you can do :
    (replace index by the pool you want to check)
    var poolDone = PoolManager.getPoolDone(index);
    poolDone.winner;

    if it's 0x0000000000..., the winner is not picked yet
    or just :
    poolDone; //to see all its info

    - Send its price to winner
    PoolManager.sendPoolMoney(index);
    This sends the pool money to the winner. This is done automatically by our console, but anyone can call it too (this costs gas)

    - Changing account
    You can change the account sending the transactions (like buy tickets)
    ETH.account = 'your_eth_addr' (replace your_eth_addr by 0x..... inside the quotes)
    or
    ETH.account = eth.accounts[1] (if you have multiple accounts set)
    By default, the account is eth.coinbase


    UPDATE COMMANDS
    The following commands are used to update the states of the pools.
    They are called automatically by our console, since they cost some gas... But you are free to call them too :-)

    PoolManager.checkPoolEnd(index)
    This check if an active pool is ended, and restart one if it is (this costs a lot of gas)
    If the pool was ended, it goes into the poolDone array
    You can use PoolManager.loadPools() to refresh the pools at any time to see active and ended pools

    PoolManager.checkPoolDone(index)
    This check if a ended pool can be terminated (if one hour has passed since the ended state), and pick a winner if it can.

    PoolManager.clearPoolsDone()
    This clear the poolDone array, when all the money have been sent

    PoolManager.sendPoolMoney(index)
    Our console send the money to the winner automatically