Open PatrickAlphaC opened 3 years ago
Good afternoon, sir. Thanks for paying attention to our project. Sorry for the late reply.
The information including stake amount and the betting time of all bets of an user are stored in an array of their own called bets
.
When the user send a request to check for the result, first we make sure to check whether result is available by checking to current time and the betting time of the specified bet in bets
array. If result were available, we would use APIs provided by Chainlink to check for the exchange rate of BTC exactly at the moment after the betting time 60 minutes. If result matched the gambler's prediction, we would create a transaction to send reward to him/her.
Finally, we update the status
and isWin
field of the specified bet in bets
array.
Thank you for your detailed reply. I'm still a bit confused how you're able to send 2.9 times instead of 2 times
Thank you for your detailed reply. I'm still a bit confused how you're able to send 2.9 times instead of 2 times
Ah, it's a little tricky here to multiply the amount by 2.9. We just multiplied the stake by 3 and then subtract 1/10 of it like this:
msg.sender.transfer([msg.sender][_index].amount *3 - [msg.sender][_index].amount /10)
Hi here,
This is really cool, thank you for submitting! How are you able to return 2.9 times the staked amount?