The two current ERC20 implementations we envision are:

The Kyber network is a very appealing approach to ERC20 wagering and payouts. Our house ETH pool or the player’s wager can easily be converted into the requested token through the use of Kyber’s API.

The commands below can be found within Kyber’s Whitepaper: https://kyber.network/assets/KyberNetworkWhitepaper.pdf

“2.4.1. User API User API can be called by any Ethereum account, including normal account and contract ones.

Transfer( amount, source tokens, destination token name, destination address)

Transfer function converts amount of source tokens (token A) to destination tokens (token B) and sends type B tokens to destination address. For example, users can call Transfer( 100, “DGD”, “Melon”, “0xb794f5ea0ba39494ce839613fffba74279579268”) to convert 100 DigixDao tokens to Melonport tokens and transfer all converted Melonport tokens to “0xb794f5ea0ba39494ce839613fffba74279579268”.

GetExchangeRate( token A, token B)

Returns the conversion rate between token A and token B. In the future we can support different exchange rates for different trade volumes.”

Scenario 1:

ETH wager to ETH payout

This is the standard and most common use case. The player wagers ETH and requests ETH payout. No special functionality required for such a scenario.

Scenario 2:

User wagers and loses 10 GNT in our casino war game, which triggers our smart contract to call the command Transfer(10,GNT,ETH,ethinowallet) from Kyber’s api.

The GNT tokens are converted into ETH and sent to our game smart contract which holds the house’s pool of ETH funds.

Scenario 3:

User wagers 10 GNT and wins in our casino war card game. They select ETH as their payout. Our smart contract calls GetExchangeRate(GNT,ETH) (Example: rate returns 0.00087930 x 10 GNT = 0.0087930 ETH)

The player is paid 0.0087930 ETH from our house ETH pool for their win.

Scenario 4:

User wagers 10 GNT and wins in our casino war card game. They select REP as their payout. Our smart contract calls Kyber with GetExchangeRate(GNT,REP) (Example: rate returns 0.1 x 10 GNT = 1 REP) Our smart contract then calls Transfer(1,REP,ETH,playerwallet)

GNT wager is converted into REP which then converts house ETH into that amount of REP and is paid out to the player.

Scenario 5:

User wagers 10 GNT and wins in our casino war card game. They select GNT as their payout. Our smart contract calls Kyber with GetExchangeRate(GNT,ETH) (Example: rate returns 0.00087930 x 10 GNT = 0.0087930 ETH) Our smart contract then calls Transfer(0.0087930,ETH,GNT,playerwallet)

Scenario 1:

ETH wager to ETH payout

This is the standard and most common use case. The player wagers ETH and requests ETH payout. No special functionality required for such a scenario.

Scenario 2:

10 GNT wager to ETH payout

One example would be the wagering of GNT tokens to win ETH. If the player wagers 10 GNT, the Ethino Game Smart Contract will reach out to the 0x order book in order to determine what the correct ETH payout should be. This can be captured by determining the GNT/ETH ratio of a 10 GNT market sell order to the 0x DEX order book.

Sample 0x DEX order book

In the event of a Player win, Ethino will request a quote for a 10 GNT/ETH market sell order from 0x DEX order book. The resulting ETH payout from Ethino bankroll is 0.00929 ETH.

In the event of a Player loss, Ethino will market sell 10 GNT/ETH from the 0x DEX order book. The resulting 0.00929 ETH will be added to Ethino’s bankroll.

Formula:

0.00929=(0.00095*(2/10))+(0.00094*(2/10))+(0.00093**(2/10))+(0.00092**(2/10))+(0.00091**(1/10))+(0.0009**(1/10))

Scenario 3:

0.00929 ETH wager to GNT payout

This is the reverse of Scenario 2. Ethino game smart contract would reach out to the 0x DEX order book in order to determine the correct conversion for 0.00929 ETH/GNT market buy order.

Sample 0x DEX order book

In the event of a Player win, Ethino will market sell 0.00929 ETH/GNT on the 0x DEX order book from its bankroll. The resulting GNT payout from Ethino bankroll is 10 GNT.

In the event of a Player loss, Ethino will add the 0.00929 ETH wager to its bankroll.

Scenario 4:

10 GNT wager to GNT payout

In this scenario the user is wagering 10 GNT and requesting a 10 GNT payout. The game smart contract will reach out to 0x to determine how much house ETH to sell for 10 GNT.

Sample 0x DEX order book

In the event of a Player win, Ethino will market sell 0.00929 ETH/GNT on the 0x DEX order book from its bankroll. The resulting GNT payout from Ethino bankroll is 10 GNT.

In the event of a Player loss, Ethino will market sell the 10 GNT wager and add 0.00929 ETH to its bankroll.