Expand description

Owner pattern implements methods to query, manage and transfer ownership of the contract.

The account that owns the contract is called the “current” owner. A contract is always initialized with an owner account. The current owner can propose an ownership transfer to a different account. This proposed account is the “proposed owner”. If the proposed owner accepts the transfer, it becomes the current owner. The current owner can also renounce ownership of the contract.

The owner of the contract may be initialized once (e.g. at contract creation) using Owner::init.

Note: There is no way to recover ownership of a renounced contract.

The pattern consists of methods in Owner and OwnerExternal. The latter exposes methods externally and can be called by other contracts. This derive macro derives default implementation both these traits.

Safety

The default implementation assumes or enforces the following invariants. Violating assumed invariants may corrupt contract state and show unexpected behavior (UB). Enforced invariants throw an error (ERR) but contract state remains intact.

Modules

Enums

Events emitted by function calls on an ownable contract

Traits

A contract with an owner
Externally-accessible functions for Owner