diff --git a/manifests/manifest.eth.ts b/manifests/manifest.eth.ts index eccea50..876eaa4 100644 --- a/manifests/manifest.eth.ts +++ b/manifests/manifest.eth.ts @@ -1,7 +1,7 @@ import 'dotenv/config'; import { createThreePoolAssetManager } from '../sources/ThreePoolAssetManager'; -import { createEthAssetManager } from '../sources/EthAssetManager'; +// import { createEthAssetManager } from '../sources/EthAssetManager'; import { createAlchemist } from '../sources/Alchemist'; import { createTransmuter } from '../sources/Transmuter'; import { createTransmuterBuffer } from '../sources/TransmuterBuffer'; @@ -25,7 +25,7 @@ export default { createTransmuterBuffer('TransmuterBuffer_alUSD'), createTransmuterBuffer('TransmuterBuffer_alETH'), createThreePoolAssetManager('ThreePoolAssetManager_alUSD', 14543500, '0x9735F7d3Ea56b454b24fFD74C58E9bD85cfaD31B'), - createEthAssetManager('EthAssetManager', 14573961, '0xe761bf731A06fE8259FeE05897B2687D56933110'), + // createEthAssetManager('EthAssetManager', 14573961, '0xe761bf731A06fE8259FeE05897B2687D56933110'), // createEthAssetManager('EthAssetManager', 18475576, '0x9fb54d1F6F506Feb4c65B721bE931e59BB538c63'), createMetaPool('alUSDMetaPool', '0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c', 11955332), createFactoryPool('alETHFactoryPool', '0xc4c319e2d4d66cca4464c0c2b32c9bd23ebe784e', 13227440), diff --git a/sources/EthAssetManager.ts b/sources/EthAssetManager.ts index ece8a78..463da68 100644 --- a/sources/EthAssetManager.ts +++ b/sources/EthAssetManager.ts @@ -1,42 +1,42 @@ -import { utils } from 'ethers'; -import { eventDeclarations, deploymentAddress } from './utils/abis'; -import { networkName, startBlockNumber } from './utils/constants'; -import { DataSource } from './utils/types'; +// import { utils } from 'ethers'; +// import { eventDeclarations, deploymentAddress } from './utils/abis'; +// import { networkName, startBlockNumber } from './utils/constants'; +// import { DataSource } from './utils/types'; -const EthAssetManagerInterface = new utils.Interface(require('../abis/EthAssetManager.json')); -const EthAssetManagerEvents = Object.values(EthAssetManagerInterface.events); +// const EthAssetManagerInterface = new utils.Interface(require('../abis/EthAssetManager.json')); +// const EthAssetManagerEvents = Object.values(EthAssetManagerInterface.events); -export function createEthAssetManager( - name: string, - block: number = startBlockNumber, - address: string = deploymentAddress(name), -): DataSource { - return { - name, - network: networkName, - kind: 'ethereum/contract', - mapping: { - apiVersion: '0.0.6', - kind: 'ethereum/events', - language: 'wasm/assemblyscript', - file: 'subgraph/handlers/EthAssetManager.ts', - entities: [], - eventHandlers: eventDeclarations(EthAssetManagerEvents), - abis: [ - { - name: 'EthAssetManager', - file: 'abis/EthAssetManager.json', - }, - { - name: 'ERC20', - file: 'abis/ERC20.json', - }, - ], - }, - source: { - abi: 'EthAssetManager', - address, - startBlock: block, - }, - }; -} +// export function createEthAssetManager( +// name: string, +// block: number = startBlockNumber, +// address: string = deploymentAddress(name), +// ): DataSource { +// return { +// name, +// network: networkName, +// kind: 'ethereum/contract', +// mapping: { +// apiVersion: '0.0.6', +// kind: 'ethereum/events', +// language: 'wasm/assemblyscript', +// file: 'subgraph/handlers/EthAssetManager.ts', +// entities: [], +// eventHandlers: eventDeclarations(EthAssetManagerEvents), +// abis: [ +// { +// name: 'EthAssetManager', +// file: 'abis/EthAssetManager.json', +// }, +// { +// name: 'ERC20', +// file: 'abis/ERC20.json', +// }, +// ], +// }, +// source: { +// abi: 'EthAssetManager', +// address, +// startBlock: block, +// }, +// }; +// } diff --git a/subgraph/handlers/EthAssetManager.ts b/subgraph/handlers/EthAssetManager.ts index c5a8f8e..97b44db 100644 --- a/subgraph/handlers/EthAssetManager.ts +++ b/subgraph/handlers/EthAssetManager.ts @@ -1,195 +1,195 @@ -import { Address, Entity, ethereum, BigInt } from '@graphprotocol/graph-ts'; -import { - AdminUpdated, - BurnMetaPoolTokens, - ClaimRewards, - DepositMetaPoolTokens, - MetaPoolSlippageUpdated, - MintMetaPoolTokens, - MintMetaPoolTokens1, - OperatorUpdated, - PendingAdminUpdated, - ReclaimEth, - RewardReceiverUpdated, - TransmuterBufferUpdated, - WithdrawMetaPoolTokens, -} from '../generated/EthAssetManager/EthAssetManager'; -import { - EthAssetManager, - EthAssetManagerAdminUpdatedEvent, - EthAssetManagerBurnMetaPoolTokensEvent, - EthAssetManagerClaimRewardsEvent, - EthAssetManagerDepositMetaPoolTokensEvent, - EthAssetManagerMetaPoolSlippageUpdatedEvent, - EthAssetManagerMintMetaPoolTokensEvent, - EthAssetManagerOperatorUpdatedEvent, - EthAssetManagerPendingAdminUpdatedEvent, - EthAssetManagerReclaimEthEvent, - EthAssetManagerRewardReceiverUpdatedEvent, - EthAssetManagerTransmuterBufferUpdatedEvent, - EthAssetManagerWithdrawMetaPoolTokensEvent, -} from '../generated/schema'; -import { CONVEX_TOKEN, CURVE_TOKEN, ETH_META_POOL_ASSETS } from '../utils/constants'; -import { - createEvent, - getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory, - getOrCreateEthAssetManagerRewardsHistory, - getOrCreateEthAssetManagerTokenBalance, - getOrCreateUnderlyingToken, -} from '../utils/entities'; - -function getOrCreateEthAssetManager(event: ethereum.Event): EthAssetManager { - let entity = EthAssetManager.load(event.address.toHex()); - - if (!entity) { - entity = new EthAssetManager(event.address.toHex()); - entity.save(); - } - - return entity; -} - -function createEthAssetManagerEvent(event: ethereum.Event): TEvent { - const contract = getOrCreateEthAssetManager(event); - const entity = createEvent(event); - entity.setString('contract', contract.id); - - return entity; -} - -export function handleAdminUpdated(event: AdminUpdated): void { - const entity = createEthAssetManagerEvent(event); - entity.admin = event.params.admin; - entity.save(); -} - -export function handlePendingAdminUpdated(event: PendingAdminUpdated): void { - const entity = createEthAssetManagerEvent(event); - entity.pendingAdmin = event.params.pendingAdmin; - entity.save(); -} - -export function handleOperatorUpdated(event: OperatorUpdated): void { - const entity = createEthAssetManagerEvent(event); - entity.operator = event.params.operator; - entity.save(); -} - -export function handleRewardReceiverUpdated(event: RewardReceiverUpdated): void { - const entity = createEthAssetManagerEvent(event); - entity.rewardReceiver = event.params.rewardReceiver; - entity.save(); -} - -export function handleTransmuterBufferUpdated(event: TransmuterBufferUpdated): void { - const entity = createEthAssetManagerEvent(event); - entity.transmuterBuffer = event.params.transmuterBuffer; - entity.save(); -} - -export function handleMetaPoolSlippageUpdated(event: MetaPoolSlippageUpdated): void { - const entity = createEthAssetManagerEvent(event); - entity.metaPoolSlippage = event.params.metaPoolSlippage; - entity.save(); -} - -export function handleMintMetaPoolTokens(event: MintMetaPoolTokens): void { - const entity = createEthAssetManagerEvent(event); - entity.amounts = event.params.amounts; - entity.mintedThreePoolTokens = event.params.mintedThreePoolTokens; - entity.save(); -} - -export function handleMintMetaPoolTokens1(event: MintMetaPoolTokens1): void { - const entity = createEthAssetManagerEvent(event); - entity.asset = event.params.asset; - entity.amount = event.params.amount; - entity.minted = event.params.minted; - entity.save(); -} - -export function handleBurnMetaPoolTokens(event: BurnMetaPoolTokens): void { - const entity = createEthAssetManagerEvent(event); - entity.asset = event.params.asset; - entity.amount = event.params.amount; - entity.withdrawn = event.params.withdrawn; - entity.save(); - - const ethAssetManager = getOrCreateEthAssetManager(event); - const metaPoolToken = getOrCreateUnderlyingToken(Address.fromString(ETH_META_POOL_ASSETS[event.params.asset])); - const token = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, metaPoolToken); - token.amount = token.amount.minus(event.params.amount); - token.save(); - - getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory(token, event.params.amount.times(BigInt.fromI32(-1)), event); -} - -export function handleWithdrawMetaPoolTokens(event: WithdrawMetaPoolTokens): void { - const entity = createEthAssetManagerEvent(event); - entity.amount = event.params.amount; - entity.success = event.params.success; - entity.save(); - - const ethAssetManager = getOrCreateEthAssetManager(event); - const metaPoolToken = getOrCreateUnderlyingToken(Address.fromString(ETH_META_POOL_ASSETS[0])); - const token = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, metaPoolToken); - token.amount = token.amount.plus(event.params.amount); - token.save(); - - getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory(token, event.params.amount, event); -} - -export function handleDepositMetaPoolTokens(event: DepositMetaPoolTokens): void { - const entity = createEthAssetManagerEvent(event); - entity.amount = event.params.amount; - entity.success = event.params.success; - entity.save(); - - const ethAssetManager = getOrCreateEthAssetManager(event); - const metaPoolToken = getOrCreateUnderlyingToken(Address.fromString(ETH_META_POOL_ASSETS[1])); - const token = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, metaPoolToken); - token.amount = token.amount.minus(event.params.amount); - token.save(); - - getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory(token, event.params.amount.times(BigInt.fromI32(-1)), event); -} - -export function handleClaimRewards(event: ClaimRewards): void { - const entity = createEthAssetManagerEvent(event); - entity.success = event.params.success; - entity.amountCurve = event.params.amountCurve; - entity.amountConvex = event.params.amountConvex; - entity.save(); - - const ethAssetManager = getOrCreateEthAssetManager(event); - const curveToken = getOrCreateUnderlyingToken(Address.fromString(CURVE_TOKEN)); - const curveState = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, curveToken); - const convexToken = getOrCreateUnderlyingToken(Address.fromString(CONVEX_TOKEN)); - const convexState = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, convexToken); - curveState.amount = curveState.amount.plus(event.params.amountCurve); - convexState.amount = convexState.amount.plus(event.params.amountConvex); - curveState.save(); - convexState.save(); - - getOrCreateEthAssetManagerRewardsHistory( - curveState, - convexState, - event.params.amountCurve, - event.params.amountConvex, - event, - ); -} - -export function handleReclaimEth(event: ReclaimEth): void { - const entity = createEthAssetManagerEvent(event); - entity.amount = event.params.amount; - entity.save(); - - const threePoolAssetManager = getOrCreateEthAssetManager(event); - const threePoolToken = getOrCreateUnderlyingToken(Address.fromString(ETH_META_POOL_ASSETS[0])); - const token = getOrCreateEthAssetManagerTokenBalance(threePoolAssetManager, threePoolToken); - token.amount = token.amount.minus(event.params.amount); - token.save(); - - getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory(token, event.params.amount.times(BigInt.fromI32(-1)), event); -} +// import { Address, Entity, ethereum, BigInt } from '@graphprotocol/graph-ts'; +// import { +// AdminUpdated, +// BurnMetaPoolTokens, +// ClaimRewards, +// DepositMetaPoolTokens, +// MetaPoolSlippageUpdated, +// MintMetaPoolTokens, +// MintMetaPoolTokens1, +// OperatorUpdated, +// PendingAdminUpdated, +// ReclaimEth, +// RewardReceiverUpdated, +// TransmuterBufferUpdated, +// WithdrawMetaPoolTokens, +// } from '../generated/EthAssetManager/EthAssetManager'; +// import { +// EthAssetManager, +// EthAssetManagerAdminUpdatedEvent, +// EthAssetManagerBurnMetaPoolTokensEvent, +// EthAssetManagerClaimRewardsEvent, +// EthAssetManagerDepositMetaPoolTokensEvent, +// EthAssetManagerMetaPoolSlippageUpdatedEvent, +// EthAssetManagerMintMetaPoolTokensEvent, +// EthAssetManagerOperatorUpdatedEvent, +// EthAssetManagerPendingAdminUpdatedEvent, +// EthAssetManagerReclaimEthEvent, +// EthAssetManagerRewardReceiverUpdatedEvent, +// EthAssetManagerTransmuterBufferUpdatedEvent, +// EthAssetManagerWithdrawMetaPoolTokensEvent, +// } from '../generated/schema'; +// import { CONVEX_TOKEN, CURVE_TOKEN, ETH_META_POOL_ASSETS } from '../utils/constants'; +// import { +// createEvent, +// getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory, +// getOrCreateEthAssetManagerRewardsHistory, +// getOrCreateEthAssetManagerTokenBalance, +// getOrCreateUnderlyingToken, +// } from '../utils/entities'; + +// function getOrCreateEthAssetManager(event: ethereum.Event): EthAssetManager { +// let entity = EthAssetManager.load(event.address.toHex()); + +// if (!entity) { +// entity = new EthAssetManager(event.address.toHex()); +// entity.save(); +// } + +// return entity; +// } + +// function createEthAssetManagerEvent(event: ethereum.Event): TEvent { +// const contract = getOrCreateEthAssetManager(event); +// const entity = createEvent(event); +// entity.setString('contract', contract.id); + +// return entity; +// } + +// export function handleAdminUpdated(event: AdminUpdated): void { +// const entity = createEthAssetManagerEvent(event); +// entity.admin = event.params.admin; +// entity.save(); +// } + +// export function handlePendingAdminUpdated(event: PendingAdminUpdated): void { +// const entity = createEthAssetManagerEvent(event); +// entity.pendingAdmin = event.params.pendingAdmin; +// entity.save(); +// } + +// export function handleOperatorUpdated(event: OperatorUpdated): void { +// const entity = createEthAssetManagerEvent(event); +// entity.operator = event.params.operator; +// entity.save(); +// } + +// export function handleRewardReceiverUpdated(event: RewardReceiverUpdated): void { +// const entity = createEthAssetManagerEvent(event); +// entity.rewardReceiver = event.params.rewardReceiver; +// entity.save(); +// } + +// export function handleTransmuterBufferUpdated(event: TransmuterBufferUpdated): void { +// const entity = createEthAssetManagerEvent(event); +// entity.transmuterBuffer = event.params.transmuterBuffer; +// entity.save(); +// } + +// export function handleMetaPoolSlippageUpdated(event: MetaPoolSlippageUpdated): void { +// const entity = createEthAssetManagerEvent(event); +// entity.metaPoolSlippage = event.params.metaPoolSlippage; +// entity.save(); +// } + +// export function handleMintMetaPoolTokens(event: MintMetaPoolTokens): void { +// const entity = createEthAssetManagerEvent(event); +// entity.amounts = event.params.amounts; +// entity.mintedThreePoolTokens = event.params.mintedThreePoolTokens; +// entity.save(); +// } + +// export function handleMintMetaPoolTokens1(event: MintMetaPoolTokens1): void { +// const entity = createEthAssetManagerEvent(event); +// entity.asset = event.params.asset; +// entity.amount = event.params.amount; +// entity.minted = event.params.minted; +// entity.save(); +// } + +// export function handleBurnMetaPoolTokens(event: BurnMetaPoolTokens): void { +// const entity = createEthAssetManagerEvent(event); +// entity.asset = event.params.asset; +// entity.amount = event.params.amount; +// entity.withdrawn = event.params.withdrawn; +// entity.save(); + +// const ethAssetManager = getOrCreateEthAssetManager(event); +// const metaPoolToken = getOrCreateUnderlyingToken(Address.fromString(ETH_META_POOL_ASSETS[event.params.asset])); +// const token = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, metaPoolToken); +// token.amount = token.amount.minus(event.params.amount); +// token.save(); + +// getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory(token, event.params.amount.times(BigInt.fromI32(-1)), event); +// } + +// export function handleWithdrawMetaPoolTokens(event: WithdrawMetaPoolTokens): void { +// const entity = createEthAssetManagerEvent(event); +// entity.amount = event.params.amount; +// entity.success = event.params.success; +// entity.save(); + +// const ethAssetManager = getOrCreateEthAssetManager(event); +// const metaPoolToken = getOrCreateUnderlyingToken(Address.fromString(ETH_META_POOL_ASSETS[0])); +// const token = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, metaPoolToken); +// token.amount = token.amount.plus(event.params.amount); +// token.save(); + +// getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory(token, event.params.amount, event); +// } + +// export function handleDepositMetaPoolTokens(event: DepositMetaPoolTokens): void { +// const entity = createEthAssetManagerEvent(event); +// entity.amount = event.params.amount; +// entity.success = event.params.success; +// entity.save(); + +// const ethAssetManager = getOrCreateEthAssetManager(event); +// const metaPoolToken = getOrCreateUnderlyingToken(Address.fromString(ETH_META_POOL_ASSETS[1])); +// const token = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, metaPoolToken); +// token.amount = token.amount.minus(event.params.amount); +// token.save(); + +// getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory(token, event.params.amount.times(BigInt.fromI32(-1)), event); +// } + +// export function handleClaimRewards(event: ClaimRewards): void { +// const entity = createEthAssetManagerEvent(event); +// entity.success = event.params.success; +// entity.amountCurve = event.params.amountCurve; +// entity.amountConvex = event.params.amountConvex; +// entity.save(); + +// const ethAssetManager = getOrCreateEthAssetManager(event); +// const curveToken = getOrCreateUnderlyingToken(Address.fromString(CURVE_TOKEN)); +// const curveState = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, curveToken); +// const convexToken = getOrCreateUnderlyingToken(Address.fromString(CONVEX_TOKEN)); +// const convexState = getOrCreateEthAssetManagerTokenBalance(ethAssetManager, convexToken); +// curveState.amount = curveState.amount.plus(event.params.amountCurve); +// convexState.amount = convexState.amount.plus(event.params.amountConvex); +// curveState.save(); +// convexState.save(); + +// getOrCreateEthAssetManagerRewardsHistory( +// curveState, +// convexState, +// event.params.amountCurve, +// event.params.amountConvex, +// event, +// ); +// } + +// export function handleReclaimEth(event: ReclaimEth): void { +// const entity = createEthAssetManagerEvent(event); +// entity.amount = event.params.amount; +// entity.save(); + +// const threePoolAssetManager = getOrCreateEthAssetManager(event); +// const threePoolToken = getOrCreateUnderlyingToken(Address.fromString(ETH_META_POOL_ASSETS[0])); +// const token = getOrCreateEthAssetManagerTokenBalance(threePoolAssetManager, threePoolToken); +// token.amount = token.amount.minus(event.params.amount); +// token.save(); + +// getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory(token, event.params.amount.times(BigInt.fromI32(-1)), event); +// } diff --git a/subgraph/utils/entities.ts b/subgraph/utils/entities.ts index 89eb10d..34b428e 100644 --- a/subgraph/utils/entities.ts +++ b/subgraph/utils/entities.ts @@ -6,7 +6,6 @@ import { AlchemistBalanceHistory, Block, Transaction, - DebtToken, YieldToken, DebtToken, TransmuterBalance, @@ -22,9 +21,9 @@ import { ThreePoolAssetManagerMetaPoolTokenBalanceHistory, ThreePoolAssetManagerToken, RewardsHistory, - EthAssetManager, - EthAssetManagerToken, - EthAssetManagerMetaPoolTokenBalanceHistory, + // EthAssetManager, + // EthAssetManagerToken, + // EthAssetManagerMetaPoolTokenBalanceHistory, } from '../generated/schema'; import { ERC20 as ERC20Contract } from '../generated/AlchemistV2_alUSD/ERC20'; import { uniqueEventId, sortableEventCursor } from './id'; @@ -398,71 +397,71 @@ export function getOrCreateThreePoolAssetManagerRewardsHistory( return entity; } -export function getOrCreateEthAssetManagerTokenBalance( - ethAssetManager: EthAssetManager, - token: UnderlyingToken, -): EthAssetManagerToken { - const id = ethAssetManager.id + '/' + token.id; - let entity = EthAssetManagerToken.load(id); - - if (!entity) { - entity = new EthAssetManagerToken(id); - entity.token = token.id; - entity.amount = BigInt.fromI32(0); - entity.save(); - } - - return entity; -} - -export function getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory( - state: EthAssetManagerToken, - amountChange: BigInt, - event: ethereum.Event, -): EthAssetManagerMetaPoolTokenBalanceHistory { - const eventId = uniqueEventId(event); - const id = state.id + '/' + eventId; - let entity = EthAssetManagerMetaPoolTokenBalanceHistory.load(id); - - if (!entity) { - entity = new EthAssetManagerMetaPoolTokenBalanceHistory(id); - entity.transaction = event.transaction.hash.toHex(); - entity.metaPoolToken = state.token; - entity.ethAssetManager = state.id; - entity.amountChange = amountChange; - entity.balance = state.amount; - entity.event = eventId; - entity.block = event.block.hash.toHex(); - entity.timestamp = event.block.timestamp; - } - - return entity; -} - -export function getOrCreateEthAssetManagerRewardsHistory( - curveState: EthAssetManagerToken, - convexState: EthAssetManagerToken, - amountChangeCurve: BigInt, - amountChangeConvex: BigInt, - event: ethereum.Event, -): RewardsHistory { - const eventId = uniqueEventId(event); - const id = curveState.id + '/' + convexState.id + '/' + eventId; - let entity = RewardsHistory.load(id); - - if (!entity) { - entity = new RewardsHistory(id); - entity.transaction = event.transaction.hash.toHex(); - entity.curveToken = curveState.id; - entity.convexToken = convexState.id; - entity.amountChangeCurve = amountChangeCurve; - entity.amountChangeConvex = amountChangeConvex; - entity.curveBalance = curveState.amount; - entity.convexBalance = convexState.amount; - entity.event = eventId; - entity.block = event.block.hash.toHex(); - entity.timestamp = event.block.timestamp; - } - - return entity; -} +// export function getOrCreateEthAssetManagerTokenBalance( +// ethAssetManager: EthAssetManager, +// token: UnderlyingToken, +// ): EthAssetManagerToken { +// const id = ethAssetManager.id + '/' + token.id; +// let entity = EthAssetManagerToken.load(id); + +// if (!entity) { +// entity = new EthAssetManagerToken(id); +// entity.token = token.id; +// entity.amount = BigInt.fromI32(0); +// entity.save(); +// } + +// return entity; +// } + +// export function getOrCreateEthAssetManagerMetaPoolTokenBalanceHistory( +// state: EthAssetManagerToken, +// amountChange: BigInt, +// event: ethereum.Event, +// ): EthAssetManagerMetaPoolTokenBalanceHistory { +// const eventId = uniqueEventId(event); +// const id = state.id + '/' + eventId; +// let entity = EthAssetManagerMetaPoolTokenBalanceHistory.load(id); + +// if (!entity) { +// entity = new EthAssetManagerMetaPoolTokenBalanceHistory(id); +// entity.transaction = event.transaction.hash.toHex(); +// entity.metaPoolToken = state.token; +// entity.ethAssetManager = state.id; +// entity.amountChange = amountChange; +// entity.balance = state.amount; +// entity.event = eventId; +// entity.block = event.block.hash.toHex(); +// entity.timestamp = event.block.timestamp; +// } + +// return entity; +// } + +// export function getOrCreateEthAssetManagerRewardsHistory( +// curveState: EthAssetManagerToken, +// convexState: EthAssetManagerToken, +// amountChangeCurve: BigInt, +// amountChangeConvex: BigInt, +// event: ethereum.Event, +// ): RewardsHistory { +// const eventId = uniqueEventId(event); +// const id = curveState.id + '/' + convexState.id + '/' + eventId; +// let entity = RewardsHistory.load(id); + +// if (!entity) { +// entity = new RewardsHistory(id); +// entity.transaction = event.transaction.hash.toHex(); +// entity.curveToken = curveState.id; +// entity.convexToken = convexState.id; +// entity.amountChangeCurve = amountChangeCurve; +// entity.amountChangeConvex = amountChangeConvex; +// entity.curveBalance = curveState.amount; +// entity.convexBalance = convexState.amount; +// entity.event = eventId; +// entity.block = event.block.hash.toHex(); +// entity.timestamp = event.block.timestamp; +// } + +// return entity; +// }