IGovernance Interface
Complete Solidity interface for the Governance contract that controls FarmTruth oracle parameters on BSC Mainnet.
Contract Address
Governance: 0x0ebCFa07497B44e66859F82AC2c8f1187F0154cf (BSC Mainnet)
View on BSCScan
Overview
The Governance contract manages on-chain governance for the FarmTruth oracle system. Token holders can create proposals, vote with locked tokens, and update oracle parameters through democratic processes.
Key Features:
- Token-Based Voting: Lock $TRUTH tokens to gain voting power
- 4 Vote Types: FOR, AGAINST, ABSTAIN, VETO (burns deposit if >50%)
- 3 Proposal Types: Parameter changes, tie extensions, and indicative votes
- On-Chain Execution: Approved proposals automatically update oracle parameters
Governance Parameters
| Parameter | Default Value | Description |
|---|---|---|
proposalCreationDeposit | 100,000 tokens | Deposit required to create a proposal |
votingPeriod | 115,200 blocks | ~1 day voting period at 0.75s/block |
quorumPercentage | 10% | Minimum participation required |
tieExtensionPeriod | 28,800 blocks | ~6 hours extension for oracle ties |
Complete Interface
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title IGovernance
* @notice Interface for the Governance contract
* @dev Deployed at: 0x0ebCFa07497B44e66859F82AC2c8f1187F0154cf (BSC Mainnet)
*
* This contract manages on-chain governance for the FarmTruth oracle system.
* Token holders can create proposals, vote, and update oracle parameters.
*
* @custom:see contracts/Governance.sol
*/
interface IGovernance {
// ============ Enums ============
/**
* @notice Types of proposals that can be created
* @param PARAMETER_CHANGE Update oracle economic parameters
* @param TIE_EXTENSION_UPDATE Update tie extension period
* @param INDICATIVE Non-binding signaling proposal
*/
enum ProposalType { PARAMETER_CHANGE, TIE_EXTENSION_UPDATE, INDICATIVE }
/**
* @notice Types of votes that can be cast
* @param FOR Support the proposal
* @param AGAINST Oppose the proposal
* @param ABSTAIN Neutral position
* @param VETO Strong opposition (burns proposer's deposit if >50%)
*/
enum VoteType { FOR, AGAINST, ABSTAIN, VETO }
// ============ State Variables ============
/**
* @notice The ERC20 token used for governance voting
*/
function governanceToken() external view returns (IERC20);
/**
* @notice Burn address for vetoed proposal deposits
*/
function BURN_ADDRESS() external view returns (address);
/**
* @notice Total number of proposals created
*/
function proposalCount() external view returns (uint256);
/**
* @notice Deposit required to create a proposal (default: 100,000 tokens)
* @dev Can be updated via PARAMETER_CHANGE proposal
*/
function proposalCreationDeposit() external view returns (uint256);
/**
* @notice Duration of voting period in blocks (default: 115,200 blocks ~1 day)
* @dev Can be updated via PARAMETER_CHANGE proposal
*/
function votingPeriod() external view returns (uint256);
/**
* @notice Minimum percentage of total supply required for quorum (default: 10%)
* @dev Can be updated via PARAMETER_CHANGE proposal
*/
function quorumPercentage() external view returns (uint256);
/**
* @notice Duration of tie extension period in blocks (default: 28,800 blocks ~6 hours)
* @dev Can be updated via TIE_EXTENSION_UPDATE proposal
*/
function tieExtensionPeriod() external view returns (uint256);
}
Proposal Types
PARAMETER_CHANGE
Updates oracle economic parameters:
proposalCreationDeposit- Cost to create oracle queriesvotingPeriod- Length of governance voting periodquorumPercentage- Minimum participation threshold
Encoding:
bytes memory data = abi.encode(
uint256 newDeposit,
uint256 newVotingPeriod,
uint256 newQuorum
);
TIE_EXTENSION_UPDATE
Updates the tie extension period for oracle queries.
Encoding:
bytes memory data = abi.encode(uint256 newPeriod);
INDICATIVE
Non-binding signaling proposals for community sentiment. Does not execute any on-chain changes.
Vote Types
| Vote Type | Effect | Quorum Weight |
|---|---|---|
| FOR | Support the proposal | Counted |
| AGAINST | Oppose the proposal | Counted |
| ABSTAIN | Neutral, contributes to quorum | Counted |
| VETO | Strong opposition | Counted |
VETO Special Behavior:
- If VETO votes exceed 50% of total votes
- Proposal is marked as vetoed
- Proposer's deposit is burned to
BURN_ADDRESS - Proposal cannot be executed
Usage Examples
Read Governance Parameters
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./IGovernance.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract GovernanceReader {
IGovernance public immutable governance;
constructor(address _governance) {
governance = IGovernance(_governance);
}
/// @notice Get all current governance parameters
function getCurrentParameters() external view returns (
uint256 creationDeposit,
uint256 votingPeriod,
uint256 quorum,
uint256 tieExtension
) {
return (
governance.proposalCreationDeposit(),
governance.votingPeriod(),
governance.quorumPercentage(),
governance.tieExtensionPeriod()
);
}
/// @notice Get the governance token address
function getTokenAddress() external view returns (address) {
return address(governance.governanceToken());
}
/// @notice Check total proposals created
function getProposalCount() external view returns (uint256) {
return governance.proposalCount();
}
}
Integration with Oracle
The Governance contract is typically accessed through the DecentralizedOracle:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "./IDecentralizedOracle.sol";
import "./IGovernance.sol";
contract OracleWithGovernance {
IDecentralizedOracle public immutable oracle;
IGovernance public immutable governance;
constructor(address _oracle) {
oracle = IDecentralizedOracle(_oracle);
governance = oracle.governance();
}
/// @notice Get required deposit to create an oracle query
function getOracleCreationCost() external view returns (uint256) {
return governance.proposalCreationDeposit();
}
/// @notice Get the voting token used by both governance and oracle
function getVotingToken() external view returns (address) {
return address(governance.governanceToken());
}
}
Governance Process
- Proposal Creation
- User locks
proposalCreationDeposittokens - Proposal enters voting period for
votingPeriodblocks
- User locks
- Voting Period
- Token holders lock tokens to vote
- Vote weight = locked token amount
- Can vote: FOR, AGAINST, ABSTAIN, or VETO
- Resolution
- After
votingPeriodblocks, proposal can be executed - Must meet quorum requirement
- FOR votes must exceed AGAINST votes
- If VETO > 50%, proposal is vetoed and deposit burned
- After
- Execution
- Approved proposals automatically update parameters
- Indicative proposals don't execute changes
Token Locking
Important: To vote in governance, you must:
- Lock tokens in the Governance contract
- Tokens remain locked until you manually unlock them
- Locked tokens cannot be transferred or used for oracle voting
- Must wait until all active votes complete before unlocking
This interface only exposes read functions. To interact with governance (create proposals, vote, lock/unlock tokens), you need the full contract interface.
Related Contracts
- DecentralizedOracle: Parameters controlled by this governance
- FarmTruthToken: Token used for voting
- OptimisticOracle: Indirectly affected by main oracle parameter changes
See Also
- IDecentralizedOracle - Main oracle interface
- IOptimisticOracle - Optimistic oracle interface
- Main Oracle Documentation
Source Code
The canonical source code for this interface is located at:
- Repository:
contracts/IGovernance.sol - Deployed: 0x0ebCFa07497B44e66859F82AC2c8f1187F0154cf
Back to Interfaces Overview | Documentation Home