axelar-gmp-sdk-solidity

Solidity API

BaseMultisig

This contract implements a custom multi-signature wallet where transactions must be confirmed by a threshold of signers. The signers and threshold may be updated every epoch.

Voting

struct Voting {
  uint256 voteCount;
  mapping(address => bool) hasVoted;
}

Signers

struct Signers {
  address[] accounts;
  uint256 threshold;
  mapping(address => bool) isSigner;
}

signers

struct BaseMultisig.Signers signers

signerEpoch

uint256 signerEpoch

Gets the current epoch.

Return Values

| Name | Type | Description | | —- | —- | ———– |

votingPerTopic

mapping(uint256 => mapping(bytes32 => struct BaseMultisig.Voting)) votingPerTopic

constructor

constructor(address[] accounts, uint256 threshold) public

Contract constructor

Sets the initial list of signers and corresponding threshold.

Parameters

Name Type Description
accounts address[] Address array of the signers
threshold uint256 Signature threshold required to validate a transaction

onlySigners

modifier onlySigners()

Modifier to ensure the caller is a signer

Keeps track of votes for each operation and resets the vote count if the operation is executed. Given the early void return, this modifier should be used with care on functions that return data.

signerThreshold

function signerThreshold() external view returns (uint256)

Returns the current signer threshold

Return Values

Name Type Description
[0] uint256 uint256 The signer threshold

signerAccounts

function signerAccounts() external view returns (address[])

Returns an array of current signers

Return Values

Name Type Description
[0] address[] array of signer addresses

isSigner

function isSigner(address account) external view returns (bool)

Getter to determine if an account is a signer

Return Values

Name Type Description
[0] bool boolean indicating if the account is a signer

hasSignerVoted

function hasSignerVoted(address account, bytes32 topic) external view returns (bool)

Getter to determine if an account has voted on a topic

Return Values

Name Type Description
[0] bool boolean indicating if the account has voted

getSignerVotesCount

function getSignerVotesCount(bytes32 topic) external view returns (uint256)

Get the number of votes for a topic

Return Values

Name Type Description
[0] uint256 uint256 indicating the number of votes for a topic

rotateSigners

function rotateSigners(address[] newAccounts, uint256 newThreshold) external virtual

Rotate the signers for the multisig

Updates the current set of signers and threshold and increments the epoch This function is protected by the onlySigners modifier

Parameters

Name Type Description
newAccounts address[] Address array of the new signers
newThreshold uint256 The new signature threshold for executing operations

_rotateSigners

function _rotateSigners(address[] newAccounts, uint256 newThreshold) internal

Internal function that implements signer rotation logic

_isFinalSignerVote

function _isFinalSignerVote() internal returns (bool)

Internal function that implements onlySigners logic

_resetSignerVotes

function _resetSignerVotes(bytes32 topic) internal

Internal function to reset the votes for a topic

_resetVoting

function _resetVoting(struct BaseMultisig.Voting voting) internal

Internal function to reset the votes for a topic