axelar-gmp-sdk-solidity

Solidity API

IRoles

IRoles is an interface that abstracts the implementation of a contract with role control features. It’s commonly included for the functionality to get current role, transfer role, and propose and accept role.

InvalidProposedAccount

error InvalidProposedAccount(address account)

hasAllTheRoles

function hasAllTheRoles(address account, uint8[] roles) external view returns (bool)

Checks if an account has all the roles.

Parameters

Name Type Description
account address The address to check
roles uint8[] The roles to check

Return Values

Name Type Description
[0] bool True if the account has all the roles, false otherwise

hasAnyOfRoles

function hasAnyOfRoles(address account, uint8[] roles) external view returns (bool)

Checks if an account has any of the roles.

Parameters

Name Type Description
account address The address to check
roles uint8[] The roles to check

Return Values

Name Type Description
[0] bool True if the account has any of the roles, false otherwise

getAccountRoles

function getAccountRoles(address account) external view returns (uint256 accountRoles)

Returns the roles of an account.

Parameters

Name Type Description
account address The address to get the roles for

Return Values

Name Type Description
accountRoles uint256 The roles of the account in uint256 format

getProposedRoles

function getProposedRoles(address fromAccount, address toAccount) external view returns (uint256 proposedRoles_)

Returns the pending role of the contract.

Parameters

Name Type Description
fromAccount address The address with the current roles
toAccount address The address with the pending roles

Return Values

Name Type Description
proposedRoles_ uint256 The pending role of the contract in uint256 format

transferRoles

function transferRoles(address toAccount, uint8[] roles) external

Transfers roles of the contract to a new account.

Can only be called by the account with all the roles. Emits RolesRemoved and RolesAdded events.

Parameters

Name Type Description
toAccount address The address to transfer role to
roles uint8[] The roles to transfer

proposeRoles

function proposeRoles(address toAccount, uint8[] roles) external

Propose to transfer roles of message sender to a new account.

Can only be called by the account with all the proposed roles. emits a RolesProposed event. Roles are not transferred until the new role accepts the role transfer.

Parameters

Name Type Description
toAccount address The address to transfer role to
roles uint8[] The roles to transfer

acceptRoles

function acceptRoles(address fromAccount, uint8[] roles) external

Accepts roles transferred from another account.

Can only be called by the pending account with all the proposed roles. Emits RolesRemoved and RolesAdded events.

Parameters

Name Type Description
fromAccount address The address of the current role
roles uint8[] The roles to accept