BuildapireferencegeneratedITangleGovernance

ITangleGovernance

Source: https://github.com/tangle-network/tnt-core/blob/main/src/interfaces/ITangleGovernance.sol

ITangleGovernance

Interface for Tangle governance components

Types

ProposalState

Proposal states

enum ProposalState {
  Pending,
  Active,
  Canceled,
  Defeated,
  Succeeded,
  Queued,
  Expired,
  Executed
}

Functions

propose

function propose(address[] targets, uint256[] values, bytes[] calldatas, string description) external returns (uint256 proposalId)

Create a new proposal

Parameters
NameTypeDescription
targetsaddress[]Contract addresses to call
valuesuint256[]ETH values to send
calldatasbytes[]Encoded function calls
descriptionstringHuman-readable description
Return Values
NameTypeDescription
proposalIduint256The unique proposal identifier

queue

function queue(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) external returns (uint256 proposalId)

Queue a successful proposal for execution

Parameters
NameTypeDescription
targetsaddress[]Contract addresses to call
valuesuint256[]ETH values to send
calldatasbytes[]Encoded function calls
descriptionHashbytes32Hash of the proposal description
Return Values
NameTypeDescription
proposalIduint256The proposal identifier

execute

function execute(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) external payable returns (uint256 proposalId)

Execute a queued proposal

Parameters
NameTypeDescription
targetsaddress[]Contract addresses to call
valuesuint256[]ETH values to send
calldatasbytes[]Encoded function calls
descriptionHashbytes32Hash of the proposal description
Return Values
NameTypeDescription
proposalIduint256The proposal identifier

cancel

function cancel(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) external returns (uint256 proposalId)

Cancel a proposal

Parameters
NameTypeDescription
targetsaddress[]Contract addresses to call
valuesuint256[]ETH values to send
calldatasbytes[]Encoded function calls
descriptionHashbytes32Hash of the proposal description
Return Values
NameTypeDescription
proposalIduint256The proposal identifier

castVote

function castVote(uint256 proposalId, uint8 support) external returns (uint256 weight)

Cast a vote on a proposal

Parameters
NameTypeDescription
proposalIduint256The proposal to vote on
supportuint80=Against, 1=For, 2=Abstain
Return Values
NameTypeDescription
weightuint256The voting weight used

castVoteWithReason

function castVoteWithReason(uint256 proposalId, uint8 support, string reason) external returns (uint256 weight)

Cast a vote with reason

Parameters
NameTypeDescription
proposalIduint256The proposal to vote on
supportuint80=Against, 1=For, 2=Abstain
reasonstringExplanation for the vote
Return Values
NameTypeDescription
weightuint256The voting weight used

castVoteBySig

function castVoteBySig(uint256 proposalId, uint8 support, address voter, bytes signature) external returns (uint256 weight)

Cast a vote using EIP-712 signature

Parameters
NameTypeDescription
proposalIduint256The proposal to vote on
supportuint80=Against, 1=For, 2=Abstain
voteraddressThe voter address
signaturebytesThe EIP-712 signature
Return Values
NameTypeDescription
weightuint256The voting weight used

state

function state(uint256 proposalId) external view returns (enum ITangleGovernance.ProposalState)

Get the current state of a proposal

proposalSnapshot

function proposalSnapshot(uint256 proposalId) external view returns (uint256)

Get the block number when voting starts

proposalDeadline

function proposalDeadline(uint256 proposalId) external view returns (uint256)

Get the block number when voting ends

proposalProposer

function proposalProposer(uint256 proposalId) external view returns (address)

Get the proposer of a proposal

hasVoted

function hasVoted(uint256 proposalId, address account) external view returns (bool)

Check if an account has voted on a proposal

getVotes

function getVotes(address account, uint256 blockNumber) external view returns (uint256)

Get voting power of an account at a specific block

quorum

function quorum(uint256 blockNumber) external view returns (uint256)

Get the required quorum at a specific block

votingDelay

function votingDelay() external view returns (uint256)

Get the voting delay (blocks before voting starts)

votingPeriod

function votingPeriod() external view returns (uint256)

Get the voting period (blocks for voting)

proposalThreshold

function proposalThreshold() external view returns (uint256)

Get the proposal threshold (tokens needed to propose)