From cbf8325ee2843541db10c8a05b6a0d97aafcbfe5 Mon Sep 17 00:00:00 2001 From: Dmitri Tsumak Date: Thu, 13 Jun 2024 10:58:21 +0300 Subject: [PATCH] Support restake vaults (#68) * Support restake vaults * Remove eigenpod operator zero address * Increase start block for eigen contracts * Update src/mappings/restakeVault.ts Co-authored-by: Mike Diamond Signed-off-by: Dmitri Tsumak * Bump version --------- Signed-off-by: Dmitri Tsumak Co-authored-by: Mike Diamond --- package-lock.json | 4 +- package.json | 2 +- src/abis/EigenDelegationManager.json | 1747 ++++++++++++++++++++++++++ src/abis/EigenPodManager.json | 757 +++++++++++ src/abis/RestakeVault.json | 1046 +++++++++++++++ src/config/chiado.json | 14 + src/config/holesky.json | 14 + src/config/mainnet.json | 14 + src/entities/vaults.ts | 23 +- src/mappings/keeper.ts | 53 + src/mappings/restakeVault.ts | 149 +++ src/mappings/vault.ts | 2 + src/mappings/vaultFactory.ts | 3 +- src/schema.graphql | 36 +- src/subgraph.template.yaml | 70 ++ 15 files changed, 3925 insertions(+), 9 deletions(-) create mode 100644 src/abis/EigenDelegationManager.json create mode 100644 src/abis/EigenPodManager.json create mode 100644 src/abis/RestakeVault.json create mode 100644 src/mappings/restakeVault.ts diff --git a/package-lock.json b/package-lock.json index d49b22d..6b0ec0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "v3-subgraph", - "version": "1.1.6", + "version": "1.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "v3-subgraph", - "version": "1.1.6", + "version": "1.2.0", "license": "AGPL-3.0-only", "devDependencies": { "@graphprotocol/graph-cli": "0.73.0", diff --git a/package.json b/package.json index 9320fe5..d0a85ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "v3-subgraph", - "version": "1.1.6", + "version": "1.2.0", "description": "Subgraph for the StakeWise Protocol", "repository": "https://github.com/stakewise/v3-subgraph", "license": "AGPL-3.0-only", diff --git a/src/abis/EigenDelegationManager.json b/src/abis/EigenDelegationManager.json new file mode 100644 index 0000000..7bba10c --- /dev/null +++ b/src/abis/EigenDelegationManager.json @@ -0,0 +1,1747 @@ +[ + { + "inputs": [ + { + "internalType": "contract IStrategyManager", + "name": "_strategyManager", + "type": "address" + }, + { + "internalType": "contract ISlasher", + "name": "_slasher", + "type": "address" + }, + { + "internalType": "contract IEigenPodManager", + "name": "_eigenPodManager", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "previousValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "MinWithdrawalDelayBlocksSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "earningsReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "delegationApprover", + "type": "address" + }, + { + "internalType": "uint32", + "name": "stakerOptOutWindowBlocks", + "type": "uint32" + } + ], + "indexed": false, + "internalType": "struct IDelegationManager.OperatorDetails", + "name": "newOperatorDetails", + "type": "tuple" + } + ], + "name": "OperatorDetailsModified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "metadataURI", + "type": "string" + } + ], + "name": "OperatorMetadataURIUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "earningsReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "delegationApprover", + "type": "address" + }, + { + "internalType": "uint32", + "name": "stakerOptOutWindowBlocks", + "type": "uint32" + } + ], + "indexed": false, + "internalType": "struct IDelegationManager.OperatorDetails", + "name": "operatorDetails", + "type": "tuple" + } + ], + "name": "OperatorRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IStrategy", + "name": "strategy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "OperatorSharesDecreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IStrategy", + "name": "strategy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "OperatorSharesIncreased", + "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": "uint256", + "name": "newPausedStatus", + "type": "uint256" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract IPauserRegistry", + "name": "pauserRegistry", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IPauserRegistry", + "name": "newPauserRegistry", + "type": "address" + } + ], + "name": "PauserRegistrySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "StakerDelegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "StakerForceUndelegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "StakerUndelegated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract IStrategy", + "name": "strategy", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousValue", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "StrategyWithdrawalDelayBlocksSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPausedStatus", + "type": "uint256" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "withdrawalRoot", + "type": "bytes32" + } + ], + "name": "WithdrawalCompleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "oldWithdrawalRoot", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "newWithdrawalRoot", + "type": "bytes32" + } + ], + "name": "WithdrawalMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "withdrawalRoot", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "delegatedTo", + "type": "address" + }, + { + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "startBlock", + "type": "uint32" + }, + { + "internalType": "contract IStrategy[]", + "name": "strategies", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + } + ], + "indexed": false, + "internalType": "struct IDelegationManager.Withdrawal", + "name": "withdrawal", + "type": "tuple" + } + ], + "name": "WithdrawalQueued", + "type": "event" + }, + { + "inputs": [], + "name": "DELEGATION_APPROVAL_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_STAKER_OPT_OUT_WINDOW_BLOCKS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_WITHDRAWAL_DELAY_BLOCKS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKER_DELEGATION_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "beaconChainETHStrategy", + "outputs": [ + { + "internalType": "contract IStrategy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + } + ], + "name": "calculateCurrentStakerDelegationDigestHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "address", + "name": "_delegationApprover", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "approverSalt", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + } + ], + "name": "calculateDelegationApprovalDigestHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_stakerNonce", + "type": "uint256" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + } + ], + "name": "calculateStakerDelegationDigestHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "delegatedTo", + "type": "address" + }, + { + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "startBlock", + "type": "uint32" + }, + { + "internalType": "contract IStrategy[]", + "name": "strategies", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + } + ], + "internalType": "struct IDelegationManager.Withdrawal", + "name": "withdrawal", + "type": "tuple" + } + ], + "name": "calculateWithdrawalRoot", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "delegatedTo", + "type": "address" + }, + { + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "startBlock", + "type": "uint32" + }, + { + "internalType": "contract IStrategy[]", + "name": "strategies", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + } + ], + "internalType": "struct IDelegationManager.Withdrawal", + "name": "withdrawal", + "type": "tuple" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "middlewareTimesIndex", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "receiveAsTokens", + "type": "bool" + } + ], + "name": "completeQueuedWithdrawal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "delegatedTo", + "type": "address" + }, + { + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "startBlock", + "type": "uint32" + }, + { + "internalType": "contract IStrategy[]", + "name": "strategies", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + } + ], + "internalType": "struct IDelegationManager.Withdrawal[]", + "name": "withdrawals", + "type": "tuple[]" + }, + { + "internalType": "contract IERC20[][]", + "name": "tokens", + "type": "address[][]" + }, + { + "internalType": "uint256[]", + "name": "middlewareTimesIndexes", + "type": "uint256[]" + }, + { + "internalType": "bool[]", + "name": "receiveAsTokens", + "type": "bool[]" + } + ], + "name": "completeQueuedWithdrawals", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "cumulativeWithdrawalsQueued", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "contract IStrategy", + "name": "strategy", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "decreaseDelegatedShares", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + } + ], + "internalType": "struct ISignatureUtils.SignatureWithExpiry", + "name": "approverSignatureAndExpiry", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "approverSalt", + "type": "bytes32" + } + ], + "name": "delegateTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + } + ], + "internalType": "struct ISignatureUtils.SignatureWithExpiry", + "name": "stakerSignatureAndExpiry", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + } + ], + "internalType": "struct ISignatureUtils.SignatureWithExpiry", + "name": "approverSignatureAndExpiry", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "approverSalt", + "type": "bytes32" + } + ], + "name": "delegateToBySignature", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegatedTo", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "delegationApprover", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "delegationApproverSaltIsSpent", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "domainSeparator", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "earningsReceiver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eigenPodManager", + "outputs": [ + { + "internalType": "contract IEigenPodManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "getDelegatableShares", + "outputs": [ + { + "internalType": "contract IStrategy[]", + "name": "", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "contract IStrategy[]", + "name": "strategies", + "type": "address[]" + } + ], + "name": "getOperatorShares", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IStrategy[]", + "name": "strategies", + "type": "address[]" + } + ], + "name": "getWithdrawalDelay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "contract IStrategy", + "name": "strategy", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "increaseDelegatedShares", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "initialOwner", + "type": "address" + }, + { + "internalType": "contract IPauserRegistry", + "name": "_pauserRegistry", + "type": "address" + }, + { + "internalType": "uint256", + "name": "initialPausedStatus", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minWithdrawalDelayBlocks", + "type": "uint256" + }, + { + "internalType": "contract IStrategy[]", + "name": "_strategies", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "_withdrawalDelayBlocks", + "type": "uint256[]" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "isDelegated", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isOperator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IStrategy[]", + "name": "strategies", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "components": [ + { + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "internalType": "uint96", + "name": "nonce", + "type": "uint96" + } + ], + "internalType": "struct IStrategyManager.DeprecatedStruct_WithdrawerAndNonce", + "name": "withdrawerAndNonce", + "type": "tuple" + }, + { + "internalType": "uint32", + "name": "withdrawalStartBlock", + "type": "uint32" + }, + { + "internalType": "address", + "name": "delegatedAddress", + "type": "address" + } + ], + "internalType": "struct IStrategyManager.DeprecatedStruct_QueuedWithdrawal[]", + "name": "withdrawalsToMigrate", + "type": "tuple[]" + } + ], + "name": "migrateQueuedWithdrawals", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minWithdrawalDelayBlocks", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "earningsReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "delegationApprover", + "type": "address" + }, + { + "internalType": "uint32", + "name": "stakerOptOutWindowBlocks", + "type": "uint32" + } + ], + "internalType": "struct IDelegationManager.OperatorDetails", + "name": "newOperatorDetails", + "type": "tuple" + } + ], + "name": "modifyOperatorDetails", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "operatorDetails", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "earningsReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "delegationApprover", + "type": "address" + }, + { + "internalType": "uint32", + "name": "stakerOptOutWindowBlocks", + "type": "uint32" + } + ], + "internalType": "struct IDelegationManager.OperatorDetails", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "contract IStrategy", + "name": "", + "type": "address" + } + ], + "name": "operatorShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newPausedStatus", + "type": "uint256" + } + ], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pauseAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "index", + "type": "uint8" + } + ], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pauserRegistry", + "outputs": [ + { + "internalType": "contract IPauserRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "pendingWithdrawals", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "contract IStrategy[]", + "name": "strategies", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "shares", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "withdrawer", + "type": "address" + } + ], + "internalType": "struct IDelegationManager.QueuedWithdrawalParams[]", + "name": "queuedWithdrawalParams", + "type": "tuple[]" + } + ], + "name": "queueWithdrawals", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "earningsReceiver", + "type": "address" + }, + { + "internalType": "address", + "name": "delegationApprover", + "type": "address" + }, + { + "internalType": "uint32", + "name": "stakerOptOutWindowBlocks", + "type": "uint32" + } + ], + "internalType": "struct IDelegationManager.OperatorDetails", + "name": "registeringOperatorDetails", + "type": "tuple" + }, + { + "internalType": "string", + "name": "metadataURI", + "type": "string" + } + ], + "name": "registerAsOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinWithdrawalDelayBlocks", + "type": "uint256" + } + ], + "name": "setMinWithdrawalDelayBlocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPauserRegistry", + "name": "newPauserRegistry", + "type": "address" + } + ], + "name": "setPauserRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IStrategy[]", + "name": "strategies", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "withdrawalDelayBlocks", + "type": "uint256[]" + } + ], + "name": "setStrategyWithdrawalDelayBlocks", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "slasher", + "outputs": [ + { + "internalType": "contract ISlasher", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "stakerNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "stakerOptOutWindowBlocks", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "strategyManager", + "outputs": [ + { + "internalType": "contract IStrategyManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IStrategy", + "name": "", + "type": "address" + } + ], + "name": "strategyWithdrawalDelayBlocks", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "undelegate", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "withdrawalRoots", + "type": "bytes32[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newPausedStatus", + "type": "uint256" + } + ], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "metadataURI", + "type": "string" + } + ], + "name": "updateOperatorMetadataURI", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/src/abis/EigenPodManager.json b/src/abis/EigenPodManager.json new file mode 100644 index 0000000..8741172 --- /dev/null +++ b/src/abis/EigenPodManager.json @@ -0,0 +1,757 @@ +[ + { + "inputs": [ + { + "internalType": "contract IETHPOSDeposit", + "name": "_ethPOS", + "type": "address" + }, + { + "internalType": "contract IBeacon", + "name": "_eigenPodBeacon", + "type": "address" + }, + { + "internalType": "contract IStrategyManager", + "name": "_strategyManager", + "type": "address" + }, + { + "internalType": "contract ISlasher", + "name": "_slasher", + "type": "address" + }, + { + "internalType": "contract IDelegationManager", + "name": "_delegationManager", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "podOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "BeaconChainETHDeposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "podOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "nonce", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "address", + "name": "delegatedAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "withdrawer", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "withdrawalRoot", + "type": "bytes32" + } + ], + "name": "BeaconChainETHWithdrawalCompleted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newOracleAddress", + "type": "address" + } + ], + "name": "BeaconOracleUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint64", + "name": "newValue", + "type": "uint64" + } + ], + "name": "DenebForkTimestampUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "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": "uint256", + "name": "newPausedStatus", + "type": "uint256" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract IPauserRegistry", + "name": "pauserRegistry", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IPauserRegistry", + "name": "newPauserRegistry", + "type": "address" + } + ], + "name": "PauserRegistrySet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "eigenPod", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "podOwner", + "type": "address" + } + ], + "name": "PodDeployed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "podOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "int256", + "name": "sharesDelta", + "type": "int256" + } + ], + "name": "PodSharesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPausedStatus", + "type": "uint256" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "podOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "addShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "beaconChainETHStrategy", + "outputs": [ + { + "internalType": "contract IStrategy", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "beaconChainOracle", + "outputs": [ + { + "internalType": "contract IBeaconChainOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "createPod", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "delegationManager", + "outputs": [ + { + "internalType": "contract IDelegationManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "denebForkTimestamp", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eigenPodBeacon", + "outputs": [ + { + "internalType": "contract IBeacon", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ethPOS", + "outputs": [ + { + "internalType": "contract IETHPOSDeposit", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "timestamp", + "type": "uint64" + } + ], + "name": "getBlockRootAtTimestamp", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "podOwner", + "type": "address" + } + ], + "name": "getPod", + "outputs": [ + { + "internalType": "contract IEigenPod", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "podOwner", + "type": "address" + } + ], + "name": "hasPod", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IBeaconChainOracle", + "name": "_beaconChainOracle", + "type": "address" + }, + { + "internalType": "address", + "name": "initialOwner", + "type": "address" + }, + { + "internalType": "contract IPauserRegistry", + "name": "_pauserRegistry", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_initPausedStatus", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "numPods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "ownerToPod", + "outputs": [ + { + "internalType": "contract IEigenPod", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newPausedStatus", + "type": "uint256" + } + ], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pauseAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "index", + "type": "uint8" + } + ], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pauserRegistry", + "outputs": [ + { + "internalType": "contract IPauserRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "podOwnerShares", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "podOwner", + "type": "address" + }, + { + "internalType": "int256", + "name": "sharesDelta", + "type": "int256" + } + ], + "name": "recordBeaconChainETHBalanceUpdate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "podOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "removeShares", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "newDenebForkTimestamp", + "type": "uint64" + } + ], + "name": "setDenebForkTimestamp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPauserRegistry", + "name": "newPauserRegistry", + "type": "address" + } + ], + "name": "setPauserRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "slasher", + "outputs": [ + { + "internalType": "contract ISlasher", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "depositDataRoot", + "type": "bytes32" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "strategyManager", + "outputs": [ + { + "internalType": "contract IStrategyManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newPausedStatus", + "type": "uint256" + } + ], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IBeaconChainOracle", + "name": "newBeaconChainOracle", + "type": "address" + } + ], + "name": "updateBeaconChainOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "podOwner", + "type": "address" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + }, + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "withdrawSharesAsTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/src/abis/RestakeVault.json b/src/abis/RestakeVault.json new file mode 100644 index 0000000..afe547c --- /dev/null +++ b/src/abis/RestakeVault.json @@ -0,0 +1,1046 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "CheckpointCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "Deposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "eigenPodOwner", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "eigenPod", + "type": "address" + } + ], + "name": "EigenPodCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "ExitQueueEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "prevPositionTicket", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPositionTicket", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "withdrawnAssets", + "type": "uint256" + } + ], + "name": "ExitedAssetsClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "feeRecipient", + "type": "address" + } + ], + "name": "FeeRecipientUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "FeeSharesMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "keysManager", + "type": "address" + } + ], + "name": "KeysManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "metadataIpfsHash", + "type": "string" + } + ], + "name": "MetadataUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "Redeemed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newRestakeOperatorsManager", + "type": "address" + } + ], + "name": "RestakeOperatorsManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newRestakeWithdrawalsManager", + "type": "address" + } + ], + "name": "RestakeWithdrawalsManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "V2ExitQueueEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "publicKey", + "type": "bytes" + } + ], + "name": "ValidatorRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "validatorsManager", + "type": "address" + } + ], + "name": "ValidatorsManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "validatorsRoot", + "type": "bytes32" + } + ], + "name": "ValidatorsRootUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitQueueIndex", + "type": "uint256" + } + ], + "name": "calculateExitedAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "leftTickets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitedTickets", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitedAssets", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "capacity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exitQueueIndex", + "type": "uint256" + } + ], + "name": "claimExitedAssets", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "name": "convertToAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "assets", + "type": "uint256" + } + ], + "name": "convertToShares", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "createEigenPod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + } + ], + "name": "enterExitQueue", + "outputs": [ + { + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "feePercent", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeRecipient", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEigenPods", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "positionTicket", + "type": "uint256" + } + ], + "name": "getExitQueueIndex", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "params", + "type": "bytes" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "isStateUpdateRequired", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mevEscrow", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "multicall", + "outputs": [ + { + "internalType": "bytes[]", + "name": "results", + "type": "bytes[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "queuedShares", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "receiveFromMevEscrow", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "validatorsRegistryRoot", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "validators", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signatures", + "type": "bytes" + }, + { + "internalType": "string", + "name": "exitSignaturesIpfsHash", + "type": "string" + } + ], + "internalType": "struct IKeeperValidators.ApprovalParams", + "name": "keeperParams", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "validatorsManagerSignature", + "type": "bytes" + } + ], + "name": "registerValidators", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "restakeOperatorsManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "restakeWithdrawalsManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeRecipient", + "type": "address" + } + ], + "name": "setFeeRecipient", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "metadataIpfsHash", + "type": "string" + } + ], + "name": "setMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newRestakeOperatorsManager", + "type": "address" + } + ], + "name": "setRestakeOperatorsManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newRestakeWithdrawalsManager", + "type": "address" + } + ], + "name": "setRestakeWithdrawalsManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_validatorsManager", + "type": "address" + } + ], + "name": "setValidatorsManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalExitingAssets", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalShares", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardsRoot", + "type": "bytes32" + }, + { + "internalType": "int160", + "name": "reward", + "type": "int160" + }, + { + "internalType": "uint160", + "name": "unlockedMevReward", + "type": "uint160" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + } + ], + "internalType": "struct IKeeperRewards.HarvestParams", + "name": "harvestParams", + "type": "tuple" + } + ], + "name": "updateState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "rewardsRoot", + "type": "bytes32" + }, + { + "internalType": "int160", + "name": "reward", + "type": "int160" + }, + { + "internalType": "uint160", + "name": "unlockedMevReward", + "type": "uint160" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + } + ], + "internalType": "struct IKeeperRewards.HarvestParams", + "name": "harvestParams", + "type": "tuple" + } + ], + "name": "updateStateAndDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "shares", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "validatorsManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vaultId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "version", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "withdrawableAssets", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/config/chiado.json b/src/config/chiado.json index e9799cf..b825e4e 100644 --- a/src/config/chiado.json +++ b/src/config/chiado.json @@ -15,6 +15,12 @@ "privErc20VaultFactoryV2": "0x81feD710De1aC9D3D860F6C9aB4f150B1dfF621d", "blocklistVaultFactoryV2": "0x6e16fc22013e07B8C8e6d4b30280F44d42A60a97", "blocklistErc20VaultFactoryV2": "0xdd9e0dBFb218fb17f0A2f96E77224e00dF095bf2", + "restakeVaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakePrivVaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakeBlocklistVaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakeErc20VaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakePrivErc20VaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakeBlocklistErc20VaultFactoryV2": "0x0000000000000000000000000000000000000000", "rewardSplitterFactoryV1": "0x0000000000000000000000000000000000000000", "rewardSplitterFactoryV2": "0x63De511Ff504E70109Bb8312d1329f2C88c14f77", "foxVault1": "0x0000000000000000000000000000000000000000", @@ -55,6 +61,14 @@ "address": "0x61A58F486c9E23D3ACB88792c50ddcdde7cda656", "startBlock": "10257854" }, + "eigenDelegationManager": { + "address": "0x0000000000000000000000000000000000000000", + "startBlock": "10257854" + }, + "eigenPodManager": { + "address": "0x0000000000000000000000000000000000000000", + "startBlock": "10257854" + }, "starknetMerkleDrop": { "address": "0x0000000000000000000000000000000000000000", "startBlock": "9650951", diff --git a/src/config/holesky.json b/src/config/holesky.json index 503fd6c..9a46e7d 100644 --- a/src/config/holesky.json +++ b/src/config/holesky.json @@ -17,6 +17,12 @@ "blocklistErc20VaultFactoryV2": "0x3A945FD94A1d810B5e1c4536747F0de358d32854", "rewardSplitterFactoryV1": "0x6c56AC64457B8AeA1Bb8d1f5eA2d1E397C9c7a13", "rewardSplitterFactoryV2": "0x7Fcb1857011BAF51003018e9299deE9012de0967", + "restakeVaultFactoryV2": "0x390C320Ae2B001C7CB31A690e2500b55313aC986", + "restakePrivVaultFactoryV2": "0x2a7FBFAaa33CFDB9E0EB3eb3F6aB01eA985354F2", + "restakeBlocklistVaultFactoryV2": "0x9e345cFa4A00aA2714264E9072800B89787aa826", + "restakeErc20VaultFactoryV2": "0x67E134aa61ee3903665a8045EC32886bfdf0B2B5", + "restakePrivErc20VaultFactoryV2": "0x860c75A594966f78fbd7c07D1748219CE9c42c39", + "restakeBlocklistErc20VaultFactoryV2": "0xd14013F989825037196089A498E8b7D3763B8695", "foxVault1": "0x3c4ae629bf823475192124E02b9879D3C1fd4538", "foxVault2": "0x37Bf0883c27365CffCd0C4202918df930989891f", "vestingEscrowFactory": { @@ -55,6 +61,14 @@ "address": "0xFb534BB912Eb83b7b629329195b8DF798Ea325b2", "startBlock": "1104931" }, + "eigenDelegationManager": { + "address": "0xA44151489861Fe9e3055d95adC98FbD462B948e7", + "startBlock": "1711347" + }, + "eigenPodManager": { + "address": "0x30770d7E3e71112d7A6b7259542D1f680a70e315", + "startBlock": "1711347" + }, "starknetMerkleDrop": { "address": "0xe8a222D887b468a71Ee8a27df4fa3b886A4B7BA1", "startBlock": "1024798", diff --git a/src/config/mainnet.json b/src/config/mainnet.json index 863d4a3..ac22108 100644 --- a/src/config/mainnet.json +++ b/src/config/mainnet.json @@ -15,6 +15,12 @@ "privErc20VaultFactoryV2": "0x0000000000000000000000000000000000000000", "blocklistVaultFactoryV2": "0x0000000000000000000000000000000000000000", "blocklistErc20VaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakeVaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakePrivVaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakeBlocklistVaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakeErc20VaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakePrivErc20VaultFactoryV2": "0x0000000000000000000000000000000000000000", + "restakeBlocklistErc20VaultFactoryV2": "0x0000000000000000000000000000000000000000", "rewardSplitterFactoryV1": "0x90a9428b8c58cA80B28aAF46B936D42e87797449", "rewardSplitterFactoryV2": "0x0000000000000000000000000000000000000000", "foxVault1": "0x4FEF9D741011476750A243aC70b9789a63dd47Df", @@ -55,6 +61,14 @@ "address": "0xFe2e637202056d30016725477c5da089Ab0A043A", "startBlock": "11726303" }, + "eigenDelegationManager": { + "address": "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A", + "startBlock": "17445562" + }, + "eigenPodManager": { + "address": "0x91E677b07F7AF907ec9a428aafA9fc14a0d3A338", + "startBlock": "17445563" + }, "starknetMerkleDrop": { "address": "0xB14eA5899D03d400705Aec4c9172E97E56022a07", "startBlock": "19560077", diff --git a/src/entities/vaults.ts b/src/entities/vaults.ts index eb34e3d..489bb5d 100644 --- a/src/entities/vaults.ts +++ b/src/entities/vaults.ts @@ -3,6 +3,7 @@ import { Erc20Vault as Erc20VaultTemplate, PrivateVault as PrivateVaultTemplate, BlocklistVault as BlocklistVaultTemplate, + RestakeVault as RestakeVaultTemplate, OwnMevEscrow as OwnMevEscrowTemplate, Vault as VaultTemplate, } from '../../generated/templates' @@ -13,7 +14,13 @@ import { createTransaction } from './transaction' const vaultsStatId = '1' -export function createVault(event: VaultCreated, isPrivate: boolean, isErc20: boolean, isBlocklist: boolean): void { +export function createVault( + event: VaultCreated, + isPrivate: boolean, + isErc20: boolean, + isBlocklist: boolean, + isRestake: boolean, +): void { const block = event.block const vaultAddress = event.params.vault const vaultAddressHex = vaultAddress.toHex() @@ -52,6 +59,7 @@ export function createVault(event: VaultCreated, isPrivate: boolean, isErc20: bo vault.principalAssets = BigInt.zero() vault.isPrivate = isPrivate vault.isBlocklist = isBlocklist + vault.isRestake = isRestake vault.isErc20 = isErc20 vault.isOsTokenEnabled = true vault.addressString = vaultAddressHex @@ -76,16 +84,22 @@ export function createVault(event: VaultCreated, isPrivate: boolean, isErc20: bo OwnMevEscrowTemplate.createWithContext(ownMevEscrow, context) } - if (vault.isPrivate) { + if (isPrivate) { PrivateVaultTemplate.create(vaultAddress) vault.whitelister = admin } - if (vault.isBlocklist) { + if (isBlocklist) { BlocklistVaultTemplate.create(vaultAddress) vault.blocklistManager = admin } + if (isRestake) { + RestakeVaultTemplate.create(vaultAddress) + vault.restakeOperatorsManager = admin + vault.restakeWithdrawalsManager = admin + } + vault.save() VaultTemplate.create(vaultAddress) @@ -100,7 +114,7 @@ export function createVault(event: VaultCreated, isPrivate: boolean, isErc20: bo createTransaction(event.transaction.hash.toHex()) log.info( - '[VaultFactory] VaultCreated address={} admin={} mevEscrow={} feePercent={} capacity={} isPrivate={} isErc20={} isBlocklist={}', + '[VaultFactory] VaultCreated address={} admin={} mevEscrow={} feePercent={} capacity={} isPrivate={} isErc20={} isBlocklist={} isRestake={}', [ vaultAddressHex, admin.toHex(), @@ -110,6 +124,7 @@ export function createVault(event: VaultCreated, isPrivate: boolean, isErc20: bo isPrivate.toString(), isErc20.toString(), isBlocklist.toString(), + isRestake.toString(), ], ) } diff --git a/src/mappings/keeper.ts b/src/mappings/keeper.ts index 1bda64f..7f2d1ae 100644 --- a/src/mappings/keeper.ts +++ b/src/mappings/keeper.ts @@ -35,6 +35,12 @@ import { REWARD_SPLITTER_FACTORY_V2, VAULT_FACTORY_V1, VAULT_FACTORY_V2, + RESTAKE_VAULT_FACTORY_V2, + RESTAKE_PRIV_VAULT_FACTORY_V2, + RESTAKE_BLOCKLIST_VAULT_FACTORY_V2, + RESTAKE_ERC20_VAULT_FACTORY_V2, + RESTAKE_PRIV_ERC20_VAULT_FACTORY_V2, + RESTAKE_BLOCKLIST_ERC20_VAULT_FACTORY_V2, WAD, ZERO_ADDRESS, } from '../helpers/constants' @@ -43,6 +49,7 @@ import { getConversionRate } from '../entities/network' const IS_PRIVATE_KEY = 'isPrivate' const IS_ERC20_KEY = 'isErc20' const IS_BLOCKLIST_KEY = 'isBlocklist' +const IS_RESTAKE_KEY = 'isRestake' export function initialize(block: ethereum.Block): void { let context = new DataSourceContext() @@ -51,6 +58,7 @@ export function initialize(block: ethereum.Block): void { context.setBoolean(IS_PRIVATE_KEY, false) context.setBoolean(IS_ERC20_KEY, false) context.setBoolean(IS_BLOCKLIST_KEY, false) + context.setBoolean(IS_RESTAKE_KEY, false) if (VAULT_FACTORY_V1 != ZERO_ADDRESS) { VaultFactoryTemplate.createWithContext(Address.fromString(VAULT_FACTORY_V1), context) log.info('[Keeper] Initialize VaultFactory V1 at block={}', [block.number.toString()]) @@ -107,6 +115,51 @@ export function initialize(block: ethereum.Block): void { log.info('[Keeper] Initialize BlocklistERC20VaultFactory V2 at block={}', [block.number.toString()]) } + // create restake vault factories + context.setBoolean(IS_PRIVATE_KEY, false) + context.setBoolean(IS_ERC20_KEY, false) + context.setBoolean(IS_BLOCKLIST_KEY, false) + context.setBoolean(IS_RESTAKE_KEY, true) + if (RESTAKE_VAULT_FACTORY_V2 != ZERO_ADDRESS) { + VaultFactoryTemplate.createWithContext(Address.fromString(RESTAKE_VAULT_FACTORY_V2), context) + log.info('[Keeper] Initialize RestakeVaultFactory V2 at block={}', [block.number.toString()]) + } + + context.setBoolean(IS_PRIVATE_KEY, true) + if (RESTAKE_PRIV_VAULT_FACTORY_V2 != ZERO_ADDRESS) { + VaultFactoryTemplate.createWithContext(Address.fromString(RESTAKE_PRIV_VAULT_FACTORY_V2), context) + log.info('[Keeper] Initialize RestakePrivateVaultFactory V2 at block={}', [block.number.toString()]) + } + + context.setBoolean(IS_PRIVATE_KEY, false) + context.setBoolean(IS_BLOCKLIST_KEY, true) + if (RESTAKE_BLOCKLIST_VAULT_FACTORY_V2 != ZERO_ADDRESS) { + VaultFactoryTemplate.createWithContext(Address.fromString(RESTAKE_BLOCKLIST_VAULT_FACTORY_V2), context) + log.info('[Keeper] Initialize RestakeBlocklistVaultFactory V2 at block={}', [block.number.toString()]) + } + + // create restake erc20 vault factories + context.setBoolean(IS_PRIVATE_KEY, false) + context.setBoolean(IS_ERC20_KEY, true) + context.setBoolean(IS_BLOCKLIST_KEY, false) + if (RESTAKE_ERC20_VAULT_FACTORY_V2 != ZERO_ADDRESS) { + VaultFactoryTemplate.createWithContext(Address.fromString(RESTAKE_ERC20_VAULT_FACTORY_V2), context) + log.info('[Keeper] Initialize RestakeERC20VaultFactory V2 at block={}', [block.number.toString()]) + } + + context.setBoolean(IS_PRIVATE_KEY, true) + if (RESTAKE_PRIV_ERC20_VAULT_FACTORY_V2 != ZERO_ADDRESS) { + VaultFactoryTemplate.createWithContext(Address.fromString(RESTAKE_PRIV_ERC20_VAULT_FACTORY_V2), context) + log.info('[Keeper] Initialize RestakePrivateERC20VaultFactory V2 at block={}', [block.number.toString()]) + } + + context.setBoolean(IS_PRIVATE_KEY, false) + context.setBoolean(IS_BLOCKLIST_KEY, true) + if (RESTAKE_BLOCKLIST_ERC20_VAULT_FACTORY_V2 != ZERO_ADDRESS) { + VaultFactoryTemplate.createWithContext(Address.fromString(RESTAKE_BLOCKLIST_ERC20_VAULT_FACTORY_V2), context) + log.info('[Keeper] Initialize RestakeBlocklistERC20VaultFactory V2 at block={}', [block.number.toString()]) + } + // create reward splitter factories if (REWARD_SPLITTER_FACTORY_V1 != ZERO_ADDRESS) { RewardSplitterFactoryTemplate.create(Address.fromString(REWARD_SPLITTER_FACTORY_V1)) diff --git a/src/mappings/restakeVault.ts b/src/mappings/restakeVault.ts new file mode 100644 index 0000000..279fd6f --- /dev/null +++ b/src/mappings/restakeVault.ts @@ -0,0 +1,149 @@ +import { BigInt, log } from '@graphprotocol/graph-ts' + +import { + StakerDelegated, + StakerUndelegated, + StakerForceUndelegated, +} from '../../generated/EigenDelegationManager/EigenDelegationManager' +import { PodSharesUpdated } from '../../generated/EigenPodManager/EigenPodManager' +import { + EigenPodCreated, + RestakeOperatorsManagerUpdated, + RestakeWithdrawalsManagerUpdated, +} from '../../generated/templates/RestakeVault/RestakeVault' +import { EigenPod, Vault } from '../../generated/schema' +import { createTransaction } from '../entities/transaction' + +// Handler for the EigenPodCreated event +export function handleEigenPodCreated(event: EigenPodCreated): void { + const params = event.params + const pod = params.eigenPod + + const vaultAddress = event.address.toHex() + const eigenPodId = params.eigenPodOwner.toHex() + const eigenPod = new EigenPod(eigenPodId) + + eigenPod.address = pod + eigenPod.vault = vaultAddress + eigenPod.shares = BigInt.zero() + eigenPod.createdAt = event.block.timestamp + eigenPod.save() + + createTransaction(event.transaction.hash.toHex()) + + log.info('[EigenPod] EigenPodCreated vault={} owner={} pod={}', [vaultAddress, eigenPodId, pod.toHex()]) +} + +// Handler for the RestakeOperatorsManagerUpdated event +export function handleRestakeOperatorsManagerUpdated(event: RestakeOperatorsManagerUpdated): void { + const params = event.params + const operatorsManager = params.newRestakeOperatorsManager + + const vaultAddress = event.address.toHex() + const vault = Vault.load(vaultAddress) as Vault + + vault.restakeOperatorsManager = operatorsManager + vault.save() + + createTransaction(event.transaction.hash.toHex()) + + log.info('[RestakeVault] RestakeOperatorsManagerUpdated vault={} operatorsManager={}', [ + vaultAddress, + operatorsManager.toHex(), + ]) +} + +// Handler for the RestakeWithdrawalsManagerUpdated event +export function handleRestakeWithdrawalsManagerUpdated(event: RestakeWithdrawalsManagerUpdated): void { + const params = event.params + const withdrawalsManager = params.newRestakeWithdrawalsManager + + const vaultAddress = event.address.toHex() + const vault = Vault.load(vaultAddress) as Vault + + vault.restakeWithdrawalsManager = withdrawalsManager + vault.save() + + createTransaction(event.transaction.hash.toHex()) + + log.info('[RestakeVault] RestakeWithdrawalsManagerUpdated vault={} withdrawalsManager={}', [ + vaultAddress, + withdrawalsManager.toHex(), + ]) +} + +// Handler for the EigenDelegationManager.StakerDelegated event +export function handleStakerDelegated(event: StakerDelegated): void { + const params = event.params + + const eigenPodId = params.staker.toHex() + const eigenPod = EigenPod.load(eigenPodId) + if (eigenPod == null) { + log.debug('[EigenDelegationManager] EigenPod not found owner={}', [eigenPodId]) + return + } + + eigenPod.operator = params.operator + eigenPod.save() + + createTransaction(event.transaction.hash.toHex()) + + log.info('[EigenDelegationManager] StakerDelegated staker={} operator={}', [eigenPodId, params.operator.toHex()]) +} + +// Handler for the EigenDelegationManager.StakerUndelegated event +export function handleStakerUndelegated(event: StakerUndelegated): void { + const params = event.params + + const eigenPodId = params.staker.toHex() + const eigenPod = EigenPod.load(eigenPodId) + if (eigenPod == null) { + log.debug('[EigenDelegationManager] EigenPod not found owner={}', [eigenPodId]) + return + } + + eigenPod.operator = null + eigenPod.save() + + createTransaction(event.transaction.hash.toHex()) + + log.info('[EigenDelegationManager] StakerUndelegated staker={}', [eigenPodId]) +} + +// Handler for the EigenDelegationManager.StakerForceUndelegated event +export function handleStakerForceUndelegated(event: StakerForceUndelegated): void { + const params = event.params + + const eigenPodId = params.staker.toHex() + const eigenPod = EigenPod.load(eigenPodId) + if (eigenPod == null) { + log.debug('[EigenDelegationManager] EigenPod not found owner={}', [eigenPodId]) + return + } + + eigenPod.operator = null + eigenPod.save() + + createTransaction(event.transaction.hash.toHex()) + + log.info('[EigenDelegationManager] StakerForceUndelegated staker={}', [eigenPodId]) +} + +// Handler for the EigenPodManager.PodSharesUpdated event +export function handlePodSharesUpdated(event: PodSharesUpdated): void { + const params = event.params + + const eigenPodId = params.podOwner.toHex() + const eigenPod = EigenPod.load(eigenPodId) + if (eigenPod == null) { + log.debug('[EigenPodManager] EigenPod not found owner={}', [eigenPodId]) + return + } + + eigenPod.shares = eigenPod.shares.plus(params.sharesDelta) + eigenPod.save() + + createTransaction(event.transaction.hash.toHex()) + + log.info('[EigenPodManager] PodSharesUpdated owner={} shares={}', [eigenPodId, params.sharesDelta.toString()]) +} diff --git a/src/mappings/vault.ts b/src/mappings/vault.ts index 2e4a143..cbd8e7e 100644 --- a/src/mappings/vault.ts +++ b/src/mappings/vault.ts @@ -559,6 +559,7 @@ export function handleGenesisVaultCreated(event: GenesisVaultCreated): void { vault.isPrivate = false vault.isBlocklist = false vault.isErc20 = false + vault.isRestake = false vault.isOsTokenEnabled = true vault.addressString = vaultAddressHex vault.createdAt = event.block.timestamp @@ -624,6 +625,7 @@ export function handleFoxVaultCreated(event: EthFoxVaultCreated): void { vault.isPrivate = false vault.isBlocklist = true vault.isErc20 = false + vault.isRestake = false vault.isOsTokenEnabled = false vault.mevEscrow = ownMevEscrow vault.addressString = vaultAddressHex diff --git a/src/mappings/vaultFactory.ts b/src/mappings/vaultFactory.ts index c6cd828..fe0a480 100644 --- a/src/mappings/vaultFactory.ts +++ b/src/mappings/vaultFactory.ts @@ -7,5 +7,6 @@ export function handleVaultCreated(event: VaultCreated): void { let isPrivate = context.getBoolean('isPrivate') let isErc20 = context.getBoolean('isErc20') let isBlocklist = context.getBoolean('isBlocklist') - createVault(event, isPrivate, isErc20, isBlocklist) + let isRestake = context.getBoolean('isRestake') + createVault(event, isPrivate, isErc20, isBlocklist, isRestake) } diff --git a/src/schema.graphql b/src/schema.graphql index d07495e..44b4959 100644 --- a/src/schema.graphql +++ b/src/schema.graphql @@ -116,7 +116,6 @@ type ExitRequest @entity { "The estimated withdrawal timestamp. Managed by the backend service." withdrawalTimestamp: BigInt - } """ @@ -219,6 +218,9 @@ type Vault @entity { "The vault apy snapshots" apySnapshots: [VaultApySnapshot!]! @derivedFrom(field: "vault") + "The vault eigen pods (only for vaults with isRestake=true)" + eigenPods: [EigenPod!]! @derivedFrom(field: "vault") + "The total number of shares" totalShares: BigInt! @@ -240,6 +242,9 @@ type Vault @entity { "Indicates whether the Vault has ERC-20 token" isErc20: Boolean! + "Indicates whether the Vault is a restaking vault" + isRestake: Boolean! + "Indicates whether the Vault supports minting OsToken" isOsTokenEnabled: Boolean! @@ -249,6 +254,12 @@ type Vault @entity { "If the Vault is with blocklist, blocklist manager can block allocators from depositing" blocklistManager: Bytes + "If the Vault is a restaking vault, restake operators manager can add/remove restake operators" + restakeOperatorsManager: Bytes + + "If the Vault is a restaking vault, restake withdrawals manager can manage EigenLayer withdrawals" + restakeWithdrawalsManager: Bytes + "Vault address string for search" addressString: String! @@ -586,3 +597,26 @@ type VestingEscrow @entity { "The vesting escrow recipient" recipient: Bytes! } + +""" +The restake vault eigen pod +""" +type EigenPod @entity { + "The address of the eigen pod owner" + id: ID! + + "The eigenPod's address" + address: Bytes! + + "The eigenPod's vault" + vault: Vault! + + "The eigenPod's shares" + shares: BigInt! + + "The eigenPod's operator" + operator: Bytes + + "The timestamp when the pod was created" + createdAt: BigInt! +} diff --git a/src/subgraph.template.yaml b/src/subgraph.template.yaml index 672c15f..53c3d44 100644 --- a/src/subgraph.template.yaml +++ b/src/subgraph.template.yaml @@ -253,6 +253,52 @@ dataSources: eventHandlers: - event: VestingEscrowCreated(indexed address,indexed address,indexed address,address,address,uint256,uint256,uint256,uint256) handler: handleVestingEscrowCreated + - kind: ethereum/contract + name: EigenDelegationManager + network: {{ network }} + source: + address: '{{ eigenDelegationManager.address }}' + abi: EigenDelegationManager + startBlock: {{ eigenDelegationManager.startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.8 + language: wasm/assemblyscript + file: ./mappings/restakeVault.ts + entities: + - EigenPod + - Transaction + abis: + - name: EigenDelegationManager + file: ./abis/EigenDelegationManager.json + eventHandlers: + - event: StakerDelegated(indexed address,indexed address) + handler: handleStakerDelegated + - event: StakerForceUndelegated(indexed address,indexed address) + handler: handleStakerForceUndelegated + - event: StakerUndelegated(indexed address,indexed address) + handler: handleStakerUndelegated + - kind: ethereum/contract + name: EigenPodManager + network: {{ network }} + source: + address: '{{ eigenPodManager.address }}' + abi: EigenPodManager + startBlock: {{ eigenPodManager.startBlock }} + mapping: + kind: ethereum/events + apiVersion: 0.0.8 + language: wasm/assemblyscript + file: ./mappings/restakeVault.ts + entities: + - EigenPod + - Transaction + abis: + - name: EigenPodManager + file: ./abis/EigenPodManager.json + eventHandlers: + - event: PodSharesUpdated(indexed address,int256) + handler: handlePodSharesUpdated templates: - kind: ethereum/contract name: VaultFactory @@ -452,6 +498,30 @@ templates: eventHandlers: - event: XdaiSwapped(uint256,uint256) handler: handleXdaiSwapped + - kind: ethereum/contract + name: RestakeVault + network: {{ network }} + source: + abi: RestakeVault + mapping: + kind: ethereum/events + apiVersion: 0.0.8 + language: wasm/assemblyscript + file: ./mappings/restakeVault.ts + entities: + - Vault + - EigenPod + - Transaction + abis: + - name: RestakeVault + file: ./abis/RestakeVault.json + eventHandlers: + - event: EigenPodCreated(address,address) + handler: handleEigenPodCreated + - event: RestakeOperatorsManagerUpdated(address) + handler: handleRestakeOperatorsManagerUpdated + - event: RestakeWithdrawalsManagerUpdated(address) + handler: handleRestakeWithdrawalManagerUpdated - kind: ethereum/contract name: OwnMevEscrow network: {{ network }}