LogoLogo
  • Introduction
    • Chain Info
    • Smart Contracts
    • About Onyx
  • DEVELOPERS
    • Building dApp
    • Estimating Gas
    • Development Framework
    • Web3 Toolkits
    • Onyx SDK
    • Run Full Node
  • GOVERNANCE
    • Overview
    • Governor
    • Security
    • Quorum Votes
    • Proposal Threshold
    • Proposal Max Operations
    • Voting Delay
    • Voting Period
    • Propose
    • Queue
    • Execute
    • Cancel
    • Get Action
    • Get Receipt
    • Proposal State
    • Cast Vote
    • Vote By Signature
    • Timelock
  • Points
    • Onyx Points
    • Earning Points
      • 🟢Passive Points
      • 🔜Activity Points
      • 🔜App Points
  • Whitelisted Assets
  • Onyx AI
    • AI Agent
    • Core Features
    • Wallet Infrastructure
    • 🔜Roadmap
  • API
    • Onyx Governance API
    • Core API Endpoints
    • GET: /proposal
    • GET: /proposal/:proposalId
    • GET: /voter/:proposalId
    • GET: /voter/accounts
    • GET: /voter/history/:address
  • RESOURCES
    • Terms of Service
    • Bug Bounty
Powered by GitBook
On this page
Export as PDF
  1. GOVERNANCE

Queue

Queing a proposal for execution on the onchain cool-down period.

The queue function is responsible for moving a successful proposal into the Onyx Timelock queue. Once a proposal has been approved by the governance process, it must be queued before it can be executed. Only proposals that have met the required voting threshold and have been successfully passed can be queued.

Function Implementation in CHNGovernance

In the CHNGovernance contract, the queue() function ensures that only validated proposals are added to the Timelock queue, preventing unauthorized executions.

Function Signature

function queue(uint proposalId) public

Parameters

  • proposalId: The unique identifier of the governance proposal that has been successfully approved and is eligible to be queued.

  • RETURN: The function does not return a value. If the proposal is invalid or not yet approved, it will revert with an error.

Example Solidity Implementation

To queue a proposal using Solidity, the queue()function can be called from an instance of the CHNGovernance contract:

CHNGovernance gov = CHNGovernance(0x123...); // Contract address of CHNGovernance
gov.queue(proposalId);

Web3.js Implementation (v1.2.6)

For interacting with the CHNGovernance contract using Web3.js, the following example demonstrates how to queue a proposal:

const tx = await gov.methods.queue(proposalId).send({ from: sender });

Technical Considerations

  • The queue() function is state-modifying and will incur gas costs.

  • A proposal must have succeeded in the voting phase before it can be queued.

  • Once queued, the proposal must wait for the Timelock period before execution can occur.

  • The Timelock contract ensures security and decentralization by preventing immediate execution after voting.

  • If an attempt is made to queue a proposal that has not succeeded, the transaction will revert with an error.

PreviousProposeNextExecute

Last updated 4 months ago