OwnableLock
RMRK team
OwnableLock
A minimal ownable lock smart contract.
Methods
getLock
function getLock() external view returns (bool isLocked)
Used to retrieve the status of a lockable smart contract.
Returns
Name | Type | Description |
---|---|---|
isLocked | bool | A boolean value signifying whether the smart contract has been locked |
isContributor
function isContributor(address contributor) external view returns (bool isContributor_)
Used to check if the address is one of the contributors.
Parameters
Name | Type | Description |
---|---|---|
contributor | address | Address of the contributor whose status we are checking |
Returns
Name | Type | Description |
---|---|---|
isContributor_ | bool | Boolean value indicating whether the address is a contributor or not |
manageContributor
function manageContributor(address contributor, bool grantRole) external nonpayable
Adds or removes a contributor to the smart contract.
Can only be called by the owner.Emits ContributorUpdate event.
Parameters
Name | Type | Description |
---|---|---|
contributor | address | Address of the contributor's account |
grantRole | bool | A boolean value signifying whether the contributor role is being granted (true ) or revoked (false ) |
owner
function owner() external view returns (address owner_)
Returns the address of the current owner.
Returns
Name | Type | Description |
---|---|---|
owner_ | address | Address of the current owner |
renounceOwnership
function renounceOwnership() external nonpayable
Leaves the contract without owner. Functions using the onlyOwner
modifier will be disabled.
Can only be called by the current owner.Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.
setLock
function setLock() external nonpayable
Locks the operation.
Once locked, functions using notLocked
modifier cannot be executed.Emits LockSet event.
transferOwnership
function transferOwnership(address newOwner) external nonpayable
Transfers ownership of the contract to a new owner.
Can only be called by the current owner.
Parameters
Name | Type | Description |
---|---|---|
newOwner | address | Address of the new owner's account |
Events
ContributorUpdate
event ContributorUpdate(address indexed contributor, bool isContributor)
Event that signifies that an address was granted contributor role or that the permission has been revoked.
This can only be triggered by a current owner, so there is no need to include that information in the event.
Parameters
Name | Type | Description |
---|---|---|
contributor indexed | address | Address of the account that had contributor role status updated |
isContributor | bool | A boolean value signifying whether the role has been granted (true ) or revoked (false ) |
LockSet
event LockSet()
Emitted when the smart contract is locked.
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Used to anounce the transfer of ownership.
Parameters
Name | Type | Description |
---|---|---|
previousOwner indexed | address | Address of the account that transferred their ownership role |
newOwner indexed | address | Address of the account receiving the ownership role |
Errors
RMRKNewContributorIsZeroAddress
error RMRKNewContributorIsZeroAddress()
Attempting to assign a 0x0 address as a contributor
RMRKNewOwnerIsZeroAddress
error RMRKNewOwnerIsZeroAddress()
Attempting to transfer the ownership to the 0x0 address
RMRKNotOwner
error RMRKNotOwner()
Attempting to interact with a management function without being the smart contract's owner