Bet lifecycle
Last updated
Was this helpful?
Last updated
Was this helpful?
Rogue Index has revolutionized the traditional binary options model by replacing bet expiry timestamps with verifiable serial numbers that are paired with price updates. This is a fundamental improvement on the binary options model.
This is made possible by our use of a third party service called random.org to generate the random numbers that are used as Rogue Index price updates.
When Rogue requests a price update from random.org, they reply with not only a random number but also a sequential serial number verifying that we didn't keep re-rolling the dice until we got a number that we like.
This creates the opportunity to use these serial numbers as the bet expiry deadlines instead of timestamps because each serial number has a verifiable price associated with it, making it impossible for us to manipulate results to affect the outcome of any bets. Here's the complete lifecycle of a bet from placement to settlement:
To submit a bet the player must set the following four variables:
Bet size - the amount of ROGUE being wagered
Bet direction - whether the index will be higher or lower when the bet settles
Bet duration - the number of serial number updates before the bet is settled
Bet currency - can only be ROGUE but is still a required argument
The player calls the placeBet function in the Rogue Index smart contract with a ROGUE value of the desired bet size and passing the bet direction, bet duration and bet currency as arguments in the function call.
When using the game UI of the Rogue Trader platform to submit bets this function call is handled under the hood after the player has entered these variables into the correct input fields and pressed the UP or DOWN button to submit the bet.
If desired, the player can bypass using the Rogue Trader platform and instead submit bets by connecting his wallet to roguescan and calling the directly on the Rogue Index smart contract, passing in the required variables as function calls.
Or the player can use open source software like ethers.js to connect directly to Rogue Chain via our public RPC endpoint and then directly calling the
function of the Rogue Index smart contract with a ROGUE value of the bet amount and the other 3 variables passed as arguments.
The method used by the player for submitting a bet makes no difference to the Rogue Index smart contract and the function call is handled exactly the same by the smart contract regardless of how the bet was submitted.
When the Rogue Index smart contract receives an incoming placeBet function call, it forwards the bet stake to the ROGUE Bankroll and creates an unsettled bet struct with the bet's info and then stores that struct in a mapping that holds all unsettled bets indexed by their expiry serial number.
The unsettled bet struct contains the following information:
The Rogue Trader platform updates the Rogue Index smart contract every second with the latest price update and serial number provided by random.org. It does this by calling the function
and passing the new price and serial number as arguments in the function call. Within that function call the function
is called which finds all the unsettled bet structs that expire at this serialNumber and settles them at newPrice.
If the bet is a winner, the Rogue Index smart contract calls the function
in the ROGUE Bankroll smart contract which updates the contract's balance and liabilities and sends the winning payout to the player's wallet.
If the bet is a loser the Rogue Index smart contract calls the function
in the ROGUE Bankroll telling it to keep the player's stake and to update it's balance and liabilities accordingly.
If the settlement price of the bet is exactly the same as the entry price the bet breaks even and so the Rogue Index smart contract calls the function
in the ROGUE Bankroll smart contract telling it to return the player's stake only and to update it's balance and liabilities accordingly.
The Rogue Index smart contract then emits the event
and then moves on to the next unsettled bet that expires at the new serial number and repeats the above process until all bets have been settled.
The game UI on the Rogue Trader platform listens for BetSettled events and uses the information in them to update the Active Bets and Settled Bets tabs accordingly.
Finally, after all bets have been settled the Rogue Index smart contract emits the event
which Rogue Trader uses to update the game UI accordingly and then it sends another request for a new price update to random.org. Upon receiving the reply from random.org it once again calls the function
in the Rogue Index smart contract with the new price and serial number and that sets off a new round of bet settlements as described above.