IOwnable is an interface that abstracts the implementation of a contract with ownership control features. It’s commonly used in upgradable contracts and includes the functionality to get current owner, transfer ownership, and propose and accept ownership.
error NotOwner()
error InvalidOwner()
error InvalidOwnerAddress()
event OwnershipTransferStarted(address newOwner)
event OwnershipTransferred(address newOwner)
function owner() external view returns (address)
Returns the current owner of the contract.
Name | Type | Description |
---|---|---|
[0] | address | address The address of the current owner |
function pendingOwner() external view returns (address)
Returns the address of the pending owner of the contract.
Name | Type | Description |
---|---|---|
[0] | address | address The address of the pending owner |
function transferOwnership(address newOwner) external
Transfers ownership of the contract to a new address
Name | Type | Description |
---|---|---|
newOwner | address | The address to transfer ownership to |
function proposeOwnership(address newOwner) external
Proposes to transfer the contract’s ownership to a new address. The new owner needs to accept the ownership explicitly.
Name | Type | Description |
---|---|---|
newOwner | address | The address to transfer ownership to |
function acceptOwnership() external
Transfers ownership to the pending owner.
Can only be called by the pending owner