Language
Libraries
@stdlib/stoppable

@stdlib/stoppable

Traits that allows to stop contract. Useful for emergency or maintenance mode. Requires Ownable trait. This trait just manages a single flag stopped in the contract and handling stopped state have to be done in the contract itself.

Stoppable

Stoppable trait implements receiver for message "Stop" that can be sent by owner, implements stopped get-method that returns true if contract is stopped and provides private functions requireNotStopped and requireStopped.

Usage

import "@stdlib/stoppable";
 
contract MyContract with Stoppable {
 
    owner: Address;
    stopped: Bool;
 
    init(owner: Address) {
        self.owner = owner;
        self.stopped = false;
    }
}

Resumable

Resumable trait extends Stoppable and allows to resume contract execution.

Usage

import "@stdlib/stoppable";
 
contract MyContract with Resumable {
 
    owner: Address;
    stopped: Bool;
 
    init(owner: Address) {
        self.owner = owner;
        self.stopped = false;
    }
}