@stdlib/ownable
Provides traits for ownable contracts. These traits are commonly required by other traits.
To use this library, import @stdlib/ownable
:
Messages
ChangeOwner
ChangeOwnerOk
Traits
Ownable
Trait Ownable
declares an owner (non-editable) of a contract and provides a helper function requireOwner()
that checks that a message was sent by an owner.
This trait requires a field owner: Address
to be declared and exposes a getter function owner()
, which reads it from the contract.
Source code:
Usage example:
OwnableTransferable
OwnableTransferable
is an extension of an Ownable
that allows to transfer ownership of a contract to another address. It provides a secure handle Message ChangeOwner
that could be called by an owner to transfer ownership.
If the owner transfer request succeeds, the contract will reply with a ChangeOwnerOk
Message.
Source code:
Usage example: