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

Voting Period

The time period that a proposal may voted for or against.

The voting period defines the duration for which a governance proposal remains open for voting, measured in Ethereum blocks. During this period, eligible token holders can cast their votes to either support or reject the proposal. Once the voting period ends, the results determine whether the proposal advances to execution or is dismissed.

Function Implementation in CHNGovernance

In the CHNGovernance contract, the votingPeriod() function establishes the length of time a proposal remains open for voting.

Function Signature

function votingPeriod() public view returns (uint)

RETURN: The function returns an unsigned integer (uint) representing the number of Ethereum blocks during which voting is active for a given proposal.

Example Solidity Implementation

To retrieve the voting period in a Solidity environment, the votingPeriod() function can be called using an instance of the CHNGovernance contract.

CHNGovernance gov = CHNGovernance(0x123...); // Contract address of CHNGovernance
uint blocks = gov.votingPeriod();

Web3.js Implementation (v1.2.6)

For interacting with the CHNGovernance contract using Web3.js, the following example demonstrates how to retrieve the voting period:

const blocks = await gov.methods.votingPeriod().call();

Technical Considerations

  • The votingPeriod() function is a view function, meaning it does not modify blockchain state and can be executed without incurring gas costs.

  • The duration of the voting period impacts governance participation, allowing stakeholders ample time to review proposals and cast votes.

  • This parameter may be adjusted through governance proposals, ensuring adaptability as governance activity and network participation evolve.

  • The retrieved value should be used by governance dashboards, off-chain governance tracking tools, and front-end governance interfaces to display accurate voting timelines.

PreviousVoting DelayNextPropose

Last updated 3 months ago