Last updated
Last updated
Three storages properties should be changed only by us :
maximum_bet
maximum_bet_percent
minimum_block_bounty
For each of them we create an @onlyOwner
endpoint :
The @onlyOwner
annotation ensure that only contract owner can call an endpoint. This is critical and should not be forgot.
Instead of TypeScript, you should always specify return type in AssemblyScript... even when it's void
!
Beside changing settings, the contract's owner need to do the two following actions :
increasing the contract's reserve of a token by sending token
withdrawing token reserve
Let's code these two endpoints :
Nothing new here, this is similar to previous onlyOwner
endpoints.
Owner can now administrate the contract, next thing to code is the bet logic 🎲
Some of previous storage values should be changed only by us, this is what we will do here. We will also add some admins actions.