Get Action
View the actions of a proposal.
The getActions
function retrieves the details of a specified proposal by providing its unique proposal ID. This function allows governance participants and developers to inspect the actions of a given proposal, including:
The contract addresses that the proposal intends to call.
The values (ETH amounts) associated with each call.
The function signatures that define which contract functions will be executed.
The
calldata
payloads that encode function arguments for execution.
This function enables transparent governance by allowing any participant to review a proposal’s execution details before casting votes or executing the proposal.
Function Implementation in CHNGovernance
CHNGovernance
The getActions()
function is implemented in the CHNGovernance
contract to return a structured breakdown of the proposal's execution plan.
Function Signature
Parameters
proposalId
: The unique identifier of the proposal whose actions need to be retrieved.RETURN:
If the function call is successful, it returns the following arrays:
targets[]
: An array of contract addresses the proposal intends to interact with.values[]
: An array of unsigned integers specifying the ETH value associated with each action.signatures[]
: An array of function signatures that describe the functions to be executed.calldatas[]
: An array of calldata (encoded function arguments) that will be passed to each function call.
If the proposal ID is invalid, the function reverts with an error.
Example Solidity Implementation
To retrieve the details of a proposal using Solidity, the getActions()
function can be called from an instance of the CHNGovernance
contract:
Web3.js Implementation (v1.2.6)
For interacting with the CHNGovernance
contract using Web3.js, the following example demonstrates how to retrieve the proposal actions:
Technical Considerations
The
getActions()
function is a view function, meaning it does not modify blockchain state and can be executed without incurring gas costs.This function is useful for off-chain governance interfaces, allowing participants to inspect proposals before voting.
If a proposal ID is invalid, the function will revert, ensuring that only valid proposals are queried.
Governance dashboards and analysis tools should utilize this function to display proposal details in an understandable format.
Last updated