From 099f3a460ac34cf065754529f053845b30ef1039 Mon Sep 17 00:00:00 2001 From: toniocodo Date: Tue, 26 Nov 2024 12:04:00 +0100 Subject: [PATCH 1/2] feat: add native 3 to oethStrategies --- src/oeth/processors/strategies.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/oeth/processors/strategies.ts b/src/oeth/processors/strategies.ts index 47fa709c..cd85256e 100644 --- a/src/oeth/processors/strategies.ts +++ b/src/oeth/processors/strategies.ts @@ -163,6 +163,18 @@ export const oethStrategies: readonly IStrategyData[] = [ assets: [WETH_ADDRESS].map((address) => ({ address, decimals: 18 })), earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, }, + { + chainId: 1, + from: 21127497, + name: 'OETH Native Staking 3', + contractName: 'NativeStakingSSVStrategy', + address: OETH_NATIVE_STRATEGY_ADDRESSES[2], + oTokenAddress: OETH_ADDRESS, + kind: 'NativeStaking', + base: { address: WETH_ADDRESS, decimals: 18 }, + assets: [WETH_ADDRESS].map((address) => ({ address, decimals: 18 })), + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, + }, ] const strategies = oethStrategies From 820f6b055329fc94f1be5b8d4891a849a30428b3 Mon Sep 17 00:00:00 2001 From: Chris Jacobs Date: Tue, 26 Nov 2024 05:24:46 -0800 Subject: [PATCH 2/2] change strategies native staking declarations to generate dynamically --- src/mainnet/processors/native-staking.ts | 6 +-- src/oeth/processors/strategies.ts | 59 ++++++++---------------- src/utils/addresses.ts | 10 ++-- 3 files changed, 27 insertions(+), 48 deletions(-) diff --git a/src/mainnet/processors/native-staking.ts b/src/mainnet/processors/native-staking.ts index 47d703d1..b3928430 100644 --- a/src/mainnet/processors/native-staking.ts +++ b/src/mainnet/processors/native-staking.ts @@ -2,15 +2,15 @@ import * as beaconAbi from '@abi/beacon-deposit-contract' import { BeaconDepositEvent, BeaconDepositPubkey } from '@model' import { Block, Context } from '@processor' import { EvmBatchProcessor } from '@subsquid/evm-processor' -import { OETH_NATIVE_STRATEGY_ADDRESSES } from '@utils/addresses' +import { OETH_NATIVE_STRATEGIES } from '@utils/addresses' import { logFilter } from '@utils/logFilter' import { readLinesFromUrlInBatches } from '@utils/readLinesFromUrlInBatches' export const from = 20029793 // Dump contains pubkeys up until 20029793. const beaconDepositContractAddress = '0x00000000219ab540356cbb839cbe05303d7705fa' -const withdrawCredentials = OETH_NATIVE_STRATEGY_ADDRESSES.map( - (address) => `0x010000000000000000000000${address.slice(2)}`, +const withdrawCredentials = OETH_NATIVE_STRATEGIES.map( + (strategy) => `0x010000000000000000000000${strategy.address.slice(2)}`, ) const beaconDepositFilter = logFilter({ diff --git a/src/oeth/processors/strategies.ts b/src/oeth/processors/strategies.ts index cd85256e..ea986265 100644 --- a/src/oeth/processors/strategies.ts +++ b/src/oeth/processors/strategies.ts @@ -11,7 +11,7 @@ import { ETH_ADDRESS, FRXETH_ADDRESS, OETH_ADDRESS, - OETH_NATIVE_STRATEGY_ADDRESSES, + OETH_NATIVE_STRATEGIES, OETH_VAULT_ADDRESS, RETH_ADDRESS, STETH_ADDRESS, @@ -139,50 +139,29 @@ export const oethStrategies: readonly IStrategyData[] = [ decimals: 18, })), }, - { - chainId: 1, - from: 20046251, - name: 'OETH Native Staking 1', - contractName: 'NativeStakingSSVStrategy', - address: OETH_NATIVE_STRATEGY_ADDRESSES[0], - oTokenAddress: OETH_ADDRESS, - kind: 'NativeStaking', - base: { address: WETH_ADDRESS, decimals: 18 }, - assets: [WETH_ADDRESS].map((address) => ({ address, decimals: 18 })), - earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, - }, - { - chainId: 1, - from: 20290461, - name: 'OETH Native Staking 2', - contractName: 'NativeStakingSSVStrategy', - address: OETH_NATIVE_STRATEGY_ADDRESSES[1], - oTokenAddress: OETH_ADDRESS, - kind: 'NativeStaking', - base: { address: WETH_ADDRESS, decimals: 18 }, - assets: [WETH_ADDRESS].map((address) => ({ address, decimals: 18 })), - earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, - }, - { - chainId: 1, - from: 21127497, - name: 'OETH Native Staking 3', - contractName: 'NativeStakingSSVStrategy', - address: OETH_NATIVE_STRATEGY_ADDRESSES[2], - oTokenAddress: OETH_ADDRESS, - kind: 'NativeStaking', - base: { address: WETH_ADDRESS, decimals: 18 }, - assets: [WETH_ADDRESS].map((address) => ({ address, decimals: 18 })), - earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, - }, + ...OETH_NATIVE_STRATEGIES.map( + (strategy, index) => + ({ + chainId: 1, + from: strategy.from, + name: `OETH Native Staking ${index + 1}`, + contractName: 'NativeStakingSSVStrategy', + address: strategy.address, + oTokenAddress: OETH_ADDRESS, + kind: 'NativeStaking', + base: { address: WETH_ADDRESS, decimals: 18 }, + assets: [WETH_ADDRESS].map((address) => ({ address, decimals: 18 })), + earnings: { passiveByDepositWithdrawal: true, rewardTokenCollected: true }, + }) as const, + ), ] const strategies = oethStrategies const eventProcessors = [ - ...OETH_NATIVE_STRATEGY_ADDRESSES.map((address) => + ...OETH_NATIVE_STRATEGIES.map((strategy) => createEventProcessor({ - address, + address: strategy.address, event: nativeStakingAbi.events.AccountingConsensusRewards, from: 20046251, mapEntity: (ctx, block, log, decoded) => @@ -191,7 +170,7 @@ const eventProcessors = [ chainId: ctx.chain.id, timestamp: new Date(block.header.timestamp), blockNumber: block.header.height, - address, + address: strategy.address, rewards: decoded.amount, }), }), diff --git a/src/utils/addresses.ts b/src/utils/addresses.ts index 6f649d6c..7d14f2e4 100644 --- a/src/utils/addresses.ts +++ b/src/utils/addresses.ts @@ -69,10 +69,10 @@ export const CURVE_ETH_OETH_POOL_ADDRESS = '0x94b17476a93b3262d87b9a326965d1e91f export const OETH_FRAX_STAKING_ADDRESS = '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5' export const OETH_MORPHO_AAVE_ADDRESS = '0xc1fc9e5ec3058921ea5025d703cbe31764756319' export const OETH_STRATEGY_BALANCER_ADDRESS = '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc' -export const OETH_NATIVE_STRATEGY_ADDRESSES = [ - '0x34edb2ee25751ee67f68a45813b22811687c0238', - '0x4685db8bf2df743c861d71e6cfb5347222992076', - '0xe98538a0e8c2871c2482e1be8cc6bd9f8e8ffd63', +export const OETH_NATIVE_STRATEGIES = [ + { address: '0x34edb2ee25751ee67f68a45813b22811687c0238', from: 20046251 }, + { address: '0x4685db8bf2df743c861d71e6cfb5347222992076', from: 20290461 }, + { address: '0xe98538a0e8c2871c2482e1be8cc6bd9f8e8ffd63', from: 21127497 }, ] export const OETH_NATIVE_STRATEGY_FEE_ACCUMULATOR_ADDRESS = '0x7ed4ccb74a1ee903af5fbd9be00ca8616f23d627' export const OETH_VAULT_ERC20_ADDRESSES = [WETH_ADDRESS, STETH_ADDRESS, RETH_ADDRESS, FRXETH_ADDRESS] @@ -131,7 +131,7 @@ export const strategies = { FraxETHStrategy: '0x3ff8654d633d4ea0fae24c52aec73b4a20d0d0e5', MorphoAaveStrategy: '0xc1fc9e5ec3058921ea5025d703cbe31764756319', BalancerMetaPoolStrategy: '0x49109629ac1deb03f2e9b2fe2ac4a623e0e7dfdc', - NativeStakingStrategies: OETH_NATIVE_STRATEGY_ADDRESSES, + NativeStakingStrategies: OETH_NATIVE_STRATEGIES.map((s) => s.address), }, ousd: { ConvexOUSDMetaStrategy: '0x89eb88fedc50fc77ae8a18aad1ca0ac27f777a90',