Execute
Deploying an Onyx Improvement Propoal (OIP) via onchain activation.
The execute function is responsible for applying changes from a successfully approved and queued proposal to the designated target contracts within the Onyx protocol. Once a proposal has passed the governance process and completed the Timelock delay period, it can be executed, implementing the proposed modifications.
Function Implementation in CHNGovernance
The execute()
function ensures that only successful and properly queued proposals can be executed, enforcing governance integrity and protocol security.
Function Signature
Parameters
proposalId
: The unique identifier of the proposal to be executed. This proposal must have successfully passed governance voting, been queued, and completed the Timelock delay period.RETURN
: The function does not return a value. If execution fails due to an invalid or non-queued proposal, it will revert with an error.
Example Solidity Implementation
To execute a proposal using Solidity, the execute()
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 execute a proposal:
Technical Considerations
The execute() function is state-modifying and will incur gas costs.
A proposal must have been successfully queued and completed the Timelock delay period before it can be executed.
The function is payable, allowing the Timelock to invoke functions that require ETH transfers.
If an attempt is made to execute an invalid, unqueued, or pending proposal, the transaction will revert with an error.
The Timelock contract ensures security and decentralization, preventing immediate execution after proposal approval.
Last updated