# The Flip Smart Contract part 5 : Contract administration

## Modifying settings the storage

Three storages properties should be changed only by us :&#x20;

* maximum\_bet
* maximum\_bet\_percent
* minimum\_block\_bounty

For each of them we create an `@onlyOwner` endpoint :&#x20;

```typescript
@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 ---
}
```

The `@onlyOwner` annotation ensure that only contract owner can call an endpoint. This is critical and should not be forgot.

{% hint style="warning" %}
Instead of TypeScript, you should always specify return type in AssemblyScript... even when it's `void` !
{% endhint %}

## Admin actions

Beside changing settings, the contract's owner need to do the two following actions :&#x20;

* increasing the contract's reserve of a token by sending token
* withdrawing token reserve

Let's code these two endpoints :&#x20;

```typescript
@contract
abstract class FlipContract extends ContractBase {

    @onlyOwner
    increaseReserve(): void {
        const payment = this.callValue.singlePayment

        this.require(
            payment.amount > BigUint.zero(),
            "no payment"
        )

        const oldTokenReserve = this.tokenReserve(payment.tokenIdentifier, payment.tokenNonce).get()

        this.tokenReserve(payment.tokenIdentifier, payment.tokenNonce).set(oldTokenReserve + payment.amount)
    }

    @onlyOwner
    withdrawReserve(
        tokenIdentifier: TokenIdentifier,
        nonce: ManagedU64,
        amount: BigUint
    ): void {
        const owner = this.blockchain.caller

        const tokenReserve = this.tokenReserve(tokenIdentifier, nonce).get()

        this.require(
            tokenReserve <= amount,
            "amount too high"
        )
        
        this.tokenReserve(tokenIdentifier, nonce).set(tokenReserve - amount)
        
        this.send.direct(
            owner,
            tokenIdentifier,
            nonce,
            amount
        )
    }
}
```

Nothing new here, this is similar to previous `onlyOwner` endpoints.

## Next up

Owner can now administrate the contract, next thing to code is the bet logic 🎲
