From bda73049da2583683475a4d70d7c991826b258bb Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Mon, 10 Feb 2025 17:52:58 -0300 Subject: [PATCH 01/39] feat: add basic handlers for stake management in Horizon, and update old ones --- abis/HorizonStaking.json | 2408 +++++++++++++++++++++++++++++++ abis/SubgraphService.json | 2287 +++++++++++++++++++++++++++++ schema.graphql | 31 +- src/mappings/helpers/helpers.ts | 2 + src/mappings/horizonStaking.ts | 78 + src/mappings/staking.ts | 4 + subgraph.template.yaml | 28 + 7 files changed, 4835 insertions(+), 3 deletions(-) create mode 100644 abis/HorizonStaking.json create mode 100644 abis/SubgraphService.json create mode 100644 src/mappings/horizonStaking.ts diff --git a/abis/HorizonStaking.json b/abis/HorizonStaking.json new file mode 100644 index 00000000..b1089b90 --- /dev/null +++ b/abis/HorizonStaking.json @@ -0,0 +1,2408 @@ +[ + { + "type": "constructor", + "inputs": [ + { + "name": "controller", + "type": "address", + "internalType": "address" + }, + { + "name": "stakingExtensionAddress", + "type": "address", + "internalType": "address" + }, + { + "name": "subgraphDataServiceAddress", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "fallback", + "stateMutability": "nonpayable" + }, + { + "type": "receive", + "stateMutability": "payable" + }, + { + "type": "function", + "name": "acceptProvisionParameters", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "acceptProxy", + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "contract IGraphProxy" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "acceptProxyAndCall", + "inputs": [ + { + "name": "_proxy", + "type": "address", + "internalType": "contract IGraphProxy" + }, + { + "name": "_data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "addToDelegationPool", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "addToProvision", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "clearThawingPeriod", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "delegate", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "delegate", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minSharesOut", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "deprovision", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "nThawRequests", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "getDelegatedTokensAvailable", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getDelegation", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "delegator", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHorizonStakingTypes.Delegation", + "components": [ + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getDelegationFeeCut", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "paymentType", + "type": "uint8", + "internalType": "enum IGraphPayments.PaymentTypes" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getDelegationPool", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHorizonStakingTypes.DelegationPool", + "components": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "tokensThawing", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sharesThawing", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "thawingNonce", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getIdleStake", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getMaxThawingPeriod", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint64", + "internalType": "uint64" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getProviderTokensAvailable", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getProvision", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHorizonStakingTypes.Provision", + "components": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "tokensThawing", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "sharesThawing", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxVerifierCut", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "thawingPeriod", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "createdAt", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "maxVerifierCutPending", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "thawingPeriodPending", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "thawingNonce", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getServiceProvider", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHorizonStakingTypes.ServiceProvider", + "components": [ + { + "name": "tokensStaked", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "tokensProvisioned", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getStake", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getThawRequest", + "inputs": [ + { + "name": "requestType", + "type": "uint8", + "internalType": "enum IHorizonStakingTypes.ThawRequestType" + }, + { + "name": "thawRequestId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct IHorizonStakingTypes.ThawRequest", + "components": [ + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "thawingUntil", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "next", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "thawingNonce", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getThawRequestList", + "inputs": [ + { + "name": "requestType", + "type": "uint8", + "internalType": "enum IHorizonStakingTypes.ThawRequestType" + }, + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct LinkedList.List", + "components": [ + { + "name": "head", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "tail", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "nonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "count", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getThawedTokens", + "inputs": [ + { + "name": "requestType", + "type": "uint8", + "internalType": "enum IHorizonStakingTypes.ThawRequestType" + }, + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getTokensAvailable", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "delegationRatio", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isAllowedLockedVerifier", + "inputs": [ + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isAuthorized", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "operator", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isDelegationSlashingEnabled", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "multicall", + "inputs": [ + { + "name": "data", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "outputs": [ + { + "name": "results", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "provision", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxVerifierCut", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "thawingPeriod", + "type": "uint64", + "internalType": "uint64" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "provisionLocked", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxVerifierCut", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "thawingPeriod", + "type": "uint64", + "internalType": "uint64" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "redelegate", + "inputs": [ + { + "name": "oldServiceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "oldVerifier", + "type": "address", + "internalType": "address" + }, + { + "name": "newServiceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "newVerifier", + "type": "address", + "internalType": "address" + }, + { + "name": "minSharesForNewProvider", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "nThawRequests", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "reprovision", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "oldVerifier", + "type": "address", + "internalType": "address" + }, + { + "name": "newVerifier", + "type": "address", + "internalType": "address" + }, + { + "name": "nThawRequests", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setAllowedLockedVerifier", + "inputs": [ + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "allowed", + "type": "bool", + "internalType": "bool" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setDelegationFeeCut", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "paymentType", + "type": "uint8", + "internalType": "enum IGraphPayments.PaymentTypes" + }, + { + "name": "feeCut", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setDelegationSlashingEnabled", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setMaxThawingPeriod", + "inputs": [ + { + "name": "maxThawingPeriod", + "type": "uint64", + "internalType": "uint64" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setOperator", + "inputs": [ + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "operator", + "type": "address", + "internalType": "address" + }, + { + "name": "allowed", + "type": "bool", + "internalType": "bool" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setOperatorLocked", + "inputs": [ + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "operator", + "type": "address", + "internalType": "address" + }, + { + "name": "allowed", + "type": "bool", + "internalType": "bool" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setProvisionParameters", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "newMaxVerifierCut", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "newThawingPeriod", + "type": "uint64", + "internalType": "uint64" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "slash", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "tokensVerifier", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "verifierDestination", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "stake", + "inputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "stakeTo", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "stakeToProvision", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "thaw", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "undelegate", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "undelegate", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "unstake", + "inputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "withdraw", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "withdrawDelegated", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "nThawRequests", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "withdrawDelegated", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "AllowedLockedVerifierSet", + "inputs": [ + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "allowed", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DelegatedTokensWithdrawn", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "delegator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DelegationFeeCutSet", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "paymentType", + "type": "uint8", + "indexed": true, + "internalType": "enum IGraphPayments.PaymentTypes" + }, + { + "name": "feeCut", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DelegationSlashed", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DelegationSlashingEnabled", + "inputs": [], + "anonymous": false + }, + { + "type": "event", + "name": "DelegationSlashingSkipped", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GraphDirectoryInitialized", + "inputs": [ + { + "name": "graphToken", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "graphStaking", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "graphPayments", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphEscrow", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphController", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "graphEpochManager", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphRewardsManager", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphTokenGateway", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphProxyAdmin", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphCuration", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "HorizonStakeDeposited", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "HorizonStakeLocked", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "until", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "HorizonStakeWithdrawn", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MaxThawingPeriodSet", + "inputs": [ + { + "name": "maxThawingPeriod", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OperatorSet", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "operator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "allowed", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProvisionCreated", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "maxVerifierCut", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + }, + { + "name": "thawingPeriod", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProvisionIncreased", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProvisionParametersSet", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "maxVerifierCut", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + }, + { + "name": "thawingPeriod", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProvisionParametersStaged", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "maxVerifierCut", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + }, + { + "name": "thawingPeriod", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProvisionSlashed", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProvisionThawed", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "StakeDelegatedWithdrawn", + "inputs": [ + { + "name": "indexer", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "delegator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ThawRequestCreated", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "shares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "thawingUntil", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + }, + { + "name": "thawRequestId", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ThawRequestFulfilled", + "inputs": [ + { + "name": "thawRequestId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "shares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "thawingUntil", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + }, + { + "name": "valid", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ThawRequestsFulfilled", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "thawRequestsFulfilled", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "requestType", + "type": "uint8", + "indexed": false, + "internalType": "enum IHorizonStakingTypes.ThawRequestType" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ThawingPeriodCleared", + "inputs": [], + "anonymous": false + }, + { + "type": "event", + "name": "TokensDelegated", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "delegator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "shares", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TokensDeprovisioned", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TokensToDelegationPoolAdded", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "TokensUndelegated", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "delegator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerifierTokensSent", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "destination", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + }, + { + "type": "error", + "name": "GraphDirectoryInvalidZeroAddress", + "inputs": [ + { + "name": "contractName", + "type": "bytes", + "internalType": "bytes" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingCallerIsServiceProvider", + "inputs": [] + }, + { + "type": "error", + "name": "HorizonStakingInsufficientDelegationTokens", + "inputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minTokens", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInsufficientIdleStake", + "inputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minTokens", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInsufficientShares", + "inputs": [ + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minShares", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInsufficientStakeForLegacyAllocations", + "inputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minTokens", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInsufficientTokens", + "inputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minRequired", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInvalidDelegationFeeCut", + "inputs": [ + { + "name": "feeCut", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInvalidDelegationPool", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInvalidDelegationPoolState", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInvalidMaxVerifierCut", + "inputs": [ + { + "name": "maxVerifierCut", + "type": "uint32", + "internalType": "uint32" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInvalidProvision", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInvalidServiceProviderZeroAddress", + "inputs": [] + }, + { + "type": "error", + "name": "HorizonStakingInvalidThawRequestType", + "inputs": [] + }, + { + "type": "error", + "name": "HorizonStakingInvalidThawingPeriod", + "inputs": [ + { + "name": "thawingPeriod", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "maxThawingPeriod", + "type": "uint64", + "internalType": "uint64" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingInvalidVerifierZeroAddress", + "inputs": [] + }, + { + "type": "error", + "name": "HorizonStakingInvalidZeroShares", + "inputs": [] + }, + { + "type": "error", + "name": "HorizonStakingInvalidZeroTokens", + "inputs": [] + }, + { + "type": "error", + "name": "HorizonStakingNotAuthorized", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "verifier", + "type": "address", + "internalType": "address" + }, + { + "name": "caller", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingNothingThawing", + "inputs": [] + }, + { + "type": "error", + "name": "HorizonStakingProvisionAlreadyExists", + "inputs": [] + }, + { + "type": "error", + "name": "HorizonStakingSlippageProtection", + "inputs": [ + { + "name": "shares", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minShares", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingStillThawing", + "inputs": [ + { + "name": "until", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingTooManyThawRequests", + "inputs": [] + }, + { + "type": "error", + "name": "HorizonStakingTooManyTokens", + "inputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxTokens", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "HorizonStakingVerifierNotAllowed", + "inputs": [ + { + "name": "verifier", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "LinkedListEmptyList", + "inputs": [] + }, + { + "type": "error", + "name": "LinkedListInvalidIterations", + "inputs": [] + }, + { + "type": "error", + "name": "LinkedListInvalidZeroId", + "inputs": [] + }, + { + "type": "error", + "name": "LinkedListMaxElementsExceeded", + "inputs": [] + }, + { + "type": "error", + "name": "ManagedIsPaused", + "inputs": [] + }, + { + "type": "error", + "name": "ManagedOnlyController", + "inputs": [] + }, + { + "type": "error", + "name": "ManagedOnlyGovernor", + "inputs": [] + }, + { + "type": "error", + "name": "PPMMathInvalidMulPPM", + "inputs": [ + { + "name": "a", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "b", + "type": "uint256", + "internalType": "uint256" + } + ] + } +] \ No newline at end of file diff --git a/abis/SubgraphService.json b/abis/SubgraphService.json new file mode 100644 index 00000000..3da88ad2 --- /dev/null +++ b/abis/SubgraphService.json @@ -0,0 +1,2287 @@ +[ + { + "type": "constructor", + "inputs": [ + { + "name": "graphController", + "type": "address", + "internalType": "address" + }, + { + "name": "disputeManager", + "type": "address", + "internalType": "address" + }, + { + "name": "tapCollector", + "type": "address", + "internalType": "address" + }, + { + "name": "curation", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "acceptProvisionPendingParameters", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "allocationProvisionTracker", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "claims", + "inputs": [ + { + "name": "claimId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "createdAt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "releasableAt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "nextClaim", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "claimsLists", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "head", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "tail", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "nonce", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "count", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "closeStaleAllocation", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "collect", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "paymentType", + "type": "uint8", + "internalType": "enum IGraphPayments.PaymentTypes" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "curationFeesCut", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "delegationRatio", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint32", + "internalType": "uint32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "eip712Domain", + "inputs": [], + "outputs": [ + { + "name": "fields", + "type": "bytes1", + "internalType": "bytes1" + }, + { + "name": "name", + "type": "string", + "internalType": "string" + }, + { + "name": "version", + "type": "string", + "internalType": "string" + }, + { + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "verifyingContract", + "type": "address", + "internalType": "address" + }, + { + "name": "salt", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "extensions", + "type": "uint256[]", + "internalType": "uint256[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "encodeAllocationProof", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "feesProvisionTracker", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getAllocation", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct Allocation.State", + "components": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "subgraphDeploymentId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "createdAt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "closedAt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "lastPOIPresentedAt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "accRewardsPerAllocatedToken", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "accRewardsPending", + "type": "uint256", + "internalType": "uint256" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getAllocationData", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getDelegationRatio", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint32", + "internalType": "uint32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getLegacyAllocation", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct LegacyAllocation.State", + "components": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "subgraphDeploymentId", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getProvisionTokensRange", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getSubgraphAllocatedTokens", + "inputs": [ + { + "name": "subgraphDeploymentId", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getThawingPeriodRange", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "", + "type": "uint64", + "internalType": "uint64" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getVerifierCutRange", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "", + "type": "uint32", + "internalType": "uint32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "indexers", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "registeredAt", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "url", + "type": "string", + "internalType": "string" + }, + { + "name": "geoHash", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "minimumProvisionTokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maximumDelegationRatio", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "stakeToFeesRatio", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "isActiveAllocation", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isOverAllocated", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isStaleAllocation", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maxPOIStaleness", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maximumProvisionTokens", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maximumThawingPeriod", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint64", + "internalType": "uint64" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "maximumVerifierCut", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint32", + "internalType": "uint32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "migrateLegacyAllocation", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "internalType": "address" + }, + { + "name": "subgraphDeploymentID", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "minimumProvisionTokens", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "minimumThawingPeriod", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint64", + "internalType": "uint64" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "minimumVerifierCut", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint32", + "internalType": "uint32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "multicall", + "inputs": [ + { + "name": "data", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "outputs": [ + { + "name": "results", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "pause", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "pauseGuardians", + "inputs": [ + { + "name": "pauseGuardian", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "allowed", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "paused", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "register", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "releaseStake", + "inputs": [ + { + "name": "numClaimsToRelease", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "resizeAllocation", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "rewardsDestination", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "destination", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "setCurationCut", + "inputs": [ + { + "name": "curationCut", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setDelegationRatio", + "inputs": [ + { + "name": "delegationRatio", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setMaxPOIStaleness", + "inputs": [ + { + "name": "maxPOIStaleness", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setMinimumProvisionTokens", + "inputs": [ + { + "name": "minimumProvisionTokens", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setPauseGuardian", + "inputs": [ + { + "name": "pauseGuardian", + "type": "address", + "internalType": "address" + }, + { + "name": "allowed", + "type": "bool", + "internalType": "bool" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setRewardsDestination", + "inputs": [ + { + "name": "rewardsDestination", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setStakeToFeesRatio", + "inputs": [ + { + "name": "stakeToFeesRatio_", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "slash", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "stakeToFeesRatio", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "startService", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "stopService", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "unpause", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "AllocationClosed", + "inputs": [ + { + "name": "indexer", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "subgraphDeploymentId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "AllocationCreated", + "inputs": [ + { + "name": "indexer", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "subgraphDeploymentId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "AllocationResized", + "inputs": [ + { + "name": "indexer", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "subgraphDeploymentId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "newTokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "oldTokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "CurationCutSet", + "inputs": [ + { + "name": "curationCut", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DelegationRatioSet", + "inputs": [ + { + "name": "ratio", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "EIP712DomainChanged", + "inputs": [], + "anonymous": false + }, + { + "type": "event", + "name": "GraphDirectoryInitialized", + "inputs": [ + { + "name": "graphToken", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "graphStaking", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "graphPayments", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphEscrow", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphController", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "graphEpochManager", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphRewardsManager", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphTokenGateway", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphProxyAdmin", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphCuration", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "IndexingRewardsCollected", + "inputs": [ + { + "name": "indexer", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "subgraphDeploymentId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "tokensRewards", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "tokensIndexerRewards", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "tokensDelegationRewards", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "poi", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "currentEpoch", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "LegacyAllocationMigrated", + "inputs": [ + { + "name": "indexer", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "subgraphDeploymentId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "MaxPOIStalenessSet", + "inputs": [ + { + "name": "maxPOIStaleness", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "PauseGuardianSet", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "allowed", + "type": "bool", + "indexed": false, + "internalType": "bool" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Paused", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProvisionPendingParametersAccepted", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProvisionTokensRangeSet", + "inputs": [ + { + "name": "min", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "max", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "QueryFeesCollected", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokensCollected", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "tokensCurators", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RewardsDestinationSet", + "inputs": [ + { + "name": "indexer", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "rewardsDestination", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ServicePaymentCollected", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "feeType", + "type": "uint8", + "indexed": true, + "internalType": "enum IGraphPayments.PaymentTypes" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ServiceProviderRegistered", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ServiceProviderSlashed", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ServiceStarted", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ServiceStopped", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "indexed": false, + "internalType": "bytes" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "StakeClaimLocked", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "claimId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "unlockTimestamp", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "StakeClaimReleased", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "claimId", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "releasableAt", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "StakeClaimsReleased", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "claimsCount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "tokensReleased", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "StakeToFeesRatioSet", + "inputs": [ + { + "name": "ratio", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "SubgraphServiceDirectoryInitialized", + "inputs": [ + { + "name": "subgraphService", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "disputeManager", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "tapCollector", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "curation", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ThawingPeriodRangeSet", + "inputs": [ + { + "name": "min", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + }, + { + "name": "max", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Unpaused", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "VerifierCutRangeSet", + "inputs": [ + { + "name": "min", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + }, + { + "name": "max", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "AllocationAlreadyExists", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "AllocationClosed", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + }, + { + "name": "closedAt", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "AllocationDoesNotExist", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "AllocationManagerAllocationClosed", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "AllocationManagerAllocationSameSize", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "AllocationManagerInvalidAllocationProof", + "inputs": [ + { + "name": "signer", + "type": "address", + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "AllocationManagerInvalidZeroAllocationId", + "inputs": [] + }, + { + "type": "error", + "name": "DataServiceFeesClaimNotFound", + "inputs": [ + { + "name": "claimId", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "DataServiceFeesZeroTokens", + "inputs": [] + }, + { + "type": "error", + "name": "DataServicePausableNotPauseGuardian", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "DataServicePausablePauseGuardianNoChange", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "allowed", + "type": "bool", + "internalType": "bool" + } + ] + }, + { + "type": "error", + "name": "DirectoryNotDisputeManager", + "inputs": [ + { + "name": "caller", + "type": "address", + "internalType": "address" + }, + { + "name": "disputeManager", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ECDSAInvalidSignature", + "inputs": [] + }, + { + "type": "error", + "name": "ECDSAInvalidSignatureLength", + "inputs": [ + { + "name": "length", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ECDSAInvalidSignatureS", + "inputs": [ + { + "name": "s", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "EnforcedPause", + "inputs": [] + }, + { + "type": "error", + "name": "ExpectedPause", + "inputs": [] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + }, + { + "type": "error", + "name": "GraphDirectoryInvalidZeroAddress", + "inputs": [ + { + "name": "contractName", + "type": "bytes", + "internalType": "bytes" + } + ] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "LegacyAllocationAlreadyExists", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "LinkedListEmptyList", + "inputs": [] + }, + { + "type": "error", + "name": "LinkedListInvalidIterations", + "inputs": [] + }, + { + "type": "error", + "name": "LinkedListInvalidZeroId", + "inputs": [] + }, + { + "type": "error", + "name": "LinkedListMaxElementsExceeded", + "inputs": [] + }, + { + "type": "error", + "name": "NotInitializing", + "inputs": [] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "PPMMathInvalidMulPPM", + "inputs": [ + { + "name": "a", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "b", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ProvisionManagerInvalidRange", + "inputs": [ + { + "name": "min", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "max", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ProvisionManagerInvalidValue", + "inputs": [ + { + "name": "message", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "value", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "min", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "max", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ProvisionManagerNotAuthorized", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + }, + { + "name": "caller", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ProvisionManagerProvisionNotFound", + "inputs": [ + { + "name": "serviceProvider", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ProvisionTrackerInsufficientTokens", + "inputs": [ + { + "name": "tokensAvailable", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "tokensRequired", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceAllocationIsAltruistic", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceAllocationNotAuthorized", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + }, + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceCannotForceCloseAllocation", + "inputs": [ + { + "name": "allocationId", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceEmptyGeohash", + "inputs": [] + }, + { + "type": "error", + "name": "SubgraphServiceEmptyUrl", + "inputs": [] + }, + { + "type": "error", + "name": "SubgraphServiceInconsistentCollection", + "inputs": [ + { + "name": "balanceBefore", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "balanceAfter", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceIndexerAlreadyRegistered", + "inputs": [] + }, + { + "type": "error", + "name": "SubgraphServiceIndexerMismatch", + "inputs": [ + { + "name": "providedIndexer", + "type": "address", + "internalType": "address" + }, + { + "name": "expectedIndexer", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceIndexerNotRegistered", + "inputs": [ + { + "name": "indexer", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceInvalidCurationCut", + "inputs": [ + { + "name": "curationCut", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceInvalidPaymentType", + "inputs": [ + { + "name": "paymentType", + "type": "uint8", + "internalType": "enum IGraphPayments.PaymentTypes" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceInvalidRAV", + "inputs": [ + { + "name": "ravIndexer", + "type": "address", + "internalType": "address" + }, + { + "name": "allocationIndexer", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "SubgraphServiceInvalidZeroStakeToFeesRatio", + "inputs": [] + } +] \ No newline at end of file diff --git a/schema.graphql b/schema.graphql index 622f7204..71f4179b 100644 --- a/schema.graphql +++ b/schema.graphql @@ -86,6 +86,8 @@ type GraphNetwork @entity { totalTokensClaimable: BigInt! # TODO - see https://github.com/graphprotocol/graph-network-subgraph/issues/89 "Total tokens that are currently locked or withdrawable in the network from unstaking" totalUnstakedTokensLocked: BigInt! + "Total GRT currently in provisions" + totalTokensProvisioned: BigInt! "Total GRT currently in allocation" totalTokensAllocated: BigInt! "Total delegated tokens in the protocol" @@ -231,6 +233,16 @@ type GraphNetwork @entity { currentL1BlockNumber: BigInt } +type DataService @entity { + "Verifier address" + id: ID! + + "Total GRT currently in provisions for this DataService" + totalTokensProvisioned: BigInt! + "Total GRT currently in allocations for this DataService" + totalTokensAllocated: BigInt! +} + """ An account within the graph network. Contains metadata and all relevant data for this accounts delegating, curating, and indexing. @@ -675,6 +687,8 @@ type Indexer @entity { # Staking data "CURRENT tokens staked in the protocol. Decreases on withdraw, not on lock" stakedTokens: BigInt! + "CURRENT tokens provisioned to data services in the protocol. In the V1 protocol, all staked tokens were always provisioned since there was only one data service" + provisionedTokens: BigInt! "CURRENT tokens allocated on all subgraphs" allocatedTokens: BigInt! "NOT IMPLEMENTED - Tokens that have been unstaked and withdrawn" @@ -764,6 +778,9 @@ type Indexer @entity { "Count of how many times this indexer has been forced to close an allocation" forcedClosures: Int! + # Provisioning + provisions: [Provision!]! @derivedFrom(field: "indexer") + # Metrics "NOT IMPLEMENTED - Total return this indexer has earned" totalReturn: BigDecimal! @@ -771,9 +788,6 @@ type Indexer @entity { annualizedReturn: BigDecimal! # You must multiple by 100 to get percentage "NOT IMPLEMENTED - Staking efficiency of the indexer" stakingEfficiency: BigDecimal! - - # Query fees breakdown by payment address - } type PaymentSource @entity { @@ -815,6 +829,17 @@ type IndexerQueryFeePaymentAggregation @entity { paymentSource: PaymentSource! } +type Provision @entity { + "Join ID of indexer address (service provider) and DataService address (verifier)" + id: ID! + + indexer: Indexer! + + service: DataService! + + tokensProvisioned: BigInt! +} + """ A state channel Allocation representing a single Indexer-SubgraphDeployment stake """ diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index b19d91e7..7803a443 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -136,6 +136,7 @@ export function createOrLoadIndexer(indexerAddress: Bytes, timestamp: BigInt): I indexer.stakedTokens = BigInt.fromI32(0) indexer.transferredToL2 = false indexer.stakedTokensTransferredToL2 = BigInt.fromI32(0) + indexer.provisionedTokens = BigInt.fromI32(0) indexer.allocatedTokens = BigInt.fromI32(0) indexer.lockedTokens = BigInt.fromI32(0) indexer.unstakedTokens = BigInt.fromI32(0) @@ -552,6 +553,7 @@ export function createOrLoadGraphNetwork( graphNetwork.totalTokensStaked = BigInt.fromI32(0) graphNetwork.totalTokensClaimable = BigInt.fromI32(0) graphNetwork.totalUnstakedTokensLocked = BigInt.fromI32(0) + graphNetwork.totalTokensProvisioned = BigInt.fromI32(0) graphNetwork.totalTokensAllocated = BigInt.fromI32(0) graphNetwork.totalDelegatedTokens = BigInt.fromI32(0) graphNetwork.totalTokensSignalled = BigInt.fromI32(0) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts new file mode 100644 index 00000000..43e50c28 --- /dev/null +++ b/src/mappings/horizonStaking.ts @@ -0,0 +1,78 @@ +import { BigInt } from '@graphprotocol/graph-ts' +import { addresses } from '../../config/addresses.template' +import { HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn} from '../types/HorizonStaking/HorizonStaking' +import { Indexer } from '../types/schema' +import { calculateCapacities, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexer, updateAdvancedIndexerMetrics } from './helpers/helpers' + + +export function handleHorizonStakeDeposited(event: HorizonStakeDeposited): void { + // To Do + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + // update indexer + let indexer = createOrLoadIndexer(event.params.serviceProvider, event.block.timestamp) + let previousStake = indexer.stakedTokens + indexer.stakedTokens = indexer.stakedTokens.plus(event.params.tokens) + indexer = updateAdvancedIndexerMetrics(indexer as Indexer) + indexer = calculateCapacities(indexer as Indexer) + indexer.save() + + // Update graph network + graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.plus(event.params.tokens) + if (previousStake == BigInt.fromI32(0)) { + graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount + 1 + } + graphNetwork.save() + + // Update epoch + let epoch = createOrLoadEpoch( + addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!, + ) + epoch.stakeDeposited = epoch.stakeDeposited.plus(event.params.tokens) + epoch.save() +} + +export function handleHorizonStakeLocked(event: HorizonStakeLocked): void { + // To Do + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + // update indexer + let id = event.params.serviceProvider.toHexString() + let indexer = Indexer.load(id)! + let oldLockedTokens = indexer.lockedTokens + indexer.lockedTokens = event.params.tokens + indexer.tokensLockedUntil = event.params.until.toI32() + indexer = updateAdvancedIndexerMetrics(indexer as Indexer) + indexer = calculateCapacities(indexer as Indexer) + indexer.save() + + // update graph network + // the tokens from the event replace the previously locked tokens + // from this indexer + graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.plus( + event.params.tokens, + ).minus(oldLockedTokens) + if (indexer.stakedTokens == indexer.lockedTokens) { + graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount - 1 + } + graphNetwork.save() +} + +export function handleHorizonStakeWithdrawn(event: HorizonStakeWithdrawn): void { + // To Do + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + // update indexer + let id = event.params.serviceProvider.toHexString() + let indexer = Indexer.load(id)! + indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) + indexer.lockedTokens = indexer.lockedTokens.minus(event.params.tokens) + indexer.tokensLockedUntil = 0 // always set to 0 when withdrawn + indexer = updateAdvancedIndexerMetrics(indexer as Indexer) + indexer = calculateCapacities(indexer as Indexer) + indexer.save() + + // Update graph network + graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.minus(event.params.tokens) + graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.minus( + event.params.tokens, + ) + graphNetwork.save() +} diff --git a/src/mappings/staking.ts b/src/mappings/staking.ts index c720dbdb..d61834a3 100644 --- a/src/mappings/staking.ts +++ b/src/mappings/staking.ts @@ -76,12 +76,14 @@ export function handleStakeDeposited(event: StakeDeposited): void { let indexer = createOrLoadIndexer(event.params.indexer, event.block.timestamp) let previousStake = indexer.stakedTokens indexer.stakedTokens = indexer.stakedTokens.plus(event.params.tokens) + indexer.provisionedTokens = indexer.provisionedTokens.plus(event.params.tokens) indexer = updateAdvancedIndexerMetrics(indexer as Indexer) indexer = calculateCapacities(indexer as Indexer) indexer.save() // Update graph network graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.plus(event.params.tokens) + graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.plus(event.params.tokens) if (previousStake == BigInt.fromI32(0)) { graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount + 1 } @@ -136,6 +138,7 @@ export function handleStakeWithdrawn(event: StakeWithdrawn): void { let id = event.params.indexer.toHexString() let indexer = Indexer.load(id)! indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) + indexer.provisionedTokens = indexer.provisionedTokens.minus(event.params.tokens) indexer.lockedTokens = indexer.lockedTokens.minus(event.params.tokens) indexer.tokensLockedUntil = 0 // always set to 0 when withdrawn indexer = updateAdvancedIndexerMetrics(indexer as Indexer) @@ -144,6 +147,7 @@ export function handleStakeWithdrawn(event: StakeWithdrawn): void { // Update graph network graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.minus(event.params.tokens) + graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.minus(event.params.tokens) graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.minus( event.params.tokens, ) diff --git a/subgraph.template.yaml b/subgraph.template.yaml index c51094bb..850b2095 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -377,6 +377,34 @@ dataSources: eventHandlers: - event: ParameterUpdated(string) handler: handleParameterUpdated + - kind: ethereum/contract + name: HorizonStaking + network: {{network}} + source: + address: "{{staking}}" + abi: HorizonStaking + startBlock: {{blockNumber}} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + file: ./src/mappings/staking.ts + entities: + - GraphNetwork + abis: + - name: HorizonStaking + file: ./abis/HorizonStaking.json + - name: GraphToken + file: ./node_modules/@graphprotocol/contracts/dist/abis/GraphToken.json + - name: EpochManager + file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json + eventHandlers: + - event: HorizonStakeDeposited(indexed address,uint256) + handler: handleHorizonStakeDeposited + - event: HorizonStakeLocked(indexed address,uint256,uint256) + handler: handleHorizonStakeLocked + - event: HorizonStakeWithdrawn(indexed address,uint256) + handler: handleHorizonStakeWithdrawn - kind: ethereum/contract name: Curation network: {{network}} From fe09148f1c3883c1d7330d5b774c5c4d7368b6f6 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Mon, 10 Feb 2025 18:30:15 -0300 Subject: [PATCH 02/39] fix: potential issue for Stage 2 --- src/mappings/horizonStaking.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 43e50c28..c5c277e5 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -63,7 +63,7 @@ export function handleHorizonStakeWithdrawn(event: HorizonStakeWithdrawn): void let id = event.params.serviceProvider.toHexString() let indexer = Indexer.load(id)! indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) - indexer.lockedTokens = indexer.lockedTokens.minus(event.params.tokens) + indexer.lockedTokens = BigInt.fromI32(0) // set to 0 to prevent issues when Stage 2 comes indexer.tokensLockedUntil = 0 // always set to 0 when withdrawn indexer = updateAdvancedIndexerMetrics(indexer as Indexer) indexer = calculateCapacities(indexer as Indexer) From 402a5722398270178f2692b1f9f58c9bf44f7652 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 13 Feb 2025 01:34:08 -0300 Subject: [PATCH 03/39] fix: comments from latest round of reviews --- schema.graphql | 8 ++++---- src/mappings/staking.ts | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/schema.graphql b/schema.graphql index 71f4179b..95969531 100644 --- a/schema.graphql +++ b/schema.graphql @@ -234,7 +234,7 @@ type GraphNetwork @entity { } type DataService @entity { - "Verifier address" + "Data Service address" id: ID! "Total GRT currently in provisions for this DataService" @@ -687,7 +687,7 @@ type Indexer @entity { # Staking data "CURRENT tokens staked in the protocol. Decreases on withdraw, not on lock" stakedTokens: BigInt! - "CURRENT tokens provisioned to data services in the protocol. In the V1 protocol, all staked tokens were always provisioned since there was only one data service" + "CURRENT tokens provisioned to data services in the protocol. In the V1 protocol, all staked tokens were always provisioned to an implicit 'subgraph data service'" provisionedTokens: BigInt! "CURRENT tokens allocated on all subgraphs" allocatedTokens: BigInt! @@ -830,12 +830,12 @@ type IndexerQueryFeePaymentAggregation @entity { } type Provision @entity { - "Join ID of indexer address (service provider) and DataService address (verifier)" + "Join ID of indexer address (service provider) and DataService address" id: ID! indexer: Indexer! - service: DataService! + dataService: DataService! tokensProvisioned: BigInt! } diff --git a/src/mappings/staking.ts b/src/mappings/staking.ts index d61834a3..c720dbdb 100644 --- a/src/mappings/staking.ts +++ b/src/mappings/staking.ts @@ -76,14 +76,12 @@ export function handleStakeDeposited(event: StakeDeposited): void { let indexer = createOrLoadIndexer(event.params.indexer, event.block.timestamp) let previousStake = indexer.stakedTokens indexer.stakedTokens = indexer.stakedTokens.plus(event.params.tokens) - indexer.provisionedTokens = indexer.provisionedTokens.plus(event.params.tokens) indexer = updateAdvancedIndexerMetrics(indexer as Indexer) indexer = calculateCapacities(indexer as Indexer) indexer.save() // Update graph network graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.plus(event.params.tokens) - graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.plus(event.params.tokens) if (previousStake == BigInt.fromI32(0)) { graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount + 1 } @@ -138,7 +136,6 @@ export function handleStakeWithdrawn(event: StakeWithdrawn): void { let id = event.params.indexer.toHexString() let indexer = Indexer.load(id)! indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) - indexer.provisionedTokens = indexer.provisionedTokens.minus(event.params.tokens) indexer.lockedTokens = indexer.lockedTokens.minus(event.params.tokens) indexer.tokensLockedUntil = 0 // always set to 0 when withdrawn indexer = updateAdvancedIndexerMetrics(indexer as Indexer) @@ -147,7 +144,6 @@ export function handleStakeWithdrawn(event: StakeWithdrawn): void { // Update graph network graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.minus(event.params.tokens) - graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.minus(event.params.tokens) graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.minus( event.params.tokens, ) From fa4fcfe1362c9b5f61dedc0d71c348c7facb17a9 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 13 Feb 2025 01:46:06 -0300 Subject: [PATCH 04/39] fix: more fixes from reviews, and fixed addresses import preventing build --- src/mappings/horizonStaking.ts | 88 ++++++++++++++++------------------ src/mappings/staking.ts | 5 +- subgraph.template.yaml | 2 +- 3 files changed, 44 insertions(+), 51 deletions(-) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index c5c277e5..c1c5b410 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -1,12 +1,11 @@ import { BigInt } from '@graphprotocol/graph-ts' -import { addresses } from '../../config/addresses.template' -import { HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn} from '../types/HorizonStaking/HorizonStaking' +import { addresses } from '../../config/addresses' +import { HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn } from '../types/HorizonStaking/HorizonStaking' import { Indexer } from '../types/schema' import { calculateCapacities, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexer, updateAdvancedIndexerMetrics } from './helpers/helpers' export function handleHorizonStakeDeposited(event: HorizonStakeDeposited): void { - // To Do let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) // update indexer let indexer = createOrLoadIndexer(event.params.serviceProvider, event.block.timestamp) @@ -15,64 +14,61 @@ export function handleHorizonStakeDeposited(event: HorizonStakeDeposited): void indexer = updateAdvancedIndexerMetrics(indexer as Indexer) indexer = calculateCapacities(indexer as Indexer) indexer.save() - + // Update graph network graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.plus(event.params.tokens) - if (previousStake == BigInt.fromI32(0)) { - graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount + 1 + if (previousStake.isZero()) { + graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount + 1 } graphNetwork.save() - + // Update epoch let epoch = createOrLoadEpoch( - addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!, + addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!, ) epoch.stakeDeposited = epoch.stakeDeposited.plus(event.params.tokens) epoch.save() } export function handleHorizonStakeLocked(event: HorizonStakeLocked): void { - // To Do - let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) - // update indexer - let id = event.params.serviceProvider.toHexString() - let indexer = Indexer.load(id)! - let oldLockedTokens = indexer.lockedTokens - indexer.lockedTokens = event.params.tokens - indexer.tokensLockedUntil = event.params.until.toI32() - indexer = updateAdvancedIndexerMetrics(indexer as Indexer) - indexer = calculateCapacities(indexer as Indexer) - indexer.save() + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + // update indexer + let id = event.params.serviceProvider.toHexString() + let indexer = Indexer.load(id)! + indexer.lockedTokens = event.params.tokens + indexer.tokensLockedUntil = event.params.until.toI32() + indexer = updateAdvancedIndexerMetrics(indexer as Indexer) + indexer = calculateCapacities(indexer as Indexer) + indexer.save() - // update graph network - // the tokens from the event replace the previously locked tokens - // from this indexer - graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.plus( - event.params.tokens, - ).minus(oldLockedTokens) - if (indexer.stakedTokens == indexer.lockedTokens) { - graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount - 1 - } - graphNetwork.save() + // update graph network + graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.plus( + event.params.tokens, + ) + graphNetwork.save() } export function handleHorizonStakeWithdrawn(event: HorizonStakeWithdrawn): void { - // To Do - let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) - // update indexer - let id = event.params.serviceProvider.toHexString() - let indexer = Indexer.load(id)! - indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) - indexer.lockedTokens = BigInt.fromI32(0) // set to 0 to prevent issues when Stage 2 comes - indexer.tokensLockedUntil = 0 // always set to 0 when withdrawn - indexer = updateAdvancedIndexerMetrics(indexer as Indexer) - indexer = calculateCapacities(indexer as Indexer) - indexer.save() + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + // update indexer + let id = event.params.serviceProvider.toHexString() + let indexer = Indexer.load(id)! + indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) + indexer.lockedTokens = BigInt.fromI32(0) // set to 0 to prevent issues when Stage 2 comes + indexer.tokensLockedUntil = 0 // always set to 0 when withdrawn + indexer = updateAdvancedIndexerMetrics(indexer as Indexer) + indexer = calculateCapacities(indexer as Indexer) + indexer.save() - // Update graph network - graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.minus(event.params.tokens) - graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.minus( - event.params.tokens, - ) - graphNetwork.save() + // Update graph network + graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.minus(event.params.tokens) + graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.minus( + event.params.tokens, + ) + // We might want to introduce the notion of "provisioned indexer count" or "active indexer count" + // to each data service since that's what this particular count wanted to convey. + if (indexer.stakedTokens.isZero()) { + graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount - 1 + } + graphNetwork.save() } diff --git a/src/mappings/staking.ts b/src/mappings/staking.ts index c720dbdb..a35d7b52 100644 --- a/src/mappings/staking.ts +++ b/src/mappings/staking.ts @@ -106,7 +106,6 @@ export function handleStakeLocked(event: StakeLocked): void { // update indexer let id = event.params.indexer.toHexString() let indexer = Indexer.load(id)! - let oldLockedTokens = indexer.lockedTokens indexer.lockedTokens = event.params.tokens indexer.tokensLockedUntil = event.params.until.toI32() indexer = updateAdvancedIndexerMetrics(indexer as Indexer) @@ -114,11 +113,9 @@ export function handleStakeLocked(event: StakeLocked): void { indexer.save() // update graph network - // the tokens from the event replace the previously locked tokens - // from this indexer graphNetwork.totalUnstakedTokensLocked = graphNetwork.totalUnstakedTokensLocked.plus( event.params.tokens, - ).minus(oldLockedTokens) + ) if (indexer.stakedTokens == indexer.lockedTokens) { graphNetwork.stakedIndexersCount = graphNetwork.stakedIndexersCount - 1 } diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 850b2095..ff4b23ce 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -388,7 +388,7 @@ dataSources: kind: ethereum/events apiVersion: 0.0.7 language: wasm/assemblyscript - file: ./src/mappings/staking.ts + file: ./src/mappings/horizonStaking.ts entities: - GraphNetwork abis: From f7f0b7ab386a7f6a31d836b5ab042f14d2c31a9b Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Tue, 11 Feb 2025 02:43:31 -0300 Subject: [PATCH 05/39] feat: add initial provision management, without thawing tracking --- schema.graphql | 29 +++++++ src/mappings/helpers/helpers.ts | 39 ++++++++++ src/mappings/horizonStaking.ts | 129 ++++++++++++++++++++++++++++++-- subgraph.template.yaml | 22 ++++++ 4 files changed, 214 insertions(+), 5 deletions(-) diff --git a/schema.graphql b/schema.graphql index 95969531..89807977 100644 --- a/schema.graphql +++ b/schema.graphql @@ -88,6 +88,8 @@ type GraphNetwork @entity { totalUnstakedTokensLocked: BigInt! "Total GRT currently in provisions" totalTokensProvisioned: BigInt! + "Total GRT currently thawing from provisions" + totalTokensThawing: BigInt! "Total GRT currently in allocation" totalTokensAllocated: BigInt! "Total delegated tokens in the protocol" @@ -239,8 +241,12 @@ type DataService @entity { "Total GRT currently in provisions for this DataService" totalTokensProvisioned: BigInt! + "Total GRT currently thawing from provisions for this DataService" + totalTokensThawing: BigInt! "Total GRT currently in allocations for this DataService" totalTokensAllocated: BigInt! + + provisions: [Provision!]! @derivedFrom(field: "service") } """ @@ -689,6 +695,8 @@ type Indexer @entity { stakedTokens: BigInt! "CURRENT tokens provisioned to data services in the protocol. In the V1 protocol, all staked tokens were always provisioned to an implicit 'subgraph data service'" provisionedTokens: BigInt! + "CURRENT tokens thawing from provisions to data services in the protocol. Only for Horizon" + thawingTokens: BigInt! "CURRENT tokens allocated on all subgraphs" allocatedTokens: BigInt! "NOT IMPLEMENTED - Tokens that have been unstaked and withdrawn" @@ -838,6 +846,27 @@ type Provision @entity { dataService: DataService! tokensProvisioned: BigInt! + + "Service provider tokens that are being thawed (and will stop being slashable soon)" + tokensThawing: BigInt! + + "Shares representing the thawing tokens" + sharesThawing: BigInt! + + "Max amount that can be taken by the verifier when slashing, expressed in parts-per-million of the amount slashed" + maxVerifierCut: Int! + + "Time, in seconds, tokens must thaw before being withdrawn" + thawingPeriod: BigInt! + + "Timestamp when the provision was created" + createdAt: BigInt! + + "Pending value for maxVerifierCut. Verifier needs to accept it before it becomes active" + maxVerifierCutPending: Int! + + "Pending value for thawingPeriod. Verifier needs to accept it before it becomes active" + thawingPeriodPending: BigInt! } """ diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 7803a443..8ff45eca 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -26,6 +26,8 @@ import { CurrentSubgraphDeploymentRelation, PaymentSource, IndexerQueryFeePaymentAggregation, + Provision, + DataService, } from '../../types/schema' import { SubgraphDeploymentManifest as SubgraphDeploymentManifestTemplate @@ -137,6 +139,7 @@ export function createOrLoadIndexer(indexerAddress: Bytes, timestamp: BigInt): I indexer.transferredToL2 = false indexer.stakedTokensTransferredToL2 = BigInt.fromI32(0) indexer.provisionedTokens = BigInt.fromI32(0) + indexer.thawingTokens = BigInt.fromI32(0) indexer.allocatedTokens = BigInt.fromI32(0) indexer.lockedTokens = BigInt.fromI32(0) indexer.unstakedTokens = BigInt.fromI32(0) @@ -188,6 +191,41 @@ export function createOrLoadIndexer(indexerAddress: Bytes, timestamp: BigInt): I return indexer as Indexer } +export function createOrLoadProvision(indexerAddress: Bytes, verifierAddress: Bytes, timestamp: BigInt): Provision { + let id = joinID([indexerAddress.toHexString(), verifierAddress.toHexString()]) + let provision = Provision.load(id) + if (provision == null) { + provision = new Provision(id) + provision.indexer = indexerAddress.toHexString() + provision.service = verifierAddress.toHexString() + provision.tokensProvisioned = BigInt.fromI32(0) + provision.tokensThawing = BigInt.fromI32(0) + provision.sharesThawing = BigInt.fromI32(0) + provision.createdAt = timestamp + provision.maxVerifierCut = 0 + provision.maxVerifierCutPending = 0 + provision.thawingPeriod = BigInt.fromI32(0) + provision.thawingPeriodPending = BigInt.fromI32(0) + provision.save() + } + + return provision as Provision +} + +export function createOrLoadDataService(verifierAddress: Bytes): DataService { + let id = verifierAddress.toHexString() + let service = DataService.load(id) + if (service == null) { + service = new DataService(id) + service.totalTokensAllocated = BigInt.fromI32(0) + service.totalTokensProvisioned = BigInt.fromI32(0) + service.totalTokensThawing = BigInt.fromI32(0) + service.save() + } + + return service as DataService +} + export function createOrLoadPaymentSource(paymentAddress: Bytes): PaymentSource { let id = paymentAddress.toHexString() let paymentSource = PaymentSource.load(id) @@ -554,6 +592,7 @@ export function createOrLoadGraphNetwork( graphNetwork.totalTokensClaimable = BigInt.fromI32(0) graphNetwork.totalUnstakedTokensLocked = BigInt.fromI32(0) graphNetwork.totalTokensProvisioned = BigInt.fromI32(0) + graphNetwork.totalTokensThawing = BigInt.fromI32(0) graphNetwork.totalTokensAllocated = BigInt.fromI32(0) graphNetwork.totalDelegatedTokens = BigInt.fromI32(0) graphNetwork.totalTokensSignalled = BigInt.fromI32(0) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index c1c5b410..1312e740 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -1,9 +1,20 @@ -import { BigInt } from '@graphprotocol/graph-ts' +import { BigInt, log } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' -import { HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn } from '../types/HorizonStaking/HorizonStaking' -import { Indexer } from '../types/schema' -import { calculateCapacities, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexer, updateAdvancedIndexerMetrics } from './helpers/helpers' - +import { HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, TokensDeprovisioned } from '../types/HorizonStaking/HorizonStaking' +import { Indexer, GraphNetwork } from '../types/schema' +import { calculateCapacities, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadProvision, updateAdvancedIndexerMetrics } from './helpers/helpers' +import { + ProvisionCreated, + ProvisionIncreased, + ProvisionParametersSet, + ProvisionParametersStaged, + ProvisionSlashed, + ProvisionThawed, + ThawRequestCreated, + ThawRequestFulfilled, + ThawRequestsFulfilled, + ThawingPeriodCleared +} from '../types/HorizonStaking/HorizonStaking' export function handleHorizonStakeDeposited(event: HorizonStakeDeposited): void { let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) @@ -72,3 +83,111 @@ export function handleHorizonStakeWithdrawn(event: HorizonStakeWithdrawn): void } graphNetwork.save() } + +export function handleProvisionCreated(event: ProvisionCreated): void { + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + let dataService = createOrLoadDataService(event.params.verifier) + let indexer = Indexer.load(event.params.serviceProvider.toHexString())! + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + + indexer.provisionedTokens = indexer.provisionedTokens.plus(event.params.tokens) + indexer.save() + + dataService.totalTokensProvisioned = dataService.totalTokensProvisioned.plus(event.params.tokens) + dataService.save() + + graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.plus(event.params.tokens) + graphNetwork.save() + + provision.tokensProvisioned = provision.tokensProvisioned.plus(event.params.tokens) + provision.maxVerifierCut = event.params.maxVerifierCut + provision.maxVerifierCutPending = event.params.maxVerifierCut + provision.thawingPeriod = event.params.thawingPeriod + provision.thawingPeriodPending = event.params.thawingPeriod + provision.save() +} + +export function handleProvisionIncreased(event: ProvisionIncreased): void { + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + let dataService = createOrLoadDataService(event.params.verifier) + let indexer = Indexer.load(event.params.serviceProvider.toHexString())! + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + + indexer.provisionedTokens = indexer.provisionedTokens.plus(event.params.tokens) + indexer.save() + + dataService.totalTokensProvisioned = dataService.totalTokensProvisioned.plus(event.params.tokens) + dataService.save() + + graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.plus(event.params.tokens) + graphNetwork.save() + + provision.tokensProvisioned = provision.tokensProvisioned.plus(event.params.tokens) + provision.save() +} + +export function handleProvisionThawed(event: ProvisionThawed): void { + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + let dataService = createOrLoadDataService(event.params.verifier) + let indexer = Indexer.load(event.params.serviceProvider.toHexString())! + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + + indexer.thawingTokens = indexer.thawingTokens.plus(event.params.tokens) + indexer.save() + + dataService.totalTokensThawing = dataService.totalTokensThawing.plus(event.params.tokens) + dataService.save() + + graphNetwork.totalTokensThawing = graphNetwork.totalTokensThawing.plus(event.params.tokens) + graphNetwork.save() + + provision.tokensThawing = provision.tokensThawing.plus(event.params.tokens) + provision.save() +} + +export function handleTokensDeprovisioned(event: TokensDeprovisioned): void { + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + let dataService = createOrLoadDataService(event.params.verifier) + let indexer = Indexer.load(event.params.serviceProvider.toHexString())! + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + + indexer.provisionedTokens = indexer.provisionedTokens.minus(event.params.tokens) + indexer.save() + + dataService.totalTokensProvisioned = dataService.totalTokensProvisioned.minus(event.params.tokens) + dataService.save() + + graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.minus(event.params.tokens) + graphNetwork.save() + + provision.tokensProvisioned = provision.tokensProvisioned.minus(event.params.tokens) + provision.save() +} + +export function handleProvisionParametersSet(event: ProvisionParametersSet): void { + // To Do +} + +export function handleProvisionParametersStaged(event: ProvisionParametersStaged): void { + // To Do +} + +export function handleProvisionSlashed(event: ProvisionSlashed): void { + // To Do +} + +export function handleThawRequestCreated(event: ThawRequestCreated): void { + // To Do +} + +export function handleThawRequestFulfilled(event: ThawRequestFulfilled): void { + // To Do +} + +export function handleThawRequestsFulfilled(event: ThawRequestsFulfilled): void { + // To Do +} + +export function handleThawingPeriodCleared(event: ThawingPeriodCleared): void { + // To Do +} diff --git a/subgraph.template.yaml b/subgraph.template.yaml index ff4b23ce..c916346f 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -405,6 +405,28 @@ dataSources: handler: handleHorizonStakeLocked - event: HorizonStakeWithdrawn(indexed address,uint256) handler: handleHorizonStakeWithdrawn + - event: ProvisionCreated(indexed address,indexed address,uint256,uint32,uint64) + handler: handleProvisionCreated + - event: ProvisionIncreased(indexed address,indexed address,uint256) + handler: handleProvisionIncreased + - event: TokensDeprovisioned(indexed address,indexed address,uint256) + handler: handleTokensDeprovisioned + - event: ProvisionParametersSet(indexed address,indexed address,uint32,uint64) + handler: handleProvisionParametersSet + - event: ProvisionParametersStaged(indexed address,indexed address,uint32,uint64) + handler: handleProvisionParametersStaged + - event: ProvisionSlashed(indexed address,indexed address,uint256) + handler: handleProvisionSlashed + - event: ProvisionThawed(indexed address,indexed address,uint256) + handler: handleProvisionThawed + - event: ThawRequestCreated(indexed address,indexed address,indexed address,uint256,uint64,bytes32) + handler: handleThawRequestCreated + - event: ThawRequestFulfilled(indexed bytes32,uint256,uint256,uint64,bool) + handler: handleThawRequestFulfilled + - event: ThawRequestsFulfilled(indexed address,indexed address,indexed address,uint256,uint256,uint8) + handler: handleThawRequestsFulfilled + - event: ThawingPeriodCleared() + handler: handleThawingPeriodCleared - kind: ethereum/contract name: Curation network: {{network}} From f194d7c1afdc64dc736d04958309302415b62696 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Wed, 12 Feb 2025 01:21:25 -0300 Subject: [PATCH 06/39] feat: basic implementation for ThawRequests --- schema.graphql | 35 +++++++++++++++++++++++++--------- src/mappings/horizonStaking.ts | 32 ++++++++++++++++++------------- subgraph.template.yaml | 4 ---- 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/schema.graphql b/schema.graphql index 89807977..e9e1825a 100644 --- a/schema.graphql +++ b/schema.graphql @@ -847,28 +847,45 @@ type Provision @entity { tokensProvisioned: BigInt! + "Timestamp when the provision was created" + createdAt: BigInt! + "Service provider tokens that are being thawed (and will stop being slashable soon)" tokensThawing: BigInt! - "Shares representing the thawing tokens" - sharesThawing: BigInt! - "Max amount that can be taken by the verifier when slashing, expressed in parts-per-million of the amount slashed" maxVerifierCut: Int! - "Time, in seconds, tokens must thaw before being withdrawn" - thawingPeriod: BigInt! - - "Timestamp when the provision was created" - createdAt: BigInt! - "Pending value for maxVerifierCut. Verifier needs to accept it before it becomes active" maxVerifierCutPending: Int! + "Time, in seconds, tokens must thaw before being withdrawn" + thawingPeriod: BigInt! + "Pending value for thawingPeriod. Verifier needs to accept it before it becomes active" thawingPeriodPending: BigInt! } +type ThawRequest @entity { + id: ID! + + indexer: Indexer! + + service: DataService! + + owner: GraphAccount! + + "Shares representing the thawing tokens" + shares: BigInt! + + "Tokens thawed" + tokens: BigInt! + + thawingUntil: BigInt! + + valid: Boolean +} + """ A state channel Allocation representing a single Indexer-SubgraphDeployment stake """ diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 1312e740..85570993 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -1,8 +1,8 @@ import { BigInt, log } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' import { HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, TokensDeprovisioned } from '../types/HorizonStaking/HorizonStaking' -import { Indexer, GraphNetwork } from '../types/schema' -import { calculateCapacities, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadProvision, updateAdvancedIndexerMetrics } from './helpers/helpers' +import { Indexer, GraphNetwork, ThawRequest } from '../types/schema' +import { calculateCapacities, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadProvision, updateAdvancedIndexerMetrics } from './helpers/helpers' import { ProvisionCreated, ProvisionIncreased, @@ -177,17 +177,23 @@ export function handleProvisionSlashed(event: ProvisionSlashed): void { } export function handleThawRequestCreated(event: ThawRequestCreated): void { - // To Do + let dataService = createOrLoadDataService(event.params.verifier) + let indexer = Indexer.load(event.params.serviceProvider.toHexString())! + let owner = createOrLoadGraphAccount(event.params.owner, event.block.timestamp) + + let request = new ThawRequest(event.params.thawRequestId.toHexString()) + request.indexer = indexer.id + request.service = dataService.id + request.owner = owner.id + request.shares = event.params.shares + request.tokens = BigInt.fromI32(0) + request.thawingUntil = event.params.thawingUntil + request.save() } export function handleThawRequestFulfilled(event: ThawRequestFulfilled): void { - // To Do -} - -export function handleThawRequestsFulfilled(event: ThawRequestsFulfilled): void { - // To Do -} - -export function handleThawingPeriodCleared(event: ThawingPeriodCleared): void { - // To Do -} + let request = ThawRequest.load(event.params.thawRequestId.toHexString()) + request.tokens = event.params.tokens + request.valid = event.params.valid + request.save() +} \ No newline at end of file diff --git a/subgraph.template.yaml b/subgraph.template.yaml index c916346f..4036bfec 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -423,10 +423,6 @@ dataSources: handler: handleThawRequestCreated - event: ThawRequestFulfilled(indexed bytes32,uint256,uint256,uint64,bool) handler: handleThawRequestFulfilled - - event: ThawRequestsFulfilled(indexed address,indexed address,indexed address,uint256,uint256,uint8) - handler: handleThawRequestsFulfilled - - event: ThawingPeriodCleared() - handler: handleThawingPeriodCleared - kind: ethereum/contract name: Curation network: {{network}} From deef219374c5272e7c3cb1fc383804532926b6d8 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 13 Feb 2025 02:10:20 -0300 Subject: [PATCH 07/39] fix: schema --- schema.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.graphql b/schema.graphql index e9e1825a..dadf5e5d 100644 --- a/schema.graphql +++ b/schema.graphql @@ -246,7 +246,7 @@ type DataService @entity { "Total GRT currently in allocations for this DataService" totalTokensAllocated: BigInt! - provisions: [Provision!]! @derivedFrom(field: "service") + provisions: [Provision!]! @derivedFrom(field: "dataService") } """ From ebf9e2968f691e6ad96844d118ed1d11323f5f32 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 13 Feb 2025 02:17:22 -0300 Subject: [PATCH 08/39] fix: maxVerifierCut/Pending wrong types, schema issues and more --- schema.graphql | 6 +++--- src/mappings/helpers/helpers.ts | 7 +++---- src/mappings/horizonStaking.ts | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/schema.graphql b/schema.graphql index dadf5e5d..f915cc7b 100644 --- a/schema.graphql +++ b/schema.graphql @@ -854,10 +854,10 @@ type Provision @entity { tokensThawing: BigInt! "Max amount that can be taken by the verifier when slashing, expressed in parts-per-million of the amount slashed" - maxVerifierCut: Int! + maxVerifierCut: BigInt! "Pending value for maxVerifierCut. Verifier needs to accept it before it becomes active" - maxVerifierCutPending: Int! + maxVerifierCutPending: BigInt! "Time, in seconds, tokens must thaw before being withdrawn" thawingPeriod: BigInt! @@ -871,7 +871,7 @@ type ThawRequest @entity { indexer: Indexer! - service: DataService! + dataService: DataService! owner: GraphAccount! diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 8ff45eca..10a08d7e 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -197,13 +197,12 @@ export function createOrLoadProvision(indexerAddress: Bytes, verifierAddress: By if (provision == null) { provision = new Provision(id) provision.indexer = indexerAddress.toHexString() - provision.service = verifierAddress.toHexString() + provision.dataService = verifierAddress.toHexString() provision.tokensProvisioned = BigInt.fromI32(0) provision.tokensThawing = BigInt.fromI32(0) - provision.sharesThawing = BigInt.fromI32(0) provision.createdAt = timestamp - provision.maxVerifierCut = 0 - provision.maxVerifierCutPending = 0 + provision.maxVerifierCut = BigInt.fromI32(0) + provision.maxVerifierCutPending = BigInt.fromI32(0) provision.thawingPeriod = BigInt.fromI32(0) provision.thawingPeriodPending = BigInt.fromI32(0) provision.save() diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 85570993..d9613323 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -183,7 +183,7 @@ export function handleThawRequestCreated(event: ThawRequestCreated): void { let request = new ThawRequest(event.params.thawRequestId.toHexString()) request.indexer = indexer.id - request.service = dataService.id + request.dataService = dataService.id request.owner = owner.id request.shares = event.params.shares request.tokens = BigInt.fromI32(0) @@ -192,7 +192,7 @@ export function handleThawRequestCreated(event: ThawRequestCreated): void { } export function handleThawRequestFulfilled(event: ThawRequestFulfilled): void { - let request = ThawRequest.load(event.params.thawRequestId.toHexString()) + let request = ThawRequest.load(event.params.thawRequestId.toHexString())! request.tokens = event.params.tokens request.valid = event.params.valid request.save() From 64f134c76cac358f760f0edae66d199191d28e45 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 13 Feb 2025 02:24:37 -0300 Subject: [PATCH 09/39] feat: added ProvisionSlashed support --- src/mappings/horizonStaking.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index d9613323..25875716 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -173,7 +173,25 @@ export function handleProvisionParametersStaged(event: ProvisionParametersStaged } export function handleProvisionSlashed(event: ProvisionSlashed): void { - // To Do + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + let dataService = createOrLoadDataService(event.params.verifier) + let indexer = Indexer.load(event.params.serviceProvider.toHexString())! + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + + // Due to thawing tokens potentially getting cancelled, we will need to figure the thawing situation + indexer.provisionedTokens = indexer.provisionedTokens.minus(event.params.tokens) + indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) + indexer.save() + + dataService.totalTokensProvisioned = dataService.totalTokensProvisioned.minus(event.params.tokens) + dataService.save() + + graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.minus(event.params.tokens) + graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.minus(event.params.tokens) + graphNetwork.save() + + provision.tokensProvisioned = provision.tokensProvisioned.minus(event.params.tokens) + provision.save() } export function handleThawRequestCreated(event: ThawRequestCreated): void { From 66ab26d723250fd13c64f424fb164ef1e9b91f91 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Wed, 12 Feb 2025 02:34:18 -0300 Subject: [PATCH 10/39] feat: add ParametersSet and Staged support for provisions --- src/mappings/horizonStaking.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 25875716..c920c06a 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -165,11 +165,17 @@ export function handleTokensDeprovisioned(event: TokensDeprovisioned): void { } export function handleProvisionParametersSet(event: ProvisionParametersSet): void { - // To Do + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + provision.thawingPeriod = event.params.thawingPeriod + provision.maxVerifierCut = event.params.maxVerifierCut + provision.save() } export function handleProvisionParametersStaged(event: ProvisionParametersStaged): void { - // To Do + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + provision.thawingPeriodPending = event.params.thawingPeriod + provision.maxVerifierCutPending = event.params.maxVerifierCut + provision.save() } export function handleProvisionSlashed(event: ProvisionSlashed): void { From 296068d8a1c81d4e3a923617b2259a565fa008c0 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 13 Feb 2025 01:28:38 -0300 Subject: [PATCH 11/39] chore: placeholder for SetOperator and DelegationFeeCutSet --- src/mappings/horizonStaking.ts | 14 +++++++++++++- subgraph.template.yaml | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index c920c06a..918342c6 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -1,6 +1,6 @@ import { BigInt, log } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' -import { HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, TokensDeprovisioned } from '../types/HorizonStaking/HorizonStaking' +import { DelegationFeeCutSet, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, TokensDeprovisioned } from '../types/HorizonStaking/HorizonStaking' import { Indexer, GraphNetwork, ThawRequest } from '../types/schema' import { calculateCapacities, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadProvision, updateAdvancedIndexerMetrics } from './helpers/helpers' import { @@ -178,6 +178,18 @@ export function handleProvisionParametersStaged(event: ProvisionParametersStaged provision.save() } +export function handleOperatorSet(event: OperatorSet): void { + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + // To Do + provision.save() +} + +export function handleDelegationFeeCutSet(event: DelegationFeeCutSet): void { + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + // To Do + provision.save() +} + export function handleProvisionSlashed(event: ProvisionSlashed): void { let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) let dataService = createOrLoadDataService(event.params.verifier) diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 4036bfec..3f2361b7 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -423,6 +423,10 @@ dataSources: handler: handleThawRequestCreated - event: ThawRequestFulfilled(indexed bytes32,uint256,uint256,uint64,bool) handler: handleThawRequestFulfilled + - event: OperatorSet(indexed address,indexed address,indexed address,bool) + handler: handleOperatorSet + - event: DelegationFeeCutSet(indexed address,indexed address,indexed uint8,uint256) + handler: handleDelegationFeeCutSet - kind: ethereum/contract name: Curation network: {{network}} From c1a997937e4080a411e82115e0c7bfd919991961 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Tue, 18 Feb 2025 02:04:25 -0300 Subject: [PATCH 12/39] feat: added new OperatorSet and DelegationFeeCutSet event support --- schema.graphql | 32 ++++++++++++++++++++++ src/mappings/helpers/helpers.ts | 19 +++++++++++++ src/mappings/horizonStaking.ts | 48 +++++++++++++++++++++++++++++---- 3 files changed, 94 insertions(+), 5 deletions(-) diff --git a/schema.graphql b/schema.graphql index f915cc7b..961e6428 100644 --- a/schema.graphql +++ b/schema.graphql @@ -273,6 +273,8 @@ type GraphAccount @entity { operatorOf: [GraphAccount!]! @derivedFrom(field: "operators") "Operators of this Graph Accounts" operators: [GraphAccount!]! + "Operators of this Graph Accounts" + provisionedOperators: [Operator!]! # GRT info "Graph token balance" @@ -837,6 +839,21 @@ type IndexerQueryFeePaymentAggregation @entity { paymentSource: PaymentSource! } +type Operator @entity { + "Joint address of all 3 parties involved (Operator, Indexer, DataService)" + id: ID! + + operatorOf: [GraphAccount!]! @derivedFrom(field: "provisionedOperators") + + operator: GraphAccount! + + indexer: Indexer! + + dataService: DataService! + + allowed: Boolean! +} + type Provision @entity { "Join ID of indexer address (service provider) and DataService address" id: ID! @@ -864,6 +881,21 @@ type Provision @entity { "Pending value for thawingPeriod. Verifier needs to accept it before it becomes active" thawingPeriodPending: BigInt! + + # Cuts for subgraph service. Percentage of rewards that the delegation pool receives + queryFeeCut: BigInt! + + indexingFeeCut: BigInt! + + indexingRewardsCut: BigInt! + + # Might want to add polymorphic handling of different fee cuts through a generic hashmap in the future +} + +enum PaymentTypes { + QueryFee, + IndexingFee, + IndexingRewards } type ThawRequest @entity { diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 10a08d7e..49657375 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -28,6 +28,7 @@ import { IndexerQueryFeePaymentAggregation, Provision, DataService, + Operator, } from '../../types/schema' import { SubgraphDeploymentManifest as SubgraphDeploymentManifestTemplate @@ -205,6 +206,9 @@ export function createOrLoadProvision(indexerAddress: Bytes, verifierAddress: By provision.maxVerifierCutPending = BigInt.fromI32(0) provision.thawingPeriod = BigInt.fromI32(0) provision.thawingPeriodPending = BigInt.fromI32(0) + provision.queryFeeCut = BigInt.fromI32(0) + provision.indexingFeeCut = BigInt.fromI32(0) + provision.indexingRewardsCut = BigInt.fromI32(0) provision.save() } @@ -225,6 +229,21 @@ export function createOrLoadDataService(verifierAddress: Bytes): DataService { return service as DataService } +export function createOrLoadOperator(address: Bytes, verifierAddress: Bytes, indexerAddress: Bytes): Operator { + let id = joinID([address.toHexString(), indexerAddress.toHexString(), verifierAddress.toHexString()]) + let operator = Operator.load(id) + if (operator == null) { + operator = new Operator(id) + operator.allowed = false + operator.operator = address.toHexString() + operator.indexer = indexerAddress.toHexString() + operator.dataService = verifierAddress.toHexString() + operator.save() + } + + return operator as Operator +} + export function createOrLoadPaymentSource(paymentAddress: Bytes): PaymentSource { let id = paymentAddress.toHexString() let paymentSource = PaymentSource.load(id) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 918342c6..95a337ca 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -2,7 +2,7 @@ import { BigInt, log } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' import { DelegationFeeCutSet, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, TokensDeprovisioned } from '../types/HorizonStaking/HorizonStaking' import { Indexer, GraphNetwork, ThawRequest } from '../types/schema' -import { calculateCapacities, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadProvision, updateAdvancedIndexerMetrics } from './helpers/helpers' +import { calculateCapacities, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision, updateAdvancedIndexerMetrics } from './helpers/helpers' import { ProvisionCreated, ProvisionIncreased, @@ -179,14 +179,52 @@ export function handleProvisionParametersStaged(event: ProvisionParametersStaged } export function handleOperatorSet(event: OperatorSet): void { - let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) - // To Do - provision.save() + let indexerGraphAccount = createOrLoadGraphAccount(event.params.serviceProvider, event.block.timestamp) + let operator = createOrLoadOperator(event.params.operator, event.params.verifier, event.params.serviceProvider) + let operators = indexerGraphAccount.operators + // Will have to handle legacy operators list, and horizon provisionedOperators list for extra context + let operatorsIndex = operators.indexOf(event.params.operator.toHexString()) + if (operatorsIndex != -1) { + // false - it existed, and we set it to false, so remove from operators + if (!event.params.allowed) { + operators.splice(operatorsIndex, 1) + } + } else { + // true - it did not exist before, and we say add, so add + if (event.params.allowed) { + operators.push(event.params.operator.toHexString()) + // Create the operator as a graph account + createOrLoadGraphAccount(event.params.operator, event.block.timestamp) + } + } + + let provisionedOperators = indexerGraphAccount.provisionedOperators + let provisionedOperatorsIndex = provisionedOperators.indexOf(event.params.operator.toHexString()) + if (provisionedOperatorsIndex != -1) { + // false - it existed, and we set it to false, so remove from operators and update operator + if (!event.params.allowed) { + operators.splice(provisionedOperatorsIndex, 1) + } + } else { + // true - it did not exist before, and we say add, so add + if (event.params.allowed) { + operators.push(event.params.operator.toHexString()) + // Create the operator as a graph account + createOrLoadGraphAccount(event.params.operator, event.block.timestamp) + } + } + operator.allowed = event.params.allowed + operator.save() + indexerGraphAccount.operators = operators + indexerGraphAccount.provisionedOperators = provisionedOperators + indexerGraphAccount.save() } export function handleDelegationFeeCutSet(event: DelegationFeeCutSet): void { let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) - // To Do + provision.queryFeeCut = event.params.paymentType == 0 ? event.params.feeCut : provision.queryFeeCut + provision.indexingFeeCut = event.params.paymentType == 1 ? event.params.feeCut : provision.indexingFeeCut + provision.indexingRewardsCut = event.params.paymentType == 2 ? event.params.feeCut : provision.indexingRewardsCut provision.save() } From 0ec46b7f9aceb0565c5964b35109a57eab3f6a9b Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Tue, 18 Feb 2025 02:07:58 -0300 Subject: [PATCH 13/39] fix: provisionedOperators missing init --- src/mappings/helpers/helpers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 49657375..3f1d4547 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -475,6 +475,7 @@ export function createOrLoadGraphAccount(owner: Bytes, timeStamp: BigInt): Graph graphAccount = new GraphAccount(id) graphAccount.createdAt = timeStamp.toI32() graphAccount.operators = [] + graphAccount.provisionedOperators = [] graphAccount.balance = BigInt.fromI32(0) graphAccount.balanceReceivedFromL1Signalling = BigInt.fromI32(0) graphAccount.balanceReceivedFromL1Delegation = BigInt.fromI32(0) From 6aca4407d029cdfd90c8f80149b57b00d1d59972 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Tue, 18 Feb 2025 02:50:17 -0300 Subject: [PATCH 14/39] feat: added basic delegation pool management --- src/mappings/helpers/helpers.ts | 12 ++++++++++++ src/mappings/horizonStaking.ts | 26 +++++++++++++++++--------- subgraph.template.yaml | 2 ++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 3f1d4547..6faf1fbe 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -909,6 +909,18 @@ export function updateAdvancedIndexerMetrics(indexer: Indexer): Indexer { return indexer as Indexer } +export function updateAdvancedIndexerMetricsHorizon(indexer: Indexer, provision: Provision): Indexer { + indexer.ownStakeRatio = calculateOwnStakeRatio(indexer as Indexer) + indexer.delegatedStakeRatio = calculateDelegatedStakeRatio(indexer as Indexer) + indexer.indexingRewardEffectiveCut = provision.indexingRewardsCut.toBigDecimal() + indexer.queryFeeEffectiveCut = provision.queryFeeCut.toBigDecimal() + indexer.indexerRewardsOwnGenerationRatio = calculateIndexerRewardOwnGenerationRatio( + indexer as Indexer, + ) + indexer.overDelegationDilution = calculateOverdelegationDilution(indexer as Indexer) + return indexer as Indexer +} + export function updateDelegationExchangeRate(indexer: Indexer): Indexer { indexer.delegationExchangeRate = indexer.delegatedTokens .toBigDecimal() diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 95a337ca..a085403a 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -1,8 +1,8 @@ -import { BigInt, log } from '@graphprotocol/graph-ts' +import { BigInt } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' -import { DelegationFeeCutSet, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, TokensDeprovisioned } from '../types/HorizonStaking/HorizonStaking' -import { Indexer, GraphNetwork, ThawRequest } from '../types/schema' -import { calculateCapacities, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision, updateAdvancedIndexerMetrics } from './helpers/helpers' +import { DelegationFeeCutSet, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, TokensDeprovisioned, TokensToDelegationPoolAdded } from '../types/HorizonStaking/HorizonStaking' +import { Indexer, ThawRequest } from '../types/schema' +import { calculateCapacities, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision, updateAdvancedIndexerMetrics, updateAdvancedIndexerMetricsHorizon, updateDelegationExchangeRate } from './helpers/helpers' import { ProvisionCreated, ProvisionIncreased, @@ -12,8 +12,6 @@ import { ProvisionThawed, ThawRequestCreated, ThawRequestFulfilled, - ThawRequestsFulfilled, - ThawingPeriodCleared } from '../types/HorizonStaking/HorizonStaking' export function handleHorizonStakeDeposited(event: HorizonStakeDeposited): void { @@ -22,7 +20,7 @@ export function handleHorizonStakeDeposited(event: HorizonStakeDeposited): void let indexer = createOrLoadIndexer(event.params.serviceProvider, event.block.timestamp) let previousStake = indexer.stakedTokens indexer.stakedTokens = indexer.stakedTokens.plus(event.params.tokens) - indexer = updateAdvancedIndexerMetrics(indexer as Indexer) + indexer = updateAdvancedIndexerMetrics(indexer as Indexer) // Can't rely on provision here, will need to figure out a way indexer = calculateCapacities(indexer as Indexer) indexer.save() @@ -48,7 +46,7 @@ export function handleHorizonStakeLocked(event: HorizonStakeLocked): void { let indexer = Indexer.load(id)! indexer.lockedTokens = event.params.tokens indexer.tokensLockedUntil = event.params.until.toI32() - indexer = updateAdvancedIndexerMetrics(indexer as Indexer) + indexer = updateAdvancedIndexerMetrics(indexer as Indexer) // Can't rely on provision here, will need to figure out a way indexer = calculateCapacities(indexer as Indexer) indexer.save() @@ -67,7 +65,7 @@ export function handleHorizonStakeWithdrawn(event: HorizonStakeWithdrawn): void indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) indexer.lockedTokens = BigInt.fromI32(0) // set to 0 to prevent issues when Stage 2 comes indexer.tokensLockedUntil = 0 // always set to 0 when withdrawn - indexer = updateAdvancedIndexerMetrics(indexer as Indexer) + indexer = updateAdvancedIndexerMetrics(indexer as Indexer) // Can't rely on provision here, will need to figure out a way indexer = calculateCapacities(indexer as Indexer) indexer.save() @@ -270,4 +268,14 @@ export function handleThawRequestFulfilled(event: ThawRequestFulfilled): void { request.tokens = event.params.tokens request.valid = event.params.valid request.save() +} + +export function handleTokensToDelegationPoolAdded(event: TokensToDelegationPoolAdded): void { + let indexer = Indexer.load(event.params.serviceProvider.toHexString())! + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + indexer.delegatedTokens = indexer.delegatedTokens.plus(event.params.tokens) + indexer = updateAdvancedIndexerMetricsHorizon(indexer, provision) + indexer = updateDelegationExchangeRate(indexer) + indexer = calculateCapacities(indexer) + indexer.save() } \ No newline at end of file diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 3f2361b7..4b9e6b87 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -427,6 +427,8 @@ dataSources: handler: handleOperatorSet - event: DelegationFeeCutSet(indexed address,indexed address,indexed uint8,uint256) handler: handleDelegationFeeCutSet + - event: TokensToDelegationPoolAdded(indexed address,indexed address,uint256) + handler: handleTokensToDelegationPoolAdded - kind: ethereum/contract name: Curation network: {{network}} From 813637d275815146de304974681e6582a7075c82 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Wed, 19 Feb 2025 01:44:53 -0300 Subject: [PATCH 15/39] feat: added provision delegated fields --- schema.graphql | 8 ++++++++ src/mappings/helpers/helpers.ts | 3 +++ src/mappings/horizonStaking.ts | 8 ++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/schema.graphql b/schema.graphql index 961e6428..650e3c2d 100644 --- a/schema.graphql +++ b/schema.graphql @@ -890,6 +890,14 @@ type Provision @entity { indexingRewardsCut: BigInt! # Might want to add polymorphic handling of different fee cuts through a generic hashmap in the future + + # Delegation + "Tokens delegated to the provision" + delegatedTokens: BigInt! + "Total shares of the delegator pool" + delegatorShares: BigInt! + "Exchange rate of of tokens received for each share" + delegationExchangeRate: BigDecimal! } enum PaymentTypes { diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 6faf1fbe..970de53f 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -209,6 +209,9 @@ export function createOrLoadProvision(indexerAddress: Bytes, verifierAddress: By provision.queryFeeCut = BigInt.fromI32(0) provision.indexingFeeCut = BigInt.fromI32(0) provision.indexingRewardsCut = BigInt.fromI32(0) + provision.delegatedTokens = BigInt.fromI32(0) + provision.delegatorShares = BigInt.fromI32(0) + provision.delegationExchangeRate = BigInt.fromI32(0).toBigDecimal() provision.save() } diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index a085403a..022e03bc 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -273,9 +273,9 @@ export function handleThawRequestFulfilled(event: ThawRequestFulfilled): void { export function handleTokensToDelegationPoolAdded(event: TokensToDelegationPoolAdded): void { let indexer = Indexer.load(event.params.serviceProvider.toHexString())! let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) - indexer.delegatedTokens = indexer.delegatedTokens.plus(event.params.tokens) - indexer = updateAdvancedIndexerMetricsHorizon(indexer, provision) - indexer = updateDelegationExchangeRate(indexer) - indexer = calculateCapacities(indexer) + provision.delegatedTokens = provision.delegatedTokens.plus(event.params.tokens) + provision.save() + + indexer.delegatedTokens = indexer.delegatedTokens.plus(event.params.tokens) // this only serves as a general tracker, but the real deal is per provision indexer.save() } \ No newline at end of file From e18db869bb18e3a5f6eaaefce38087569a11509b Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Wed, 19 Feb 2025 01:46:56 -0300 Subject: [PATCH 16/39] feat: removed advanced metrics for indexer on horizon since it makes no sense --- src/mappings/helpers/helpers.ts | 12 ------------ src/mappings/horizonStaking.ts | 8 +------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 970de53f..19cb75d2 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -912,18 +912,6 @@ export function updateAdvancedIndexerMetrics(indexer: Indexer): Indexer { return indexer as Indexer } -export function updateAdvancedIndexerMetricsHorizon(indexer: Indexer, provision: Provision): Indexer { - indexer.ownStakeRatio = calculateOwnStakeRatio(indexer as Indexer) - indexer.delegatedStakeRatio = calculateDelegatedStakeRatio(indexer as Indexer) - indexer.indexingRewardEffectiveCut = provision.indexingRewardsCut.toBigDecimal() - indexer.queryFeeEffectiveCut = provision.queryFeeCut.toBigDecimal() - indexer.indexerRewardsOwnGenerationRatio = calculateIndexerRewardOwnGenerationRatio( - indexer as Indexer, - ) - indexer.overDelegationDilution = calculateOverdelegationDilution(indexer as Indexer) - return indexer as Indexer -} - export function updateDelegationExchangeRate(indexer: Indexer): Indexer { indexer.delegationExchangeRate = indexer.delegatedTokens .toBigDecimal() diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 022e03bc..0af83856 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -2,7 +2,7 @@ import { BigInt } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' import { DelegationFeeCutSet, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, TokensDeprovisioned, TokensToDelegationPoolAdded } from '../types/HorizonStaking/HorizonStaking' import { Indexer, ThawRequest } from '../types/schema' -import { calculateCapacities, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision, updateAdvancedIndexerMetrics, updateAdvancedIndexerMetricsHorizon, updateDelegationExchangeRate } from './helpers/helpers' +import { createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision } from './helpers/helpers' import { ProvisionCreated, ProvisionIncreased, @@ -20,8 +20,6 @@ export function handleHorizonStakeDeposited(event: HorizonStakeDeposited): void let indexer = createOrLoadIndexer(event.params.serviceProvider, event.block.timestamp) let previousStake = indexer.stakedTokens indexer.stakedTokens = indexer.stakedTokens.plus(event.params.tokens) - indexer = updateAdvancedIndexerMetrics(indexer as Indexer) // Can't rely on provision here, will need to figure out a way - indexer = calculateCapacities(indexer as Indexer) indexer.save() // Update graph network @@ -46,8 +44,6 @@ export function handleHorizonStakeLocked(event: HorizonStakeLocked): void { let indexer = Indexer.load(id)! indexer.lockedTokens = event.params.tokens indexer.tokensLockedUntil = event.params.until.toI32() - indexer = updateAdvancedIndexerMetrics(indexer as Indexer) // Can't rely on provision here, will need to figure out a way - indexer = calculateCapacities(indexer as Indexer) indexer.save() // update graph network @@ -65,8 +61,6 @@ export function handleHorizonStakeWithdrawn(event: HorizonStakeWithdrawn): void indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) indexer.lockedTokens = BigInt.fromI32(0) // set to 0 to prevent issues when Stage 2 comes indexer.tokensLockedUntil = 0 // always set to 0 when withdrawn - indexer = updateAdvancedIndexerMetrics(indexer as Indexer) // Can't rely on provision here, will need to figure out a way - indexer = calculateCapacities(indexer as Indexer) indexer.save() // Update graph network From fc6f7ce163d96ac2819559ae18619ece2d484b59 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Wed, 19 Feb 2025 02:03:52 -0300 Subject: [PATCH 17/39] feat: prepared configs, placeholder mapping file --- config/addresses.template.ts | 2 + config/arbitrumGoerliAddressScript.ts | 51 ------------------------ config/arbitrumSepoliaAddressScript.ts | 1 + config/goerliAddressScript.ts | 52 ------------------------ config/ipfs.json | 3 -- config/mainnetAddressScript.ts | 52 ------------------------ config/mainnetArbitrumAddressScript.ts | 5 +++ config/no-ipfs.json | 3 -- config/sepoliaAddressScript.ts | 55 -------------------------- config/testAddressesL1.ts | 1 + config/testAddressesL2.ts | 1 + src/mappings/subgraphService.ts | 1 + subgraph.template.yaml | 26 ++++++++++++ 13 files changed, 37 insertions(+), 216 deletions(-) delete mode 100644 config/arbitrumGoerliAddressScript.ts delete mode 100644 config/goerliAddressScript.ts delete mode 100644 config/ipfs.json delete mode 100644 config/mainnetAddressScript.ts delete mode 100644 config/no-ipfs.json delete mode 100644 config/sepoliaAddressScript.ts create mode 100644 src/mappings/subgraphService.ts diff --git a/config/addresses.template.ts b/config/addresses.template.ts index dda69c57..3121b7e5 100644 --- a/config/addresses.template.ts +++ b/config/addresses.template.ts @@ -20,6 +20,7 @@ export class Addresses { l1GraphTokenGateway: string l2GraphTokenGateway: string ethereumDIDRegistry: string + subgraphService: string isL1: boolean } @@ -45,5 +46,6 @@ export let addresses: Addresses = { l1GraphTokenGateway: '{{l1GraphTokenGateway}}', l2GraphTokenGateway: '{{l2GraphTokenGateway}}', ethereumDIDRegistry: '{{ethereumDIDRegistry}}', + subgraphService: '{{subgraphService}}', isL1: {{isL1}}, } diff --git a/config/arbitrumGoerliAddressScript.ts b/config/arbitrumGoerliAddressScript.ts deleted file mode 100644 index d83f9f4b..00000000 --- a/config/arbitrumGoerliAddressScript.ts +++ /dev/null @@ -1,51 +0,0 @@ -import * as fs from 'fs' -import * as mustache from 'mustache' -import * as networkAddresses from '@graphprotocol/contracts/addresses.json' -import { Addresses } from './addresses.template' - -// mustache doesn't like numbered object keys -// eslint-disable-next-line @typescript-eslint/no-explicit-any -let renameAddresses: any = networkAddresses -renameAddresses['arbgor'] = networkAddresses['421613'] - -export let addresses: Addresses = { - controller: '{{arbgor.Controller.address}}', - graphToken: '{{arbgor.L2GraphToken.address}}', - epochManager: '{{arbgor.EpochManager.address}}', - disputeManager: '{{arbgor.DisputeManager.address}}', - staking: '{{arbgor.L2Staking.address}}', - stakingExtension: '{{arbgor.StakingExtension.address}}', - curation: '{{arbgor.L2Curation.address}}', - rewardsManager: '{{arbgor.RewardsManager.address}}', - serviceRegistry: '{{arbgor.ServiceRegistry.address}}', - gns: '{{arbgor.L2GNS.address}}', - ens: '{{arbgor.IENS.address}}', - ensPublicResolver: '{{arbgor.IPublicResolver.address}}', - blockNumber: '', - bridgeBlockNumber: '', - network: '', - tokenLockManager: '', - subgraphNFT: '{{arbgor.SubgraphNFT.address}}', - l1GraphTokenGateway: '', - l2GraphTokenGateway: '{{arbgor.L2GraphTokenGateway.address}}', - ethereumDIDRegistry: '{{arbgor.IEthereumDIDRegistry.address}}', - isL1: false, -} - -const main = (): void => { - try { - let output = JSON.parse(mustache.render(JSON.stringify(addresses), renameAddresses)) - output.blockNumber = '1023264' // Protocol deployment - output.bridgeBlockNumber = '1023272' // Bridge deployment block on L2 - output.network = 'arbitrum-goerli' - output.useTokenLockManager = false - if(output.ens == '') { - output.ens = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config - } - fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2)) - } catch (e) { - console.log(`Error saving artifacts: ${e.message}`) - } -} - -main() diff --git a/config/arbitrumSepoliaAddressScript.ts b/config/arbitrumSepoliaAddressScript.ts index bde52f92..44334c9d 100644 --- a/config/arbitrumSepoliaAddressScript.ts +++ b/config/arbitrumSepoliaAddressScript.ts @@ -29,6 +29,7 @@ export let addresses: Addresses = { l1GraphTokenGateway: '', l2GraphTokenGateway: '{{arbsep.L2GraphTokenGateway.address}}', ethereumDIDRegistry: '{{arbsep.EthereumDIDRegistry.address}}', + subgraphService: '{{arbsep.SubgraphService.address}}', isL1: false, } diff --git a/config/goerliAddressScript.ts b/config/goerliAddressScript.ts deleted file mode 100644 index f0a48f71..00000000 --- a/config/goerliAddressScript.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as fs from 'fs' -import * as mustache from 'mustache' -import * as networkAddresses from '@graphprotocol/contracts/addresses.json' -import { Addresses } from './addresses.template' - -// mustache doesn't like numbered object keys -// eslint-disable-next-line @typescript-eslint/no-explicit-any -let renameAddresses: any = networkAddresses -renameAddresses['goerli'] = networkAddresses['5'] - -export let addresses: Addresses = { - controller: '{{goerli.Controller.address}}', - graphToken: '{{goerli.GraphToken.address}}', - epochManager: '{{goerli.EpochManager.address}}', - disputeManager: '{{goerli.DisputeManager.address}}', - staking: '{{goerli.L1Staking.address}}', - stakingExtension: '{{goerli.StakingExtension.address}}', - curation: '{{goerli.Curation.address}}', - rewardsManager: '{{goerli.RewardsManager.address}}', - serviceRegistry: '{{goerli.ServiceRegistry.address}}', - gns: '{{goerli.L1GNS.address}}', - ens: '{{goerli.IENS.address}}', - ensPublicResolver: '{{goerli.IPublicResolver.address}}', - blockNumber: '', - bridgeBlockNumber: '', - network: '', - tokenLockManager: '', - subgraphNFT: '{{goerli.SubgraphNFT.address}}', - l1GraphTokenGateway: '{{goerli.L1GraphTokenGateway.address}}', - l2GraphTokenGateway: '', - ethereumDIDRegistry: '{{goerli.IEthereumDIDRegistry.address}}', - isL1: true, -} - -const main = (): void => { - try { - let output = JSON.parse(mustache.render(JSON.stringify(addresses), renameAddresses)) - output.blockNumber = '7210000' // Hardcoded from before first contract deploy of the latest phase - output.bridgeBlockNumber = '7891183' // Bridge deployment block on L1 - output.network = 'goerli' - output.tokenLockManager = '0x9a7a54e86560f4304d8862Ea00F45D1090c59ac8' // we don't have one, this is rinkebys' - output.useTokenLockManager = true - if(output.ens == '') { - output.ens = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config - } - fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2)) - } catch (e) { - console.log(`Error saving artifacts: ${e.message}`) - } -} - -main() diff --git a/config/ipfs.json b/config/ipfs.json deleted file mode 100644 index ab467581..00000000 --- a/config/ipfs.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ipfs": true -} diff --git a/config/mainnetAddressScript.ts b/config/mainnetAddressScript.ts deleted file mode 100644 index 4ddba6e9..00000000 --- a/config/mainnetAddressScript.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as fs from 'fs' -import * as mustache from 'mustache' -import * as networkAddresses from '@graphprotocol/contracts/addresses.json' -import { Addresses } from './addresses.template' - -// mustache doesn't like numbered object keys -// eslint-disable-next-line @typescript-eslint/no-explicit-any -let renameAddresses: any = networkAddresses -renameAddresses['mainnet'] = networkAddresses['1'] - -export let addresses: Addresses = { - controller: '{{mainnet.Controller.address}}', - graphToken: '{{mainnet.GraphToken.address}}', - epochManager: '{{mainnet.EpochManager.address}}', - disputeManager: '{{mainnet.DisputeManager.address}}', - staking: '{{mainnet.L1Staking.address}}', - stakingExtension: '{{mainnet.StakingExtension.address}}', - curation: '{{mainnet.Curation.address}}', - rewardsManager: '{{mainnet.RewardsManager.address}}', - serviceRegistry: '{{mainnet.ServiceRegistry.address}}', - gns: '{{mainnet.L1GNS.address}}', - ens: '{{mainnet.IENS.address}}', - ensPublicResolver: '{{mainnet.IPublicResolver.address}}', - blockNumber: '', - bridgeBlockNumber: '', - network: '', - tokenLockManager: '', - subgraphNFT: '{{mainnet.SubgraphNFT.address}}', - l1GraphTokenGateway: '{{mainnet.L1GraphTokenGateway.address}}', - l2GraphTokenGateway: '', - ethereumDIDRegistry: '{{mainnet.IEthereumDIDRegistry.address}}', - isL1: true, -} - -const main = (): void => { - try { - let output = JSON.parse(mustache.render(JSON.stringify(addresses), renameAddresses)) - output.blockNumber = '11440000' // Hardcoded a few thousand blocks before 1st contract deployed - output.network = 'mainnet' - output.bridgeBlockNumber = '16083315' // Bridge deployment block on L1 - output.tokenLockManager = '0xFCf78AC094288D7200cfdB367A8CD07108dFa128' - output.useTokenLockManager = true - if(output.ens == '') { - output.ens = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config - } - fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2)) - } catch (e) { - console.log(`Error saving artifacts: ${e.message}`) - } -} - -main() diff --git a/config/mainnetArbitrumAddressScript.ts b/config/mainnetArbitrumAddressScript.ts index b8fb1985..9384be1e 100644 --- a/config/mainnetArbitrumAddressScript.ts +++ b/config/mainnetArbitrumAddressScript.ts @@ -29,6 +29,7 @@ export let addresses: Addresses = { l1GraphTokenGateway: '', l2GraphTokenGateway: '{{arbitrum.L2GraphTokenGateway.address}}', ethereumDIDRegistry: '{{arbitrum.IEthereumDIDRegistry.address}}', + subgraphService: '{{arbitrum.SubgraphService.address}}', isL1: false, } @@ -46,6 +47,10 @@ const main = (): void => { if(output.ens == '') { output.ens = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config } + // remove once we have proper packages + if(output.subgraphService == '') { + output.subgraphService = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config + } fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2)) } catch (e) { console.log(`Error saving artifacts: ${e.message}`) diff --git a/config/no-ipfs.json b/config/no-ipfs.json deleted file mode 100644 index ee53b3b9..00000000 --- a/config/no-ipfs.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ipfs": false -} diff --git a/config/sepoliaAddressScript.ts b/config/sepoliaAddressScript.ts deleted file mode 100644 index 3fe4cf3c..00000000 --- a/config/sepoliaAddressScript.ts +++ /dev/null @@ -1,55 +0,0 @@ -import * as fs from 'fs' -import * as mustache from 'mustache' -import * as networkAddresses from '@graphprotocol/contracts/addresses.json' -import { Addresses } from './addresses.template' - -// mustache doesn't like numbered object keys -// eslint-disable-next-line @typescript-eslint/no-explicit-any -let renameAddresses: any = networkAddresses -renameAddresses['sepolia'] = networkAddresses['11155111'] - -export let addresses: Addresses = { - controller: '{{sepolia.Controller.address}}', - graphToken: '{{sepolia.GraphToken.address}}', - epochManager: '{{sepolia.EpochManager.address}}', - disputeManager: '{{sepolia.DisputeManager.address}}', - staking: '{{sepolia.L1Staking.address}}', - stakingExtension: '{{sepolia.StakingExtension.address}}', - curation: '{{sepolia.Curation.address}}', - rewardsManager: '{{sepolia.RewardsManager.address}}', - serviceRegistry: '{{sepolia.ServiceRegistry.address}}', - gns: '{{sepolia.L1GNS.address}}', - ens: '{{sepolia.IENS.address}}', - ensPublicResolver: '{{sepolia.IPublicResolver.address}}', - blockNumber: '', - bridgeBlockNumber: '', - network: '', - tokenLockManager: '', - subgraphNFT: '{{sepolia.SubgraphNFT.address}}', - l1GraphTokenGateway: '{{sepolia.L1GraphTokenGateway.address}}', - l2GraphTokenGateway: '', - ethereumDIDRegistry: '{{sepolia.EthereumDIDRegistry.address}}', - isL1: true, -} - -const main = (): void => { - try { - let output = JSON.parse(mustache.render(JSON.stringify(addresses), renameAddresses)) - output.blockNumber = '4454000' - output.bridgeBlockNumber = '4454000' - output.network = 'sepolia' - //output.tokenLockManager = '0x9a7a54e86560f4304d8862Ea00F45D1090c59ac8' // we don't have one, this is rinkebys' - output.useTokenLockManager = false - if(output.ens == '') { - output.ens = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config - } - if(output.ethereumDIDRegistry == '') { - output.ethereumDIDRegistry = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config - } - fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2)) - } catch (e) { - console.log(`Error saving artifacts: ${e.message}`) - } -} - -main() diff --git a/config/testAddressesL1.ts b/config/testAddressesL1.ts index d4eacb42..56bbbb32 100644 --- a/config/testAddressesL1.ts +++ b/config/testAddressesL1.ts @@ -29,6 +29,7 @@ export let addresses: Addresses = { l1GraphTokenGateway: '0x0000000000000000000000000000000000000000', l2GraphTokenGateway: '', ethereumDIDRegistry: '0x0000000000000000000000000000000000000000', + subgraphService: '0x0000000000000000000000000000000000000000', isL1: true, } diff --git a/config/testAddressesL2.ts b/config/testAddressesL2.ts index c18dbb4f..0fab2b9a 100644 --- a/config/testAddressesL2.ts +++ b/config/testAddressesL2.ts @@ -29,6 +29,7 @@ export let addresses: Addresses = { l1GraphTokenGateway: '', l2GraphTokenGateway: '0x0000000000000000000000000000000000000000', ethereumDIDRegistry: '0x0000000000000000000000000000000000000000', + subgraphService: '0x0000000000000000000000000000000000000000', isL1: false, } diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts new file mode 100644 index 00000000..423e1c85 --- /dev/null +++ b/src/mappings/subgraphService.ts @@ -0,0 +1 @@ +// ToDo \ No newline at end of file diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 4b9e6b87..857af4b2 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -429,6 +429,32 @@ dataSources: handler: handleDelegationFeeCutSet - event: TokensToDelegationPoolAdded(indexed address,indexed address,uint256) handler: handleTokensToDelegationPoolAdded + - kind: ethereum/contract + name: SubgraphService + network: {{network}} + source: + address: "{{subgraphService}}" + abi: SubgraphService + startBlock: {{blockNumber}} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + file: ./src/mappings/subgraphService.ts + entities: + - GraphNetwork + abis: + - name: SubgraphService + file: ./abis/SubgraphService.json + - name: GraphToken + file: ./node_modules/@graphprotocol/contracts/dist/abis/GraphToken.json + - name: EpochManager + file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json + eventHandlers: + - event: ServiceProviderRegistered(indexed address,bytes) + handler: handleServiceProviderRegistered + - event: RewardsDestinationSet(indexed address,indexed address) + handler: handleRewardsDestinationSet - kind: ethereum/contract name: Curation network: {{network}} From c660b8a9ea4e839bcf8c3e1f9522b38c124e43e8 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 20 Feb 2025 01:26:38 -0300 Subject: [PATCH 18/39] feat: added basic service registry for Horizon --- schema.graphql | 7 +++++++ src/mappings/subgraphService.ts | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/schema.graphql b/schema.graphql index 650e3c2d..543a342d 100644 --- a/schema.graphql +++ b/schema.graphql @@ -898,6 +898,13 @@ type Provision @entity { delegatorShares: BigInt! "Exchange rate of of tokens received for each share" delegationExchangeRate: BigDecimal! + + "Service registry URL for the indexer" + url: String + "Geohash of the indexer. Shows where their indexer is located in the world" + geoHash: String + "Address set as rewards destination for payments to the service provider" + rewardsDestination: Bytes } enum PaymentTypes { diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index 423e1c85..3a5b6b64 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -1 +1,17 @@ -// ToDo \ No newline at end of file +import { ethereum } from "@graphprotocol/graph-ts" +import { RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" +import { createOrLoadProvision } from "./helpers/helpers" + +export function handleServiceProviderRegistered(event: ServiceProviderRegistered): void { + let decodedCalldata = ethereum.decode('(string,string,address)', event.params.data).toTuple() + let provision = createOrLoadProvision(event.params.serviceProvider, event.address, event.block.timestamp) + provision.url = decodedCalldata[0].toString() + provision.geoHash = decodedCalldata[1].toString() + provision.save() +} + +export function handleRewardsDestinationSet(event: RewardsDestinationSet): void { + let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) + provision.rewardsDestination = event.params.rewardsDestination + provision.save() +} From 3fd572dfa26a354f1e7649f2294068d2f97999e0 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Mon, 24 Feb 2025 04:12:42 -0300 Subject: [PATCH 19/39] fix: abi.decode potential decoding failure --- src/mappings/subgraphService.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index 3a5b6b64..1ba54400 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -1,13 +1,18 @@ -import { ethereum } from "@graphprotocol/graph-ts" +import { ethereum, ValueKind, log } from "@graphprotocol/graph-ts" import { RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" import { createOrLoadProvision } from "./helpers/helpers" export function handleServiceProviderRegistered(event: ServiceProviderRegistered): void { - let decodedCalldata = ethereum.decode('(string,string,address)', event.params.data).toTuple() - let provision = createOrLoadProvision(event.params.serviceProvider, event.address, event.block.timestamp) - provision.url = decodedCalldata[0].toString() - provision.geoHash = decodedCalldata[1].toString() - provision.save() + let decodedCalldata = ethereum.decode('(string,string,address)', event.params.data) + if( decodedCalldata != null && decodedCalldata.kind == ethereum.ValueKind.TUPLE) { + let tupleData = decodedCalldata.toTuple() + let provision = createOrLoadProvision(event.params.serviceProvider, event.address, event.block.timestamp) + provision.url = tupleData[0].toString() + provision.geoHash = tupleData[1].toString() + provision.save() + } else { + log.warning("ServiceProviderRegistered failed to decode: {}", [event.params.data.toHexString()]) + } } export function handleRewardsDestinationSet(event: RewardsDestinationSet): void { From b69288b5e4e11eeebfc5af2925e78b822f488cd2 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 20 Feb 2025 02:07:57 -0300 Subject: [PATCH 20/39] chore: placeholder event handlers --- src/mappings/subgraphService.ts | 22 +++++++++++++++++++++- subgraph.template.yaml | 6 ++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index 1ba54400..04c7a3c1 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -1,5 +1,5 @@ import { ethereum, ValueKind, log } from "@graphprotocol/graph-ts" -import { RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" +import { AllocationClosed, AllocationCreated, AllocationResized, RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" import { createOrLoadProvision } from "./helpers/helpers" export function handleServiceProviderRegistered(event: ServiceProviderRegistered): void { @@ -20,3 +20,23 @@ export function handleRewardsDestinationSet(event: RewardsDestinationSet): void provision.rewardsDestination = event.params.rewardsDestination provision.save() } + +export function handleAllocationClosed(event: AllocationClosed): void { + let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) + // To Do + provision.save() +} + + +export function handleAllocationCreated(event: AllocationCreated): void { + let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) + // To Do + provision.save() +} + + +export function handleAllocationResized(event: AllocationResized): void { + let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) + // To Do + provision.save() +} diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 857af4b2..34b6d4a8 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -455,6 +455,12 @@ dataSources: handler: handleServiceProviderRegistered - event: RewardsDestinationSet(indexed address,indexed address) handler: handleRewardsDestinationSet + - event: AllocationClosed(indexed address,indexed address,indexed bytes32,uint256) + handler: handleAllocationClosed + - event: AllocationCreated(indexed address,indexed address,indexed bytes32,uint256) + handler: handleAllocationCreated + - event: AllocationResized(indexed address,indexed address,indexed bytes32,uint256,uint256) + handler: handleAllocationResized - kind: ethereum/contract name: Curation network: {{network}} From 46e866534102561ac262fe09ee9339e8d5b5d9d2 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Mon, 24 Feb 2025 03:07:17 -0300 Subject: [PATCH 21/39] chore: updated ABIs --- abis/HorizonStaking.json | 4833 +++++++++++++++++++------------------ abis/SubgraphService.json | 4552 +++++++++++++++++----------------- subgraph.template.yaml | 10 +- 3 files changed, 4701 insertions(+), 4694 deletions(-) diff --git a/abis/HorizonStaking.json b/abis/HorizonStaking.json index b1089b90..6472aeaa 100644 --- a/abis/HorizonStaking.json +++ b/abis/HorizonStaking.json @@ -1,2408 +1,2431 @@ [ { - "type": "constructor", - "inputs": [ - { - "name": "controller", - "type": "address", - "internalType": "address" - }, - { - "name": "stakingExtensionAddress", - "type": "address", - "internalType": "address" - }, - { - "name": "subgraphDataServiceAddress", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "fallback", - "stateMutability": "nonpayable" - }, - { - "type": "receive", - "stateMutability": "payable" - }, - { - "type": "function", - "name": "acceptProvisionParameters", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "acceptProxy", - "inputs": [ - { - "name": "_proxy", - "type": "address", - "internalType": "contract IGraphProxy" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "acceptProxyAndCall", - "inputs": [ - { - "name": "_proxy", - "type": "address", - "internalType": "contract IGraphProxy" - }, - { - "name": "_data", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "addToDelegationPool", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "addToProvision", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "clearThawingPeriod", - "inputs": [], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "delegate", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "delegate", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "minSharesOut", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "deprovision", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "nThawRequests", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "getDelegatedTokensAvailable", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getDelegation", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "delegator", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "tuple", - "internalType": "struct IHorizonStakingTypes.Delegation", - "components": [ - { - "name": "shares", - "type": "uint256", - "internalType": "uint256" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getDelegationFeeCut", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "paymentType", - "type": "uint8", - "internalType": "enum IGraphPayments.PaymentTypes" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getDelegationPool", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "tuple", - "internalType": "struct IHorizonStakingTypes.DelegationPool", - "components": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "shares", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "tokensThawing", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "sharesThawing", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "thawingNonce", - "type": "uint256", - "internalType": "uint256" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getIdleStake", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getMaxThawingPeriod", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint64", - "internalType": "uint64" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getProviderTokensAvailable", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getProvision", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "tuple", - "internalType": "struct IHorizonStakingTypes.Provision", - "components": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "tokensThawing", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "sharesThawing", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maxVerifierCut", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "thawingPeriod", - "type": "uint64", - "internalType": "uint64" - }, - { - "name": "createdAt", - "type": "uint64", - "internalType": "uint64" - }, - { - "name": "maxVerifierCutPending", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "thawingPeriodPending", - "type": "uint64", - "internalType": "uint64" - }, - { - "name": "thawingNonce", - "type": "uint256", - "internalType": "uint256" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getServiceProvider", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "tuple", - "internalType": "struct IHorizonStakingTypes.ServiceProvider", - "components": [ - { - "name": "tokensStaked", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "tokensProvisioned", - "type": "uint256", - "internalType": "uint256" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getStake", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getThawRequest", - "inputs": [ - { - "name": "requestType", - "type": "uint8", - "internalType": "enum IHorizonStakingTypes.ThawRequestType" - }, - { - "name": "thawRequestId", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "outputs": [ - { - "name": "", - "type": "tuple", - "internalType": "struct IHorizonStakingTypes.ThawRequest", - "components": [ - { - "name": "shares", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "thawingUntil", - "type": "uint64", - "internalType": "uint64" - }, - { - "name": "next", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "thawingNonce", - "type": "uint256", - "internalType": "uint256" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getThawRequestList", - "inputs": [ - { - "name": "requestType", - "type": "uint8", - "internalType": "enum IHorizonStakingTypes.ThawRequestType" - }, - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "owner", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "tuple", - "internalType": "struct LinkedList.List", - "components": [ - { - "name": "head", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "tail", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "count", - "type": "uint256", - "internalType": "uint256" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getThawedTokens", - "inputs": [ - { - "name": "requestType", - "type": "uint8", - "internalType": "enum IHorizonStakingTypes.ThawRequestType" - }, - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "owner", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getTokensAvailable", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "delegationRatio", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "isAllowedLockedVerifier", - "inputs": [ - { - "name": "verifier", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "isAuthorized", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "operator", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "isDelegationSlashingEnabled", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "multicall", - "inputs": [ - { - "name": "data", - "type": "bytes[]", - "internalType": "bytes[]" - } - ], - "outputs": [ - { - "name": "results", - "type": "bytes[]", - "internalType": "bytes[]" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "provision", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maxVerifierCut", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "thawingPeriod", - "type": "uint64", - "internalType": "uint64" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "provisionLocked", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maxVerifierCut", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "thawingPeriod", - "type": "uint64", - "internalType": "uint64" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "redelegate", - "inputs": [ - { - "name": "oldServiceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "oldVerifier", - "type": "address", - "internalType": "address" - }, - { - "name": "newServiceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "newVerifier", - "type": "address", - "internalType": "address" - }, - { - "name": "minSharesForNewProvider", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "nThawRequests", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "reprovision", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "oldVerifier", - "type": "address", - "internalType": "address" - }, - { - "name": "newVerifier", - "type": "address", - "internalType": "address" - }, - { - "name": "nThawRequests", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setAllowedLockedVerifier", - "inputs": [ - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "allowed", - "type": "bool", - "internalType": "bool" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setDelegationFeeCut", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "paymentType", - "type": "uint8", - "internalType": "enum IGraphPayments.PaymentTypes" - }, - { - "name": "feeCut", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setDelegationSlashingEnabled", - "inputs": [], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setMaxThawingPeriod", - "inputs": [ - { - "name": "maxThawingPeriod", - "type": "uint64", - "internalType": "uint64" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setOperator", - "inputs": [ - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "operator", - "type": "address", - "internalType": "address" - }, - { - "name": "allowed", - "type": "bool", - "internalType": "bool" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setOperatorLocked", - "inputs": [ - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "operator", - "type": "address", - "internalType": "address" - }, - { - "name": "allowed", - "type": "bool", - "internalType": "bool" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setProvisionParameters", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "newMaxVerifierCut", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "newThawingPeriod", - "type": "uint64", - "internalType": "uint64" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "slash", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "tokensVerifier", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "verifierDestination", - "type": "address", - "internalType": "address" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "stake", - "inputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "stakeTo", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "stakeToProvision", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "thaw", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "undelegate", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "shares", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "undelegate", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "shares", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "unstake", - "inputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "withdraw", - "inputs": [], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "withdrawDelegated", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "nThawRequests", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "withdrawDelegated", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "event", - "name": "AllowedLockedVerifierSet", - "inputs": [ - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "allowed", - "type": "bool", - "indexed": false, - "internalType": "bool" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "DelegatedTokensWithdrawn", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "delegator", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "DelegationFeeCutSet", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "paymentType", - "type": "uint8", - "indexed": true, - "internalType": "enum IGraphPayments.PaymentTypes" - }, - { - "name": "feeCut", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "DelegationSlashed", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "DelegationSlashingEnabled", - "inputs": [], - "anonymous": false - }, - { - "type": "event", - "name": "DelegationSlashingSkipped", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "GraphDirectoryInitialized", - "inputs": [ - { - "name": "graphToken", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "graphStaking", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "graphPayments", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphEscrow", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphController", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "graphEpochManager", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphRewardsManager", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphTokenGateway", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphProxyAdmin", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphCuration", - "type": "address", - "indexed": false, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "HorizonStakeDeposited", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "HorizonStakeLocked", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "until", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "HorizonStakeWithdrawn", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "MaxThawingPeriodSet", - "inputs": [ - { - "name": "maxThawingPeriod", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "OperatorSet", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "operator", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "allowed", - "type": "bool", - "indexed": false, - "internalType": "bool" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ProvisionCreated", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "maxVerifierCut", - "type": "uint32", - "indexed": false, - "internalType": "uint32" - }, - { - "name": "thawingPeriod", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ProvisionIncreased", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ProvisionParametersSet", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "maxVerifierCut", - "type": "uint32", - "indexed": false, - "internalType": "uint32" - }, - { - "name": "thawingPeriod", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ProvisionParametersStaged", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "maxVerifierCut", - "type": "uint32", - "indexed": false, - "internalType": "uint32" - }, - { - "name": "thawingPeriod", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ProvisionSlashed", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ProvisionThawed", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "StakeDelegatedWithdrawn", - "inputs": [ - { - "name": "indexer", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "delegator", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ThawRequestCreated", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "owner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "shares", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "thawingUntil", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - }, - { - "name": "thawRequestId", - "type": "bytes32", - "indexed": false, - "internalType": "bytes32" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ThawRequestFulfilled", - "inputs": [ - { - "name": "thawRequestId", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "shares", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "thawingUntil", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - }, - { - "name": "valid", - "type": "bool", - "indexed": false, - "internalType": "bool" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ThawRequestsFulfilled", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "owner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "thawRequestsFulfilled", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "requestType", - "type": "uint8", - "indexed": false, - "internalType": "enum IHorizonStakingTypes.ThawRequestType" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ThawingPeriodCleared", - "inputs": [], - "anonymous": false - }, - { - "type": "event", - "name": "TokensDelegated", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "delegator", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "shares", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "TokensDeprovisioned", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "TokensToDelegationPoolAdded", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "TokensUndelegated", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "delegator", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "VerifierTokensSent", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "destination", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "error", - "name": "AddressEmptyCode", - "inputs": [ - { - "name": "target", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "FailedInnerCall", - "inputs": [] - }, - { - "type": "error", - "name": "GraphDirectoryInvalidZeroAddress", - "inputs": [ - { - "name": "contractName", - "type": "bytes", - "internalType": "bytes" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingCallerIsServiceProvider", - "inputs": [] - }, - { - "type": "error", - "name": "HorizonStakingInsufficientDelegationTokens", - "inputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "minTokens", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInsufficientIdleStake", - "inputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "minTokens", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInsufficientShares", - "inputs": [ - { - "name": "shares", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "minShares", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInsufficientStakeForLegacyAllocations", - "inputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "minTokens", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInsufficientTokens", - "inputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "minRequired", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInvalidDelegationFeeCut", - "inputs": [ - { - "name": "feeCut", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInvalidDelegationPool", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInvalidDelegationPoolState", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInvalidMaxVerifierCut", - "inputs": [ - { - "name": "maxVerifierCut", - "type": "uint32", - "internalType": "uint32" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInvalidProvision", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInvalidServiceProviderZeroAddress", - "inputs": [] - }, - { - "type": "error", - "name": "HorizonStakingInvalidThawRequestType", - "inputs": [] - }, - { - "type": "error", - "name": "HorizonStakingInvalidThawingPeriod", - "inputs": [ - { - "name": "thawingPeriod", - "type": "uint64", - "internalType": "uint64" - }, - { - "name": "maxThawingPeriod", - "type": "uint64", - "internalType": "uint64" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingInvalidVerifierZeroAddress", - "inputs": [] - }, - { - "type": "error", - "name": "HorizonStakingInvalidZeroShares", - "inputs": [] - }, - { - "type": "error", - "name": "HorizonStakingInvalidZeroTokens", - "inputs": [] - }, - { - "type": "error", - "name": "HorizonStakingNotAuthorized", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "verifier", - "type": "address", - "internalType": "address" - }, - { - "name": "caller", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingNothingThawing", - "inputs": [] - }, - { - "type": "error", - "name": "HorizonStakingProvisionAlreadyExists", - "inputs": [] - }, - { - "type": "error", - "name": "HorizonStakingSlippageProtection", - "inputs": [ - { - "name": "shares", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "minShares", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingStillThawing", - "inputs": [ - { - "name": "until", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingTooManyThawRequests", - "inputs": [] - }, - { - "type": "error", - "name": "HorizonStakingTooManyTokens", - "inputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maxTokens", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "HorizonStakingVerifierNotAllowed", - "inputs": [ - { - "name": "verifier", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "LinkedListEmptyList", - "inputs": [] - }, - { - "type": "error", - "name": "LinkedListInvalidIterations", - "inputs": [] - }, - { - "type": "error", - "name": "LinkedListInvalidZeroId", - "inputs": [] - }, - { - "type": "error", - "name": "LinkedListMaxElementsExceeded", - "inputs": [] - }, - { - "type": "error", - "name": "ManagedIsPaused", - "inputs": [] - }, - { - "type": "error", - "name": "ManagedOnlyController", - "inputs": [] - }, - { - "type": "error", - "name": "ManagedOnlyGovernor", - "inputs": [] - }, - { - "type": "error", - "name": "PPMMathInvalidMulPPM", - "inputs": [ - { - "name": "a", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "b", - "type": "uint256", - "internalType": "uint256" - } - ] + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "address", + "name": "stakingExtensionAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "subgraphDataServiceAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "contractName", + "type": "bytes" + } + ], + "name": "GraphDirectoryInvalidZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingCallerIsServiceProvider", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTokens", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientDelegationTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTokens", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientIdleStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minShares", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientShares", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTokens", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientStakeForLegacyAllocations", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minRequired", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "feeCut", + "type": "uint256" + } + ], + "name": "HorizonStakingInvalidDelegationFeeCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingInvalidDelegationPool", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingInvalidDelegationPoolState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + } + ], + "name": "HorizonStakingInvalidMaxVerifierCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingInvalidProvision", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidServiceProviderZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidThawRequestType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "maxThawingPeriod", + "type": "uint64" + } + ], + "name": "HorizonStakingInvalidThawingPeriod", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingInvalidVerifier", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidVerifierZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidZeroShares", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidZeroTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "HorizonStakingNotAuthorized", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingNothingThawing", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingProvisionAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minShares", + "type": "uint256" + } + ], + "name": "HorizonStakingSlippageProtection", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "until", + "type": "uint256" + } + ], + "name": "HorizonStakingStillThawing", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingTooManyThawRequests", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTokens", + "type": "uint256" + } + ], + "name": "HorizonStakingTooManyTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingVerifierNotAllowed", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListEmptyList", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListInvalidIterations", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListInvalidZeroId", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListMaxElementsExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "ManagedIsPaused", + "type": "error" + }, + { + "inputs": [], + "name": "ManagedOnlyController", + "type": "error" + }, + { + "inputs": [], + "name": "ManagedOnlyGovernor", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "PPMMathInvalidMulPPM", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "AllowedLockedVerifierSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "DelegatedTokensWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeCut", + "type": "uint256" + } + ], + "name": "DelegationFeeCutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "DelegationSlashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "DelegationSlashingEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "DelegationSlashingSkipped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "graphToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "graphStaking", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphPayments", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphEscrow", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "graphController", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphEpochManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphRewardsManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphTokenGateway", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphProxyAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphCuration", + "type": "address" + } + ], + "name": "GraphDirectoryInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "HorizonStakeDeposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "until", + "type": "uint256" + } + ], + "name": "HorizonStakeLocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "HorizonStakeWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "maxThawingPeriod", + "type": "uint64" + } + ], + "name": "MaxThawingPeriodSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "OperatorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "ProvisionCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ProvisionIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "ProvisionParametersSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "ProvisionParametersStaged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ProvisionSlashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ProvisionThawed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "StakeDelegatedWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingUntil", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "thawRequestId", + "type": "bytes32" + } + ], + "name": "ThawRequestCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "thawRequestId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingUntil", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "name": "ThawRequestFulfilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "thawRequestsFulfilled", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ThawRequestsFulfilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "ThawingPeriodCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "TokensDelegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "TokensDeprovisioned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "TokensToDelegationPoolAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "TokensUndelegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "VerifierTokensSent", + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "fallback" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "acceptProvisionParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IGraphProxy", + "name": "_proxy", + "type": "address" + } + ], + "name": "acceptProxy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IGraphProxy", + "name": "_proxy", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "acceptProxyAndCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "addToDelegationPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "addToProvision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "clearThawingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nThawRequests", + "type": "uint256" + } + ], + "name": "deprovision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "getDelegatedTokensAvailable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "delegator", + "type": "address" + } + ], + "name": "getDelegation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.Delegation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + } + ], + "name": "getDelegationFeeCut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "getDelegationPool", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensThawing", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sharesThawing", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "thawingNonce", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.DelegationPool", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "getIdleStake", + "outputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxThawingPeriod", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "getProviderTokensAvailable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "getProvision", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensThawing", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sharesThawing", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "createdAt", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "maxVerifierCutPending", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "thawingPeriodPending", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "thawingNonce", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.Provision", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "getServiceProvider", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokensStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensProvisioned", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.ServiceProvider", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "getStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "thawRequestId", + "type": "bytes32" + } + ], + "name": "getThawRequest", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint64", + "name": "thawingUntil", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "next", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "thawingNonce", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.ThawRequest", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "getThawRequestList", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "head", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "tail", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "internalType": "struct LinkedList.List", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "getThawedTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint32", + "name": "delegationRatio", + "type": "uint32" + } + ], + "name": "getTokensAvailable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "isAllowedLockedVerifier", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isAuthorized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isDelegationSlashingEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "provision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "provisionLocked", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "oldServiceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "oldVerifier", + "type": "address" + }, + { + "internalType": "address", + "name": "newServiceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "newVerifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesForNewProvider", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nThawRequests", + "type": "uint256" + } + ], + "name": "redelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "oldVerifier", + "type": "address" + }, + { + "internalType": "address", + "name": "newVerifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nThawRequests", + "type": "uint256" + } + ], + "name": "reprovision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "setAllowedLockedVerifier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "feeCut", + "type": "uint256" + } + ], + "name": "setDelegationFeeCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "setDelegationSlashingEnabled", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "maxThawingPeriod", + "type": "uint64" + } + ], + "name": "setMaxThawingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "setOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "setOperatorLocked", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint32", + "name": "newMaxVerifierCut", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "newThawingPeriod", + "type": "uint64" + } + ], + "name": "setProvisionParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensVerifier", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifierDestination", + "type": "address" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "stakeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "stakeToProvision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "thaw", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "undelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "undelegate", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "unstake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nThawRequests", + "type": "uint256" + } + ], + "name": "withdrawDelegated", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdrawDelegated", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" } -] \ No newline at end of file + ] \ No newline at end of file diff --git a/abis/SubgraphService.json b/abis/SubgraphService.json index 3da88ad2..f2ffdcc6 100644 --- a/abis/SubgraphService.json +++ b/abis/SubgraphService.json @@ -1,2287 +1,2271 @@ [ { - "type": "constructor", - "inputs": [ - { - "name": "graphController", - "type": "address", - "internalType": "address" - }, - { - "name": "disputeManager", - "type": "address", - "internalType": "address" - }, - { - "name": "tapCollector", - "type": "address", - "internalType": "address" - }, - { - "name": "curation", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "acceptProvisionPendingParameters", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "allocationProvisionTracker", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "claims", - "inputs": [ - { - "name": "claimId", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "outputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "createdAt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "releasableAt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "nextClaim", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "claimsLists", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "head", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "tail", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "nonce", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "count", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "closeStaleAllocation", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "collect", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "paymentType", - "type": "uint8", - "internalType": "enum IGraphPayments.PaymentTypes" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "curationFeesCut", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "delegationRatio", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint32", - "internalType": "uint32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "eip712Domain", - "inputs": [], - "outputs": [ - { - "name": "fields", - "type": "bytes1", - "internalType": "bytes1" - }, - { - "name": "name", - "type": "string", - "internalType": "string" - }, - { - "name": "version", - "type": "string", - "internalType": "string" - }, - { - "name": "chainId", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "verifyingContract", - "type": "address", - "internalType": "address" - }, - { - "name": "salt", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "extensions", - "type": "uint256[]", - "internalType": "uint256[]" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "encodeAllocationProof", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "feesProvisionTracker", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getAllocation", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "tuple", - "internalType": "struct Allocation.State", - "components": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "subgraphDeploymentId", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "createdAt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "closedAt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "lastPOIPresentedAt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "accRewardsPerAllocatedToken", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "accRewardsPending", - "type": "uint256", - "internalType": "uint256" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getAllocationData", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - }, - { - "name": "", - "type": "bytes32", - "internalType": "bytes32" - }, - { - "name": "", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getDelegationRatio", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint32", - "internalType": "uint32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getLegacyAllocation", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "tuple", - "internalType": "struct LegacyAllocation.State", - "components": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "subgraphDeploymentId", - "type": "bytes32", - "internalType": "bytes32" - } - ] - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getProvisionTokensRange", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getSubgraphAllocatedTokens", - "inputs": [ - { - "name": "subgraphDeploymentId", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getThawingPeriodRange", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint64", - "internalType": "uint64" - }, - { - "name": "", - "type": "uint64", - "internalType": "uint64" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "getVerifierCutRange", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "", - "type": "uint32", - "internalType": "uint32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "indexers", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "registeredAt", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "url", - "type": "string", - "internalType": "string" - }, - { - "name": "geoHash", - "type": "string", - "internalType": "string" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "initialize", - "inputs": [ - { - "name": "minimumProvisionTokens", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "maximumDelegationRatio", - "type": "uint32", - "internalType": "uint32" - }, - { - "name": "stakeToFeesRatio", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "isActiveAllocation", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "isOverAllocated", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "isStaleAllocation", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "maxPOIStaleness", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "maximumProvisionTokens", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "maximumThawingPeriod", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint64", - "internalType": "uint64" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "maximumVerifierCut", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint32", - "internalType": "uint32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "migrateLegacyAllocation", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "internalType": "address" - }, - { - "name": "subgraphDeploymentID", - "type": "bytes32", - "internalType": "bytes32" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "minimumProvisionTokens", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "minimumThawingPeriod", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint64", - "internalType": "uint64" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "minimumVerifierCut", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint32", - "internalType": "uint32" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "multicall", - "inputs": [ - { - "name": "data", - "type": "bytes[]", - "internalType": "bytes[]" - } - ], - "outputs": [ - { - "name": "results", - "type": "bytes[]", - "internalType": "bytes[]" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "owner", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "pause", - "inputs": [], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "pauseGuardians", - "inputs": [ - { - "name": "pauseGuardian", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "allowed", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "paused", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "bool", - "internalType": "bool" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "register", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "releaseStake", - "inputs": [ - { - "name": "numClaimsToRelease", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "renounceOwnership", - "inputs": [], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "resizeAllocation", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "rewardsDestination", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - } - ], - "outputs": [ - { - "name": "destination", - "type": "address", - "internalType": "address" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "setCurationCut", - "inputs": [ - { - "name": "curationCut", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setDelegationRatio", - "inputs": [ - { - "name": "delegationRatio", - "type": "uint32", - "internalType": "uint32" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setMaxPOIStaleness", - "inputs": [ - { - "name": "maxPOIStaleness", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setMinimumProvisionTokens", - "inputs": [ - { - "name": "minimumProvisionTokens", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setPauseGuardian", - "inputs": [ - { - "name": "pauseGuardian", - "type": "address", - "internalType": "address" - }, - { - "name": "allowed", - "type": "bool", - "internalType": "bool" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setRewardsDestination", - "inputs": [ - { - "name": "rewardsDestination", - "type": "address", - "internalType": "address" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "setStakeToFeesRatio", - "inputs": [ - { - "name": "stakeToFeesRatio_", - "type": "uint256", - "internalType": "uint256" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "slash", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "stakeToFeesRatio", - "inputs": [], - "outputs": [ - { - "name": "", - "type": "uint256", - "internalType": "uint256" - } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "startService", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "stopService", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "internalType": "bytes" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "transferOwnership", - "inputs": [ - { - "name": "newOwner", - "type": "address", - "internalType": "address" - } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "unpause", - "inputs": [], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "event", - "name": "AllocationClosed", - "inputs": [ - { - "name": "indexer", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "subgraphDeploymentId", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "AllocationCreated", - "inputs": [ - { - "name": "indexer", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "subgraphDeploymentId", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "AllocationResized", - "inputs": [ - { - "name": "indexer", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "subgraphDeploymentId", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - }, - { - "name": "newTokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "oldTokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "CurationCutSet", - "inputs": [ - { - "name": "curationCut", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "DelegationRatioSet", - "inputs": [ - { - "name": "ratio", - "type": "uint32", - "indexed": false, - "internalType": "uint32" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "EIP712DomainChanged", - "inputs": [], - "anonymous": false - }, - { - "type": "event", - "name": "GraphDirectoryInitialized", - "inputs": [ - { - "name": "graphToken", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "graphStaking", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "graphPayments", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphEscrow", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphController", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "graphEpochManager", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphRewardsManager", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphTokenGateway", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphProxyAdmin", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "graphCuration", - "type": "address", - "indexed": false, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "IndexingRewardsCollected", - "inputs": [ - { - "name": "indexer", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "subgraphDeploymentId", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - }, - { - "name": "tokensRewards", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "tokensIndexerRewards", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "tokensDelegationRewards", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "poi", - "type": "bytes32", - "indexed": false, - "internalType": "bytes32" - }, - { - "name": "currentEpoch", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Initialized", - "inputs": [ - { - "name": "version", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "LegacyAllocationMigrated", - "inputs": [ - { - "name": "indexer", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "subgraphDeploymentId", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "MaxPOIStalenessSet", - "inputs": [ - { - "name": "maxPOIStaleness", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "OwnershipTransferred", - "inputs": [ - { - "name": "previousOwner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "newOwner", - "type": "address", - "indexed": true, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "PauseGuardianSet", - "inputs": [ - { - "name": "account", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "allowed", - "type": "bool", - "indexed": false, - "internalType": "bool" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Paused", - "inputs": [ - { - "name": "account", - "type": "address", - "indexed": false, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ProvisionPendingParametersAccepted", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ProvisionTokensRangeSet", - "inputs": [ - { - "name": "min", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "max", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "QueryFeesCollected", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokensCollected", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "tokensCurators", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "RewardsDestinationSet", - "inputs": [ - { - "name": "indexer", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "rewardsDestination", - "type": "address", - "indexed": true, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ServicePaymentCollected", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "feeType", - "type": "uint8", - "indexed": true, - "internalType": "enum IGraphPayments.PaymentTypes" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ServiceProviderRegistered", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "indexed": false, - "internalType": "bytes" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ServiceProviderSlashed", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ServiceStarted", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "indexed": false, - "internalType": "bytes" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ServiceStopped", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "data", - "type": "bytes", - "indexed": false, - "internalType": "bytes" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "StakeClaimLocked", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "claimId", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "unlockTimestamp", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "StakeClaimReleased", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "claimId", - "type": "bytes32", - "indexed": true, - "internalType": "bytes32" - }, - { - "name": "tokens", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "releasableAt", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "StakeClaimsReleased", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "claimsCount", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - }, - { - "name": "tokensReleased", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "StakeToFeesRatioSet", - "inputs": [ - { - "name": "ratio", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "SubgraphServiceDirectoryInitialized", - "inputs": [ - { - "name": "subgraphService", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "disputeManager", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "tapCollector", - "type": "address", - "indexed": false, - "internalType": "address" - }, - { - "name": "curation", - "type": "address", - "indexed": false, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "ThawingPeriodRangeSet", - "inputs": [ - { - "name": "min", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - }, - { - "name": "max", - "type": "uint64", - "indexed": false, - "internalType": "uint64" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "Unpaused", - "inputs": [ - { - "name": "account", - "type": "address", - "indexed": false, - "internalType": "address" - } - ], - "anonymous": false - }, - { - "type": "event", - "name": "VerifierCutRangeSet", - "inputs": [ - { - "name": "min", - "type": "uint32", - "indexed": false, - "internalType": "uint32" - }, - { - "name": "max", - "type": "uint32", - "indexed": false, - "internalType": "uint32" - } - ], - "anonymous": false - }, - { - "type": "error", - "name": "AddressEmptyCode", - "inputs": [ - { - "name": "target", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "AllocationAlreadyExists", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "AllocationClosed", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - }, - { - "name": "closedAt", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "AllocationDoesNotExist", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "AllocationManagerAllocationClosed", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "AllocationManagerAllocationSameSize", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - }, - { - "name": "tokens", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "AllocationManagerInvalidAllocationProof", - "inputs": [ - { - "name": "signer", - "type": "address", - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "AllocationManagerInvalidZeroAllocationId", - "inputs": [] - }, - { - "type": "error", - "name": "DataServiceFeesClaimNotFound", - "inputs": [ - { - "name": "claimId", - "type": "bytes32", - "internalType": "bytes32" - } - ] - }, - { - "type": "error", - "name": "DataServiceFeesZeroTokens", - "inputs": [] - }, - { - "type": "error", - "name": "DataServicePausableNotPauseGuardian", - "inputs": [ - { - "name": "account", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "DataServicePausablePauseGuardianNoChange", - "inputs": [ - { - "name": "account", - "type": "address", - "internalType": "address" - }, - { - "name": "allowed", - "type": "bool", - "internalType": "bool" - } - ] - }, - { - "type": "error", - "name": "DirectoryNotDisputeManager", - "inputs": [ - { - "name": "caller", - "type": "address", - "internalType": "address" - }, - { - "name": "disputeManager", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "ECDSAInvalidSignature", - "inputs": [] - }, - { - "type": "error", - "name": "ECDSAInvalidSignatureLength", - "inputs": [ - { - "name": "length", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "ECDSAInvalidSignatureS", - "inputs": [ - { - "name": "s", - "type": "bytes32", - "internalType": "bytes32" - } - ] - }, - { - "type": "error", - "name": "EnforcedPause", - "inputs": [] - }, - { - "type": "error", - "name": "ExpectedPause", - "inputs": [] - }, - { - "type": "error", - "name": "FailedInnerCall", - "inputs": [] - }, - { - "type": "error", - "name": "GraphDirectoryInvalidZeroAddress", - "inputs": [ - { - "name": "contractName", - "type": "bytes", - "internalType": "bytes" - } - ] - }, - { - "type": "error", - "name": "InvalidInitialization", - "inputs": [] - }, - { - "type": "error", - "name": "LegacyAllocationAlreadyExists", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "LinkedListEmptyList", - "inputs": [] - }, - { - "type": "error", - "name": "LinkedListInvalidIterations", - "inputs": [] - }, - { - "type": "error", - "name": "LinkedListInvalidZeroId", - "inputs": [] - }, - { - "type": "error", - "name": "LinkedListMaxElementsExceeded", - "inputs": [] - }, - { - "type": "error", - "name": "NotInitializing", - "inputs": [] - }, - { - "type": "error", - "name": "OwnableInvalidOwner", - "inputs": [ - { - "name": "owner", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "OwnableUnauthorizedAccount", - "inputs": [ - { - "name": "account", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "PPMMathInvalidMulPPM", - "inputs": [ - { - "name": "a", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "b", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "ProvisionManagerInvalidRange", - "inputs": [ - { - "name": "min", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "max", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "ProvisionManagerInvalidValue", - "inputs": [ - { - "name": "message", - "type": "bytes", - "internalType": "bytes" - }, - { - "name": "value", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "min", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "max", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "ProvisionManagerNotAuthorized", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - }, - { - "name": "caller", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "ProvisionManagerProvisionNotFound", - "inputs": [ - { - "name": "serviceProvider", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "ProvisionTrackerInsufficientTokens", - "inputs": [ - { - "name": "tokensAvailable", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "tokensRequired", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceAllocationIsAltruistic", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceAllocationNotAuthorized", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - }, - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceCannotForceCloseAllocation", - "inputs": [ - { - "name": "allocationId", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceEmptyGeohash", - "inputs": [] - }, - { - "type": "error", - "name": "SubgraphServiceEmptyUrl", - "inputs": [] - }, - { - "type": "error", - "name": "SubgraphServiceInconsistentCollection", - "inputs": [ - { - "name": "balanceBefore", - "type": "uint256", - "internalType": "uint256" - }, - { - "name": "balanceAfter", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceIndexerAlreadyRegistered", - "inputs": [] - }, - { - "type": "error", - "name": "SubgraphServiceIndexerMismatch", - "inputs": [ - { - "name": "providedIndexer", - "type": "address", - "internalType": "address" - }, - { - "name": "expectedIndexer", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceIndexerNotRegistered", - "inputs": [ - { - "name": "indexer", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceInvalidCurationCut", - "inputs": [ - { - "name": "curationCut", - "type": "uint256", - "internalType": "uint256" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceInvalidPaymentType", - "inputs": [ - { - "name": "paymentType", - "type": "uint8", - "internalType": "enum IGraphPayments.PaymentTypes" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceInvalidRAV", - "inputs": [ - { - "name": "ravIndexer", - "type": "address", - "internalType": "address" - }, - { - "name": "allocationIndexer", - "type": "address", - "internalType": "address" - } - ] - }, - { - "type": "error", - "name": "SubgraphServiceInvalidZeroStakeToFeesRatio", - "inputs": [] + "inputs": [ + { + "internalType": "address", + "name": "graphController", + "type": "address" + }, + { + "internalType": "address", + "name": "disputeManager", + "type": "address" + }, + { + "internalType": "address", + "name": "graphTallyCollector", + "type": "address" + }, + { + "internalType": "address", + "name": "curation", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "AllocationAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "internalType": "uint256", + "name": "closedAt", + "type": "uint256" + } + ], + "name": "AllocationClosed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "AllocationDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "AllocationManagerAllocationClosed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "AllocationManagerAllocationSameSize", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "AllocationManagerInvalidAllocationProof", + "type": "error" + }, + { + "inputs": [], + "name": "AllocationManagerInvalidZeroAllocationId", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "claimId", + "type": "bytes32" + } + ], + "name": "DataServiceFeesClaimNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "DataServiceFeesZeroTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "DataServicePausableNotPauseGuardian", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "DataServicePausablePauseGuardianNoChange", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "internalType": "address", + "name": "disputeManager", + "type": "address" + } + ], + "name": "DirectoryNotDisputeManager", + "type": "error" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "EnforcedPause", + "type": "error" + }, + { + "inputs": [], + "name": "ExpectedPause", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "contractName", + "type": "bytes" + } + ], + "name": "GraphDirectoryInvalidZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "LegacyAllocationAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListEmptyList", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListInvalidIterations", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListInvalidZeroId", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListMaxElementsExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "PPMMathInvalidMulPPM", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "name": "ProvisionManagerInvalidRange", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "name": "ProvisionManagerInvalidValue", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "ProvisionManagerNotAuthorized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "ProvisionManagerProvisionNotFound", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokensAvailable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensRequired", + "type": "uint256" + } + ], + "name": "ProvisionTrackerInsufficientTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "SubgraphServiceAllocationIsAltruistic", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "SubgraphServiceAllocationNotAuthorized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "SubgraphServiceCannotForceCloseAllocation", + "type": "error" + }, + { + "inputs": [], + "name": "SubgraphServiceEmptyGeohash", + "type": "error" + }, + { + "inputs": [], + "name": "SubgraphServiceEmptyUrl", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balanceBefore", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceAfter", + "type": "uint256" + } + ], + "name": "SubgraphServiceInconsistentCollection", + "type": "error" + }, + { + "inputs": [], + "name": "SubgraphServiceIndexerAlreadyRegistered", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "providedIndexer", + "type": "address" + }, + { + "internalType": "address", + "name": "expectedIndexer", + "type": "address" + } + ], + "name": "SubgraphServiceIndexerMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "SubgraphServiceIndexerNotRegistered", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "collectionId", + "type": "bytes32" + } + ], + "name": "SubgraphServiceInvalidCollectionId", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "curationCut", + "type": "uint256" + } + ], + "name": "SubgraphServiceInvalidCurationCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + } + ], + "name": "SubgraphServiceInvalidPaymentType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ravIndexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationIndexer", + "type": "address" + } + ], + "name": "SubgraphServiceInvalidRAV", + "type": "error" + }, + { + "inputs": [], + "name": "SubgraphServiceInvalidZeroStakeToFeesRatio", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "AllocationClosed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "currentEpoch", + "type": "uint256" + } + ], + "name": "AllocationCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldTokens", + "type": "uint256" + } + ], + "name": "AllocationResized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "curationCut", + "type": "uint256" + } + ], + "name": "CurationCutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "ratio", + "type": "uint32" + } + ], + "name": "DelegationRatioSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "graphToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "graphStaking", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphPayments", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphEscrow", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "graphController", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphEpochManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphRewardsManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphTokenGateway", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphProxyAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphCuration", + "type": "address" + } + ], + "name": "GraphDirectoryInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensIndexerRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensDelegationRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "poi", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "currentEpoch", + "type": "uint256" + } + ], + "name": "IndexingRewardsCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + } + ], + "name": "LegacyAllocationMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "maxPOIStaleness", + "type": "uint256" + } + ], + "name": "MaxPOIStalenessSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "PauseGuardianSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "ProvisionPendingParametersAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "name": "ProvisionTokensRangeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensCollected", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensCurators", + "type": "uint256" + } + ], + "name": "QueryFeesCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardsDestination", + "type": "address" + } + ], + "name": "RewardsDestinationSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "feeType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ServicePaymentCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "ServiceProviderRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ServiceProviderSlashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "ServiceStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "ServiceStopped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "claimId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unlockTimestamp", + "type": "uint256" + } + ], + "name": "StakeClaimLocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "claimId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "releasableAt", + "type": "uint256" + } + ], + "name": "StakeClaimReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "claimsCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensReleased", + "type": "uint256" + } + ], + "name": "StakeClaimsReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "ratio", + "type": "uint256" + } + ], + "name": "StakeToFeesRatioSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "subgraphService", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "disputeManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphTallyCollector", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "curation", + "type": "address" + } + ], + "name": "SubgraphServiceDirectoryInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "min", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "max", + "type": "uint64" + } + ], + "name": "ThawingPeriodRangeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "min", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "max", + "type": "uint32" + } + ], + "name": "VerifierCutRangeSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "acceptProvisionPendingParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "allocationProvisionTracker", + "outputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "claimId", + "type": "bytes32" + } + ], + "name": "claims", + "outputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "createdAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "releasableAt", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "nextClaim", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "claimsLists", + "outputs": [ + { + "internalType": "bytes32", + "name": "head", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "tail", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "closeStaleAllocation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "collect", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "curationFeesCut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "delegationRatio", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "encodeAllocationProof", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "feesProvisionTracker", + "outputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "getAllocation", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "createdAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "closedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastPOIPresentedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accRewardsPerAllocatedToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accRewardsPending", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "createdAtEpoch", + "type": "uint256" + } + ], + "internalType": "struct Allocation.State", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "getAllocationData", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDelegationRatio", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "getLegacyAllocation", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + } + ], + "internalType": "struct LegacyAllocation.State", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProvisionTokensRange", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + } + ], + "name": "getSubgraphAllocatedTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getThawingPeriodRange", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVerifierCutRange", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "indexers", + "outputs": [ + { + "internalType": "uint256", + "name": "registeredAt", + "type": "uint256" + }, + { + "internalType": "string", + "name": "url", + "type": "string" + }, + { + "internalType": "string", + "name": "geoHash", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "minimumProvisionTokens", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "maximumDelegationRatio", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "stakeToFeesRatio", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "isOverAllocated", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxPOIStaleness", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumProvisionTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumThawingPeriod", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumVerifierCut", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "subgraphDeploymentID", + "type": "bytes32" + } + ], + "name": "migrateLegacyAllocation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minimumProvisionTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumThawingPeriod", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumVerifierCut", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pauseGuardian", + "type": "address" + } + ], + "name": "pauseGuardians", + "outputs": [ + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "numClaimsToRelease", + "type": "uint256" + } + ], + "name": "releaseStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "resizeAllocation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "rewardsDestination", + "outputs": [ + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "curationCut", + "type": "uint256" + } + ], + "name": "setCurationCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "delegationRatio", + "type": "uint32" + } + ], + "name": "setDelegationRatio", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "maxPOIStaleness", + "type": "uint256" + } + ], + "name": "setMaxPOIStaleness", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "minimumProvisionTokens", + "type": "uint256" + } + ], + "name": "setMinimumProvisionTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pauseGuardian", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "setPauseGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "rewardsDestination", + "type": "address" + } + ], + "name": "setRewardsDestination", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "stakeToFeesRatio_", + "type": "uint256" + } + ], + "name": "setStakeToFeesRatio", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakeToFeesRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "startService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "stopService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" } -] \ No newline at end of file + ] \ No newline at end of file diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 34b6d4a8..1c8d28b3 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -419,9 +419,9 @@ dataSources: handler: handleProvisionSlashed - event: ProvisionThawed(indexed address,indexed address,uint256) handler: handleProvisionThawed - - event: ThawRequestCreated(indexed address,indexed address,indexed address,uint256,uint64,bytes32) + - event: ThawRequestCreated(indexed uint8,indexed address,indexed address,address,uint256,uint64,bytes32) handler: handleThawRequestCreated - - event: ThawRequestFulfilled(indexed bytes32,uint256,uint256,uint64,bool) + - event: ThawRequestFulfilled(indexed uint8,indexed bytes32,uint256,uint256,uint64,bool) handler: handleThawRequestFulfilled - event: OperatorSet(indexed address,indexed address,indexed address,bool) handler: handleOperatorSet @@ -455,12 +455,12 @@ dataSources: handler: handleServiceProviderRegistered - event: RewardsDestinationSet(indexed address,indexed address) handler: handleRewardsDestinationSet - - event: AllocationClosed(indexed address,indexed address,indexed bytes32,uint256) - handler: handleAllocationClosed - - event: AllocationCreated(indexed address,indexed address,indexed bytes32,uint256) + - event: AllocationCreated(indexed address,indexed address,indexed bytes32,uint256,uint256) handler: handleAllocationCreated - event: AllocationResized(indexed address,indexed address,indexed bytes32,uint256,uint256) handler: handleAllocationResized + - event: AllocationClosed(indexed address,indexed address,indexed bytes32,uint256) + handler: handleAllocationClosed - kind: ethereum/contract name: Curation network: {{network}} From 1875a907483bf40460eff34a31f138063846befe Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Mon, 24 Feb 2025 04:05:33 -0300 Subject: [PATCH 22/39] feat: implemented AllocationCreated, Closed and Resized --- schema.graphql | 31 ++++++- src/mappings/helpers/helpers.ts | 3 + src/mappings/subgraphService.ts | 143 ++++++++++++++++++++++++++++++-- 3 files changed, 166 insertions(+), 11 deletions(-) diff --git a/schema.graphql b/schema.graphql index 543a342d..0ca6b80c 100644 --- a/schema.graphql +++ b/schema.graphql @@ -864,6 +864,15 @@ type Provision @entity { tokensProvisioned: BigInt! + tokensAllocated: BigInt! + + totalAllocationCount: BigInt! + + allocationCount: Int! + + "Active allocations of stake for this Provision" + allocations: [Allocation!]! @derivedFrom(field: "activeForProvision") + "Timestamp when the provision was created" createdAt: BigInt! @@ -934,17 +943,21 @@ type ThawRequest @entity { } """ -A state channel Allocation representing a single Indexer-SubgraphDeployment stake +A state channel Allocation representing a single Indexer/Provision-SubgraphDeployment stake """ type Allocation @entity { "Channel Address" id: ID! "Indexer of this allocation" indexer: Indexer! + "Provision of this allocation (for Horizon allocations only)" + provision: Provision "Creator of the allocation - can be the operator or the indexer" creator: Bytes! "If the Allocation is active it shows the indexer. If closed, it is null" activeForIndexer: Indexer + "If the Allocation is active it shows the provision. If closed, it is null" + activeForProvision: Provision "Subgraph deployment that is being allocated to" subgraphDeployment: SubgraphDeployment! "Tokens allocation in this allocation" @@ -987,10 +1000,12 @@ type Allocation @entity { createdAt: Int! "Timestamp this allocation was closed at" closedAt: Int - "POI submitted with a closed allocation" + "POI submitted when closing allocations in the legacy protocol. Also reflects the latest POI submitted for a Horizon payment collection" poi: Bytes + "POIs submitted when collecting payments in Horizon" + pois: [PoiSubmission!]! @derivedFrom(field: "allocation") - # Indexer cut settings at start and close + # Indexer/Provision cut settings at start and close indexingRewardCutAtStart: Int! indexingRewardEffectiveCutAtStart: BigDecimal! queryFeeCutAtStart: Int! @@ -1008,6 +1023,16 @@ type Allocation @entity { annualizedReturn: BigDecimal! } +type PoiSubmission @entity { + id: ID! + + allocation: Allocation! + + poi: Bytes! + + submittedAtEpoch: Int! +} + enum AllocationStatus { Null # == indexer == address(0) Active # == not Null && tokens > 0 # diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 19cb75d2..2c5829c7 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -200,6 +200,9 @@ export function createOrLoadProvision(indexerAddress: Bytes, verifierAddress: By provision.indexer = indexerAddress.toHexString() provision.dataService = verifierAddress.toHexString() provision.tokensProvisioned = BigInt.fromI32(0) + provision.tokensAllocated = BigInt.fromI32(0) + provision.totalAllocationCount = BigInt.fromI32(0) + provision.allocationCount = 0 provision.tokensThawing = BigInt.fromI32(0) provision.createdAt = timestamp provision.maxVerifierCut = BigInt.fromI32(0) diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index 04c7a3c1..93608512 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -1,6 +1,8 @@ -import { ethereum, ValueKind, log } from "@graphprotocol/graph-ts" +import { BigDecimal, BigInt, ethereum, log } from "@graphprotocol/graph-ts" import { AllocationClosed, AllocationCreated, AllocationResized, RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" -import { createOrLoadProvision } from "./helpers/helpers" +import { createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadProvision, createOrLoadSubgraphDeployment } from "./helpers/helpers" +import { Allocation, GraphAccount, Indexer } from "../types/schema" +import { addresses } from "../../config/addresses" export function handleServiceProviderRegistered(event: ServiceProviderRegistered): void { let decodedCalldata = ethereum.decode('(string,string,address)', event.params.data) @@ -21,22 +23,147 @@ export function handleRewardsDestinationSet(event: RewardsDestinationSet): void provision.save() } -export function handleAllocationClosed(event: AllocationClosed): void { +export function handleAllocationCreated(event: AllocationCreated): void { + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + let subgraphDeploymentID = event.params.subgraphDeploymentId.toHexString() + let indexerID = event.params.indexer.toHexString() + let allocationID = event.params.allocationId.toHexString() + + // update indexer + let indexer = Indexer.load(indexerID)! + indexer.allocatedTokens = indexer.allocatedTokens.plus(event.params.tokens) + indexer.totalAllocationCount = indexer.totalAllocationCount.plus(BigInt.fromI32(1)) + indexer.allocationCount = indexer.allocationCount + 1 + indexer.save() + + // update provision let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) - // To Do + provision.tokensAllocated = provision.tokensAllocated.plus(event.params.tokens) + provision.totalAllocationCount = provision.totalAllocationCount.plus(BigInt.fromI32(1)) + provision.allocationCount = provision.allocationCount + 1 provision.save() + + // update graph network + graphNetwork.totalTokensAllocated = graphNetwork.totalTokensAllocated.plus(event.params.tokens) + graphNetwork.allocationCount = graphNetwork.allocationCount + 1 + graphNetwork.activeAllocationCount = graphNetwork.activeAllocationCount + 1 + graphNetwork.save() + + // update subgraph deployment + let deployment = createOrLoadSubgraphDeployment(subgraphDeploymentID, event.block.timestamp) + deployment.stakedTokens = deployment.stakedTokens.plus(event.params.tokens) + deployment.save() + + // create allocation + let allocation = new Allocation(allocationID) + allocation.indexer = indexerID + allocation.provision = provision.id + allocation.creator = event.transaction.from + allocation.activeForIndexer = indexerID + allocation.activeForProvision = provision.id + allocation.subgraphDeployment = subgraphDeploymentID + allocation.allocatedTokens = event.params.tokens + allocation.effectiveAllocation = BigInt.fromI32(0) + allocation.createdAtEpoch = event.params.currentEpoch.toI32() + allocation.createdAtBlockHash = event.block.hash + allocation.createdAtBlockNumber = ( + addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber! + ).toI32() + allocation.queryFeesCollected = BigInt.fromI32(0) + allocation.queryFeeRebates = BigInt.fromI32(0) + allocation.distributedRebates = BigInt.fromI32(0) + allocation.curatorRewards = BigInt.fromI32(0) + allocation.indexingRewards = BigInt.fromI32(0) + allocation.indexingIndexerRewards = BigInt.fromI32(0) + allocation.indexingDelegatorRewards = BigInt.fromI32(0) + allocation.delegationFees = BigInt.fromI32(0) + allocation.status = 'Active' + allocation.totalReturn = BigDecimal.fromString('0') + allocation.annualizedReturn = BigDecimal.fromString('0') + allocation.createdAt = event.block.timestamp.toI32() + allocation.indexingRewardCutAtStart = provision.indexingRewardsCut + allocation.indexingRewardEffectiveCutAtStart = provision.indexingRewardsCut.toBigDecimal() + allocation.queryFeeCutAtStart = provision.queryFeeCut + allocation.queryFeeEffectiveCutAtStart = provision.queryFeeCut.toBigDecimal() + allocation.save() } +export function handleAllocationClosed(event: AllocationClosed): void { + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + let indexerID = event.params.indexer.toHexString() + let allocationID = event.params.allocationId.toHexString() -export function handleAllocationCreated(event: AllocationCreated): void { + // update indexer + let indexer = Indexer.load(indexerID)! + const indexerAccount = GraphAccount.load(indexer.account)! + const closedByIndexer = event.transaction.from == event.params.indexer + const closedByOperator = indexerAccount.operators.includes(event.transaction.from.toHexString()) + + if (!closedByIndexer && !closedByOperator) { + indexer.forcedClosures = indexer.forcedClosures + 1 + } + indexer.allocatedTokens = indexer.allocatedTokens.minus(event.params.tokens) + indexer.allocationCount = indexer.allocationCount - 1 + indexer.save() + + // update provision let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) - // To Do + provision.tokensAllocated = provision.tokensAllocated.minus(event.params.tokens) + provision.allocationCount = provision.allocationCount - 1 provision.save() -} + // update allocation + let allocation = Allocation.load(allocationID)! + allocation.poolClosedIn = graphNetwork.currentEpoch + allocation.activeForIndexer = null + allocation.closedAtEpoch = graphNetwork.currentEpoch + allocation.closedAtBlockHash = event.block.hash + allocation.closedAtBlockNumber = ( + addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber! + ).toI32() + allocation.status = 'Closed' + allocation.closedAt = event.block.timestamp.toI32() + allocation.indexingRewardCutAtStart = provision.indexingRewardsCut + allocation.indexingRewardEffectiveCutAtStart = provision.indexingRewardsCut.toBigDecimal() + allocation.queryFeeCutAtStart = provision.queryFeeCut + allocation.queryFeeEffectiveCutAtStart = provision.queryFeeCut.toBigDecimal() + allocation.save() + + // update epoch - We do it here to have more epochs created, instead of seeing none created + // Likely this problem would go away with a live network with long epochs + let epoch = createOrLoadEpoch( + addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!, + ) + epoch.save() + + let subgraphDeploymentID = event.params.subgraphDeploymentId.toHexString() + let deployment = createOrLoadSubgraphDeployment(subgraphDeploymentID, event.block.timestamp) + deployment.stakedTokens = deployment.stakedTokens.minus(event.params.tokens) + deployment.save() + + // update graph network + graphNetwork.activeAllocationCount = graphNetwork.activeAllocationCount - 1 + graphNetwork.totalTokensAllocated = graphNetwork.totalTokensAllocated.minus(event.params.tokens) + graphNetwork.save() +} export function handleAllocationResized(event: AllocationResized): void { + let allocationID = event.params.allocationId.toHexString() + let indexerID = event.params.indexer.toHexString() + let diffTokens = event.params.newTokens.minus(event.params.oldTokens) + + // update indexer + let indexer = Indexer.load(indexerID)! + indexer.allocatedTokens = indexer.allocatedTokens.plus(diffTokens) + indexer.save() + + // update provision let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) - // To Do + provision.tokensAllocated = provision.tokensAllocated.plus(diffTokens) provision.save() + + // update allocation + let allocation = Allocation.load(allocationID)! + allocation.allocatedTokens = event.params.newTokens + allocation.save() } From 371208d35cbe12c01eae3e107ba29033dccc8b5f Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Mon, 24 Feb 2025 04:17:01 -0300 Subject: [PATCH 23/39] fix: build issues --- src/mappings/subgraphService.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index 93608512..d0342038 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -81,9 +81,9 @@ export function handleAllocationCreated(event: AllocationCreated): void { allocation.totalReturn = BigDecimal.fromString('0') allocation.annualizedReturn = BigDecimal.fromString('0') allocation.createdAt = event.block.timestamp.toI32() - allocation.indexingRewardCutAtStart = provision.indexingRewardsCut + allocation.indexingRewardCutAtStart = provision.indexingRewardsCut.toI32() allocation.indexingRewardEffectiveCutAtStart = provision.indexingRewardsCut.toBigDecimal() - allocation.queryFeeCutAtStart = provision.queryFeeCut + allocation.queryFeeCutAtStart = provision.queryFeeCut.toI32() allocation.queryFeeEffectiveCutAtStart = provision.queryFeeCut.toBigDecimal() allocation.save() } @@ -114,7 +114,7 @@ export function handleAllocationClosed(event: AllocationClosed): void { // update allocation let allocation = Allocation.load(allocationID)! - allocation.poolClosedIn = graphNetwork.currentEpoch + allocation.poolClosedIn = graphNetwork.currentEpoch.toString() allocation.activeForIndexer = null allocation.closedAtEpoch = graphNetwork.currentEpoch allocation.closedAtBlockHash = event.block.hash @@ -123,9 +123,9 @@ export function handleAllocationClosed(event: AllocationClosed): void { ).toI32() allocation.status = 'Closed' allocation.closedAt = event.block.timestamp.toI32() - allocation.indexingRewardCutAtStart = provision.indexingRewardsCut + allocation.indexingRewardCutAtStart = provision.indexingRewardsCut.toI32() allocation.indexingRewardEffectiveCutAtStart = provision.indexingRewardsCut.toBigDecimal() - allocation.queryFeeCutAtStart = provision.queryFeeCut + allocation.queryFeeCutAtStart = provision.queryFeeCut.toI32() allocation.queryFeeEffectiveCutAtStart = provision.queryFeeCut.toBigDecimal() allocation.save() From c32f56c355eb650d3b9bb19d7ebad4dd1eec68d4 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Mon, 24 Feb 2025 04:27:07 -0300 Subject: [PATCH 24/39] chore: placeholder handler definition --- src/mappings/subgraphService.ts | 14 +++++++++++++- subgraph.template.yaml | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index d0342038..73d47f67 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -1,5 +1,5 @@ import { BigDecimal, BigInt, ethereum, log } from "@graphprotocol/graph-ts" -import { AllocationClosed, AllocationCreated, AllocationResized, RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" +import { AllocationClosed, AllocationCreated, AllocationResized, IndexingRewardsCollected, QueryFeesCollected, RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" import { createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadProvision, createOrLoadSubgraphDeployment } from "./helpers/helpers" import { Allocation, GraphAccount, Indexer } from "../types/schema" import { addresses } from "../../config/addresses" @@ -167,3 +167,15 @@ export function handleAllocationResized(event: AllocationResized): void { allocation.allocatedTokens = event.params.newTokens allocation.save() } + +export function handleIndexingRewardsCollected(event: IndexingRewardsCollected): void { + let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) + // To Do + provision.save() +} + +export function handleQueryFeesCollected(event: QueryFeesCollected): void { + let provision = createOrLoadProvision(event.params.serviceProvider, event.address, event.block.timestamp) + // To Do + provision.save() +} diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 1c8d28b3..18bfa2e0 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -461,6 +461,10 @@ dataSources: handler: handleAllocationResized - event: AllocationClosed(indexed address,indexed address,indexed bytes32,uint256) handler: handleAllocationClosed + - event: IndexingRewardsCollected(indexed address,indexed address,indexed bytes32,uint256,uint256,uint256,bytes32,uint256) + handler: handleIndexingRewardsCollected + - event: QueryFeesCollected(indexed address,uint256,uint256) + handler: handleQueryFeesCollected - kind: ethereum/contract name: Curation network: {{network}} From 79f5e7aec396a05bcf336daffdadcc4298b08c37 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Tue, 25 Feb 2025 02:04:27 -0300 Subject: [PATCH 25/39] feat: added indexing rewards collection handler --- schema.graphql | 8 ++++ src/mappings/horizonStaking.ts | 9 +++- src/mappings/subgraphService.ts | 76 ++++++++++++++++++++++++++++++--- 3 files changed, 86 insertions(+), 7 deletions(-) diff --git a/schema.graphql b/schema.graphql index 0ca6b80c..99e1dcfd 100644 --- a/schema.graphql +++ b/schema.graphql @@ -900,6 +900,14 @@ type Provision @entity { # Might want to add polymorphic handling of different fee cuts through a generic hashmap in the future + # Indexing rewards. Keeping the same naming from Indexer entity to make it easier to understand + "Total indexing rewards earned by this indexer. Including delegation rewards" + rewardsEarned: BigInt! + "The total amount of indexing rewards the indexer kept" + indexerIndexingRewards: BigInt! + "The total amount of indexing rewards given to delegators" + delegatorIndexingRewards: BigInt! + # Delegation "Tokens delegated to the provision" delegatedTokens: BigInt! diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 0af83856..3253cea6 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -2,7 +2,7 @@ import { BigInt } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' import { DelegationFeeCutSet, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, TokensDeprovisioned, TokensToDelegationPoolAdded } from '../types/HorizonStaking/HorizonStaking' import { Indexer, ThawRequest } from '../types/schema' -import { createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision } from './helpers/helpers' +import { createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision, updateDelegationExchangeRate } from './helpers/helpers' import { ProvisionCreated, ProvisionIncreased, @@ -265,11 +265,18 @@ export function handleThawRequestFulfilled(event: ThawRequestFulfilled): void { } export function handleTokensToDelegationPoolAdded(event: TokensToDelegationPoolAdded): void { + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) let indexer = Indexer.load(event.params.serviceProvider.toHexString())! let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) provision.delegatedTokens = provision.delegatedTokens.plus(event.params.tokens) provision.save() indexer.delegatedTokens = indexer.delegatedTokens.plus(event.params.tokens) // this only serves as a general tracker, but the real deal is per provision + if (indexer.delegatorShares != BigInt.fromI32(0)) { + indexer = updateDelegationExchangeRate(indexer as Indexer) + } indexer.save() + + graphNetwork.totalDelegatedTokens = graphNetwork.totalDelegatedTokens.plus(event.params.tokens) + graphNetwork.save() } \ No newline at end of file diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index 73d47f67..e1756e92 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -1,12 +1,12 @@ import { BigDecimal, BigInt, ethereum, log } from "@graphprotocol/graph-ts" import { AllocationClosed, AllocationCreated, AllocationResized, IndexingRewardsCollected, QueryFeesCollected, RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" -import { createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadProvision, createOrLoadSubgraphDeployment } from "./helpers/helpers" -import { Allocation, GraphAccount, Indexer } from "../types/schema" +import { createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadProvision, createOrLoadSubgraphDeployment, joinID, updateDelegationExchangeRate } from "./helpers/helpers" +import { Allocation, GraphAccount, Indexer, PoiSubmission } from "../types/schema" import { addresses } from "../../config/addresses" export function handleServiceProviderRegistered(event: ServiceProviderRegistered): void { let decodedCalldata = ethereum.decode('(string,string,address)', event.params.data) - if( decodedCalldata != null && decodedCalldata.kind == ethereum.ValueKind.TUPLE) { + if (decodedCalldata != null && decodedCalldata.kind == ethereum.ValueKind.TUPLE) { let tupleData = decodedCalldata.toTuple() let provision = createOrLoadProvision(event.params.serviceProvider, event.address, event.block.timestamp) provision.url = tupleData[0].toString() @@ -169,13 +169,77 @@ export function handleAllocationResized(event: AllocationResized): void { } export function handleIndexingRewardsCollected(event: IndexingRewardsCollected): void { + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + let indexerID = event.params.indexer.toHexString() + let allocationID = event.params.allocationId.toHexString() + + // update indexer + let indexer = Indexer.load(indexerID)! + indexer.rewardsEarned = indexer.rewardsEarned.plus(event.params.tokensRewards) + indexer.indexerIndexingRewards = indexer.indexerIndexingRewards.plus(event.params.tokensIndexerRewards) + indexer.delegatorIndexingRewards = indexer.delegatorIndexingRewards.plus(event.params.tokensDelegationRewards) + indexer.save() + + // update provision let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) - // To Do + provision.rewardsEarned = provision.rewardsEarned.plus(event.params.tokensRewards) + provision.indexerIndexingRewards = provision.indexerIndexingRewards.plus(event.params.tokensIndexerRewards) + provision.delegatorIndexingRewards = provision.delegatorIndexingRewards.plus(event.params.tokensDelegationRewards) + // No need to update delegated tokens, as that happens in handleTokensToDelegationPoolAdded provision.save() + + // update allocation + let allocation = Allocation.load(allocationID)! + allocation.indexingRewards = allocation.indexingRewards.plus(event.params.tokensRewards) + allocation.indexingIndexerRewards = allocation.indexingIndexerRewards.plus(event.params.tokensIndexerRewards) + allocation.indexingDelegatorRewards = allocation.indexingDelegatorRewards.plus( + event.params.tokensDelegationRewards, + ) + allocation.save() + + // Create PoI submission + let poiSubmission = new PoiSubmission(joinID([event.transaction.hash.toHexString(), event.logIndex.toString()])) + poiSubmission.allocation = allocation.id + poiSubmission.poi = event.params.poi + poiSubmission.submittedAtEpoch = event.params.currentEpoch.toI32() + poiSubmission.save() + + // Update epoch + let epoch = createOrLoadEpoch((addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!)) + epoch.totalRewards = epoch.totalRewards.plus(event.params.tokensRewards) + epoch.totalIndexerRewards = epoch.totalIndexerRewards.plus(event.params.tokensIndexerRewards) + epoch.totalDelegatorRewards = epoch.totalDelegatorRewards.plus(event.params.tokensDelegationRewards) + epoch.save() + + // update subgraph deployment + let subgraphDeploymentID = allocation.subgraphDeployment + let subgraphDeployment = createOrLoadSubgraphDeployment( + subgraphDeploymentID, + event.block.timestamp, + ) + subgraphDeployment.indexingRewardAmount = subgraphDeployment.indexingRewardAmount.plus( + event.params.tokensRewards, + ) + subgraphDeployment.indexingIndexerRewardAmount = subgraphDeployment.indexingIndexerRewardAmount.plus( + event.params.tokensIndexerRewards, + ) + subgraphDeployment.indexingDelegatorRewardAmount = subgraphDeployment.indexingDelegatorRewardAmount.plus( + event.params.tokensDelegationRewards, + ) + subgraphDeployment.save() + + // update graph network + graphNetwork.totalIndexingRewards = graphNetwork.totalIndexingRewards.plus(event.params.tokensRewards) + graphNetwork.totalIndexingIndexerRewards = graphNetwork.totalIndexingIndexerRewards.plus( + event.params.tokensIndexerRewards, + ) + graphNetwork.totalIndexingDelegatorRewards = graphNetwork.totalIndexingDelegatorRewards.plus( + event.params.tokensDelegationRewards, + ) + // No need to update delegated tokens, as that happens in handleTokensToDelegationPoolAdded + graphNetwork.save() } export function handleQueryFeesCollected(event: QueryFeesCollected): void { - let provision = createOrLoadProvision(event.params.serviceProvider, event.address, event.block.timestamp) // To Do - provision.save() } From 1c4873a3248d2cecf214cc6a40b81f807ef334b9 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Wed, 26 Feb 2025 04:10:35 -0300 Subject: [PATCH 26/39] feat: add QueryFeesCollected support --- abis/HorizonStaking.json | 4860 +++++++++++++++---------------- abis/SubgraphService.json | 4511 ++++++++++++++-------------- schema.graphql | 4 + src/mappings/subgraphService.ts | 71 +- subgraph.template.yaml | 2 +- 5 files changed, 4745 insertions(+), 4703 deletions(-) diff --git a/abis/HorizonStaking.json b/abis/HorizonStaking.json index 6472aeaa..67eb616b 100644 --- a/abis/HorizonStaking.json +++ b/abis/HorizonStaking.json @@ -1,2431 +1,2431 @@ [ - { - "inputs": [ - { - "internalType": "address", - "name": "controller", - "type": "address" - }, - { - "internalType": "address", - "name": "stakingExtensionAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "subgraphDataServiceAddress", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "AddressEmptyCode", - "type": "error" - }, - { - "inputs": [], - "name": "FailedInnerCall", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "contractName", - "type": "bytes" - } - ], - "name": "GraphDirectoryInvalidZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "HorizonStakingCallerIsServiceProvider", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minTokens", - "type": "uint256" - } - ], - "name": "HorizonStakingInsufficientDelegationTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minTokens", - "type": "uint256" - } - ], - "name": "HorizonStakingInsufficientIdleStake", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShares", - "type": "uint256" - } - ], - "name": "HorizonStakingInsufficientShares", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minTokens", - "type": "uint256" - } - ], - "name": "HorizonStakingInsufficientStakeForLegacyAllocations", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minRequired", - "type": "uint256" - } - ], - "name": "HorizonStakingInsufficientTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "feeCut", - "type": "uint256" - } - ], - "name": "HorizonStakingInvalidDelegationFeeCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "HorizonStakingInvalidDelegationPool", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "HorizonStakingInvalidDelegationPoolState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "maxVerifierCut", - "type": "uint32" - } - ], - "name": "HorizonStakingInvalidMaxVerifierCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "HorizonStakingInvalidProvision", - "type": "error" - }, - { - "inputs": [], - "name": "HorizonStakingInvalidServiceProviderZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "HorizonStakingInvalidThawRequestType", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "thawingPeriod", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "maxThawingPeriod", - "type": "uint64" - } - ], - "name": "HorizonStakingInvalidThawingPeriod", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "HorizonStakingInvalidVerifier", - "type": "error" - }, - { - "inputs": [], - "name": "HorizonStakingInvalidVerifierZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "HorizonStakingInvalidZeroShares", - "type": "error" - }, - { - "inputs": [], - "name": "HorizonStakingInvalidZeroTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "address", - "name": "caller", - "type": "address" - } - ], - "name": "HorizonStakingNotAuthorized", - "type": "error" - }, - { - "inputs": [], - "name": "HorizonStakingNothingThawing", - "type": "error" - }, - { - "inputs": [], - "name": "HorizonStakingProvisionAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minShares", - "type": "uint256" - } - ], - "name": "HorizonStakingSlippageProtection", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "until", - "type": "uint256" - } - ], - "name": "HorizonStakingStillThawing", - "type": "error" - }, - { - "inputs": [], - "name": "HorizonStakingTooManyThawRequests", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTokens", - "type": "uint256" - } - ], - "name": "HorizonStakingTooManyTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "HorizonStakingVerifierNotAllowed", - "type": "error" - }, - { - "inputs": [], - "name": "LinkedListEmptyList", - "type": "error" - }, - { - "inputs": [], - "name": "LinkedListInvalidIterations", - "type": "error" - }, - { - "inputs": [], - "name": "LinkedListInvalidZeroId", - "type": "error" - }, - { - "inputs": [], - "name": "LinkedListMaxElementsExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "ManagedIsPaused", - "type": "error" - }, - { - "inputs": [], - "name": "ManagedOnlyController", - "type": "error" - }, - { - "inputs": [], - "name": "ManagedOnlyGovernor", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "PPMMathInvalidMulPPM", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "allowed", - "type": "bool" - } - ], - "name": "AllowedLockedVerifierSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "DelegatedTokensWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": true, - "internalType": "enum IGraphPayments.PaymentTypes", - "name": "paymentType", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "feeCut", - "type": "uint256" - } - ], - "name": "DelegationFeeCutSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "DelegationSlashed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "DelegationSlashingEnabled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "DelegationSlashingSkipped", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "graphToken", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "graphStaking", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphPayments", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphEscrow", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "graphController", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphEpochManager", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphRewardsManager", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphTokenGateway", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphProxyAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphCuration", - "type": "address" - } - ], - "name": "GraphDirectoryInitialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "HorizonStakeDeposited", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "until", - "type": "uint256" - } - ], - "name": "HorizonStakeLocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "HorizonStakeWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint64", - "name": "maxThawingPeriod", - "type": "uint64" - } - ], - "name": "MaxThawingPeriodSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "allowed", - "type": "bool" - } - ], - "name": "OperatorSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "maxVerifierCut", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "thawingPeriod", - "type": "uint64" - } - ], - "name": "ProvisionCreated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "ProvisionIncreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "maxVerifierCut", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "thawingPeriod", - "type": "uint64" - } - ], - "name": "ProvisionParametersSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "maxVerifierCut", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "thawingPeriod", - "type": "uint64" - } - ], - "name": "ProvisionParametersStaged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "ProvisionSlashed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "ProvisionThawed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "StakeDelegatedWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "enum IHorizonStakingTypes.ThawRequestType", - "name": "requestType", - "type": "uint8" - }, - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "thawingUntil", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "thawRequestId", - "type": "bytes32" - } - ], - "name": "ThawRequestCreated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "enum IHorizonStakingTypes.ThawRequestType", - "name": "requestType", - "type": "uint8" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "thawRequestId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "thawingUntil", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "bool", - "name": "valid", - "type": "bool" - } - ], - "name": "ThawRequestFulfilled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "enum IHorizonStakingTypes.ThawRequestType", - "name": "requestType", - "type": "uint8" - }, - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "thawRequestsFulfilled", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "ThawRequestsFulfilled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "ThawingPeriodCleared", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "name": "TokensDelegated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "TokensDeprovisioned", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "TokensToDelegationPoolAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "TokensUndelegated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "destination", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "VerifierTokensSent", - "type": "event" - }, - { - "stateMutability": "nonpayable", - "type": "fallback" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - } - ], - "name": "acceptProvisionParameters", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IGraphProxy", - "name": "_proxy", - "type": "address" - } - ], - "name": "acceptProxy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract IGraphProxy", - "name": "_proxy", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "acceptProxyAndCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "addToDelegationPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "addToProvision", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "clearThawingPeriod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minSharesOut", - "type": "uint256" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nThawRequests", - "type": "uint256" - } - ], - "name": "deprovision", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "getDelegatedTokensAvailable", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "address", - "name": "delegator", - "type": "address" - } - ], - "name": "getDelegation", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "internalType": "struct IHorizonStakingTypes.Delegation", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "enum IGraphPayments.PaymentTypes", - "name": "paymentType", - "type": "uint8" - } - ], - "name": "getDelegationFeeCut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "getDelegationPool", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensThawing", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sharesThawing", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "thawingNonce", - "type": "uint256" - } - ], - "internalType": "struct IHorizonStakingTypes.DelegationPool", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - } - ], - "name": "getIdleStake", - "outputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxThawingPeriod", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "getProviderTokensAvailable", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "getProvision", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensThawing", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "sharesThawing", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "maxVerifierCut", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "thawingPeriod", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "createdAt", - "type": "uint64" - }, - { - "internalType": "uint32", - "name": "maxVerifierCutPending", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "thawingPeriodPending", - "type": "uint64" - }, - { - "internalType": "uint256", - "name": "thawingNonce", - "type": "uint256" - } - ], - "internalType": "struct IHorizonStakingTypes.Provision", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - } - ], - "name": "getServiceProvider", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokensStaked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensProvisioned", - "type": "uint256" - } - ], - "internalType": "struct IHorizonStakingTypes.ServiceProvider", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - } - ], - "name": "getStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum IHorizonStakingTypes.ThawRequestType", - "name": "requestType", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "thawRequestId", - "type": "bytes32" - } - ], - "name": "getThawRequest", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - }, - { - "internalType": "uint64", - "name": "thawingUntil", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "next", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "thawingNonce", - "type": "uint256" - } - ], - "internalType": "struct IHorizonStakingTypes.ThawRequest", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum IHorizonStakingTypes.ThawRequestType", - "name": "requestType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "getThawRequestList", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "head", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "tail", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "count", - "type": "uint256" - } - ], - "internalType": "struct LinkedList.List", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum IHorizonStakingTypes.ThawRequestType", - "name": "requestType", - "type": "uint8" - }, - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "getThawedTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint32", - "name": "delegationRatio", - "type": "uint32" - } - ], - "name": "getTokensAvailable", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "verifier", - "type": "address" - } - ], - "name": "isAllowedLockedVerifier", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isAuthorized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isDelegationSlashingEnabled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "maxVerifierCut", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "thawingPeriod", - "type": "uint64" - } - ], - "name": "provision", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "maxVerifierCut", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "thawingPeriod", - "type": "uint64" - } - ], - "name": "provisionLocked", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "oldServiceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "oldVerifier", - "type": "address" - }, - { - "internalType": "address", - "name": "newServiceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "newVerifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "minSharesForNewProvider", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nThawRequests", - "type": "uint256" - } - ], - "name": "redelegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "oldVerifier", - "type": "address" - }, - { - "internalType": "address", - "name": "newVerifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nThawRequests", - "type": "uint256" - } - ], - "name": "reprovision", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowed", - "type": "bool" - } - ], - "name": "setAllowedLockedVerifier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "enum IGraphPayments.PaymentTypes", - "name": "paymentType", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "feeCut", - "type": "uint256" - } - ], - "name": "setDelegationFeeCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "setDelegationSlashingEnabled", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "maxThawingPeriod", - "type": "uint64" - } - ], - "name": "setMaxThawingPeriod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowed", - "type": "bool" - } - ], - "name": "setOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowed", - "type": "bool" - } - ], - "name": "setOperatorLocked", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint32", - "name": "newMaxVerifierCut", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "newThawingPeriod", - "type": "uint64" - } - ], - "name": "setProvisionParameters", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensVerifier", - "type": "uint256" - }, - { - "internalType": "address", - "name": "verifierDestination", - "type": "address" - } - ], - "name": "slash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "stakeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "stakeToProvision", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "thaw", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "name": "undelegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "shares", - "type": "uint256" - } - ], - "name": "undelegate", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "unstake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "verifier", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nThawRequests", - "type": "uint256" - } - ], - "name": "withdrawDelegated", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "withdrawDelegated", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } - ] \ No newline at end of file + { + "inputs": [ + { + "internalType": "address", + "name": "controller", + "type": "address" + }, + { + "internalType": "address", + "name": "stakingExtensionAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "subgraphDataServiceAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "contractName", + "type": "bytes" + } + ], + "name": "GraphDirectoryInvalidZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingCallerIsServiceProvider", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTokens", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientDelegationTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTokens", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientIdleStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minShares", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientShares", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTokens", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientStakeForLegacyAllocations", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minRequired", + "type": "uint256" + } + ], + "name": "HorizonStakingInsufficientTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "feeCut", + "type": "uint256" + } + ], + "name": "HorizonStakingInvalidDelegationFeeCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingInvalidDelegationPool", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingInvalidDelegationPoolState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + } + ], + "name": "HorizonStakingInvalidMaxVerifierCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingInvalidProvision", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidServiceProviderZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidThawRequestType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "maxThawingPeriod", + "type": "uint64" + } + ], + "name": "HorizonStakingInvalidThawingPeriod", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingInvalidVerifier", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidVerifierZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidZeroShares", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingInvalidZeroTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "HorizonStakingNotAuthorized", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingNothingThawing", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingProvisionAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minShares", + "type": "uint256" + } + ], + "name": "HorizonStakingSlippageProtection", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "until", + "type": "uint256" + } + ], + "name": "HorizonStakingStillThawing", + "type": "error" + }, + { + "inputs": [], + "name": "HorizonStakingTooManyThawRequests", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTokens", + "type": "uint256" + } + ], + "name": "HorizonStakingTooManyTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "HorizonStakingVerifierNotAllowed", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListEmptyList", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListInvalidIterations", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListInvalidZeroId", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListMaxElementsExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "ManagedIsPaused", + "type": "error" + }, + { + "inputs": [], + "name": "ManagedOnlyController", + "type": "error" + }, + { + "inputs": [], + "name": "ManagedOnlyGovernor", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "PPMMathInvalidMulPPM", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "AllowedLockedVerifierSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "DelegatedTokensWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeCut", + "type": "uint256" + } + ], + "name": "DelegationFeeCutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "DelegationSlashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "DelegationSlashingEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "DelegationSlashingSkipped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "graphToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "graphStaking", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphPayments", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphEscrow", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "graphController", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphEpochManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphRewardsManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphTokenGateway", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphProxyAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphCuration", + "type": "address" + } + ], + "name": "GraphDirectoryInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "HorizonStakeDeposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "until", + "type": "uint256" + } + ], + "name": "HorizonStakeLocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "HorizonStakeWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "maxThawingPeriod", + "type": "uint64" + } + ], + "name": "MaxThawingPeriodSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "OperatorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "ProvisionCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ProvisionIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "ProvisionParametersSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "ProvisionParametersStaged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ProvisionSlashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ProvisionThawed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "StakeDelegatedWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingUntil", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "thawRequestId", + "type": "bytes32" + } + ], + "name": "ThawRequestCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "thawRequestId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "thawingUntil", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "bool", + "name": "valid", + "type": "bool" + } + ], + "name": "ThawRequestFulfilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "thawRequestsFulfilled", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ThawRequestsFulfilled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "ThawingPeriodCleared", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "TokensDelegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "TokensDeprovisioned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "TokensToDelegationPoolAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "TokensUndelegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "VerifierTokensSent", + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "fallback" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "acceptProvisionParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IGraphProxy", + "name": "_proxy", + "type": "address" + } + ], + "name": "acceptProxy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IGraphProxy", + "name": "_proxy", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "acceptProxyAndCall", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "addToDelegationPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "addToProvision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "clearThawingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nThawRequests", + "type": "uint256" + } + ], + "name": "deprovision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "getDelegatedTokensAvailable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "delegator", + "type": "address" + } + ], + "name": "getDelegation", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.Delegation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + } + ], + "name": "getDelegationFeeCut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "getDelegationPool", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensThawing", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sharesThawing", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "thawingNonce", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.DelegationPool", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "getIdleStake", + "outputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxThawingPeriod", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "getProviderTokensAvailable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "getProvision", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensThawing", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sharesThawing", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "createdAt", + "type": "uint64" + }, + { + "internalType": "uint32", + "name": "maxVerifierCutPending", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "thawingPeriodPending", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "thawingNonce", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.Provision", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "getServiceProvider", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokensStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensProvisioned", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.ServiceProvider", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "getStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "thawRequestId", + "type": "bytes32" + } + ], + "name": "getThawRequest", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "uint64", + "name": "thawingUntil", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "next", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "thawingNonce", + "type": "uint256" + } + ], + "internalType": "struct IHorizonStakingTypes.ThawRequest", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "getThawRequestList", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "head", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "tail", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "internalType": "struct LinkedList.List", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum IHorizonStakingTypes.ThawRequestType", + "name": "requestType", + "type": "uint8" + }, + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "getThawedTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint32", + "name": "delegationRatio", + "type": "uint32" + } + ], + "name": "getTokensAvailable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + } + ], + "name": "isAllowedLockedVerifier", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isAuthorized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isDelegationSlashingEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "provision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "maxVerifierCut", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "thawingPeriod", + "type": "uint64" + } + ], + "name": "provisionLocked", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "oldServiceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "oldVerifier", + "type": "address" + }, + { + "internalType": "address", + "name": "newServiceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "newVerifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesForNewProvider", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nThawRequests", + "type": "uint256" + } + ], + "name": "redelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "oldVerifier", + "type": "address" + }, + { + "internalType": "address", + "name": "newVerifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nThawRequests", + "type": "uint256" + } + ], + "name": "reprovision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "setAllowedLockedVerifier", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "feeCut", + "type": "uint256" + } + ], + "name": "setDelegationFeeCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "setDelegationSlashingEnabled", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "maxThawingPeriod", + "type": "uint64" + } + ], + "name": "setMaxThawingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "setOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "setOperatorLocked", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint32", + "name": "newMaxVerifierCut", + "type": "uint32" + }, + { + "internalType": "uint64", + "name": "newThawingPeriod", + "type": "uint64" + } + ], + "name": "setProvisionParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensVerifier", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifierDestination", + "type": "address" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "stakeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "stakeToProvision", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "thaw", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "undelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "undelegate", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "unstake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "verifier", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nThawRequests", + "type": "uint256" + } + ], + "name": "withdrawDelegated", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "withdrawDelegated", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] \ No newline at end of file diff --git a/abis/SubgraphService.json b/abis/SubgraphService.json index f2ffdcc6..3fa424a0 100644 --- a/abis/SubgraphService.json +++ b/abis/SubgraphService.json @@ -1,2271 +1,2242 @@ [ - { - "inputs": [ - { - "internalType": "address", - "name": "graphController", - "type": "address" - }, - { - "internalType": "address", - "name": "disputeManager", - "type": "address" - }, - { - "internalType": "address", - "name": "graphTallyCollector", - "type": "address" - }, - { - "internalType": "address", - "name": "curation", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "target", - "type": "address" - } - ], - "name": "AddressEmptyCode", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "AllocationAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - }, - { - "internalType": "uint256", - "name": "closedAt", - "type": "uint256" - } - ], - "name": "AllocationClosed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "AllocationDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "AllocationManagerAllocationClosed", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "AllocationManagerAllocationSameSize", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "signer", - "type": "address" - }, - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "AllocationManagerInvalidAllocationProof", - "type": "error" - }, - { - "inputs": [], - "name": "AllocationManagerInvalidZeroAllocationId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "claimId", - "type": "bytes32" - } - ], - "name": "DataServiceFeesClaimNotFound", - "type": "error" - }, - { - "inputs": [], - "name": "DataServiceFeesZeroTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "DataServicePausableNotPauseGuardian", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowed", - "type": "bool" - } - ], - "name": "DataServicePausablePauseGuardianNoChange", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "internalType": "address", - "name": "disputeManager", - "type": "address" - } - ], - "name": "DirectoryNotDisputeManager", - "type": "error" - }, - { - "inputs": [], - "name": "ECDSAInvalidSignature", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "length", - "type": "uint256" - } - ], - "name": "ECDSAInvalidSignatureLength", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "ECDSAInvalidSignatureS", - "type": "error" - }, - { - "inputs": [], - "name": "EnforcedPause", - "type": "error" - }, - { - "inputs": [], - "name": "ExpectedPause", - "type": "error" - }, - { - "inputs": [], - "name": "FailedInnerCall", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "contractName", - "type": "bytes" - } - ], - "name": "GraphDirectoryInvalidZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidInitialization", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "LegacyAllocationAlreadyExists", - "type": "error" - }, - { - "inputs": [], - "name": "LinkedListEmptyList", - "type": "error" - }, - { - "inputs": [], - "name": "LinkedListInvalidIterations", - "type": "error" - }, - { - "inputs": [], - "name": "LinkedListInvalidZeroId", - "type": "error" - }, - { - "inputs": [], - "name": "LinkedListMaxElementsExceeded", - "type": "error" - }, - { - "inputs": [], - "name": "NotInitializing", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "OwnableInvalidOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "OwnableUnauthorizedAccount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "a", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "b", - "type": "uint256" - } - ], - "name": "PPMMathInvalidMulPPM", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "name": "ProvisionManagerInvalidRange", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "message", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "name": "ProvisionManagerInvalidValue", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "caller", - "type": "address" - } - ], - "name": "ProvisionManagerNotAuthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - } - ], - "name": "ProvisionManagerProvisionNotFound", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokensAvailable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "tokensRequired", - "type": "uint256" - } - ], - "name": "ProvisionTrackerInsufficientTokens", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "SubgraphServiceAllocationIsAltruistic", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "SubgraphServiceAllocationNotAuthorized", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "SubgraphServiceCannotForceCloseAllocation", - "type": "error" - }, - { - "inputs": [], - "name": "SubgraphServiceEmptyGeohash", - "type": "error" - }, - { - "inputs": [], - "name": "SubgraphServiceEmptyUrl", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balanceBefore", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "balanceAfter", - "type": "uint256" - } - ], - "name": "SubgraphServiceInconsistentCollection", - "type": "error" - }, - { - "inputs": [], - "name": "SubgraphServiceIndexerAlreadyRegistered", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "providedIndexer", - "type": "address" - }, - { - "internalType": "address", - "name": "expectedIndexer", - "type": "address" - } - ], - "name": "SubgraphServiceIndexerMismatch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - } - ], - "name": "SubgraphServiceIndexerNotRegistered", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "collectionId", - "type": "bytes32" - } - ], - "name": "SubgraphServiceInvalidCollectionId", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "curationCut", - "type": "uint256" - } - ], - "name": "SubgraphServiceInvalidCurationCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum IGraphPayments.PaymentTypes", - "name": "paymentType", - "type": "uint8" - } - ], - "name": "SubgraphServiceInvalidPaymentType", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "ravIndexer", - "type": "address" - }, - { - "internalType": "address", - "name": "allocationIndexer", - "type": "address" - } - ], - "name": "SubgraphServiceInvalidRAV", - "type": "error" - }, - { - "inputs": [], - "name": "SubgraphServiceInvalidZeroStakeToFeesRatio", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "allocationId", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "subgraphDeploymentId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "AllocationClosed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "allocationId", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "subgraphDeploymentId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "currentEpoch", - "type": "uint256" - } - ], - "name": "AllocationCreated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "allocationId", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "subgraphDeploymentId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newTokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "oldTokens", - "type": "uint256" - } - ], - "name": "AllocationResized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "curationCut", - "type": "uint256" - } - ], - "name": "CurationCutSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "ratio", - "type": "uint32" - } - ], - "name": "DelegationRatioSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "EIP712DomainChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "graphToken", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "graphStaking", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphPayments", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphEscrow", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "graphController", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphEpochManager", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphRewardsManager", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphTokenGateway", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphProxyAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphCuration", - "type": "address" - } - ], - "name": "GraphDirectoryInitialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "allocationId", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "subgraphDeploymentId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokensRewards", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokensIndexerRewards", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokensDelegationRewards", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "poi", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "currentEpoch", - "type": "uint256" - } - ], - "name": "IndexingRewardsCollected", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint64", - "name": "version", - "type": "uint64" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "allocationId", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "subgraphDeploymentId", - "type": "bytes32" - } - ], - "name": "LegacyAllocationMigrated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "maxPOIStaleness", - "type": "uint256" - } - ], - "name": "MaxPOIStalenessSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "allowed", - "type": "bool" - } - ], - "name": "PauseGuardianSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - } - ], - "name": "ProvisionPendingParametersAccepted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "min", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "max", - "type": "uint256" - } - ], - "name": "ProvisionTokensRangeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokensCollected", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokensCurators", - "type": "uint256" - } - ], - "name": "QueryFeesCollected", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "rewardsDestination", - "type": "address" - } - ], - "name": "RewardsDestinationSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "enum IGraphPayments.PaymentTypes", - "name": "feeType", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "ServicePaymentCollected", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "ServiceProviderRegistered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "ServiceProviderSlashed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "ServiceStarted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "ServiceStopped", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "claimId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "unlockTimestamp", - "type": "uint256" - } - ], - "name": "StakeClaimLocked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "claimId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "releasableAt", - "type": "uint256" - } - ], - "name": "StakeClaimReleased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "serviceProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "claimsCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokensReleased", - "type": "uint256" - } - ], - "name": "StakeClaimsReleased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "ratio", - "type": "uint256" - } - ], - "name": "StakeToFeesRatioSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "subgraphService", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "disputeManager", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "graphTallyCollector", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "curation", - "type": "address" - } - ], - "name": "SubgraphServiceDirectoryInitialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint64", - "name": "min", - "type": "uint64" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "max", - "type": "uint64" - } - ], - "name": "ThawingPeriodRangeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint32", - "name": "min", - "type": "uint32" - }, - { - "indexed": false, - "internalType": "uint32", - "name": "max", - "type": "uint32" - } - ], - "name": "VerifierCutRangeSet", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "acceptProvisionPendingParameters", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - } - ], - "name": "allocationProvisionTracker", - "outputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "claimId", - "type": "bytes32" - } - ], - "name": "claims", - "outputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "releasableAt", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "nextClaim", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - } - ], - "name": "claimsLists", - "outputs": [ - { - "internalType": "bytes32", - "name": "head", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "tail", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "count", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "closeStaleAllocation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "enum IGraphPayments.PaymentTypes", - "name": "paymentType", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "collect", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "curationFeesCut", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "delegationRatio", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip712Domain", - "outputs": [ - { - "internalType": "bytes1", - "name": "fields", - "type": "bytes1" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "verifyingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "extensions", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "encodeAllocationProof", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "serviceProvider", - "type": "address" - } - ], - "name": "feesProvisionTracker", - "outputs": [ - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "getAllocation", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "subgraphDeploymentId", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "closedAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastPOIPresentedAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accRewardsPerAllocatedToken", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accRewardsPending", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "createdAtEpoch", - "type": "uint256" - } - ], - "internalType": "struct Allocation.State", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "getAllocationData", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getDelegationRatio", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "allocationId", - "type": "address" - } - ], - "name": "getLegacyAllocation", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "subgraphDeploymentId", - "type": "bytes32" - } - ], - "internalType": "struct LegacyAllocation.State", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getProvisionTokensRange", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "subgraphDeploymentId", - "type": "bytes32" - } - ], - "name": "getSubgraphAllocatedTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getThawingPeriodRange", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getVerifierCutRange", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - }, - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - } - ], - "name": "indexers", - "outputs": [ - { - "internalType": "uint256", - "name": "registeredAt", - "type": "uint256" - }, - { - "internalType": "string", - "name": "url", - "type": "string" - }, - { - "internalType": "string", - "name": "geoHash", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minimumProvisionTokens", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "maximumDelegationRatio", - "type": "uint32" - }, - { - "internalType": "uint256", - "name": "stakeToFeesRatio", - "type": "uint256" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - } - ], - "name": "isOverAllocated", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxPOIStaleness", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maximumProvisionTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maximumThawingPeriod", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maximumVerifierCut", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "address", - "name": "allocationId", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "subgraphDeploymentID", - "type": "bytes32" - } - ], - "name": "migrateLegacyAllocation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "minimumProvisionTokens", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minimumThawingPeriod", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minimumVerifierCut", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes[]", - "name": "data", - "type": "bytes[]" - } - ], - "name": "multicall", - "outputs": [ - { - "internalType": "bytes[]", - "name": "results", - "type": "bytes[]" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pauseGuardian", - "type": "address" - } - ], - "name": "pauseGuardians", - "outputs": [ - { - "internalType": "bool", - "name": "allowed", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "register", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "numClaimsToRelease", - "type": "uint256" - } - ], - "name": "releaseStake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "address", - "name": "allocationId", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokens", - "type": "uint256" - } - ], - "name": "resizeAllocation", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - } - ], - "name": "rewardsDestination", - "outputs": [ - { - "internalType": "address", - "name": "destination", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "curationCut", - "type": "uint256" - } - ], - "name": "setCurationCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "delegationRatio", - "type": "uint32" - } - ], - "name": "setDelegationRatio", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "maxPOIStaleness", - "type": "uint256" - } - ], - "name": "setMaxPOIStaleness", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "minimumProvisionTokens", - "type": "uint256" - } - ], - "name": "setMinimumProvisionTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pauseGuardian", - "type": "address" - }, - { - "internalType": "bool", - "name": "allowed", - "type": "bool" - } - ], - "name": "setPauseGuardian", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "rewardsDestination", - "type": "address" - } - ], - "name": "setRewardsDestination", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "stakeToFeesRatio_", - "type": "uint256" - } - ], - "name": "setStakeToFeesRatio", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "slash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "stakeToFeesRatio", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "startService", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "indexer", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "stopService", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] \ No newline at end of file + { + "inputs": [ + { + "internalType": "address", + "name": "graphController", + "type": "address" + }, + { + "internalType": "address", + "name": "disputeManager", + "type": "address" + }, + { + "internalType": "address", + "name": "graphTallyCollector", + "type": "address" + }, + { + "internalType": "address", + "name": "curation", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "AllocationAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "internalType": "uint256", + "name": "closedAt", + "type": "uint256" + } + ], + "name": "AllocationClosed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "AllocationDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "AllocationManagerAllocationClosed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "AllocationManagerAllocationSameSize", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "signer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "AllocationManagerInvalidAllocationProof", + "type": "error" + }, + { + "inputs": [], + "name": "AllocationManagerInvalidZeroAllocationId", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "claimId", + "type": "bytes32" + } + ], + "name": "DataServiceFeesClaimNotFound", + "type": "error" + }, + { + "inputs": [], + "name": "DataServiceFeesZeroTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "DataServicePausableNotPauseGuardian", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "DataServicePausablePauseGuardianNoChange", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "internalType": "address", + "name": "disputeManager", + "type": "address" + } + ], + "name": "DirectoryNotDisputeManager", + "type": "error" + }, + { + "inputs": [], + "name": "ECDSAInvalidSignature", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "length", + "type": "uint256" + } + ], + "name": "ECDSAInvalidSignatureLength", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "ECDSAInvalidSignatureS", + "type": "error" + }, + { + "inputs": [], + "name": "EnforcedPause", + "type": "error" + }, + { + "inputs": [], + "name": "ExpectedPause", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "contractName", + "type": "bytes" + } + ], + "name": "GraphDirectoryInvalidZeroAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidInitialization", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "LegacyAllocationAlreadyExists", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListEmptyList", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListInvalidIterations", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListInvalidZeroId", + "type": "error" + }, + { + "inputs": [], + "name": "LinkedListMaxElementsExceeded", + "type": "error" + }, + { + "inputs": [], + "name": "NotInitializing", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "PPMMathInvalidMulPPM", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "name": "ProvisionManagerInvalidRange", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "message", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "name": "ProvisionManagerInvalidValue", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "caller", + "type": "address" + } + ], + "name": "ProvisionManagerNotAuthorized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "ProvisionManagerProvisionNotFound", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokensAvailable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "tokensRequired", + "type": "uint256" + } + ], + "name": "ProvisionTrackerInsufficientTokens", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "SubgraphServiceAllocationIsAltruistic", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "SubgraphServiceAllocationNotAuthorized", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "SubgraphServiceCannotForceCloseAllocation", + "type": "error" + }, + { + "inputs": [], + "name": "SubgraphServiceEmptyGeohash", + "type": "error" + }, + { + "inputs": [], + "name": "SubgraphServiceEmptyUrl", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balanceBefore", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceAfter", + "type": "uint256" + } + ], + "name": "SubgraphServiceInconsistentCollection", + "type": "error" + }, + { + "inputs": [], + "name": "SubgraphServiceIndexerAlreadyRegistered", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "providedIndexer", + "type": "address" + }, + { + "internalType": "address", + "name": "expectedIndexer", + "type": "address" + } + ], + "name": "SubgraphServiceIndexerMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "SubgraphServiceIndexerNotRegistered", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "collectionId", + "type": "bytes32" + } + ], + "name": "SubgraphServiceInvalidCollectionId", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "curationCut", + "type": "uint256" + } + ], + "name": "SubgraphServiceInvalidCurationCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + } + ], + "name": "SubgraphServiceInvalidPaymentType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ravIndexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationIndexer", + "type": "address" + } + ], + "name": "SubgraphServiceInvalidRAV", + "type": "error" + }, + { + "inputs": [], + "name": "SubgraphServiceInvalidZeroStakeToFeesRatio", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "AllocationClosed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "currentEpoch", + "type": "uint256" + } + ], + "name": "AllocationCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newTokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "oldTokens", + "type": "uint256" + } + ], + "name": "AllocationResized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "curationCut", + "type": "uint256" + } + ], + "name": "CurationCutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "ratio", + "type": "uint32" + } + ], + "name": "DelegationRatioSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "graphToken", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "graphStaking", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphPayments", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphEscrow", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "graphController", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphEpochManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphRewardsManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphTokenGateway", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphProxyAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphCuration", + "type": "address" + } + ], + "name": "GraphDirectoryInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensIndexerRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensDelegationRewards", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "poi", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "currentEpoch", + "type": "uint256" + } + ], + "name": "IndexingRewardsCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "version", + "type": "uint64" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + } + ], + "name": "LegacyAllocationMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "maxPOIStaleness", + "type": "uint256" + } + ], + "name": "MaxPOIStalenessSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "PauseGuardianSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "ProvisionPendingParametersAccepted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "min", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "max", + "type": "uint256" + } + ], + "name": "ProvisionTokensRangeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "payer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensCollected", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensCurators", + "type": "uint256" + } + ], + "name": "QueryFeesCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "rewardsDestination", + "type": "address" + } + ], + "name": "RewardsDestinationSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "feeType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ServicePaymentCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "ServiceProviderRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "ServiceProviderSlashed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "ServiceStarted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "ServiceStopped", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "claimId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "unlockTimestamp", + "type": "uint256" + } + ], + "name": "StakeClaimLocked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "claimId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "releasableAt", + "type": "uint256" + } + ], + "name": "StakeClaimReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "serviceProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "claimsCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tokensReleased", + "type": "uint256" + } + ], + "name": "StakeClaimsReleased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "ratio", + "type": "uint256" + } + ], + "name": "StakeToFeesRatioSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "subgraphService", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "disputeManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "graphTallyCollector", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "curation", + "type": "address" + } + ], + "name": "SubgraphServiceDirectoryInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "min", + "type": "uint64" + }, + { + "indexed": false, + "internalType": "uint64", + "name": "max", + "type": "uint64" + } + ], + "name": "ThawingPeriodRangeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "min", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "max", + "type": "uint32" + } + ], + "name": "VerifierCutRangeSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "acceptProvisionPendingParameters", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "allocationProvisionTracker", + "outputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "claimId", + "type": "bytes32" + } + ], + "name": "claims", + "outputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "createdAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "releasableAt", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "nextClaim", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "claimsLists", + "outputs": [ + { + "internalType": "bytes32", + "name": "head", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "tail", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "count", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "closeStaleAllocation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "enum IGraphPayments.PaymentTypes", + "name": "paymentType", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "collect", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "curationFeesCut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "encodeAllocationProof", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "serviceProvider", + "type": "address" + } + ], + "name": "feesProvisionTracker", + "outputs": [ + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "getAllocation", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "createdAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "closedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastPOIPresentedAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accRewardsPerAllocatedToken", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accRewardsPending", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "createdAtEpoch", + "type": "uint256" + } + ], + "internalType": "struct Allocation.State", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "getAllocationData", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCuration", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDelegationRatio", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDisputeManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGraphTallyCollector", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "allocationId", + "type": "address" + } + ], + "name": "getLegacyAllocation", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + } + ], + "internalType": "struct LegacyAllocation.State", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getProvisionTokensRange", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "subgraphDeploymentId", + "type": "bytes32" + } + ], + "name": "getSubgraphAllocatedTokens", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getThawingPeriodRange", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVerifierCutRange", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "indexers", + "outputs": [ + { + "internalType": "uint256", + "name": "registeredAt", + "type": "uint256" + }, + { + "internalType": "string", + "name": "url", + "type": "string" + }, + { + "internalType": "string", + "name": "geoHash", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minimumProvisionTokens", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "maximumDelegationRatio", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "stakeToFeesRatio", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "isOverAllocated", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxPOIStaleness", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "subgraphDeploymentID", + "type": "bytes32" + } + ], + "name": "migrateLegacyAllocation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pauseGuardian", + "type": "address" + } + ], + "name": "pauseGuardians", + "outputs": [ + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "register", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "numClaimsToRelease", + "type": "uint256" + } + ], + "name": "releaseStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "address", + "name": "allocationId", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokens", + "type": "uint256" + } + ], + "name": "resizeAllocation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + } + ], + "name": "rewardsDestination", + "outputs": [ + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "curationCut", + "type": "uint256" + } + ], + "name": "setCurationCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "delegationRatio", + "type": "uint32" + } + ], + "name": "setDelegationRatio", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "maxPOIStaleness", + "type": "uint256" + } + ], + "name": "setMaxPOIStaleness", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "minimumProvisionTokens", + "type": "uint256" + } + ], + "name": "setMinimumProvisionTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pauseGuardian", + "type": "address" + }, + { + "internalType": "bool", + "name": "allowed", + "type": "bool" + } + ], + "name": "setPauseGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "rewardsDestination", + "type": "address" + } + ], + "name": "setRewardsDestination", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "stakeToFeesRatio_", + "type": "uint256" + } + ], + "name": "setStakeToFeesRatio", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakeToFeesRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "startService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "indexer", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "stopService", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/schema.graphql b/schema.graphql index 99e1dcfd..721ba75f 100644 --- a/schema.graphql +++ b/schema.graphql @@ -908,6 +908,10 @@ type Provision @entity { "The total amount of indexing rewards given to delegators" delegatorIndexingRewards: BigInt! + # Query fees + "Total query fees collected. Includes the portion given to delegators" + queryFeesCollected: BigInt! + # Delegation "Tokens delegated to the provision" delegatedTokens: BigInt! diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index e1756e92..7ef17c62 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -1,7 +1,7 @@ import { BigDecimal, BigInt, ethereum, log } from "@graphprotocol/graph-ts" import { AllocationClosed, AllocationCreated, AllocationResized, IndexingRewardsCollected, QueryFeesCollected, RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" -import { createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadProvision, createOrLoadSubgraphDeployment, joinID, updateDelegationExchangeRate } from "./helpers/helpers" -import { Allocation, GraphAccount, Indexer, PoiSubmission } from "../types/schema" +import { batchUpdateSubgraphSignalledTokens, calculatePricePerShare, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexerQueryFeePaymentAggregation, createOrLoadPaymentSource, createOrLoadProvision, createOrLoadSubgraphDeployment, joinID, updateDelegationExchangeRate } from "./helpers/helpers" +import { Allocation, GraphAccount, Indexer, PoiSubmission, SubgraphDeployment } from "../types/schema" import { addresses } from "../../config/addresses" export function handleServiceProviderRegistered(event: ServiceProviderRegistered): void { @@ -242,4 +242,71 @@ export function handleIndexingRewardsCollected(event: IndexingRewardsCollected): export function handleQueryFeesCollected(event: QueryFeesCollected): void { // To Do + + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + let subgraphDeploymentID = event.params.subgraphDeploymentId.toHexString() + let indexerID = event.params.serviceProvider.toHexString() + let allocationID = event.params.allocationId.toHexString() + let paymentAddress = event.params.payer + + // update indexer + let indexer = Indexer.load(indexerID)! + indexer.queryFeesCollected = indexer.queryFeesCollected.plus(event.params.tokensCollected) + indexer.save() + + // update provision + let provision = createOrLoadProvision(event.params.serviceProvider, event.address, event.block.timestamp) + provision.queryFeesCollected = provision.queryFeesCollected.plus(event.params.tokensCollected) + provision.save() + + // Replicate for payment source specific aggregation + let paymentAggregation = createOrLoadIndexerQueryFeePaymentAggregation(paymentAddress, event.params.serviceProvider) + paymentAggregation.queryFeesCollected = paymentAggregation.queryFeesCollected.plus(event.params.tokensCollected) + paymentAggregation.save() + + // update allocation + let allocation = Allocation.load(allocationID)! + allocation.queryFeesCollected = allocation.queryFeesCollected.plus(event.params.tokensCollected) + allocation.curatorRewards = allocation.curatorRewards.plus(event.params.tokensCurators) + allocation.save() + + // Update epoch + let epoch = createOrLoadEpoch( + addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!, + ) + epoch.totalQueryFees = epoch.totalQueryFees.plus(event.params.tokensCollected).plus(event.params.tokensCurators) + epoch.queryFeesCollected = epoch.queryFeesCollected.plus(event.params.tokensCollected) + epoch.curatorQueryFees = epoch.curatorQueryFees.plus(event.params.tokensCurators) + epoch.save() + + // update subgraph deployment + let deployment = SubgraphDeployment.load(subgraphDeploymentID)! + deployment.queryFeesAmount = deployment.queryFeesAmount.plus(event.params.tokensCollected) + deployment.signalledTokens = deployment.signalledTokens.plus(event.params.tokensCurators) + deployment.curatorFeeRewards = deployment.curatorFeeRewards.plus(event.params.tokensCurators) + deployment.pricePerShare = calculatePricePerShare(deployment as SubgraphDeployment) + deployment.save() + + batchUpdateSubgraphSignalledTokens(deployment as SubgraphDeployment) + + // update graph network + graphNetwork.totalQueryFees = graphNetwork.totalQueryFees.plus(event.params.tokensCollected).plus(event.params.tokensCurators) + graphNetwork.totalIndexerQueryFeesCollected = graphNetwork.totalIndexerQueryFeesCollected.plus( + event.params.tokensCollected, + ) + graphNetwork.totalCuratorQueryFees = graphNetwork.totalCuratorQueryFees.plus( + event.params.tokensCurators, + ) + graphNetwork.save() + + // Replicate for payment source specific data + let paymentSource = createOrLoadPaymentSource(paymentAddress) + paymentSource.totalQueryFees = paymentSource.totalQueryFees.plus(event.params.tokensCollected).plus(event.params.tokensCurators) + paymentSource.totalIndexerQueryFeesCollected = paymentSource.totalIndexerQueryFeesCollected.plus( + event.params.tokensCollected, + ) + paymentSource.totalCuratorQueryFees = paymentSource.totalCuratorQueryFees.plus( + event.params.tokensCurators, + ) + paymentSource.save() } diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 18bfa2e0..96c7b177 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -463,7 +463,7 @@ dataSources: handler: handleAllocationClosed - event: IndexingRewardsCollected(indexed address,indexed address,indexed bytes32,uint256,uint256,uint256,bytes32,uint256) handler: handleIndexingRewardsCollected - - event: QueryFeesCollected(indexed address,uint256,uint256) + - event: QueryFeesCollected(indexed address,indexed address,indexed address,bytes32,uint256,uint256) handler: handleQueryFeesCollected - kind: ethereum/contract name: Curation From c62626f270b15f56f2053fb2c429b025052d2ba8 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 27 Feb 2025 01:24:56 -0300 Subject: [PATCH 27/39] feat: added QueryFeesCollected handler with latest contract changes --- schema.graphql | 9 +++++-- src/mappings/helpers/helpers.ts | 1 + src/mappings/staking.ts | 2 ++ src/mappings/subgraphService.ts | 45 ++++++++++++++++++++++++++++----- 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/schema.graphql b/schema.graphql index 721ba75f..c12b4561 100644 --- a/schema.graphql +++ b/schema.graphql @@ -575,11 +575,12 @@ type SubgraphDeployment @entity { indexingDelegatorRewardAmount: BigInt! "Total query fees earned by this Subgraph Deployment, without curator query fees" queryFeesAmount: BigInt! - "Total query fee rebates earned from the protocol, through the rebates formula. Does not include delegation fees" + "Total query fee rebates earned from the protocol, through the rebates formula. Does not include delegation query fees" queryFeeRebates: BigInt! "Total curator rewards from fees" curatorFeeRewards: BigInt! - # TODO - We can add a field here for delegation fees earned when calling claim() + "Total query fee rebates earned from the protocol, through the rebates formula. Does not include indexer query fees" + delegatorsQueryFeeRebates: BigInt! # Subgraph deployment curation bonding curve "CURRENT signalled tokens in the bonding curve" @@ -911,6 +912,10 @@ type Provision @entity { # Query fees "Total query fees collected. Includes the portion given to delegators" queryFeesCollected: BigInt! + "Query fee amount collected from the protocol. Does not include portion given to delegators" + providerQueryFees: BigInt! + "Query fee amount collected from the protocol for Delegators. Does not include portion taken by the provider" + delegatorQueryFees: BigInt! # Delegation "Tokens delegated to the provision" diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 2c5829c7..a70eef19 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -102,6 +102,7 @@ export function createOrLoadSubgraphDeployment( deployment.indexingDelegatorRewardAmount = BigInt.fromI32(0) deployment.queryFeesAmount = BigInt.fromI32(0) deployment.queryFeeRebates = BigInt.fromI32(0) + deployment.delegatorsQueryFeeRebates = BigInt.fromI32(0) deployment.curatorFeeRewards = BigInt.fromI32(0) deployment.signalledTokensReceivedOnL2 = BigInt.fromI32(0) deployment.signalledTokensSentToL2 = BigInt.fromI32(0) diff --git a/src/mappings/staking.ts b/src/mappings/staking.ts index a35d7b52..ab4a2c71 100644 --- a/src/mappings/staking.ts +++ b/src/mappings/staking.ts @@ -673,6 +673,7 @@ export function handleRebateClaimed(event: RebateClaimed): void { // update subgraph deployment let subgraphDeployment = SubgraphDeployment.load(subgraphDeploymentID)! subgraphDeployment.queryFeeRebates = subgraphDeployment.queryFeeRebates.plus(event.params.tokens) + subgraphDeployment.delegatorsQueryFeeRebates = subgraphDeployment.delegatorsQueryFeeRebates.plus(event.params.delegationFees) subgraphDeployment.save() // update graph network @@ -751,6 +752,7 @@ export function handleRebateCollected(event: RebateCollected): void { deployment.curatorFeeRewards = deployment.curatorFeeRewards.plus(event.params.curationFees) deployment.pricePerShare = calculatePricePerShare(deployment as SubgraphDeployment) deployment.queryFeeRebates = deployment.queryFeeRebates.plus(event.params.queryRebates) + deployment.delegatorsQueryFeeRebates = deployment.delegatorsQueryFeeRebates.plus(event.params.delegationRewards) deployment.save() batchUpdateSubgraphSignalledTokens(deployment as SubgraphDeployment) diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index 7ef17c62..dd27b7e0 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -241,33 +241,49 @@ export function handleIndexingRewardsCollected(event: IndexingRewardsCollected): } export function handleQueryFeesCollected(event: QueryFeesCollected): void { - // To Do - let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) let subgraphDeploymentID = event.params.subgraphDeploymentId.toHexString() let indexerID = event.params.serviceProvider.toHexString() let allocationID = event.params.allocationId.toHexString() let paymentAddress = event.params.payer - // update indexer - let indexer = Indexer.load(indexerID)! - indexer.queryFeesCollected = indexer.queryFeesCollected.plus(event.params.tokensCollected) - indexer.save() - // update provision let provision = createOrLoadProvision(event.params.serviceProvider, event.address, event.block.timestamp) + + let delegationPoolQueryFees = + provision.delegatedTokens == BigInt.fromI32(0) + ? event.params.tokensCollected + : event.params.tokensCollected + .times(provision.queryFeeCut) + .div(BigInt.fromI32(1000000)) + let indexerQueryFees = event.params.tokensCollected.minus(delegationPoolQueryFees) + provision.queryFeesCollected = provision.queryFeesCollected.plus(event.params.tokensCollected) + provision.providerQueryFees = provision.providerQueryFees.plus(indexerQueryFees) + provision.delegatorQueryFees = provision.delegatorQueryFees.plus(delegationPoolQueryFees) provision.save() + // update indexer + let indexer = Indexer.load(indexerID)! + indexer.queryFeesCollected = indexer.queryFeesCollected.plus(event.params.tokensCollected) + indexer.queryFeeRebates = indexer.queryFeeRebates.plus(indexerQueryFees) + indexer.delegatorQueryFees = indexer.delegatorQueryFees.plus(delegationPoolQueryFees) + indexer.save() + // Replicate for payment source specific aggregation let paymentAggregation = createOrLoadIndexerQueryFeePaymentAggregation(paymentAddress, event.params.serviceProvider) paymentAggregation.queryFeesCollected = paymentAggregation.queryFeesCollected.plus(event.params.tokensCollected) + paymentAggregation.queryFeeRebates = paymentAggregation.queryFeeRebates.plus(indexerQueryFees) + paymentAggregation.delegatorQueryFees = paymentAggregation.delegatorQueryFees.plus(delegationPoolQueryFees) paymentAggregation.save() // update allocation let allocation = Allocation.load(allocationID)! allocation.queryFeesCollected = allocation.queryFeesCollected.plus(event.params.tokensCollected) allocation.curatorRewards = allocation.curatorRewards.plus(event.params.tokensCurators) + allocation.queryFeeRebates = allocation.queryFeeRebates.plus(indexerQueryFees) + allocation.distributedRebates = allocation.distributedRebates.plus(event.params.tokensCollected) + allocation.delegationFees = allocation.delegationFees.plus(delegationPoolQueryFees) allocation.save() // Update epoch @@ -277,6 +293,7 @@ export function handleQueryFeesCollected(event: QueryFeesCollected): void { epoch.totalQueryFees = epoch.totalQueryFees.plus(event.params.tokensCollected).plus(event.params.tokensCurators) epoch.queryFeesCollected = epoch.queryFeesCollected.plus(event.params.tokensCollected) epoch.curatorQueryFees = epoch.curatorQueryFees.plus(event.params.tokensCurators) + epoch.queryFeeRebates = epoch.queryFeeRebates.plus(event.params.tokensCollected) epoch.save() // update subgraph deployment @@ -285,6 +302,8 @@ export function handleQueryFeesCollected(event: QueryFeesCollected): void { deployment.signalledTokens = deployment.signalledTokens.plus(event.params.tokensCurators) deployment.curatorFeeRewards = deployment.curatorFeeRewards.plus(event.params.tokensCurators) deployment.pricePerShare = calculatePricePerShare(deployment as SubgraphDeployment) + deployment.queryFeeRebates = deployment.queryFeeRebates.plus(indexerQueryFees) + deployment.delegatorsQueryFeeRebates = deployment.delegatorsQueryFeeRebates.plus(delegationPoolQueryFees) deployment.save() batchUpdateSubgraphSignalledTokens(deployment as SubgraphDeployment) @@ -297,6 +316,12 @@ export function handleQueryFeesCollected(event: QueryFeesCollected): void { graphNetwork.totalCuratorQueryFees = graphNetwork.totalCuratorQueryFees.plus( event.params.tokensCurators, ) + graphNetwork.totalIndexerQueryFeeRebates = graphNetwork.totalIndexerQueryFeeRebates.plus( + indexerQueryFees, + ) + graphNetwork.totalDelegatorQueryFeeRebates = graphNetwork.totalDelegatorQueryFeeRebates.plus( + delegationPoolQueryFees, + ) graphNetwork.save() // Replicate for payment source specific data @@ -308,5 +333,11 @@ export function handleQueryFeesCollected(event: QueryFeesCollected): void { paymentSource.totalCuratorQueryFees = paymentSource.totalCuratorQueryFees.plus( event.params.tokensCurators, ) + paymentSource.totalIndexerQueryFeeRebates = paymentSource.totalIndexerQueryFeeRebates.plus( + indexerQueryFees, + ) + paymentSource.totalDelegatorQueryFeeRebates = paymentSource.totalDelegatorQueryFeeRebates.plus( + delegationPoolQueryFees, + ) paymentSource.save() } From d15378893c457aade263368838fdc1e27031d7f0 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 27 Feb 2025 01:33:23 -0300 Subject: [PATCH 28/39] feat: add GraphPayments abi --- abis/GraphPayments.json | 317 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 abis/GraphPayments.json diff --git a/abis/GraphPayments.json b/abis/GraphPayments.json new file mode 100644 index 00000000..156f9b05 --- /dev/null +++ b/abis/GraphPayments.json @@ -0,0 +1,317 @@ +[ + { + "type": "constructor", + "inputs": [ + { + "name": "controller", + "type": "address", + "internalType": "address" + }, + { + "name": "protocolPaymentCut", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "PROTOCOL_PAYMENT_CUT", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "collect", + "inputs": [ + { + "name": "paymentType", + "type": "uint8", + "internalType": "enum IGraphPayments.PaymentTypes" + }, + { + "name": "receiver", + "type": "address", + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "dataService", + "type": "address", + "internalType": "address" + }, + { + "name": "dataServiceCut", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "initialize", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "multicall", + "inputs": [ + { + "name": "data", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "outputs": [ + { + "name": "results", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "GraphDirectoryInitialized", + "inputs": [ + { + "name": "graphToken", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "graphStaking", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "graphPayments", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphEscrow", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphController", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "graphEpochManager", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphRewardsManager", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphTokenGateway", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphProxyAdmin", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "graphCuration", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "GraphPaymentCollected", + "inputs": [ + { + "name": "paymentType", + "type": "uint8", + "indexed": true, + "internalType": "enum IGraphPayments.PaymentTypes" + }, + { + "name": "payer", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "receiver", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "dataService", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "tokens", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "tokensProtocol", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "tokensDataService", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "tokensDelegationPool", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "tokensReceiver", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + }, + { + "type": "error", + "name": "GraphDirectoryInvalidZeroAddress", + "inputs": [ + { + "name": "contractName", + "type": "bytes", + "internalType": "bytes" + } + ] + }, + { + "type": "error", + "name": "GraphPaymentsInvalidCut", + "inputs": [ + { + "name": "cut", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "GraphPaymentsInvalidProtocolPaymentCut", + "inputs": [ + { + "name": "protocolPaymentCut", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "NotInitializing", + "inputs": [] + }, + { + "type": "error", + "name": "PPMMathInvalidMulPPM", + "inputs": [ + { + "name": "a", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "b", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "PPMMathInvalidPPM", + "inputs": [ + { + "name": "value", + "type": "uint256", + "internalType": "uint256" + } + ] + } +] \ No newline at end of file From 3b506bb789d09a0f5e1c33afe395f265c4f212ca Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 27 Feb 2025 01:58:53 -0300 Subject: [PATCH 29/39] feat: add tax tracking for Horizon through GraphPayments --- config/addresses.template.ts | 2 ++ config/arbitrumSepoliaAddressScript.ts | 8 ++++++++ config/mainnetArbitrumAddressScript.ts | 4 ++++ config/testAddressesL1.ts | 1 + config/testAddressesL2.ts | 1 + src/mappings/graphPayments.ts | 25 +++++++++++++++++++++++++ subgraph.template.yaml | 24 ++++++++++++++++++++++++ 7 files changed, 65 insertions(+) create mode 100644 src/mappings/graphPayments.ts diff --git a/config/addresses.template.ts b/config/addresses.template.ts index 3121b7e5..89df6658 100644 --- a/config/addresses.template.ts +++ b/config/addresses.template.ts @@ -21,6 +21,7 @@ export class Addresses { l2GraphTokenGateway: string ethereumDIDRegistry: string subgraphService: string + graphPayments: string isL1: boolean } @@ -47,5 +48,6 @@ export let addresses: Addresses = { l2GraphTokenGateway: '{{l2GraphTokenGateway}}', ethereumDIDRegistry: '{{ethereumDIDRegistry}}', subgraphService: '{{subgraphService}}', + graphPayments: '{{graphPayments}}', isL1: {{isL1}}, } diff --git a/config/arbitrumSepoliaAddressScript.ts b/config/arbitrumSepoliaAddressScript.ts index 44334c9d..35f7daf0 100644 --- a/config/arbitrumSepoliaAddressScript.ts +++ b/config/arbitrumSepoliaAddressScript.ts @@ -30,6 +30,7 @@ export let addresses: Addresses = { l2GraphTokenGateway: '{{arbsep.L2GraphTokenGateway.address}}', ethereumDIDRegistry: '{{arbsep.EthereumDIDRegistry.address}}', subgraphService: '{{arbsep.SubgraphService.address}}', + graphPayments: '{{arbsep.GraphPayments.address}}', isL1: false, } @@ -46,6 +47,13 @@ const main = (): void => { if(output.ethereumDIDRegistry == '') { output.ethereumDIDRegistry = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config } + // remove once we have proper packages + if(output.subgraphService == '') { + output.subgraphService = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config + } + if(output.graphPayments == '') { + output.graphPayments = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config + } fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2)) } catch (e) { console.log(`Error saving artifacts: ${e.message}`) diff --git a/config/mainnetArbitrumAddressScript.ts b/config/mainnetArbitrumAddressScript.ts index 9384be1e..97f74e18 100644 --- a/config/mainnetArbitrumAddressScript.ts +++ b/config/mainnetArbitrumAddressScript.ts @@ -30,6 +30,7 @@ export let addresses: Addresses = { l2GraphTokenGateway: '{{arbitrum.L2GraphTokenGateway.address}}', ethereumDIDRegistry: '{{arbitrum.IEthereumDIDRegistry.address}}', subgraphService: '{{arbitrum.SubgraphService.address}}', + graphPayments: '{{arbitrum.GraphPayments.address}}', isL1: false, } @@ -51,6 +52,9 @@ const main = (): void => { if(output.subgraphService == '') { output.subgraphService = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config } + if(output.graphPayments == '') { + output.graphPayments = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config + } fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2)) } catch (e) { console.log(`Error saving artifacts: ${e.message}`) diff --git a/config/testAddressesL1.ts b/config/testAddressesL1.ts index 56bbbb32..b6faebe5 100644 --- a/config/testAddressesL1.ts +++ b/config/testAddressesL1.ts @@ -30,6 +30,7 @@ export let addresses: Addresses = { l2GraphTokenGateway: '', ethereumDIDRegistry: '0x0000000000000000000000000000000000000000', subgraphService: '0x0000000000000000000000000000000000000000', + graphPayments: '0x0000000000000000000000000000000000000000', isL1: true, } diff --git a/config/testAddressesL2.ts b/config/testAddressesL2.ts index 0fab2b9a..4bfc932c 100644 --- a/config/testAddressesL2.ts +++ b/config/testAddressesL2.ts @@ -30,6 +30,7 @@ export let addresses: Addresses = { l2GraphTokenGateway: '0x0000000000000000000000000000000000000000', ethereumDIDRegistry: '0x0000000000000000000000000000000000000000', subgraphService: '0x0000000000000000000000000000000000000000', + graphPayments: '0x0000000000000000000000000000000000000000', isL1: false, } diff --git a/src/mappings/graphPayments.ts b/src/mappings/graphPayments.ts new file mode 100644 index 00000000..408560ee --- /dev/null +++ b/src/mappings/graphPayments.ts @@ -0,0 +1,25 @@ +import { addresses } from "../../config/addresses" +import { GraphPaymentCollected } from "../types/GraphPayments/GraphPayments" +import { createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadPaymentSource } from "./helpers/helpers" + +export function handleGraphPaymentCollected(event: GraphPaymentCollected): void { + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + + // Update epoch + let epoch = createOrLoadEpoch( + addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!, + ) + epoch.taxedQueryFees = epoch.taxedQueryFees.plus(event.params.tokensProtocol) + epoch.save() + + // update graph network + graphNetwork.totalTaxedQueryFees = graphNetwork.totalTaxedQueryFees.plus(event.params.tokensProtocol) + graphNetwork.save() + + // Replicate for payment source specific data + let paymentSource = createOrLoadPaymentSource(event.params.payer) + paymentSource.totalTaxedQueryFees = paymentSource.totalTaxedQueryFees.plus(event.params.tokensProtocol) + paymentSource.save() + + // Might want to add data service tax tracking here +} diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 96c7b177..7b3bb3f3 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -465,6 +465,30 @@ dataSources: handler: handleIndexingRewardsCollected - event: QueryFeesCollected(indexed address,indexed address,indexed address,bytes32,uint256,uint256) handler: handleQueryFeesCollected + - kind: ethereum/contract + name: GraphPayments + network: {{network}} + source: + address: "{{graphPayments}}" + abi: GraphPayments + startBlock: {{blockNumber}} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + file: ./src/mappings/graphPayments.ts + entities: + - GraphNetwork + abis: + - name: GraphPayments + file: ./abis/GraphPayments.json + - name: GraphToken + file: ./node_modules/@graphprotocol/contracts/dist/abis/GraphToken.json + - name: EpochManager + file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json + eventHandlers: + - event: GraphPaymentCollected(indexed uint8,indexed address,address,indexed address,uint256,uint256,uint256,uint256,uint256) + handler: handleGraphPaymentCollected - kind: ethereum/contract name: Curation network: {{network}} From ae10be72910756085572811b8302ec5fbe84f7fc Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 27 Feb 2025 02:36:24 -0300 Subject: [PATCH 30/39] feat: placeholders and manifest changes for delegation --- src/mappings/horizonStaking.ts | 24 +++++++++++++++++++++++- subgraph.template.yaml | 10 ++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 3253cea6..cb6a5f72 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -1,6 +1,6 @@ import { BigInt } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' -import { DelegationFeeCutSet, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, TokensDeprovisioned, TokensToDelegationPoolAdded } from '../types/HorizonStaking/HorizonStaking' +import { DelegatedTokensWithdrawn, DelegationFeeCutSet, DelegationSlashed, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, StakeDelegatedWithdrawn, TokensDelegated, TokensDeprovisioned, TokensToDelegationPoolAdded, TokensUndelegated } from '../types/HorizonStaking/HorizonStaking' import { Indexer, ThawRequest } from '../types/schema' import { createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision, updateDelegationExchangeRate } from './helpers/helpers' import { @@ -279,4 +279,26 @@ export function handleTokensToDelegationPoolAdded(event: TokensToDelegationPoolA graphNetwork.totalDelegatedTokens = graphNetwork.totalDelegatedTokens.plus(event.params.tokens) graphNetwork.save() +} + +// Delegation + +export function handleTokensDelegated(event: TokensDelegated): void { + // To Do +} + +export function handleDelegationSlashed(event: DelegationSlashed): void { + // To Do +} + +export function handleTokensUndelegated(event: TokensUndelegated): void { + // To Do +} + +export function handleDelegatedTokensWithdrawn(event: DelegatedTokensWithdrawn): void { + // To Do +} + +export function handleStakeDelegatedWithdrawn(event: StakeDelegatedWithdrawn): void { + // To Do } \ No newline at end of file diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 7b3bb3f3..2cbdc33a 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -429,6 +429,16 @@ dataSources: handler: handleDelegationFeeCutSet - event: TokensToDelegationPoolAdded(indexed address,indexed address,uint256) handler: handleTokensToDelegationPoolAdded + - event: TokensDelegated(indexed address,indexed address,indexed address,uint256,uint256) + handler: handleTokensDelegated + - event: DelegationSlashed(indexed address,indexed address,uint256) + handler: handleDelegationSlashed + - event: TokensUndelegated(indexed address,indexed address,indexed address,uint256) + handler: handleTokensUndelegated + - event: DelegatedTokensWithdrawn(indexed address,indexed address,indexed address,uint256) + handler: handleDelegatedTokensWithdrawn + - event: StakeDelegatedWithdrawn(indexed address,indexed address,uint256) + handler: handleStakeDelegatedWithdrawn - kind: ethereum/contract name: SubgraphService network: {{network}} From 9d13be9cf94a94f3de8ba9a45d08e0717a84aaf4 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Mon, 3 Mar 2025 20:35:00 -0300 Subject: [PATCH 31/39] feat: added horizon delegation events support --- abis/HorizonStaking.json | 35 ++++++- schema.graphql | 20 +++- src/mappings/helpers/helpers.ts | 118 ++++++++++++++++++++- src/mappings/horizonStaking.ts | 176 ++++++++++++++++++++++++++++++-- subgraph.template.yaml | 4 +- 5 files changed, 331 insertions(+), 22 deletions(-) diff --git a/abis/HorizonStaking.json b/abis/HorizonStaking.json index 67eb616b..1b2a72f6 100644 --- a/abis/HorizonStaking.json +++ b/abis/HorizonStaking.json @@ -254,6 +254,11 @@ "name": "HorizonStakingInvalidZeroTokens", "type": "error" }, + { + "inputs": [], + "name": "HorizonStakingLegacySlashFailed", + "type": "error" + }, { "inputs": [ { @@ -280,6 +285,11 @@ "name": "HorizonStakingNothingThawing", "type": "error" }, + { + "inputs": [], + "name": "HorizonStakingNothingToWithdraw", + "type": "error" + }, { "inputs": [], "name": "HorizonStakingProvisionAlreadyExists", @@ -1159,6 +1169,12 @@ "internalType": "uint256", "name": "tokens", "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" } ], "name": "TokensUndelegated", @@ -1517,7 +1533,7 @@ "outputs": [ { "internalType": "uint256", - "name": "tokens", + "name": "", "type": "uint256" } ], @@ -1682,6 +1698,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getStakingExtension", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -2423,9 +2452,5 @@ ], "stateMutability": "nonpayable", "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" } ] \ No newline at end of file diff --git a/schema.graphql b/schema.graphql index c12b4561..d388b553 100644 --- a/schema.graphql +++ b/schema.graphql @@ -893,12 +893,22 @@ type Provision @entity { thawingPeriodPending: BigInt! # Cuts for subgraph service. Percentage of rewards that the delegation pool receives + "Raw query fee cut. In Horizon this is amount of query fees that the delegation pool receives in PPM" queryFeeCut: BigInt! + "Raw indexing fee cut. In Horizon this is amount of indexing fees that the delegation pool receives in PPM" indexingFeeCut: BigInt! + "Raw indexing rewards cut. In Horizon this is amount of indexing rewards that the delegation pool receives in PPM" indexingRewardsCut: BigInt! + "The percent of indexing rewards generated by the delegated stake that the Indexer keeps for itself" + indexingRewardEffectiveCut: BigDecimal! + "The percent of query rebate rewards generated by the delegated stake that the Indexer keeps for itself" + queryFeeEffectiveCut: BigDecimal! + "The percent of reward dilution delegators experience because of overdelegation. Overdelegated stake can't be used to generate rewards but still gets accounted while distributing the generated rewards. This causes dilution of the rewards for the rest of the pool." + overDelegationDilution: BigDecimal! + # Might want to add polymorphic handling of different fee cuts through a generic hashmap in the future # Indexing rewards. Keeping the same naming from Indexer entity to make it easier to understand @@ -924,6 +934,10 @@ type Provision @entity { delegatorShares: BigInt! "Exchange rate of of tokens received for each share" delegationExchangeRate: BigDecimal! + "Ratio between the amount of the indexers own stake over the total usable stake." + ownStakeRatio: BigDecimal! + "Ratio between the amount of delegated stake over the total usable stake." + delegatedStakeRatio: BigDecimal! "Service registry URL for the indexer" url: String @@ -1111,8 +1125,12 @@ Delegator stake for a single Indexer type DelegatedStake @entity { "Concatenation of Delegator address and Indexer address" id: ID! - "Index the stake is delegated to" + "Indexer the stake is delegated to" indexer: Indexer! + "DataService the stake is delegated to. Only for Horizon delegations" + dataService: DataService + "Provision the stake is delegated to. Only for Horizon delegations" + provision: Provision "Delegator" delegator: Delegator! "CUMULATIVE tokens delegated" diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index a70eef19..93d815d2 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -348,6 +348,46 @@ export function createOrLoadDelegatedStake( } return delegatedStake as DelegatedStake } + +export function createOrLoadDelegatedStakeForProvision( + delegator: string, + indexer: string, + dataService: string, + timestamp: i32, +): DelegatedStake { + let provisionId = joinID([indexer, dataService]) + let id = joinID([delegator, provisionId]) + let delegatedStake = DelegatedStake.load(id) + if (delegatedStake == null) { + delegatedStake = new DelegatedStake(id) + delegatedStake.indexer = indexer + delegatedStake.dataService = dataService + delegatedStake.provision = provisionId + delegatedStake.delegator = delegator + delegatedStake.stakedTokens = BigInt.fromI32(0) + delegatedStake.transferredToL2 = false + delegatedStake.stakedTokensTransferredToL2 = BigInt.fromI32(0) + delegatedStake.unstakedTokens = BigInt.fromI32(0) + delegatedStake.lockedTokens = BigInt.fromI32(0) + delegatedStake.lockedUntil = 0 + delegatedStake.shareAmount = BigInt.fromI32(0) + delegatedStake.personalExchangeRate = BigDecimal.fromString('1') + delegatedStake.realizedRewards = BigDecimal.fromString('0') + delegatedStake.createdAt = timestamp + + delegatedStake.save() + + let delegatorEntity = Delegator.load(delegator)! + delegatorEntity.stakesCount = delegatorEntity.stakesCount + 1 + delegatorEntity.save() + + let graphNetwork = GraphNetwork.load('1')! + graphNetwork.delegationCount = graphNetwork.delegationCount + 1 + graphNetwork.save() + } + return delegatedStake as DelegatedStake +} + export function createOrLoadCurator(curatorAddress: Bytes, timestamp: BigInt): Curator { let id = curatorAddress.toHexString() let curator = Curator.load(id) @@ -916,6 +956,68 @@ export function updateAdvancedIndexerMetrics(indexer: Indexer): Indexer { return indexer as Indexer } +export function calculateOwnStakeRatioForProvision(provision: Provision): BigDecimal { + let totalTokens = provision.tokensProvisioned.plus(provision.delegatedTokens) + return totalTokens == BigInt.fromI32(0) + ? BigDecimal.fromString('0') + : provision.tokensProvisioned.toBigDecimal().div(totalTokens.toBigDecimal()) +} + +export function calculateDelegatedStakeRatioForProvision(provision: Provision): BigDecimal { + let totalTokens = provision.tokensProvisioned.plus(provision.delegatedTokens) + return totalTokens == BigInt.fromI32(0) + ? BigDecimal.fromString('0') + : provision.delegatedTokens.toBigDecimal().div(totalTokens.toBigDecimal()) +} + +export function calculateIndexingRewardEffectiveCutForProvision(provision: Provision): BigDecimal { + let delegatorCut = + provision.indexingRewardsCut.toBigDecimal() / + BigDecimal.fromString('1000000') + return provision.delegatedStakeRatio == BigDecimal.fromString('0') + ? BigDecimal.fromString('0') + : BigDecimal.fromString('1') - delegatorCut / provision.delegatedStakeRatio +} + +export function calculateQueryFeeEffectiveCutForProvision(provision: Provision): BigDecimal { + let delegatorCut = + provision.queryFeeCut.toBigDecimal() / BigDecimal.fromString('1000000') + return provision.delegatedStakeRatio == BigDecimal.fromString('0') + ? BigDecimal.fromString('0') + : BigDecimal.fromString('1') - delegatorCut / provision.delegatedStakeRatio +} + +export function calculateIndexerRewardOwnGenerationRatioForProvision(provision: Provision): BigDecimal { + let rewardCut = + provision.indexingRewardsCut.toBigDecimal() / BigDecimal.fromString('1000000') + return provision.ownStakeRatio == BigDecimal.fromString('0') + ? BigDecimal.fromString('0') + : rewardCut / provision.ownStakeRatio +} + +export function calculateOverdelegationDilutionForProvision(provision: Provision): BigDecimal { + let provisionedTokensBD = provision.tokensProvisioned.toBigDecimal() + let delegatedTokensBD = provision.delegatedTokens.toBigDecimal() + let graphNetwork = GraphNetwork.load('1')! + let delegationRatioBD = BigInt.fromI32(graphNetwork.delegationRatio).toBigDecimal() + let maxDelegatedStake = provisionedTokensBD * delegationRatioBD + return provisionedTokensBD == BigDecimal.fromString('0') + ? BigDecimal.fromString('0') + : BigDecimal.fromString('1') - maxDelegatedStake / max(maxDelegatedStake, delegatedTokensBD) +} + +export function updateAdvancedProvisionMetrics(provision: Provision): Provision { + provision.ownStakeRatio = calculateOwnStakeRatioForProvision(provision as Provision) + provision.delegatedStakeRatio = calculateDelegatedStakeRatioForProvision(provision as Provision) + provision.indexingRewardEffectiveCut = calculateIndexingRewardEffectiveCutForProvision(provision as Provision) + provision.queryFeeEffectiveCut = calculateQueryFeeEffectiveCutForProvision(provision as Provision) + provision.indexerRewardsOwnGenerationRatio = calculateIndexerRewardOwnGenerationRatioForProvision( + provision as Provision, + ) + provision.overDelegationDilution = calculateOverdelegationDilutionForProvision(provision as Provision) + return provision as Provision +} + export function updateDelegationExchangeRate(indexer: Indexer): Indexer { indexer.delegationExchangeRate = indexer.delegatedTokens .toBigDecimal() @@ -924,6 +1026,14 @@ export function updateDelegationExchangeRate(indexer: Indexer): Indexer { return indexer as Indexer } +export function updateDelegationExchangeRateForProvision(provision: Provision): Provision { + provision.delegationExchangeRate = provision.delegatedTokens + .toBigDecimal() + .div(provision.delegatorShares.toBigDecimal()) + .truncate(18) + return provision as Provision +} + // TODO - this is broken if we change the delegatio ratio // Need to remove, or find a fix export function calculateCapacities(indexer: Indexer): Indexer { @@ -957,10 +1067,10 @@ export function calculatePricePerShare(deployment: SubgraphDeployment): BigDecim deployment.signalAmount == BigInt.fromI32(0) ? BigDecimal.fromString('0') : deployment.signalledTokens - .toBigDecimal() - .div(deployment.signalAmount.toBigDecimal()) - .times(BigInt.fromI32(reserveRatioMultiplier).toBigDecimal()) - .truncate(18) + .toBigDecimal() + .div(deployment.signalAmount.toBigDecimal()) + .times(BigInt.fromI32(reserveRatioMultiplier).toBigDecimal()) + .truncate(18) return pricePerShare } diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index cb6a5f72..40519a75 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -1,8 +1,8 @@ import { BigInt } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' import { DelegatedTokensWithdrawn, DelegationFeeCutSet, DelegationSlashed, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, StakeDelegatedWithdrawn, TokensDelegated, TokensDeprovisioned, TokensToDelegationPoolAdded, TokensUndelegated } from '../types/HorizonStaking/HorizonStaking' -import { Indexer, ThawRequest } from '../types/schema' -import { createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision, updateDelegationExchangeRate } from './helpers/helpers' +import { DelegatedStake, Delegator, Indexer, Provision, ThawRequest } from '../types/schema' +import { calculateCapacities, createOrLoadDataService, createOrLoadDelegatedStake, createOrLoadDelegatedStakeForProvision, createOrLoadDelegator, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision, joinID, updateAdvancedIndexerMetrics, updateAdvancedProvisionMetrics, updateDelegationExchangeRate, updateDelegationExchangeRateForProvision } from './helpers/helpers' import { ProvisionCreated, ProvisionIncreased, @@ -284,21 +284,179 @@ export function handleTokensToDelegationPoolAdded(event: TokensToDelegationPoolA // Delegation export function handleTokensDelegated(event: TokensDelegated): void { - // To Do + let zeroShares = event.params.shares.equals(BigInt.fromI32(0)) + + let dataService = createOrLoadDataService(event.params.verifier) + // Might want to track some stuff here in the future + dataService.save() + + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + provision.delegatedTokens = provision.delegatedTokens.plus(event.params.tokens) + provision.delegatorShares = provision.delegatorShares.plus(event.params.shares) + if (provision.delegatorShares != BigInt.fromI32(0)) { + provision = updateDelegationExchangeRateForProvision(provision as Provision) + } + provision = updateAdvancedProvisionMetrics(provision as Provision) + provision.save() + + // update indexer + let indexer = createOrLoadIndexer(event.params.serviceProvider, event.block.timestamp) + indexer.delegatedTokens = indexer.delegatedTokens.plus(event.params.tokens) + indexer.delegatorShares = indexer.delegatorShares.plus(event.params.shares) + indexer.save() + + // update delegator + let delegatorID = event.params.delegator.toHexString() + let delegator = createOrLoadDelegator(event.params.delegator, event.block.timestamp) + delegator.totalStakedTokens = delegator.totalStakedTokens.plus(event.params.tokens) + delegator.save() + + // update delegated stake + let delegatedStake = createOrLoadDelegatedStakeForProvision( + delegatorID, + indexer.id, + dataService.id, + event.block.timestamp.toI32(), + ) + + if (!zeroShares) { + let previousExchangeRate = delegatedStake.personalExchangeRate + let previousShares = delegatedStake.shareAmount + let averageCostBasisTokens = previousExchangeRate + .times(previousShares.toBigDecimal()) + .plus(event.params.tokens.toBigDecimal()) + let averageCostBasisShares = previousShares.plus(event.params.shares) + if (averageCostBasisShares.gt(BigInt.fromI32(0))) { + delegatedStake.personalExchangeRate = averageCostBasisTokens + .div(averageCostBasisShares.toBigDecimal()) + .truncate(18) + } + } + + let isStakeBecomingActive = delegatedStake.shareAmount.isZero() && !event.params.shares.isZero() + + delegatedStake.stakedTokens = delegatedStake.stakedTokens.plus(event.params.tokens) + delegatedStake.shareAmount = delegatedStake.shareAmount.plus(event.params.shares) + delegatedStake.lastDelegatedAt = event.block.timestamp.toI32() + delegatedStake.save() + + // reload delegator to avoid edge case where we can overwrite stakesCount if stake is new + delegator = Delegator.load(delegatorID) as Delegator + + // upgrade graph network + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + graphNetwork.totalDelegatedTokens = graphNetwork.totalDelegatedTokens.plus(event.params.tokens) + + if (isStakeBecomingActive) { + graphNetwork.activeDelegationCount = graphNetwork.activeDelegationCount + 1 + delegator.activeStakesCount = delegator.activeStakesCount + 1 + // Is delegator becoming active because of the stake becoming active? + if (delegator.activeStakesCount == 1) { + graphNetwork.activeDelegatorCount = graphNetwork.activeDelegatorCount + 1 + } + } + + graphNetwork.save() + delegator.save() } export function handleDelegationSlashed(event: DelegationSlashed): void { - // To Do + // This is a delegation pool wide change, no particular delegation or delegator can be updated here. + + // update provision + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + provision.delegatedTokens = provision.delegatedTokens.minus(event.params.tokens) + if (provision.delegatorShares != BigInt.fromI32(0)) { + provision = updateDelegationExchangeRateForProvision(provision as Provision) + } + provision = updateAdvancedProvisionMetrics(provision as Provision) + provision.save() + + // update indexer + let indexerID = event.params.serviceProvider.toHexString() + let indexer = Indexer.load(indexerID)! + indexer.delegatedTokens = indexer.delegatedTokens.minus(event.params.tokens) + indexer.save() + + // upgrade graph network + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + graphNetwork.totalDelegatedTokens = graphNetwork.totalDelegatedTokens.minus(event.params.tokens) + graphNetwork.save() } export function handleTokensUndelegated(event: TokensUndelegated): void { - // To Do + // update provision + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + + let beforeUpdateDelegationExchangeRate = provision.delegationExchangeRate + + provision.delegatedTokens = provision.delegatedTokens.minus(event.params.tokens) + provision.delegatorShares = provision.delegatorShares.minus(event.params.shares) + if (provision.delegatorShares != BigInt.fromI32(0)) { + provision = updateDelegationExchangeRateForProvision(provision as Provision) + } + provision = updateAdvancedProvisionMetrics(provision as Provision) + provision.save() + + // update indexer + let indexerID = event.params.serviceProvider.toHexString() + let indexer = Indexer.load(indexerID)! + indexer.delegatedTokens = indexer.delegatedTokens.minus(event.params.tokens) + indexer.delegatorShares = indexer.delegatorShares.minus(event.params.shares) + indexer.save() + + // update delegated stake + let delegatorID = event.params.delegator.toHexString() + let id = joinID([delegatorID, provision.id]) + let delegatedStake = DelegatedStake.load(id)! + + let isStakeBecomingInactive = + !delegatedStake.shareAmount.isZero() && delegatedStake.shareAmount == event.params.shares + + delegatedStake.unstakedTokens = delegatedStake.unstakedTokens.plus(event.params.tokens) + delegatedStake.shareAmount = delegatedStake.shareAmount.minus(event.params.shares) + delegatedStake.lockedTokens = delegatedStake.lockedTokens.plus(event.params.tokens) + //delegatedStake.lockedUntil = event.params.until.toI32() // until always updates and overwrites the past lockedUntil time + delegatedStake.lastUndelegatedAt = event.block.timestamp.toI32() + + let currentBalance = event.params.shares.toBigDecimal().times(beforeUpdateDelegationExchangeRate) + let oldBalance = event.params.shares.toBigDecimal().times(delegatedStake.personalExchangeRate) + let realizedRewards = currentBalance.minus(oldBalance) + + delegatedStake.realizedRewards = delegatedStake.realizedRewards.plus(realizedRewards) + delegatedStake.save() + + // update delegator + let delegator = Delegator.load(delegatorID)! + delegator.totalUnstakedTokens = delegator.totalUnstakedTokens.plus(event.params.tokens) + delegator.totalRealizedRewards = delegator.totalRealizedRewards.plus(realizedRewards) + + // upgrade graph network + let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) + graphNetwork.totalDelegatedTokens = graphNetwork.totalDelegatedTokens.minus(event.params.tokens) + + if (isStakeBecomingInactive) { + graphNetwork.activeDelegationCount = graphNetwork.activeDelegationCount - 1 + delegator.activeStakesCount = delegator.activeStakesCount - 1 + // Is delegator becoming inactive because of the stake becoming inactive? + if (delegator.activeStakesCount == 0) { + graphNetwork.activeDelegatorCount = graphNetwork.activeDelegatorCount - 1 + } + } + + graphNetwork.save() + delegator.save() } export function handleDelegatedTokensWithdrawn(event: DelegatedTokensWithdrawn): void { - // To Do -} + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + // might want to track locked/thawing tokens in provision too + provision.save() -export function handleStakeDelegatedWithdrawn(event: StakeDelegatedWithdrawn): void { - // To Do + // update delegated stake + let delegatorID = event.params.delegator.toHexString() + let id = joinID([delegatorID, provision.id]) + let delegatedStake = DelegatedStake.load(id)! + delegatedStake.lockedTokens = delegatedStake.lockedTokens.minus(event.params.tokens) + delegatedStake.save() } \ No newline at end of file diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 2cbdc33a..34b1f105 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -433,12 +433,10 @@ dataSources: handler: handleTokensDelegated - event: DelegationSlashed(indexed address,indexed address,uint256) handler: handleDelegationSlashed - - event: TokensUndelegated(indexed address,indexed address,indexed address,uint256) + - event: TokensUndelegated(indexed address,indexed address,indexed address,uint256,uint256) handler: handleTokensUndelegated - event: DelegatedTokensWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleDelegatedTokensWithdrawn - - event: StakeDelegatedWithdrawn(indexed address,indexed address,uint256) - handler: handleStakeDelegatedWithdrawn - kind: ethereum/contract name: SubgraphService network: {{network}} From a2c134ba79ff1a55f0a5fdda5e0fa8bfc415dabb Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Thu, 6 Mar 2025 01:12:50 -0300 Subject: [PATCH 32/39] fix: missing inits --- schema.graphql | 2 ++ src/mappings/helpers/helpers.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/schema.graphql b/schema.graphql index d388b553..86526577 100644 --- a/schema.graphql +++ b/schema.graphql @@ -938,6 +938,8 @@ type Provision @entity { ownStakeRatio: BigDecimal! "Ratio between the amount of delegated stake over the total usable stake." delegatedStakeRatio: BigDecimal! + "Percentage of indexers' own rewards received in relation to its own stake. 1 (100%) means that the indexer is receiving the exact amount that is generated by his own stake" + indexerRewardsOwnGenerationRatio: BigDecimal! "Service registry URL for the indexer" url: String diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 93d815d2..f2f233c0 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -216,6 +216,11 @@ export function createOrLoadProvision(indexerAddress: Bytes, verifierAddress: By provision.delegatedTokens = BigInt.fromI32(0) provision.delegatorShares = BigInt.fromI32(0) provision.delegationExchangeRate = BigInt.fromI32(0).toBigDecimal() + provision.indexingRewardEffectiveCut = BigInt.fromI32(0).toBigDecimal() + provision.queryFeeEffectiveCut = BigInt.fromI32(0).toBigDecimal() + provision.ownStakeRatio = BigInt.fromI32(0).toBigDecimal() + provision.delegatedStakeRatio = BigInt.fromI32(0).toBigDecimal() + provision.indexerRewardsOwnGenerationRatio = BigInt.fromI32(0).toBigDecimal() provision.save() } From 21d9616de222e0b12172a972430f248857d02542 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Sun, 30 Mar 2025 17:37:10 -0300 Subject: [PATCH 33/39] fix: address gh pr feedback --- schema.graphql | 15 +++++++++++---- src/mappings/helpers/helpers.ts | 13 +++++++++---- src/mappings/horizonStaking.ts | 8 +++++--- src/mappings/subgraphService.ts | 10 ++++++++-- subgraph.template.yaml | 2 ++ 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/schema.graphql b/schema.graphql index 86526577..fdf94006 100644 --- a/schema.graphql +++ b/schema.graphql @@ -246,6 +246,9 @@ type DataService @entity { "Total GRT currently in allocations for this DataService" totalTokensAllocated: BigInt! + "Ratio of max staked delegation tokens to indexers stake that earns rewards" + delegationRatio: Int + provisions: [Provision!]! @derivedFrom(field: "dataService") } @@ -867,6 +870,10 @@ type Provision @entity { tokensAllocated: BigInt! + tokensSlashedServiceProvider: BigInt! + + tokensSlashedDelegationPool: BigInt! + totalAllocationCount: BigInt! allocationCount: Int! @@ -904,7 +911,7 @@ type Provision @entity { "The percent of indexing rewards generated by the delegated stake that the Indexer keeps for itself" indexingRewardEffectiveCut: BigDecimal! - "The percent of query rebate rewards generated by the delegated stake that the Indexer keeps for itself" + "The percent of query fees generated by the delegated stake that the Indexer keeps for itself" queryFeeEffectiveCut: BigDecimal! "The percent of reward dilution delegators experience because of overdelegation. Overdelegated stake can't be used to generate rewards but still gets accounted while distributing the generated rewards. This causes dilution of the rewards for the rest of the pool." overDelegationDilution: BigDecimal! @@ -934,11 +941,11 @@ type Provision @entity { delegatorShares: BigInt! "Exchange rate of of tokens received for each share" delegationExchangeRate: BigDecimal! - "Ratio between the amount of the indexers own stake over the total usable stake." + "Ratio between the amount of the indexers own stake over the total usable stake (capped by the delegationRatio)." ownStakeRatio: BigDecimal! - "Ratio between the amount of delegated stake over the total usable stake." + "Ratio between the amount of delegated stake over the total usable stake (capped by the delegationRatio)." delegatedStakeRatio: BigDecimal! - "Percentage of indexers' own rewards received in relation to its own stake. 1 (100%) means that the indexer is receiving the exact amount that is generated by his own stake" + "Percentage of indexers' own rewards received in relation to its own stake. 1 (100%) means that the indexer is receiving the exact amount that is generated by his own stake, the value can be over 100% or below depending on the amount of delegation and cuts set" indexerRewardsOwnGenerationRatio: BigDecimal! "Service registry URL for the indexer" diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index f2f233c0..1787efbe 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -202,6 +202,8 @@ export function createOrLoadProvision(indexerAddress: Bytes, verifierAddress: By provision.dataService = verifierAddress.toHexString() provision.tokensProvisioned = BigInt.fromI32(0) provision.tokensAllocated = BigInt.fromI32(0) + provision.tokensSlashedServiceProvider = BigInt.fromI32(0) + provision.tokensSlashedDelegationPool = BigInt.fromI32(0) provision.totalAllocationCount = BigInt.fromI32(0) provision.allocationCount = 0 provision.tokensThawing = BigInt.fromI32(0) @@ -993,18 +995,21 @@ export function calculateQueryFeeEffectiveCutForProvision(provision: Provision): } export function calculateIndexerRewardOwnGenerationRatioForProvision(provision: Provision): BigDecimal { - let rewardCut = + let delegatorCut = provision.indexingRewardsCut.toBigDecimal() / BigDecimal.fromString('1000000') return provision.ownStakeRatio == BigDecimal.fromString('0') ? BigDecimal.fromString('0') - : rewardCut / provision.ownStakeRatio + : (BigDecimal.fromString('1') - delegatorCut) / provision.ownStakeRatio } export function calculateOverdelegationDilutionForProvision(provision: Provision): BigDecimal { let provisionedTokensBD = provision.tokensProvisioned.toBigDecimal() let delegatedTokensBD = provision.delegatedTokens.toBigDecimal() - let graphNetwork = GraphNetwork.load('1')! - let delegationRatioBD = BigInt.fromI32(graphNetwork.delegationRatio).toBigDecimal() + let dataService = DataService.load(provision.dataService)! + if (dataService.delegationRatio == null) { + return BigDecimal.fromString('0') + } + let delegationRatioBD = BigInt.fromI32(dataService.delegationRatio).toBigDecimal() let maxDelegatedStake = provisionedTokensBD * delegationRatioBD return provisionedTokensBD == BigDecimal.fromString('0') ? BigDecimal.fromString('0') diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 40519a75..3407d6a2 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -230,15 +230,16 @@ export function handleProvisionSlashed(event: ProvisionSlashed): void { indexer.provisionedTokens = indexer.provisionedTokens.minus(event.params.tokens) indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) indexer.save() - + dataService.totalTokensProvisioned = dataService.totalTokensProvisioned.minus(event.params.tokens) dataService.save() - + graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.minus(event.params.tokens) graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.minus(event.params.tokens) graphNetwork.save() - + provision.tokensProvisioned = provision.tokensProvisioned.minus(event.params.tokens) + provision.tokensSlashedServiceProvider = provision.tokensSlashedServiceProvider.plus(event.params.tokens) provision.save() } @@ -366,6 +367,7 @@ export function handleDelegationSlashed(event: DelegationSlashed): void { // update provision let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) provision.delegatedTokens = provision.delegatedTokens.minus(event.params.tokens) + provision.tokensSlashedDelegationPool = provision.tokensSlashedDelegationPool.plus(event.params.tokens) if (provision.delegatorShares != BigInt.fromI32(0)) { provision = updateDelegationExchangeRateForProvision(provision as Provision) } diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index dd27b7e0..fe686087 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -1,6 +1,6 @@ import { BigDecimal, BigInt, ethereum, log } from "@graphprotocol/graph-ts" -import { AllocationClosed, AllocationCreated, AllocationResized, IndexingRewardsCollected, QueryFeesCollected, RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" -import { batchUpdateSubgraphSignalledTokens, calculatePricePerShare, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexerQueryFeePaymentAggregation, createOrLoadPaymentSource, createOrLoadProvision, createOrLoadSubgraphDeployment, joinID, updateDelegationExchangeRate } from "./helpers/helpers" +import { AllocationClosed, AllocationCreated, AllocationResized, DelegationRatioSet, IndexingRewardsCollected, QueryFeesCollected, RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService" +import { batchUpdateSubgraphSignalledTokens, calculatePricePerShare, createOrLoadDataService, createOrLoadEpoch, createOrLoadGraphNetwork, createOrLoadIndexerQueryFeePaymentAggregation, createOrLoadPaymentSource, createOrLoadProvision, createOrLoadSubgraphDeployment, joinID, updateDelegationExchangeRate } from "./helpers/helpers" import { Allocation, GraphAccount, Indexer, PoiSubmission, SubgraphDeployment } from "../types/schema" import { addresses } from "../../config/addresses" @@ -23,6 +23,12 @@ export function handleRewardsDestinationSet(event: RewardsDestinationSet): void provision.save() } +export function handleDelegationRatioSet(event: DelegationRatioSet): void { + let dataService = createOrLoadDataService(event.address) + dataService.delegationRatio = event.params.ratio + dataService.save() +} + export function handleAllocationCreated(event: AllocationCreated): void { let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address) let subgraphDeploymentID = event.params.subgraphDeploymentId.toHexString() diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 34b1f105..156c77a2 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -473,6 +473,8 @@ dataSources: handler: handleIndexingRewardsCollected - event: QueryFeesCollected(indexed address,indexed address,indexed address,bytes32,uint256,uint256) handler: handleQueryFeesCollected + - event: DelegationRatioSet(uint32) + handler: handleDelegationRatioSet - kind: ethereum/contract name: GraphPayments network: {{network}} From 9fa408de093bda95eebbcddc222c8d5c86b20c00 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Sun, 30 Mar 2025 18:05:59 -0300 Subject: [PATCH 34/39] fix: build issues and feedback from PaymentCollection PR --- schema.graphql | 4 ++-- src/mappings/graphPayments.ts | 1 + src/mappings/subgraphService.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/schema.graphql b/schema.graphql index fdf94006..7fe20c8a 100644 --- a/schema.graphql +++ b/schema.graphql @@ -930,8 +930,8 @@ type Provision @entity { "Total query fees collected. Includes the portion given to delegators" queryFeesCollected: BigInt! "Query fee amount collected from the protocol. Does not include portion given to delegators" - providerQueryFees: BigInt! - "Query fee amount collected from the protocol for Delegators. Does not include portion taken by the provider" + indexerQueryFees: BigInt! + "Query fee amount collected from the protocol for Delegators. Does not include portion taken by the indexer" delegatorQueryFees: BigInt! # Delegation diff --git a/src/mappings/graphPayments.ts b/src/mappings/graphPayments.ts index 408560ee..6a159149 100644 --- a/src/mappings/graphPayments.ts +++ b/src/mappings/graphPayments.ts @@ -17,6 +17,7 @@ export function handleGraphPaymentCollected(event: GraphPaymentCollected): void graphNetwork.save() // Replicate for payment source specific data + // Payer here is the PaymentsEscrow in most cases, might need to figure out how to know who funded the escrow in the future let paymentSource = createOrLoadPaymentSource(event.params.payer) paymentSource.totalTaxedQueryFees = paymentSource.totalTaxedQueryFees.plus(event.params.tokensProtocol) paymentSource.save() diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index fe686087..f9c1d3d4 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -25,7 +25,7 @@ export function handleRewardsDestinationSet(event: RewardsDestinationSet): void export function handleDelegationRatioSet(event: DelegationRatioSet): void { let dataService = createOrLoadDataService(event.address) - dataService.delegationRatio = event.params.ratio + dataService.delegationRatio = event.params.ratio.toI32() dataService.save() } @@ -265,7 +265,7 @@ export function handleQueryFeesCollected(event: QueryFeesCollected): void { let indexerQueryFees = event.params.tokensCollected.minus(delegationPoolQueryFees) provision.queryFeesCollected = provision.queryFeesCollected.plus(event.params.tokensCollected) - provision.providerQueryFees = provision.providerQueryFees.plus(indexerQueryFees) + provision.indexerQueryFees = provision.indexerQueryFees.plus(indexerQueryFees) provision.delegatorQueryFees = provision.delegatorQueryFees.plus(delegationPoolQueryFees) provision.save() From ace4a5601c1bc3e3350ec8c2e0d78365b0305cc0 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Sun, 30 Mar 2025 20:25:00 -0300 Subject: [PATCH 35/39] fix: addressed AllocationManagement pr feedback --- schema.graphql | 6 ++++++ src/mappings/staking.ts | 11 +++++++++-- src/mappings/subgraphService.ts | 20 +++++++++++++------- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/schema.graphql b/schema.graphql index 7fe20c8a..2110b3cd 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1044,6 +1044,12 @@ type Allocation @entity { poi: Bytes "POIs submitted when collecting payments in Horizon" pois: [PoiSubmission!]! @derivedFrom(field: "allocation") + "Number of POIs submitted for this allocation. Only available for Horizon allocations" + poiCount: BigInt + "Whether this allocation was created in the legacy protocol. If true, the allocation will not have a provision since it's not a Horizon allocation" + isLegacy: Boolean! + "Whether this allocation was forced closed. Force closures in Horizon can happen when the latest PoI is stale, compared to the legacy protocol, where force closures can happen when the allocation hasn't been closed within the max amount of epochs" + forceClosed: Boolean # Indexer/Provision cut settings at start and close indexingRewardCutAtStart: Int! diff --git a/src/mappings/staking.ts b/src/mappings/staking.ts index ab4a2c71..db5551c2 100644 --- a/src/mappings/staking.ts +++ b/src/mappings/staking.ts @@ -374,6 +374,7 @@ export function handleAllocationCreated(event: AllocationCreated): void { allocation.indexingRewardEffectiveCutAtStart = indexer.indexingRewardEffectiveCut allocation.queryFeeCutAtStart = indexer.queryFeeCut allocation.queryFeeEffectiveCutAtStart = indexer.queryFeeEffectiveCut + allocation.isLegacy = true allocation.save() } @@ -493,12 +494,16 @@ export function handleAllocationClosed(event: AllocationClosed): void { // update indexer let indexer = Indexer.load(indexerID)! + let allocation = Allocation.load(allocationID)! const indexerAccount = GraphAccount.load(indexer.account)! const closedByIndexer = event.params.sender == event.params.indexer const closedByOperator = indexerAccount.operators.includes(event.params.sender.toHexString()) if (!closedByIndexer && !closedByOperator) { indexer.forcedClosures = indexer.forcedClosures + 1 + allocation.forceClosed = true + } else { + allocation.forceClosed = false } indexer.allocatedTokens = indexer.allocatedTokens.minus(event.params.tokens) indexer.allocationCount = indexer.allocationCount - 1 @@ -507,7 +512,6 @@ export function handleAllocationClosed(event: AllocationClosed): void { indexer.save() // update allocation - let allocation = Allocation.load(allocationID)! allocation.poolClosedIn = event.params.epoch.toString() allocation.activeForIndexer = null allocation.closedAtEpoch = event.params.epoch.toI32() @@ -561,12 +565,16 @@ export function handleAllocationClosedCobbDouglas(event: AllocationClosed1): voi // update indexer let indexer = Indexer.load(indexerID)! + let allocation = Allocation.load(allocationID)! const indexerAccount = GraphAccount.load(indexer.account)! const closedByIndexer = event.params.sender == event.params.indexer const closedByOperator = indexerAccount.operators.includes(event.params.sender.toHexString()) if (!closedByIndexer && !closedByOperator) { indexer.forcedClosures = indexer.forcedClosures + 1 + allocation.forceClosed = true + } else { + allocation.forceClosed = false } indexer.allocatedTokens = indexer.allocatedTokens.minus(event.params.tokens) indexer.allocationCount = indexer.allocationCount - 1 @@ -575,7 +583,6 @@ export function handleAllocationClosedCobbDouglas(event: AllocationClosed1): voi indexer.save() // update allocation - let allocation = Allocation.load(allocationID)! allocation.poolClosedIn = event.params.epoch.toString() allocation.activeForIndexer = null allocation.closedAtEpoch = event.params.epoch.toI32() diff --git a/src/mappings/subgraphService.ts b/src/mappings/subgraphService.ts index f9c1d3d4..6efed72c 100644 --- a/src/mappings/subgraphService.ts +++ b/src/mappings/subgraphService.ts @@ -88,9 +88,11 @@ export function handleAllocationCreated(event: AllocationCreated): void { allocation.annualizedReturn = BigDecimal.fromString('0') allocation.createdAt = event.block.timestamp.toI32() allocation.indexingRewardCutAtStart = provision.indexingRewardsCut.toI32() - allocation.indexingRewardEffectiveCutAtStart = provision.indexingRewardsCut.toBigDecimal() + allocation.indexingRewardEffectiveCutAtStart = provision.indexingRewardEffectiveCut allocation.queryFeeCutAtStart = provision.queryFeeCut.toI32() - allocation.queryFeeEffectiveCutAtStart = provision.queryFeeCut.toBigDecimal() + allocation.queryFeeEffectiveCutAtStart = provision.queryFeeEffectiveCut + allocation.poiCount = BigInt.fromI32(0) + allocation.isLegacy = false allocation.save() } @@ -101,12 +103,16 @@ export function handleAllocationClosed(event: AllocationClosed): void { // update indexer let indexer = Indexer.load(indexerID)! + let allocation = Allocation.load(allocationID)! const indexerAccount = GraphAccount.load(indexer.account)! const closedByIndexer = event.transaction.from == event.params.indexer const closedByOperator = indexerAccount.operators.includes(event.transaction.from.toHexString()) if (!closedByIndexer && !closedByOperator) { indexer.forcedClosures = indexer.forcedClosures + 1 + allocation.forceClosed = true + } else { + allocation.forceClosed = false } indexer.allocatedTokens = indexer.allocatedTokens.minus(event.params.tokens) indexer.allocationCount = indexer.allocationCount - 1 @@ -119,7 +125,6 @@ export function handleAllocationClosed(event: AllocationClosed): void { provision.save() // update allocation - let allocation = Allocation.load(allocationID)! allocation.poolClosedIn = graphNetwork.currentEpoch.toString() allocation.activeForIndexer = null allocation.closedAtEpoch = graphNetwork.currentEpoch @@ -129,10 +134,10 @@ export function handleAllocationClosed(event: AllocationClosed): void { ).toI32() allocation.status = 'Closed' allocation.closedAt = event.block.timestamp.toI32() - allocation.indexingRewardCutAtStart = provision.indexingRewardsCut.toI32() - allocation.indexingRewardEffectiveCutAtStart = provision.indexingRewardsCut.toBigDecimal() - allocation.queryFeeCutAtStart = provision.queryFeeCut.toI32() - allocation.queryFeeEffectiveCutAtStart = provision.queryFeeCut.toBigDecimal() + allocation.indexingRewardCutAtClose = provision.indexingRewardsCut.toI32() + allocation.indexingRewardEffectiveCutAtClose = provision.indexingRewardEffectiveCut + allocation.queryFeeCutAtClose = provision.queryFeeCut.toI32() + allocation.queryFeeEffectiveCutAtClose = provision.queryFeeEffectiveCut allocation.save() // update epoch - We do it here to have more epochs created, instead of seeing none created @@ -201,6 +206,7 @@ export function handleIndexingRewardsCollected(event: IndexingRewardsCollected): allocation.indexingDelegatorRewards = allocation.indexingDelegatorRewards.plus( event.params.tokensDelegationRewards, ) + allocation.poiCount = allocation.poiCount!.plus(BigInt.fromI32(1)) allocation.save() // Create PoI submission From 0cb688edad92be322894c3e075c5f02dd5ca69fd Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Sun, 30 Mar 2025 23:01:02 -0300 Subject: [PATCH 36/39] fix: address feedback from Subgraph Indexing Registration PR --- schema.graphql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/schema.graphql b/schema.graphql index 2110b3cd..07d5f1d3 100644 --- a/schema.graphql +++ b/schema.graphql @@ -858,6 +858,15 @@ type Operator @entity { allowed: Boolean! } + +""" + For the Horizon Stage 1 subgraph, the Provision entity will be mimicking the Indexer entity as closely as possible. + That means that the Provision entity will contain some fields that are particular for the Subgraph Service, even if in Horizon + a Provision could be for a different Data Service from the Subgraph Service. + This is to make the data closer to the legacy protocol, given that the Subgraph Service will be the first Data Service to be supported + + Once the Stage 2 subgraph is implemented, the Provision entity will have to be more generic, and particular data service fields will need to be restructured. +""" type Provision @entity { "Join ID of indexer address (service provider) and DataService address" id: ID! From a08bbe323ab27a4c1529bf3e837b21c89e917a69 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Sun, 30 Mar 2025 23:15:22 -0300 Subject: [PATCH 37/39] fix: address feedback from Delegation Pool pr --- schema.graphql | 2 +- src/mappings/horizonStaking.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/schema.graphql b/schema.graphql index 07d5f1d3..4688488d 100644 --- a/schema.graphql +++ b/schema.graphql @@ -948,7 +948,7 @@ type Provision @entity { delegatedTokens: BigInt! "Total shares of the delegator pool" delegatorShares: BigInt! - "Exchange rate of of tokens received for each share" + "Exchange rate of tokens received for each share" delegationExchangeRate: BigDecimal! "Ratio between the amount of the indexers own stake over the total usable stake (capped by the delegationRatio)." ownStakeRatio: BigDecimal! diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 3407d6a2..42be6276 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -270,6 +270,9 @@ export function handleTokensToDelegationPoolAdded(event: TokensToDelegationPoolA let indexer = Indexer.load(event.params.serviceProvider.toHexString())! let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) provision.delegatedTokens = provision.delegatedTokens.plus(event.params.tokens) + if (provision.delegatorShares != BigInt.fromI32(0)) { + provision = updateDelegationExchangeRateForProvision(provision as Provision) + } provision.save() indexer.delegatedTokens = indexer.delegatedTokens.plus(event.params.tokens) // this only serves as a general tracker, but the real deal is per provision From 55f3ef5b46ab6e4196c8dafe4063d1d944289e22 Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Sun, 30 Mar 2025 23:24:54 -0300 Subject: [PATCH 38/39] fix: addressed provision config PR feedback --- schema.graphql | 18 ++++++------------ src/mappings/helpers/helpers.ts | 12 ++++++------ src/mappings/horizonStaking.ts | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/schema.graphql b/schema.graphql index 4688488d..ee5c29b4 100644 --- a/schema.graphql +++ b/schema.graphql @@ -274,10 +274,10 @@ type GraphAccount @entity { # Operator info "Operator of other Graph Accounts" operatorOf: [GraphAccount!]! @derivedFrom(field: "operators") - "Operators of this Graph Accounts" + "Operators of this Graph Account" operators: [GraphAccount!]! - "Operators of this Graph Accounts" - provisionedOperators: [Operator!]! + "Horizon Operators of this Graph Account" + horizonOperators: [HorizonOperator!]! # GRT info "Graph token balance" @@ -843,11 +843,11 @@ type IndexerQueryFeePaymentAggregation @entity { paymentSource: PaymentSource! } -type Operator @entity { +type HorizonOperator @entity { "Joint address of all 3 parties involved (Operator, Indexer, DataService)" id: ID! - operatorOf: [GraphAccount!]! @derivedFrom(field: "provisionedOperators") + operatorOf: [GraphAccount!]! @derivedFrom(field: "horizonOperators") operator: GraphAccount! @@ -908,7 +908,7 @@ type Provision @entity { "Pending value for thawingPeriod. Verifier needs to accept it before it becomes active" thawingPeriodPending: BigInt! - # Cuts for subgraph service. Percentage of rewards that the delegation pool receives + # Percentage of rewards/fees that the delegation pool receives "Raw query fee cut. In Horizon this is amount of query fees that the delegation pool receives in PPM" queryFeeCut: BigInt! @@ -965,12 +965,6 @@ type Provision @entity { rewardsDestination: Bytes } -enum PaymentTypes { - QueryFee, - IndexingFee, - IndexingRewards -} - type ThawRequest @entity { id: ID! diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 1787efbe..3665dd73 100644 --- a/src/mappings/helpers/helpers.ts +++ b/src/mappings/helpers/helpers.ts @@ -28,7 +28,7 @@ import { IndexerQueryFeePaymentAggregation, Provision, DataService, - Operator, + HorizonOperator, } from '../../types/schema' import { SubgraphDeploymentManifest as SubgraphDeploymentManifestTemplate @@ -243,11 +243,11 @@ export function createOrLoadDataService(verifierAddress: Bytes): DataService { return service as DataService } -export function createOrLoadOperator(address: Bytes, verifierAddress: Bytes, indexerAddress: Bytes): Operator { +export function createOrLoadHorizonOperator(address: Bytes, verifierAddress: Bytes, indexerAddress: Bytes): HorizonOperator { let id = joinID([address.toHexString(), indexerAddress.toHexString(), verifierAddress.toHexString()]) - let operator = Operator.load(id) + let operator = HorizonOperator.load(id) if (operator == null) { - operator = new Operator(id) + operator = new HorizonOperator(id) operator.allowed = false operator.operator = address.toHexString() operator.indexer = indexerAddress.toHexString() @@ -255,7 +255,7 @@ export function createOrLoadOperator(address: Bytes, verifierAddress: Bytes, ind operator.save() } - return operator as Operator + return operator as HorizonOperator } export function createOrLoadPaymentSource(paymentAddress: Bytes): PaymentSource { @@ -529,7 +529,7 @@ export function createOrLoadGraphAccount(owner: Bytes, timeStamp: BigInt): Graph graphAccount = new GraphAccount(id) graphAccount.createdAt = timeStamp.toI32() graphAccount.operators = [] - graphAccount.provisionedOperators = [] + graphAccount.horizonOperators = [] graphAccount.balance = BigInt.fromI32(0) graphAccount.balanceReceivedFromL1Signalling = BigInt.fromI32(0) graphAccount.balanceReceivedFromL1Delegation = BigInt.fromI32(0) diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 42be6276..26bc4d0a 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -2,7 +2,7 @@ import { BigInt } from '@graphprotocol/graph-ts' import { addresses } from '../../config/addresses' import { DelegatedTokensWithdrawn, DelegationFeeCutSet, DelegationSlashed, HorizonStakeDeposited, HorizonStakeLocked, HorizonStakeWithdrawn, OperatorSet, StakeDelegatedWithdrawn, TokensDelegated, TokensDeprovisioned, TokensToDelegationPoolAdded, TokensUndelegated } from '../types/HorizonStaking/HorizonStaking' import { DelegatedStake, Delegator, Indexer, Provision, ThawRequest } from '../types/schema' -import { calculateCapacities, createOrLoadDataService, createOrLoadDelegatedStake, createOrLoadDelegatedStakeForProvision, createOrLoadDelegator, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadIndexer, createOrLoadOperator, createOrLoadProvision, joinID, updateAdvancedIndexerMetrics, updateAdvancedProvisionMetrics, updateDelegationExchangeRate, updateDelegationExchangeRateForProvision } from './helpers/helpers' +import { calculateCapacities, createOrLoadDataService, createOrLoadDelegatedStake, createOrLoadDelegatedStakeForProvision, createOrLoadDelegator, createOrLoadEpoch, createOrLoadGraphAccount, createOrLoadGraphNetwork, createOrLoadHorizonOperator, createOrLoadIndexer, createOrLoadProvision, joinID, updateAdvancedIndexerMetrics, updateAdvancedProvisionMetrics, updateDelegationExchangeRate, updateDelegationExchangeRateForProvision } from './helpers/helpers' import { ProvisionCreated, ProvisionIncreased, @@ -172,9 +172,9 @@ export function handleProvisionParametersStaged(event: ProvisionParametersStaged export function handleOperatorSet(event: OperatorSet): void { let indexerGraphAccount = createOrLoadGraphAccount(event.params.serviceProvider, event.block.timestamp) - let operator = createOrLoadOperator(event.params.operator, event.params.verifier, event.params.serviceProvider) + let operator = createOrLoadHorizonOperator(event.params.operator, event.params.verifier, event.params.serviceProvider) let operators = indexerGraphAccount.operators - // Will have to handle legacy operators list, and horizon provisionedOperators list for extra context + // Will have to handle legacy operators list, and horizon horizonOperators list for extra context let operatorsIndex = operators.indexOf(event.params.operator.toHexString()) if (operatorsIndex != -1) { // false - it existed, and we set it to false, so remove from operators @@ -190,12 +190,12 @@ export function handleOperatorSet(event: OperatorSet): void { } } - let provisionedOperators = indexerGraphAccount.provisionedOperators - let provisionedOperatorsIndex = provisionedOperators.indexOf(event.params.operator.toHexString()) - if (provisionedOperatorsIndex != -1) { + let horizonOperators = indexerGraphAccount.horizonOperators + let horizonOperatorsIndex = horizonOperators.indexOf(event.params.operator.toHexString()) + if (horizonOperatorsIndex != -1) { // false - it existed, and we set it to false, so remove from operators and update operator if (!event.params.allowed) { - operators.splice(provisionedOperatorsIndex, 1) + operators.splice(horizonOperatorsIndex, 1) } } else { // true - it did not exist before, and we say add, so add @@ -208,7 +208,7 @@ export function handleOperatorSet(event: OperatorSet): void { operator.allowed = event.params.allowed operator.save() indexerGraphAccount.operators = operators - indexerGraphAccount.provisionedOperators = provisionedOperators + indexerGraphAccount.horizonOperators = horizonOperators indexerGraphAccount.save() } @@ -230,14 +230,14 @@ export function handleProvisionSlashed(event: ProvisionSlashed): void { indexer.provisionedTokens = indexer.provisionedTokens.minus(event.params.tokens) indexer.stakedTokens = indexer.stakedTokens.minus(event.params.tokens) indexer.save() - + dataService.totalTokensProvisioned = dataService.totalTokensProvisioned.minus(event.params.tokens) dataService.save() - + graphNetwork.totalTokensProvisioned = graphNetwork.totalTokensProvisioned.minus(event.params.tokens) graphNetwork.totalTokensStaked = graphNetwork.totalTokensStaked.minus(event.params.tokens) graphNetwork.save() - + provision.tokensProvisioned = provision.tokensProvisioned.minus(event.params.tokens) provision.tokensSlashedServiceProvider = provision.tokensSlashedServiceProvider.plus(event.params.tokens) provision.save() From 8f6a3b4ff8b8f7c77591762f6c6fc840c42a1e5b Mon Sep 17 00:00:00 2001 From: Juan Manuel Rodriguez Defago Date: Mon, 31 Mar 2025 00:11:02 -0300 Subject: [PATCH 39/39] fix: most of the feedback from ProvisionManagement PR --- schema.graphql | 4 +++- src/mappings/horizonStaking.ts | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/schema.graphql b/schema.graphql index ee5c29b4..d744a4df 100644 --- a/schema.graphql +++ b/schema.graphql @@ -982,7 +982,9 @@ type ThawRequest @entity { thawingUntil: BigInt! - valid: Boolean + fulfilledAsValid: Boolean + + fulfilled: Boolean! } """ diff --git a/src/mappings/horizonStaking.ts b/src/mappings/horizonStaking.ts index 26bc4d0a..554feb83 100644 --- a/src/mappings/horizonStaking.ts +++ b/src/mappings/horizonStaking.ts @@ -153,6 +153,7 @@ export function handleTokensDeprovisioned(event: TokensDeprovisioned): void { graphNetwork.save() provision.tokensProvisioned = provision.tokensProvisioned.minus(event.params.tokens) + provision.tokensThawing = provision.tokensThawing.plus(event.params.tokens) provision.save() } @@ -239,6 +240,7 @@ export function handleProvisionSlashed(event: ProvisionSlashed): void { graphNetwork.save() provision.tokensProvisioned = provision.tokensProvisioned.minus(event.params.tokens) + // To DO, update thawing tokens according to the accounting calculation from the contract provision.tokensSlashedServiceProvider = provision.tokensSlashedServiceProvider.plus(event.params.tokens) provision.save() } @@ -255,13 +257,15 @@ export function handleThawRequestCreated(event: ThawRequestCreated): void { request.shares = event.params.shares request.tokens = BigInt.fromI32(0) request.thawingUntil = event.params.thawingUntil + request.fulfilled = false request.save() } export function handleThawRequestFulfilled(event: ThawRequestFulfilled): void { let request = ThawRequest.load(event.params.thawRequestId.toHexString())! request.tokens = event.params.tokens - request.valid = event.params.valid + request.fulfilledAsValid = event.params.valid + request.fulfilled = true request.save() }