diff --git a/deployment/deployment.json b/deployment/deployment.json index 649337f8fa..a30c62871b 100644 --- a/deployment/deployment.json +++ b/deployment/deployment.json @@ -6499,6 +6499,36 @@ } } }, + "hifi-governance": { + "schema": "governance", + "base": "governor-alpha-bravo", + "protocol": "hifi-governance", + "project": "hifi", + "deployments": { + "hifi-governance-ethereum": { + "network": "ethereum", + "status": "prod", + "versions": { + "schema": "1.0.0", + "subgraph": "1.0.0", + "methodology": "1.0.0" + }, + "files": { + "template": "hifi-governance.template.yaml" + }, + "options": { + "prepare:yaml": true, + "prepare:constants": false + }, + "services": { + "hosted-service": { + "slug": "hifi-governance", + "query-id": "hifi-governance" + } + } + } + } + }, "idle-governance": { "schema": "governance", "base": "governor-alpha-bravo", diff --git a/subgraphs/governor-alpha-bravo/abis/hifi-governance/GovernorBravoDelegate.json b/subgraphs/governor-alpha-bravo/abis/hifi-governance/GovernorBravoDelegate.json new file mode 100644 index 0000000000..0929dc3061 --- /dev/null +++ b/subgraphs/governor-alpha-bravo/abis/hifi-governance/GovernorBravoDelegate.json @@ -0,0 +1,632 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldImplementation", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "NewImplementation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPendingAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "NewPendingAdmin", + "type": "event" + }, + { + "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": "uint256", + "name": "oldProposalThreshold", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newProposalThreshold", + "type": "uint256" + } + ], + "name": "ProposalThresholdSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "voter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "support", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "votes", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "reason", + "type": "string" + } + ], + "name": "VoteCast", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVotingDelay", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVotingDelay", + "type": "uint256" + } + ], + "name": "VotingDelaySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "oldVotingPeriod", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newVotingPeriod", + "type": "uint256" + } + ], + "name": "VotingPeriodSet", + "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": "MAX_PROPOSAL_THRESHOLD", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_VOTING_DELAY", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_VOTING_PERIOD", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_PROPOSAL_THRESHOLD", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_VOTING_DELAY", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_VOTING_PERIOD", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_acceptAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newPendingAdmin", + "type": "address" + } + ], + "name": "_setPendingAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newProposalThreshold", + "type": "uint256" + } + ], + "name": "_setProposalThreshold", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "newVotingDelay", "type": "uint256" } + ], + "name": "_setVotingDelay", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newVotingPeriod", + "type": "uint256" + } + ], + "name": "_setVotingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "admin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "proposalId", "type": "uint256" } + ], + "name": "cancel", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "proposalId", "type": "uint256" }, + { "internalType": "uint8", "name": "support", "type": "uint8" } + ], + "name": "castVote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "proposalId", "type": "uint256" }, + { "internalType": "uint8", "name": "support", "type": "uint8" }, + { "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" }, + { "internalType": "uint8", "name": "support", "type": "uint8" }, + { "internalType": "string", "name": "reason", "type": "string" } + ], + "name": "castVoteWithReason", + "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": "uint8", "name": "support", "type": "uint8" }, + { "internalType": "uint96", "name": "votes", "type": "uint96" } + ], + "internalType": "struct GovernorBravoDelegateStorageV1.Receipt", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hifi", + "outputs": [ + { + "internalType": "contract HifiInterface", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "timelock_", "type": "address" }, + { "internalType": "address", "name": "hifi_", "type": "address" }, + { "internalType": "uint256", "name": "votingPeriod_", "type": "uint256" }, + { "internalType": "uint256", "name": "votingDelay_", "type": "uint256" }, + { + "internalType": "uint256", + "name": "proposalThreshold_", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "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": "pendingAdmin", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "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": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proposalThreshold", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "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": "uint256", "name": "abstainVotes", "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": [ + { "internalType": "uint256", "name": "proposalId", "type": "uint256" } + ], + "name": "queue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "quorumVotes", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "proposalId", "type": "uint256" } + ], + "name": "state", + "outputs": [ + { + "internalType": "enum GovernorBravoDelegateStorageV1.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": "view", + "type": "function" + }, + { + "inputs": [], + "name": "votingPeriod", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/subgraphs/governor-alpha-bravo/abis/hifi-governance/Hifi.json b/subgraphs/governor-alpha-bravo/abis/hifi-governance/Hifi.json new file mode 100644 index 0000000000..11878226a8 --- /dev/null +++ b/subgraphs/governor-alpha-bravo/abis/hifi-governance/Hifi.json @@ -0,0 +1,414 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "address", "name": "minter_", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newMinter", + "type": "address" + } + ], + "name": "MinterChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mftAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "hifiAmount", + "type": "uint256" + } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DELEGATION_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": "PERMIT_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint32", "name": "", "type": "uint32" } + ], + "name": "checkpoints", + "outputs": [ + { "internalType": "uint32", "name": "fromBlock", "type": "uint32" }, + { "internalType": "uint96", "name": "votes", "type": "uint96" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "delegatee", "type": "address" } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "delegatee", "type": "address" }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "uint256", "name": "expiry", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "delegates", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" } + ], + "name": "getCurrentVotes", + "outputs": [{ "internalType": "uint96", "name": "", "type": "uint96" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } + ], + "name": "getPriorVotes", + "outputs": [{ "internalType": "uint96", "name": "", "type": "uint96" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mft", + "outputs": [ + { "internalType": "contract IERC20", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minter", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "numCheckpoints", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "minter_", "type": "address" } + ], + "name": "setMinter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "mftAmount", "type": "uint256" } + ], + "name": "swap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "swapRatio", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/subgraphs/governor-alpha-bravo/protocols/hifi-governance/config/deployments/hifi-governance-ethereum/configurations.json b/subgraphs/governor-alpha-bravo/protocols/hifi-governance/config/deployments/hifi-governance-ethereum/configurations.json new file mode 100644 index 0000000000..60e327068a --- /dev/null +++ b/subgraphs/governor-alpha-bravo/protocols/hifi-governance/config/deployments/hifi-governance-ethereum/configurations.json @@ -0,0 +1,7 @@ +{ + "network": "mainnet", + "governorContractAddress": "0xef0a0421ea43b602e5be35e9018dd3e34bcee007", + "governorContractStartBlock": 16157581, + "tokenContractAddress": "0x4b9278b94a1112cad404048903b8d343a810b07e", + "tokenContractStartBlock": 16143034 +} diff --git a/subgraphs/governor-alpha-bravo/protocols/hifi-governance/config/templates/hifi-governance.template.yaml b/subgraphs/governor-alpha-bravo/protocols/hifi-governance/config/templates/hifi-governance.template.yaml new file mode 100644 index 0000000000..0030a1756f --- /dev/null +++ b/subgraphs/governor-alpha-bravo/protocols/hifi-governance/config/templates/hifi-governance.template.yaml @@ -0,0 +1,71 @@ +specVersion: 0.0.2 +repository: https://github.com/messari/subgraphs +schema: + file: ./schema.graphql +dataSources: + - kind: ethereum/contract + name: GovernorBravoDelegate + network: {{ network }} + source: + address: "{{ governorContractAddress }}" + abi: GovernorBravoDelegate + startBlock: {{ governorContractStartBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Governance + - Proposal + - Vote + - TokenHolder + - Delegate + abis: + - name: GovernorBravoDelegate + file: ./abis/hifi-governance/GovernorBravoDelegate.json + eventHandlers: + - event: ProposalCanceled(uint256) + handler: handleProposalCanceled + - event: ProposalCreated(uint256,address,address[],uint256[],string[],bytes[],uint256,uint256,string) + handler: handleProposalCreated + - event: ProposalExecuted(uint256) + handler: handleProposalExecuted + - event: ProposalQueued(uint256,uint256) + handler: handleProposalQueued + - event: ProposalThresholdSet(uint256,uint256) + handler: handleProposalThresholdSet + - event: VoteCast(indexed address,uint256,uint8,uint256,string) + handler: handleVoteCast + - event: VotingDelaySet(uint256,uint256) + handler: handleVotingDelaySet + - event: VotingPeriodSet(uint256,uint256) + handler: handleVotingPeriodSet + file: ./protocols/hifi-governance/src/governor-bravo-delegate.ts + - kind: ethereum/contract + name: Hifi + network: {{ network }} + source: + address: "{{ tokenContractAddress }}" + abi: Hifi + startBlock: {{ tokenContractStartBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - Governance + - Proposal + - Vote + - TokenHolder + - Delegate + abis: + - name: Hifi + file: ./abis/hifi-governance/Hifi.json + eventHandlers: + - event: DelegateChanged(indexed address,indexed address,indexed address) + handler: handleDelegateChanged + - event: DelegateVotesChanged(indexed address,uint256,uint256) + handler: handleDelegateVotesChanged + - event: Transfer(indexed address,indexed address,uint256) + handler: handleTransfer + file: ./protocols/hifi-governance/src/hifi.ts diff --git a/subgraphs/governor-alpha-bravo/protocols/hifi-governance/src/governor-bravo-delegate.ts b/subgraphs/governor-alpha-bravo/protocols/hifi-governance/src/governor-bravo-delegate.ts new file mode 100644 index 0000000000..7dc9d13d24 --- /dev/null +++ b/subgraphs/governor-alpha-bravo/protocols/hifi-governance/src/governor-bravo-delegate.ts @@ -0,0 +1,174 @@ +import { Address, BigInt } from "@graphprotocol/graph-ts"; +import { + ProposalCanceled, + ProposalCreated, + ProposalExecuted, + ProposalQueued, + ProposalThresholdSet, + VoteCast, + VotingDelaySet, + VotingPeriodSet, +} from "../../../generated/GovernorBravoDelegate/GovernorBravoDelegate"; +import { + _handleProposalCreated, + _handleProposalCanceled, + _handleProposalExecuted, + _handleProposalQueued, + _handleVoteCast, + getProposal, + getGovernance, +} from "../../../src/handlers"; +import { GovernorBravoDelegate } from "../../../generated/GovernorBravoDelegate/GovernorBravoDelegate"; +import { GovernanceFramework, Proposal } from "../../../generated/schema"; +import { + BIGINT_ONE, + GovernanceFrameworkType, + NA, + ProposalState, +} from "../../../src/constants"; + +// ProposalCanceled(proposalId) +export function handleProposalCanceled(event: ProposalCanceled): void { + _handleProposalCanceled(event.params.id.toString(), event); +} + +// ProposalCreated(proposalId, proposer, targets, values, signatures, calldatas, startBlock, endBlock, description) +export function handleProposalCreated(event: ProposalCreated): void { + const quorumVotes = getQuorumFromContract(event.address); + + // FIXME: Prefer to use a single object arg for params + // e.g. { proposalId: event.params.proposalId, proposer: event.params.proposer, ...} + // but graph wasm compilation breaks for unknown reasons + _handleProposalCreated( + event.params.id.toString(), + event.params.proposer.toHexString(), + event.params.targets, + event.params.values, + event.params.signatures, + event.params.calldatas, + event.params.startBlock, + event.params.endBlock, + event.params.description, + quorumVotes, + event + ); +} + +// ProposalExecuted(proposalId) +export function handleProposalExecuted(event: ProposalExecuted): void { + _handleProposalExecuted(event.params.id.toString(), event); +} + +// ProposalQueued(proposalId, eta) +export function handleProposalQueued(event: ProposalQueued): void { + _handleProposalQueued(event.params.id, event.params.eta, event); +} + +// ProposalThresholdSet(oldProposalThreshold,newProposalThreshold) +export function handleProposalThresholdSet(event: ProposalThresholdSet): void { + const governanceFramework = getGovernanceFramework( + event.address.toHexString() + ); + governanceFramework.proposalThreshold = event.params.newProposalThreshold; + governanceFramework.save(); +} + +function getLatestProposalValues( + proposalId: string, + contractAddress: Address +): Proposal { + const proposal = getProposal(proposalId); + + // On first vote, set state and quorum values + if (proposal.state == ProposalState.PENDING) { + const contract = GovernorBravoDelegate.bind(contractAddress); + proposal.state = ProposalState.ACTIVE; + const res = contract.try_quorumVotes(); + if (!res.reverted) { + proposal.quorumVotes = res.value; + } else { + proposal.quorumVotes = BIGINT_ONE; + } + + const governance = getGovernance(); + proposal.tokenHoldersAtStart = governance.currentTokenHolders; + proposal.delegatesAtStart = governance.currentDelegates; + } + return proposal; +} +// VoteCast(account, proposalId, support, weight, reason); +export function handleVoteCast(event: VoteCast): void { + const proposal = getLatestProposalValues( + event.params.proposalId.toString(), + event.address + ); + + // Proposal will be updated as part of handler + _handleVoteCast( + proposal, + event.params.voter.toHexString(), + event.params.votes, + event.params.reason, + event.params.support, + event + ); +} + +// VotingDelaySet(oldVotingDelay,newVotingDelay) +export function handleVotingDelaySet(event: VotingDelaySet): void { + const governanceFramework = getGovernanceFramework( + event.address.toHexString() + ); + governanceFramework.votingDelay = event.params.newVotingDelay; + governanceFramework.save(); +} + +// VotingDelaySet(oldVotingPeriod,newVotingPeriod) +export function handleVotingPeriodSet(event: VotingPeriodSet): void { + const governanceFramework = getGovernanceFramework( + event.address.toHexString() + ); + governanceFramework.votingPeriod = event.params.newVotingPeriod; + governanceFramework.save(); +} + +// Helper function that imports and binds the contract +function getGovernanceFramework(contractAddress: string): GovernanceFramework { + let governanceFramework = GovernanceFramework.load(contractAddress); + + if (!governanceFramework) { + governanceFramework = new GovernanceFramework(contractAddress); + const contract = GovernorBravoDelegate.bind( + Address.fromString(contractAddress) + ); + + governanceFramework.name = "hifi-governance"; + governanceFramework.type = GovernanceFrameworkType.GOVERNOR_BRAVO; + governanceFramework.version = NA; + + governanceFramework.contractAddress = contractAddress; + governanceFramework.tokenAddress = contract.hifi().toHexString(); + governanceFramework.timelockAddress = contract.timelock().toHexString(); + + governanceFramework.votingDelay = contract.votingDelay(); + governanceFramework.votingPeriod = contract.votingPeriod(); + governanceFramework.proposalThreshold = contract.proposalThreshold(); + governanceFramework.quorumVotes = contract.quorumVotes(); + } + + return governanceFramework; +} + +function getQuorumFromContract(contractAddress: Address): BigInt { + const contract = GovernorBravoDelegate.bind(contractAddress); + const quorumVotes = contract.quorumVotes(); + + // Update quorum at the contract level as well + const governanceFramework = getGovernanceFramework( + contractAddress.toHexString() + ); + governanceFramework.quorumVotes = quorumVotes; + governanceFramework.save(); + + return quorumVotes; +} diff --git a/subgraphs/governor-alpha-bravo/protocols/hifi-governance/src/hifi.ts b/subgraphs/governor-alpha-bravo/protocols/hifi-governance/src/hifi.ts new file mode 100644 index 0000000000..c1ffae4a44 --- /dev/null +++ b/subgraphs/governor-alpha-bravo/protocols/hifi-governance/src/hifi.ts @@ -0,0 +1,41 @@ +import { + DelegateChanged, + DelegateVotesChanged, + Transfer, +} from "../../../generated/Hifi/Hifi"; +import { + _handleDelegateChanged, + _handleDelegateVotesChanged, + _handleTransfer, +} from "../../../src/tokenHandlers"; + +// DelegateChanged(indexed address,indexed address,indexed address) +export function handleDelegateChanged(event: DelegateChanged): void { + _handleDelegateChanged( + event.params.delegator.toHexString(), + event.params.fromDelegate.toHexString(), + event.params.toDelegate.toHexString(), + event + ); +} + +// DelegateVotesChanged(indexed address,uint256,uint256) +// Called in succession to the above DelegateChanged event +export function handleDelegateVotesChanged(event: DelegateVotesChanged): void { + _handleDelegateVotesChanged( + event.params.delegate.toHexString(), + event.params.previousBalance, + event.params.newBalance, + event + ); +} + +// // Transfer(indexed address,indexed address,uint256) +export function handleTransfer(event: Transfer): void { + _handleTransfer( + event.params.from.toHexString(), + event.params.to.toHexString(), + event.params.amount, + event + ); +}