UNPKG

@pollum-io/pegasys-protocol

Version:

Contracts for the Pegasys Dex.

978 lines (977 loc) 3.07 MB
{ "id": "0416871e4655d9463f4af74b2bc1bfb0", "_format": "hh-sol-build-info-1", "solcVersion": "0.8.10", "solcLongVersion": "0.8.10+commit.fc410830", "input": { "language": "Solidity", "sources": { "contracts/governance/GovernorAlpha.sol": { "content": "// SPDX-License-Identifier: BSD-3-Clause\npragma solidity ^0.8.10;\n\ncontract GovernorAlpha {\n /// @notice The name of this contract\n string public constant name = \"Pegasys Governor Alpha\";\n\n /// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed\n function quorumVotes() public pure returns (uint) {\n return 4000000e18;\n } // 4,000,000 = 4% of PSYS\n\n /// @notice The number of votes required in order for a voter to become a proposer\n function proposalThreshold() public pure returns (uint) {\n return 1000000e18;\n } // 1,000,000 = 1% of PSYS\n\n /// @notice The maximum number of actions that can be included in a proposal\n function proposalMaxOperations() public pure returns (uint) {\n return 10;\n } // 10 actions\n\n /// @notice The delay before voting on a proposal may take place, once proposed\n function votingDelay() public pure returns (uint) {\n return 1;\n } // 1 block\n\n /// @notice The duration of voting on a proposal, in blocks\n function votingPeriod() public pure virtual returns (uint) {\n return 1728;\n } // ~3 days in blocks (assuming 150s blocks)\n\n /// @notice The address of the Pegasys Protocol Timelock\n TimelockInterface public timelock;\n\n /// @notice The address of the Pegasys governance token\n PsysInterface public psys;\n\n /// @notice The address of the Governor Guardian\n address public guardian;\n\n /// @notice The total number of proposals\n uint public proposalCount;\n\n struct Proposal {\n /// @notice Unique id for looking up a proposal\n uint id;\n /// @notice Creator of the proposal\n address proposer;\n /// @notice The timestamp that the proposal will be available for execution, set once the vote succeeds\n uint eta;\n /// @notice the ordered list of target addresses for calls to be made\n address[] targets;\n /// @notice The ordered list of values (i.e. msg.value) to be passed to the calls to be made\n uint[] values;\n /// @notice The ordered list of function signatures to be called\n string[] signatures;\n /// @notice The ordered list of calldata to be passed to each call\n bytes[] calldatas;\n /// @notice The block at which voting begins: holders must delegate their votes prior to this block\n uint startBlock;\n /// @notice The block at which voting ends: votes must be cast prior to this block\n uint endBlock;\n /// @notice Current number of votes in favor of this proposal\n uint forVotes;\n /// @notice Current number of votes in opposition to this proposal\n uint againstVotes;\n /// @notice Flag marking whether the proposal has been canceled\n bool canceled;\n /// @notice Flag marking whether the proposal has been executed\n bool executed;\n /// @notice Receipts of ballots for the entire set of voters\n mapping(address => Receipt) receipts;\n }\n\n /// @notice Ballot receipt record for a voter\n struct Receipt {\n /// @notice Whether or not a vote has been cast\n bool hasVoted;\n /// @notice Whether or not the voter supports the proposal\n bool support;\n /// @notice The number of votes the voter had, which were cast\n uint96 votes;\n }\n\n /// @notice Possible states that a proposal may be in\n enum ProposalState {\n Pending,\n Active,\n Canceled,\n Defeated,\n Succeeded,\n Queued,\n Expired,\n Executed\n }\n\n /// @notice The official record of all proposals ever proposed\n mapping(uint => Proposal) public proposals;\n\n /// @notice The latest proposal for each proposer\n mapping(address => uint) public latestProposalIds;\n\n /// @notice The EIP-712 typehash for the contract's domain\n bytes32 public constant DOMAIN_TYPEHASH =\n keccak256(\n \"EIP712Domain(string name,uint256 chainId,address verifyingContract)\"\n );\n\n /// @notice The EIP-712 typehash for the ballot struct used by the contract\n bytes32 public constant BALLOT_TYPEHASH =\n keccak256(\"Ballot(uint256 proposalId,bool support)\");\n\n /// @notice An event emitted when a new proposal is created\n event ProposalCreated(\n uint id,\n address proposer,\n address[] targets,\n uint[] values,\n string[] signatures,\n bytes[] calldatas,\n uint startBlock,\n uint endBlock,\n string description\n );\n\n /// @notice An event emitted when a vote has been cast on a proposal\n event VoteCast(address voter, uint proposalId, bool support, uint votes);\n\n /// @notice An event emitted when a proposal has been canceled\n event ProposalCanceled(uint id);\n\n /// @notice An event emitted when a proposal has been queued in the Timelock\n event ProposalQueued(uint id, uint eta);\n\n /// @notice An event emitted when a proposal has been executed in the Timelock\n event ProposalExecuted(uint id);\n\n constructor(\n address timelock_,\n address psys_,\n address guardian_\n ) {\n timelock = TimelockInterface(timelock_);\n psys = PsysInterface(psys_);\n guardian = guardian_;\n }\n\n function propose(\n address[] memory targets,\n uint[] memory values,\n string[] memory signatures,\n bytes[] memory calldatas,\n string memory description\n ) public returns (uint) {\n require(\n psys.getPriorVotes(msg.sender, sub256(block.number, 1)) >\n proposalThreshold(),\n \"GovernorAlpha::propose: proposer votes below proposal threshold\"\n );\n require(\n targets.length == values.length &&\n targets.length == signatures.length &&\n targets.length == calldatas.length,\n \"GovernorAlpha::propose: proposal function information arity mismatch\"\n );\n require(\n targets.length != 0,\n \"GovernorAlpha::propose: must provide actions\"\n );\n require(\n targets.length <= proposalMaxOperations(),\n \"GovernorAlpha::propose: too many actions\"\n );\n\n uint latestProposalId = latestProposalIds[msg.sender];\n if (latestProposalId != 0) {\n ProposalState proposersLatestProposalState = state(\n latestProposalId\n );\n require(\n proposersLatestProposalState != ProposalState.Active,\n \"GovernorAlpha::propose: one live proposal per proposer, found an already active proposal\"\n );\n require(\n proposersLatestProposalState != ProposalState.Pending,\n \"GovernorAlpha::propose: one live proposal per proposer, found an already pending proposal\"\n );\n }\n\n uint startBlock = add256(block.number, votingDelay());\n uint endBlock = add256(startBlock, votingPeriod());\n\n proposalCount++;\n uint proposalId = proposalCount;\n Proposal storage newProposal = proposals[proposalId];\n // This should never happen but add a check in case.\n require(\n newProposal.id == 0,\n \"GovernorAlpha::propose: ProposalID collsion\"\n );\n newProposal.id = proposalId;\n newProposal.proposer = msg.sender;\n newProposal.eta = 0;\n newProposal.targets = targets;\n newProposal.values = values;\n newProposal.signatures = signatures;\n newProposal.calldatas = calldatas;\n newProposal.startBlock = startBlock;\n newProposal.endBlock = endBlock;\n newProposal.forVotes = 0;\n newProposal.againstVotes = 0;\n newProposal.canceled = false;\n newProposal.executed = false;\n\n latestProposalIds[newProposal.proposer] = newProposal.id;\n\n emit ProposalCreated(\n newProposal.id,\n msg.sender,\n targets,\n values,\n signatures,\n calldatas,\n startBlock,\n endBlock,\n description\n );\n return newProposal.id;\n }\n\n function queue(uint proposalId) public {\n require(\n state(proposalId) == ProposalState.Succeeded,\n \"GovernorAlpha::queue: proposal can only be queued if it is succeeded\"\n );\n Proposal storage proposal = proposals[proposalId];\n uint eta = add256(block.timestamp, timelock.delay());\n for (uint i = 0; i < proposal.targets.length; i++) {\n _queueOrRevert(\n proposal.targets[i],\n proposal.values[i],\n proposal.signatures[i],\n proposal.calldatas[i],\n eta\n );\n }\n proposal.eta = eta;\n emit ProposalQueued(proposalId, eta);\n }\n\n function _queueOrRevert(\n address target,\n uint value,\n string memory signature,\n bytes memory data,\n uint eta\n ) internal {\n require(\n !timelock.queuedTransactions(\n keccak256(abi.encode(target, value, signature, data, eta))\n ),\n \"GovernorAlpha::_queueOrRevert: proposal action already queued at eta\"\n );\n timelock.queueTransaction(target, value, signature, data, eta);\n }\n\n function execute(uint proposalId) public payable {\n require(\n state(proposalId) == ProposalState.Queued,\n \"GovernorAlpha::execute: proposal can only be executed if it is queued\"\n );\n Proposal storage proposal = proposals[proposalId];\n proposal.executed = true;\n for (uint i = 0; i < proposal.targets.length; i++) {\n timelock.executeTransaction{value: proposal.values[i]}(\n proposal.targets[i],\n proposal.values[i],\n proposal.signatures[i],\n proposal.calldatas[i],\n proposal.eta\n );\n }\n emit ProposalExecuted(proposalId);\n }\n\n function cancel(uint proposalId) public {\n ProposalState state = state(proposalId);\n require(\n state != ProposalState.Executed,\n \"GovernorAlpha::cancel: cannot cancel executed proposal\"\n );\n\n Proposal storage proposal = proposals[proposalId];\n require(\n msg.sender == guardian ||\n psys.getPriorVotes(proposal.proposer, sub256(block.number, 1)) <\n proposalThreshold(),\n \"GovernorAlpha::cancel: proposer above threshold\"\n );\n\n proposal.canceled = true;\n for (uint i = 0; i < proposal.targets.length; i++) {\n timelock.cancelTransaction(\n proposal.targets[i],\n proposal.values[i],\n proposal.signatures[i],\n proposal.calldatas[i],\n proposal.eta\n );\n }\n\n emit ProposalCanceled(proposalId);\n }\n\n function getActions(uint proposalId)\n public\n view\n returns (\n address[] memory targets,\n uint[] memory values,\n string[] memory signatures,\n bytes[] memory calldatas\n )\n {\n Proposal storage p = proposals[proposalId];\n return (p.targets, p.values, p.signatures, p.calldatas);\n }\n\n function getReceipt(uint proposalId, address voter)\n public\n view\n returns (Receipt memory)\n {\n return proposals[proposalId].receipts[voter];\n }\n\n function state(uint proposalId) public view returns (ProposalState) {\n require(\n proposalCount >= proposalId && proposalId > 0,\n \"GovernorAlpha::state: invalid proposal id\"\n );\n Proposal storage proposal = proposals[proposalId];\n if (proposal.canceled) {\n return ProposalState.Canceled;\n } else if (block.number <= proposal.startBlock) {\n return ProposalState.Pending;\n } else if (block.number <= proposal.endBlock) {\n return ProposalState.Active;\n } else if (\n proposal.forVotes <= proposal.againstVotes ||\n proposal.forVotes < quorumVotes()\n ) {\n return ProposalState.Defeated;\n } else if (proposal.eta == 0) {\n return ProposalState.Succeeded;\n } else if (proposal.executed) {\n return ProposalState.Executed;\n } else if (\n block.timestamp >= add256(proposal.eta, timelock.GRACE_PERIOD())\n ) {\n return ProposalState.Expired;\n } else {\n return ProposalState.Queued;\n }\n }\n\n function castVote(uint proposalId, bool support) public {\n return _castVote(msg.sender, proposalId, support);\n }\n\n function castVoteBySig(\n uint proposalId,\n bool support,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public {\n bytes32 domainSeparator = keccak256(\n abi.encode(\n DOMAIN_TYPEHASH,\n keccak256(bytes(name)),\n getChainId(),\n address(this)\n )\n );\n bytes32 structHash = keccak256(\n abi.encode(BALLOT_TYPEHASH, proposalId, support)\n );\n bytes32 digest = keccak256(\n abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash)\n );\n address signatory = ecrecover(digest, v, r, s);\n require(\n signatory != address(0),\n \"GovernorAlpha::castVoteBySig: invalid signature\"\n );\n return _castVote(signatory, proposalId, support);\n }\n\n function _castVote(\n address voter,\n uint proposalId,\n bool support\n ) internal {\n require(\n state(proposalId) == ProposalState.Active,\n \"GovernorAlpha::_castVote: voting is closed\"\n );\n Proposal storage proposal = proposals[proposalId];\n Receipt storage receipt = proposal.receipts[voter];\n require(\n receipt.hasVoted == false,\n \"GovernorAlpha::_castVote: voter already voted\"\n );\n uint96 votes = psys.getPriorVotes(voter, proposal.startBlock);\n\n if (support) {\n proposal.forVotes = add256(proposal.forVotes, votes);\n } else {\n proposal.againstVotes = add256(proposal.againstVotes, votes);\n }\n\n receipt.hasVoted = true;\n receipt.support = support;\n receipt.votes = votes;\n\n emit VoteCast(voter, proposalId, support, votes);\n }\n\n function __acceptAdmin() public {\n require(\n msg.sender == guardian,\n \"GovernorAlpha::__acceptAdmin: sender must be gov guardian\"\n );\n timelock.acceptAdmin();\n }\n\n function __abdicate() public {\n require(\n msg.sender == guardian,\n \"GovernorAlpha::__abdicate: sender must be gov guardian\"\n );\n guardian = address(0);\n }\n\n function __queueSetTimelockPendingAdmin(address newPendingAdmin, uint eta)\n public\n {\n require(\n msg.sender == guardian,\n \"GovernorAlpha::__queueSetTimelockPendingAdmin: sender must be gov guardian\"\n );\n timelock.queueTransaction(\n address(timelock),\n 0,\n \"setPendingAdmin(address)\",\n abi.encode(newPendingAdmin),\n eta\n );\n }\n\n function __executeSetTimelockPendingAdmin(address newPendingAdmin, uint eta)\n public\n {\n require(\n msg.sender == guardian,\n \"GovernorAlpha::__executeSetTimelockPendingAdmin: sender must be gov guardian\"\n );\n timelock.executeTransaction(\n address(timelock),\n 0,\n \"setPendingAdmin(address)\",\n abi.encode(newPendingAdmin),\n eta\n );\n }\n\n function add256(uint256 a, uint256 b) internal pure returns (uint) {\n uint c = a + b;\n require(c >= a, \"addition overflow\");\n return c;\n }\n\n function sub256(uint256 a, uint256 b) internal pure returns (uint) {\n require(b <= a, \"subtraction underflow\");\n return a - b;\n }\n\n function getChainId() internal view returns (uint) {\n uint chainId;\n assembly {\n chainId := chainid()\n }\n return chainId;\n }\n}\n\ninterface TimelockInterface {\n function delay() external view returns (uint);\n\n function GRACE_PERIOD() external view returns (uint);\n\n function acceptAdmin() external;\n\n function queuedTransactions(bytes32 hash) external view returns (bool);\n\n function queueTransaction(\n address target,\n uint value,\n string calldata signature,\n bytes calldata data,\n uint eta\n ) external returns (bytes32);\n\n function cancelTransaction(\n address target,\n uint value,\n string calldata signature,\n bytes calldata data,\n uint eta\n ) external;\n\n function executeTransaction(\n address target,\n uint value,\n string calldata signature,\n bytes calldata data,\n uint eta\n ) external payable returns (bytes memory);\n}\n\ninterface PsysInterface {\n function getPriorVotes(address account, uint blockNumber)\n external\n view\n returns (uint96);\n}\n" } }, "settings": { "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "abi", "evm.bytecode", "evm.deployedBytecode", "evm.methodIdentifiers", "metadata" ], "": [ "ast" ] } } } }, "output": { "contracts": { "contracts/governance/GovernorAlpha.sol": { "GovernorAlpha": { "abi": [ { "inputs": [ { "internalType": "address", "name": "timelock_", "type": "address" }, { "internalType": "address", "name": "psys_", "type": "address" }, { "internalType": "address", "name": "guardian_", "type": "address" } ], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" } ], "name": "ProposalCanceled", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" }, { "indexed": false, "internalType": "address", "name": "proposer", "type": "address" }, { "indexed": false, "internalType": "address[]", "name": "targets", "type": "address[]" }, { "indexed": false, "internalType": "uint256[]", "name": "values", "type": "uint256[]" }, { "indexed": false, "internalType": "string[]", "name": "signatures", "type": "string[]" }, { "indexed": false, "internalType": "bytes[]", "name": "calldatas", "type": "bytes[]" }, { "indexed": false, "internalType": "uint256", "name": "startBlock", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "endBlock", "type": "uint256" }, { "indexed": false, "internalType": "string", "name": "description", "type": "string" } ], "name": "ProposalCreated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" } ], "name": "ProposalExecuted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "id", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "eta", "type": "uint256" } ], "name": "ProposalQueued", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "address", "name": "voter", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "proposalId", "type": "uint256" }, { "indexed": false, "internalType": "bool", "name": "support", "type": "bool" }, { "indexed": false, "internalType": "uint256", "name": "votes", "type": "uint256" } ], "name": "VoteCast", "type": "event" }, { "inputs": [], "name": "BALLOT_TYPEHASH", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "DOMAIN_TYPEHASH", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "__abdicate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "__acceptAdmin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newPendingAdmin", "type": "address" }, { "internalType": "uint256", "name": "eta", "type": "uint256" } ], "name": "__executeSetTimelockPendingAdmin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newPendingAdmin", "type": "address" }, { "internalType": "uint256", "name": "eta", "type": "uint256" } ], "name": "__queueSetTimelockPendingAdmin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "proposalId", "type": "uint256" } ], "name": "cancel", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "proposalId", "type": "uint256" }, { "internalType": "bool", "name": "support", "type": "bool" } ], "name": "castVote", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "proposalId", "type": "uint256" }, { "internalType": "bool", "name": "support", "type": "bool" }, { "internalType": "uint8", "name": "v", "type": "uint8" }, { "internalType": "bytes32", "name": "r", "type": "bytes32" }, { "internalType": "bytes32", "name": "s", "type": "bytes32" } ], "name": "castVoteBySig", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "proposalId", "type": "uint256" } ], "name": "execute", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "proposalId", "type": "uint256" } ], "name": "getActions", "outputs": [ { "internalType": "address[]", "name": "targets", "type": "address[]" }, { "internalType": "uint256[]", "name": "values", "type": "uint256[]" }, { "internalType": "string[]", "name": "signatures", "type": "string[]" }, { "internalType": "bytes[]", "name": "calldatas", "type": "bytes[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "proposalId", "type": "uint256" }, { "internalType": "address", "name": "voter", "type": "address" } ], "name": "getReceipt", "outputs": [ { "components": [ { "internalType": "bool", "name": "hasVoted", "type": "bool" }, { "internalType": "bool", "name": "support", "type": "bool" }, { "internalType": "uint96", "name": "votes", "type": "uint96" } ], "internalType": "struct GovernorAlpha.Receipt", "name": "", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "guardian", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "latestProposalIds", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "name", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proposalCount", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proposalMaxOperations", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "proposalThreshold", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "name": "proposals", "outputs": [ { "internalType": "uint256", "name": "id", "type": "uint256" }, { "internalType": "address", "name": "proposer", "type": "address" }, { "internalType": "uint256", "name": "eta", "type": "uint256" }, { "internalType": "uint256", "name": "startBlock", "type": "uint256" }, { "internalType": "uint256", "name": "endBlock", "type": "uint256" }, { "internalType": "uint256", "name": "forVotes", "type": "uint256" }, { "internalType": "uint256", "name": "againstVotes", "type": "uint256" }, { "internalType": "bool", "name": "canceled", "type": "bool" }, { "internalType": "bool", "name": "executed", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address[]", "name": "targets", "type": "address[]" }, { "internalType": "uint256[]", "name": "values", "type": "uint256[]" }, { "internalType": "string[]", "name": "signatures", "type": "string[]" }, { "internalType": "bytes[]", "name": "calldatas", "type": "bytes[]" }, { "internalType": "string", "name": "description", "type": "string" } ], "name": "propose", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "psys", "outputs": [ { "internalType": "contract PsysInterface", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "proposalId", "type": "uint256" } ], "name": "queue", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "quorumVotes", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "proposalId", "type": "uint256" } ], "name": "state", "outputs": [ { "internalType": "enum GovernorAlpha.ProposalState", "name": "", "type": "uint8" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "timelock", "outputs": [ { "internalType": "contract TimelockInterface", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "votingDelay", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "votingPeriod", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" } ], "evm": { "bytecode": { "functionDebugData": { "@_235": { "entryPoint": null, "id": 235, "parameterSlots": 3, "returnSlots": 0 }, "abi_decode_t_address_fromMemory": { "entryPoint": 341, "id": null, "parameterSlots": 2, "returnSlots": 1 }, "abi_decode_tuple_t_addresst_addresst_address_fromMemory": { "entryPoint": 364, "id": null, "parameterSlots": 2, "returnSlots": 3 }, "allocate_unbounded": { "entryPoint": null, "id": null, "parameterSlots": 0, "returnSlots": 1 }, "cleanup_t_address": { "entryPoint": 295, "id": null, "parameterSlots": 1, "returnSlots": 1 }, "cleanup_t_uint160": { "entryPoint": 263, "id": null, "parameterSlots": 1, "returnSlots": 1 }, "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db": { "entryPoint": null, "id": null, "parameterSlots": 0, "returnSlots": 0 }, "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b": { "entryPoint": 258, "id": null, "parameterSlots": 0, "returnSlots": 0 }, "validator_revert_t_address": { "entryPoint": 315, "id": null, "parameterSlots": 1, "returnSlots": 0 } }, "generatedSources": [ { "ast": { "nodeType": "YulBlock", "src": "0:1511:1", "statements": [ { "body": { "nodeType": "YulBlock", "src": "47:35:1", "statements": [ { "nodeType": "YulAssignment", "src": "57:19:1", "value": { "arguments": [ { "kind": "number", "nodeType": "YulLiteral", "src": "73:2:1", "type": "", "value": "64" } ], "functionName": { "name": "mload", "nodeType": "YulIdentifier", "src": "67:5:1" }, "nodeType": "YulFunctionCall", "src": "67:9:1" }, "variableNames": [ { "name": "memPtr", "nodeType": "YulIdentifier", "src": "57:6:1" } ] } ] }, "name": "allocate_unbounded", "nodeType": "YulFunctionDefinition", "returnVariables": [ { "name": "memPtr", "nodeType": "YulTypedName", "src": "40:6:1", "type": "" } ], "src": "7:75:1" }, { "body": { "nodeType": "YulBlock", "src": "177:28:1", "statements": [ { "expression": { "arguments": [ { "kind": "number", "nodeType": "YulLiteral", "src": "194:1:1", "type": "", "value": "0" }, { "kind": "number", "nodeType": "YulLiteral", "src": "197:1:1", "type": "", "value": "0" } ], "functionName": { "name": "revert", "nodeType": "YulIdentifier", "src": "187:6:1" }, "nodeType": "YulFunctionCall", "src": "187:12:1" }, "nodeType": "YulExpressionStatement", "src": "187:12:1" } ] }, "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", "nodeType": "YulFunctionDefinition", "src": "88:117:1" }, { "body": { "nodeType": "YulBlock", "src": "300:28:1", "statements": [ { "expression": { "arguments": [ { "kind": "number", "nodeType": "YulLiteral", "src": "317:1:1", "type": "", "value": "0" }, { "kind": "number", "nodeType": "YulLiteral", "src": "320:1:1", "type": "", "value": "0" } ], "functionName": { "name": "revert", "nodeType": "YulIdentifier", "src": "310:6:1" }, "nodeType": "YulFunctionCall", "src": "310:12:1" }, "nodeType": "YulExpressionStatement", "src": "310:12:1" } ] }, "name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db", "nodeType": "YulFunctionDefinition", "src": "211:117:1" }, { "body": { "nodeType": "YulBlock", "src": "379:81:1", "statements": [ { "nodeType": "YulAssignment", "src": "389:65:1", "value": { "arguments": [ { "name": "value", "nodeType": "YulIdentifier", "src": "404:5:1" }, { "kind": "number", "nodeType": "YulLiteral", "src": "411:42:1", "type": "", "value": "0xffffffffffffffffffffffffffffffffffffffff" } ], "functionName": { "name": "and", "nodeType": "YulIdentifier", "src": "400:3:1" }, "nodeType": "YulFunctionCall", "src": "400:54:1" }, "variableNames": [ { "name": "cleaned", "nodeType": "YulIdentifier", "src": "389:7:1" } ] } ] }, "name": "cleanup_t_uint160", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "value", "nodeType": "YulTypedName", "src": "361:5:1", "type": "" } ], "returnVariables": [ { "name": "cleaned", "nodeType": "YulTypedName", "src": "371:7:1", "type": "" } ], "src": "334:126:1" }, { "body": { "nodeType": "YulBlock", "src": "511:51:1", "statements": [ { "nodeType": "YulAssignment", "src": "521:35:1", "value": { "arguments": [ { "name": "value", "nodeType": "YulIdentifier", "src": "550:5:1" } ], "functionName": { "name": "cleanup_t_uint160", "nodeType": "YulIdentifier", "src": "532:17:1"