axelar-gmp-sdk-solidity

Solidity API

Roles

A contract module which provides set of external functions providing basic role transferring functionality.

The role account is set through role transfer. This module makes it possible to transfer the role of the contract to a new account in one step, as well as to an interim pending role. In the second flow the role does not change until the pending role accepts the role transfer.

hasAllTheRoles

function hasAllTheRoles(address account, uint8[] roles) public 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) public 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) public 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) public 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

proposeRoles

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

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 virtual

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

transferRoles

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

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