Skip to main content
Version: testnet (v0.75)

MultisigControl (MultisigControl.sol)

View Source: contracts/MultisigControl.sol

↗ Extends: IMultisigControl

MultisigControl

This contract enables validators, through a multisignature process, to run functions on contracts by consensus

Contract Members

Constants & Variables

uint16 internal threshold;

uint8 internal signer_count;

mapping(address => bool) internal signers;

mapping(uint256 => bool) internal used_nonces;

mapping(bytes32 => mapping(address => bool)) internal has_signed;

Functions

function () public nonpayable

Arguments

NameTypeDescription

set_threshold

Sets threshold of signatures that must be met before function is executed.Emits ThresholdSet event

function set_threshold(uint16 new_threshold, uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
new_thresholduint16New threshold value
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

add_signer

Adds new valid signer and adjusts signer count.Emits 'SignerAdded' event

function add_signer(address new_signer, uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
new_signeraddressNew signer address
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

remove_signer

Removes currently valid signer and adjusts signer count.Emits 'SignerRemoved' event

function remove_signer(address old_signer, uint256 nonce, bytes signatures) public nonpayable

Arguments

NameTypeDescription
old_signeraddressAddress of signer to be removed.
nonceuint256Vega-assigned single-use number that provides replay attack protection
signaturesbytesVega-supplied signature bundle of a validator-signed order

verify_signatures

Verifies a signature bundle and returns true only if the threshold of valid signers is met,

function verify_signatures(bytes signatures, bytes message, uint256 nonce) public nonpayable
returns(bool)

Returns

Returns true if valid signatures are over the threshold

Arguments

NameTypeDescription
signaturesbytes
messagebytes
nonceuint256

get_valid_signer_count

function get_valid_signer_count() public view
returns(uint8)

Returns

Number of valid signers

Arguments

NameTypeDescription

get_current_threshold

function get_current_threshold() public view
returns(uint16)

Returns

Current threshold

Arguments

NameTypeDescription

is_valid_signer

function is_valid_signer(address signer_address) public view
returns(bool)

Returns

true if address provided is valid signer

Arguments

NameTypeDescription
signer_addressaddresstarget potential signer address

is_nonce_used

function is_nonce_used(uint256 nonce) public view
returns(bool)

Returns

true if nonce has been used

Arguments

NameTypeDescription
nonceuint256Nonce to lookup