// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import {Governor} from "@openzeppelin/contracts/governance/Governor.sol"; import {TimelockController} from "@openzeppelin/contracts/governance/TimelockController.sol"; import {GovernorCountingSimple} from "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol"; import {GovernorSettings} from "@openzeppelin/contracts/governance/extensions/GovernorSettings.sol"; import {GovernorTimelockControl} from "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol"; import {GovernorVotes} from "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol"; import { GovernorVotesQuorumFraction } from "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol"; import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol"; /// @title SigmaGovernor /// @author sigmacode.io (Sanicura d.o.o.) /// @notice On-chain DAO governor: token holders propose, vote For/Against/Abstain, and successful /// proposals are executed through a {TimelockController} after a mandatory delay. /// @dev Composition of audited OpenZeppelin v5 modules: /// - GovernorSettings: voting delay / period / proposal threshold, adjustable by governance itself. /// - GovernorCountingSimple: For / Against / Abstain; quorum counts For + Abstain. /// - GovernorVotes: voting power from an ERC-5805 token (timestamp clock). /// - GovernorVotesQuorumFraction: quorum as a percentage of total supply at proposal snapshot. /// - GovernorTimelockControl: the timelock (not the governor) holds assets and permissions. contract SigmaGovernor is Governor, GovernorSettings, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl { /// @param token_ ERC-5805 voting token. /// @param timelock_ Timelock that executes proposals. /// @param votingDelay_ Delay between proposal and vote start (clock units, here seconds). /// @param votingPeriod_ Voting duration (seconds). /// @param proposalThreshold_ Minimum voting power needed to create a proposal. /// @param quorumPercent_ Quorum as a percentage of total supply. constructor( IVotes token_, TimelockController timelock_, uint48 votingDelay_, uint32 votingPeriod_, uint256 proposalThreshold_, uint256 quorumPercent_ ) Governor("SigmaGovernor") GovernorSettings(votingDelay_, votingPeriod_, proposalThreshold_) GovernorVotes(token_) GovernorVotesQuorumFraction(quorumPercent_) GovernorTimelockControl(timelock_) {} // ----- Required overrides (Solidity multiple inheritance) ----- /// @inheritdoc Governor function votingDelay() public view override(Governor, GovernorSettings) returns (uint256) { return super.votingDelay(); } /// @inheritdoc Governor function votingPeriod() public view override(Governor, GovernorSettings) returns (uint256) { return super.votingPeriod(); } /// @inheritdoc Governor function quorum(uint256 timepoint) public view override(Governor, GovernorVotesQuorumFraction) returns (uint256) { return super.quorum(timepoint); } /// @inheritdoc Governor function state(uint256 proposalId) public view override(Governor, GovernorTimelockControl) returns (ProposalState) { return super.state(proposalId); } /// @inheritdoc Governor function proposalNeedsQueuing(uint256 proposalId) public view override(Governor, GovernorTimelockControl) returns (bool) { return super.proposalNeedsQueuing(proposalId); } /// @inheritdoc Governor function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) { return super.proposalThreshold(); } function _queueOperations( uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash ) internal override(Governor, GovernorTimelockControl) returns (uint48) { return super._queueOperations(proposalId, targets, values, calldatas, descriptionHash); } function _executeOperations( uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash ) internal override(Governor, GovernorTimelockControl) { super._executeOperations(proposalId, targets, values, calldatas, descriptionHash); } function _cancel( address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash ) internal override(Governor, GovernorTimelockControl) returns (uint256) { return super._cancel(targets, values, calldatas, descriptionHash); } function _executor() internal view override(Governor, GovernorTimelockControl) returns (address) { return super._executor(); } }