Ownable
The Ownable
smart contract extension is usable with any base smart contract. It lets you set an owner for your smart contract.
View on GitHub
The Ownable
extension is an abstract contract , and expects you to implement the following functions by yourself:
This is an example smart contract demonstrating how to inherit from this extension and override the functions to add (optional) custom functionality.
All of the base contracts implement this extension.
Returns the owner of the contract.
Set this value using the setOwner
function.
Lets an authorized wallet set a new owner for the contract. This value can be read from the owner
function.
Parameter _newOwner
: The address to make the owner of the contract.
The _canSetOwner
function is run on every call to this function. If the return value of _canSetOwner
is false
, the setOwner
call will revert.
Sets the owner of the smart contract. This value can be read from the owner
function.
Parameter _newOwner
: The address to make the owner of the contract.
The _canSetOwner
function is not run on a call to this function.
Runs on every setOwner
function call.
Returns whether a new owner can be set in the given execution context.
For example, this function can check whether the wallet calling setOwner
is the contract owner, and enforce that only the current owner should be able to successfully call setOwner
.