The Flip Smart Contract part 5 : Contract administration
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.
Modifying settings the storage
@contract
abstract class FlipContract extends ContractBase {
@onlyOwner
setMaximumBet(
tokenIdentifier: TokenIdentifier,
nonce: ManagedU64,
amount: BigUint
): void {
this.require(
amount > BigUint.zero(),
"amount zero"
)
this.maximumBet(tokenIdentifier, nonce).set(amount)
}
@onlyOwner
setMaximumBetPercent(
tokenIdentifier: TokenIdentifier,
nonce: ManagedU64,
percent: ManagedU64
): void {
this.require(
percent > ManagedU64.zero(),
"percent zero"
)
this.maximumBetPercent(tokenIdentifier, nonce).set(percent)
}
@onlyOwner
setMinimumBlockBounty(
minimumBlockBounty: ManagedU64
): void {
this.require(
minimumBlockBounty > ManagedU64.zero(),
"minimum block bounty zero"
)
this.minimumBlockBounty().set(minimumBlockBounty)
}
//--- previous code ---
}Admin actions
Next up
PreviousThe Flip Smart Contract part 4 : Writing the contract storageNextThe Flip Smart Contract part 6 : Bet logic
Last updated