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 diff --git a/abis/HorizonStaking.json b/abis/HorizonStaking.json index b1089b90..1b2a72f6 100644 --- a/abis/HorizonStaking.json +++ b/abis/HorizonStaking.json @@ -1,2408 +1,2456 @@ [ - { - "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": [], + "name": "HorizonStakingLegacySlashFailed", + "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": "HorizonStakingNothingToWithdraw", + "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" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "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": "", + "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": [], + "name": "getStakingExtension", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "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" + } ] \ No newline at end of file diff --git a/abis/SubgraphService.json b/abis/SubgraphService.json index 3da88ad2..3fa424a0 100644 --- a/abis/SubgraphService.json +++ b/abis/SubgraphService.json @@ -1,2287 +1,2242 @@ [ - { - "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", + { + "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", - "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", + "type": "uint32" + } + ], + "name": "setDelegationRatio", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", "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", + "type": "uint256" + } + ], + "name": "setMaxPOIStaleness", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", "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", + "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", - "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": [] - } + "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/config/addresses.template.ts b/config/addresses.template.ts index dda69c57..89df6658 100644 --- a/config/addresses.template.ts +++ b/config/addresses.template.ts @@ -20,6 +20,8 @@ export class Addresses { l1GraphTokenGateway: string l2GraphTokenGateway: string ethereumDIDRegistry: string + subgraphService: string + graphPayments: string isL1: boolean } @@ -45,5 +47,7 @@ export let addresses: Addresses = { l1GraphTokenGateway: '{{l1GraphTokenGateway}}', l2GraphTokenGateway: '{{l2GraphTokenGateway}}', ethereumDIDRegistry: '{{ethereumDIDRegistry}}', + subgraphService: '{{subgraphService}}', + graphPayments: '{{graphPayments}}', 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..35f7daf0 100644 --- a/config/arbitrumSepoliaAddressScript.ts +++ b/config/arbitrumSepoliaAddressScript.ts @@ -29,6 +29,8 @@ export let addresses: Addresses = { l1GraphTokenGateway: '', l2GraphTokenGateway: '{{arbsep.L2GraphTokenGateway.address}}', ethereumDIDRegistry: '{{arbsep.EthereumDIDRegistry.address}}', + subgraphService: '{{arbsep.SubgraphService.address}}', + graphPayments: '{{arbsep.GraphPayments.address}}', isL1: false, } @@ -45,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/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..97f74e18 100644 --- a/config/mainnetArbitrumAddressScript.ts +++ b/config/mainnetArbitrumAddressScript.ts @@ -29,6 +29,8 @@ export let addresses: Addresses = { l1GraphTokenGateway: '', l2GraphTokenGateway: '{{arbitrum.L2GraphTokenGateway.address}}', ethereumDIDRegistry: '{{arbitrum.IEthereumDIDRegistry.address}}', + subgraphService: '{{arbitrum.SubgraphService.address}}', + graphPayments: '{{arbitrum.GraphPayments.address}}', isL1: false, } @@ -46,6 +48,13 @@ 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 + } + 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/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..b6faebe5 100644 --- a/config/testAddressesL1.ts +++ b/config/testAddressesL1.ts @@ -29,6 +29,8 @@ export let addresses: Addresses = { l1GraphTokenGateway: '0x0000000000000000000000000000000000000000', l2GraphTokenGateway: '', ethereumDIDRegistry: '0x0000000000000000000000000000000000000000', + subgraphService: '0x0000000000000000000000000000000000000000', + graphPayments: '0x0000000000000000000000000000000000000000', isL1: true, } diff --git a/config/testAddressesL2.ts b/config/testAddressesL2.ts index c18dbb4f..4bfc932c 100644 --- a/config/testAddressesL2.ts +++ b/config/testAddressesL2.ts @@ -29,6 +29,8 @@ export let addresses: Addresses = { l1GraphTokenGateway: '', l2GraphTokenGateway: '0x0000000000000000000000000000000000000000', ethereumDIDRegistry: '0x0000000000000000000000000000000000000000', + subgraphService: '0x0000000000000000000000000000000000000000', + graphPayments: '0x0000000000000000000000000000000000000000', isL1: false, } diff --git a/schema.graphql b/schema.graphql index 961e6428..4688488d 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") } @@ -575,11 +578,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" @@ -854,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! @@ -864,6 +877,19 @@ type Provision @entity { tokensProvisioned: BigInt! + tokensAllocated: BigInt! + + tokensSlashedServiceProvider: BigInt! + + tokensSlashedDelegationPool: 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! @@ -883,13 +909,60 @@ 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 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! + # 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! + + # 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" + indexerQueryFees: BigInt! + "Query fee amount collected from the protocol for Delegators. Does not include portion taken by the indexer" + delegatorQueryFees: BigInt! + + # Delegation + "Tokens delegated to the provision" + delegatedTokens: BigInt! + "Total shares of the delegator pool" + delegatorShares: BigInt! + "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! + "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, 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" + 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 { @@ -919,17 +992,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" @@ -972,10 +1049,18 @@ 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 - - # Indexer cut settings at start and close + "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! indexingRewardEffectiveCutAtStart: BigDecimal! queryFeeCutAtStart: Int! @@ -993,6 +1078,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 # @@ -1054,8 +1149,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/graphPayments.ts b/src/mappings/graphPayments.ts new file mode 100644 index 00000000..6a159149 --- /dev/null +++ b/src/mappings/graphPayments.ts @@ -0,0 +1,26 @@ +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 + // 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() + + // Might want to add data service tax tracking here +} diff --git a/src/mappings/helpers/helpers.ts b/src/mappings/helpers/helpers.ts index 3f1d4547..1787efbe 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) @@ -200,6 +201,11 @@ 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.tokensSlashedServiceProvider = BigInt.fromI32(0) + provision.tokensSlashedDelegationPool = BigInt.fromI32(0) + provision.totalAllocationCount = BigInt.fromI32(0) + provision.allocationCount = 0 provision.tokensThawing = BigInt.fromI32(0) provision.createdAt = timestamp provision.maxVerifierCut = BigInt.fromI32(0) @@ -209,6 +215,14 @@ 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.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() } @@ -341,6 +355,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) @@ -909,6 +963,71 @@ 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 delegatorCut = + provision.indexingRewardsCut.toBigDecimal() / BigDecimal.fromString('1000000') + return provision.ownStakeRatio == BigDecimal.fromString('0') + ? BigDecimal.fromString('0') + : (BigDecimal.fromString('1') - delegatorCut) / provision.ownStakeRatio +} + +export function calculateOverdelegationDilutionForProvision(provision: Provision): BigDecimal { + let provisionedTokensBD = provision.tokensProvisioned.toBigDecimal() + let delegatedTokensBD = provision.delegatedTokens.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') + : 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() @@ -917,6 +1036,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 { @@ -950,10 +1077,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 95a337ca..42be6276 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 { 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 { ProvisionCreated, ProvisionIncreased, @@ -12,8 +12,6 @@ import { ProvisionThawed, ThawRequestCreated, ThawRequestFulfilled, - ThawRequestsFulfilled, - ThawingPeriodCleared } from '../types/HorizonStaking/HorizonStaking' export function handleHorizonStakeDeposited(event: HorizonStakeDeposited): void { @@ -22,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) - indexer = calculateCapacities(indexer as Indexer) indexer.save() // Update graph network @@ -48,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) - indexer = calculateCapacities(indexer as Indexer) indexer.save() // update graph network @@ -67,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) - indexer = calculateCapacities(indexer as Indexer) indexer.save() // Update graph network @@ -238,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() } @@ -270,4 +263,205 @@ 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 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) + 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 + if (indexer.delegatorShares != BigInt.fromI32(0)) { + indexer = updateDelegationExchangeRate(indexer as Indexer) + } + indexer.save() + + graphNetwork.totalDelegatedTokens = graphNetwork.totalDelegatedTokens.plus(event.params.tokens) + graphNetwork.save() +} + +// Delegation + +export function handleTokensDelegated(event: TokensDelegated): void { + 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 { + // 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) + provision.tokensSlashedDelegationPool = provision.tokensSlashedDelegationPool.plus(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 { + // 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 { + let provision = createOrLoadProvision(event.params.serviceProvider, event.params.verifier, event.block.timestamp) + // might want to track locked/thawing tokens in provision too + provision.save() + + // 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/src/mappings/staking.ts b/src/mappings/staking.ts index a35d7b52..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() @@ -673,6 +680,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 +759,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 new file mode 100644 index 00000000..6efed72c --- /dev/null +++ b/src/mappings/subgraphService.ts @@ -0,0 +1,355 @@ +import { BigDecimal, BigInt, ethereum, log } from "@graphprotocol/graph-ts" +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" + +export function handleServiceProviderRegistered(event: ServiceProviderRegistered): void { + 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 { + let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) + provision.rewardsDestination = event.params.rewardsDestination + provision.save() +} + +export function handleDelegationRatioSet(event: DelegationRatioSet): void { + let dataService = createOrLoadDataService(event.address) + dataService.delegationRatio = event.params.ratio.toI32() + dataService.save() +} + +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) + 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.toI32() + allocation.indexingRewardEffectiveCutAtStart = provision.indexingRewardEffectiveCut + allocation.queryFeeCutAtStart = provision.queryFeeCut.toI32() + allocation.queryFeeEffectiveCutAtStart = provision.queryFeeEffectiveCut + allocation.poiCount = BigInt.fromI32(0) + allocation.isLegacy = false + 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() + + // 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 + indexer.save() + + // update provision + let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp) + provision.tokensAllocated = provision.tokensAllocated.minus(event.params.tokens) + provision.allocationCount = provision.allocationCount - 1 + provision.save() + + // update allocation + allocation.poolClosedIn = graphNetwork.currentEpoch.toString() + 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.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 + // 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) + provision.tokensAllocated = provision.tokensAllocated.plus(diffTokens) + provision.save() + + // update allocation + let allocation = Allocation.load(allocationID)! + allocation.allocatedTokens = event.params.newTokens + allocation.save() +} + +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) + 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.poiCount = allocation.poiCount!.plus(BigInt.fromI32(1)) + 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 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 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.indexerQueryFees = provision.indexerQueryFees.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 + 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.queryFeeRebates = epoch.queryFeeRebates.plus(event.params.tokensCollected) + 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.queryFeeRebates = deployment.queryFeeRebates.plus(indexerQueryFees) + deployment.delegatorsQueryFeeRebates = deployment.delegatorsQueryFeeRebates.plus(delegationPoolQueryFees) + 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.totalIndexerQueryFeeRebates = graphNetwork.totalIndexerQueryFeeRebates.plus( + indexerQueryFees, + ) + graphNetwork.totalDelegatorQueryFeeRebates = graphNetwork.totalDelegatorQueryFeeRebates.plus( + delegationPoolQueryFees, + ) + 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.totalIndexerQueryFeeRebates = paymentSource.totalIndexerQueryFeeRebates.plus( + indexerQueryFees, + ) + paymentSource.totalDelegatorQueryFeeRebates = paymentSource.totalDelegatorQueryFeeRebates.plus( + delegationPoolQueryFees, + ) + paymentSource.save() +} diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 3f2361b7..156c77a2 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -419,14 +419,86 @@ 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 - event: DelegationFeeCutSet(indexed address,indexed address,indexed uint8,uint256) 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,uint256) + handler: handleTokensUndelegated + - event: DelegatedTokensWithdrawn(indexed address,indexed address,indexed address,uint256) + handler: handleDelegatedTokensWithdrawn + - 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 + - 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 + - event: IndexingRewardsCollected(indexed address,indexed address,indexed bytes32,uint256,uint256,uint256,bytes32,uint256) + 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}} + 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}}