Core
Other
Access
Ownable Lock

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

NameTypeDescription
isLockedboolA 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

NameTypeDescription
contributoraddressAddress of the contributor whose status we are checking

Returns

NameTypeDescription
isContributor_boolBoolean 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

NameTypeDescription
contributoraddressAddress of the contributor's account
grantRoleboolA 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

NameTypeDescription
owner_addressAddress 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

NameTypeDescription
newOwneraddressAddress 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

NameTypeDescription
contributor indexedaddressAddress of the account that had contributor role status updated
isContributorboolA 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

NameTypeDescription
previousOwner indexedaddressAddress of the account that transferred their ownership role
newOwner indexedaddressAddress 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