From bd1ce6d76c84e3e1841144fb4d8649d4d051dd0f Mon Sep 17 00:00:00 2001 From: toyvo Date: Sun, 21 Jan 2024 13:20:50 -0500 Subject: [PATCH] add missing event handlers --- schema.graphql | 48 +++++++++++++++++++++++++++ subgraph/handlers/Alchemist.ts | 9 +++++ subgraph/handlers/EthAssetManager.ts | 16 +++++++++ subgraph/handlers/FactoryPool.ts | 5 +++ subgraph/handlers/TransmuterBuffer.ts | 10 +++++- 5 files changed, 87 insertions(+), 1 deletion(-) diff --git a/schema.graphql b/schema.graphql index 74ec0ca..7144e39 100644 --- a/schema.graphql +++ b/schema.graphql @@ -494,6 +494,18 @@ type AlchemistSnapEvent implements Event @entity { yieldToken: Bytes! } +type AlchemistSweepTokensEvent implements Event @entity { + id: ID! + cursor: BigInt! + index: BigInt! + block: Block! + timestamp: BigInt! + contract: Contract! + transaction: Transaction! + rewardToken: Bytes! + amount: BigInt! +} + type AlchemistTokenAdapterUpdatedEvent implements Event @entity { id: ID! cursor: BigInt! @@ -836,6 +848,18 @@ type TransmuterBufferSetSourceEvent implements Event @entity { source: Bytes! } +type TransmuterBufferSetTransmuterEvent implements Event @entity { + id: ID! + cursor: BigInt! + index: BigInt! + block: Block! + timestamp: BigInt! + contract: Contract! + transaction: Transaction! + underlyingToken: Bytes! + transmuter: Bytes! +} + type TransmuterBufferSetAmoEvent implements Event @entity { id: ID! cursor: BigInt! @@ -997,6 +1021,30 @@ type PoolRemoveLiquidityOneEvent implements PoolEvent @entity { transaction: Bytes! } +type PoolRampAEvent implements PoolEvent @entity { + id: ID! + pool: Pool! + old_A: BigInt! + new_A: BigInt! + initial_time: BigInt! + future_time: BigInt! + + block: Block! + timestamp: BigInt! + transaction: Bytes! +} + +type PoolStopRampAEvent implements PoolEvent @entity { + id: ID! + pool: Pool! + A: BigInt! + t: BigInt! + + block: Block! + timestamp: BigInt! + transaction: Bytes! +} + type PoolExchange implements PoolEvent @entity { id: ID! pool: Pool! diff --git a/subgraph/handlers/Alchemist.ts b/subgraph/handlers/Alchemist.ts index 338cc91..073af8b 100644 --- a/subgraph/handlers/Alchemist.ts +++ b/subgraph/handlers/Alchemist.ts @@ -26,6 +26,7 @@ import { AlchemistRepayLimitUpdatedEvent, AlchemistSentinelSetEvent, AlchemistSnapEvent, + AlchemistSweepTokensEvent, AlchemistTokenAdapterUpdatedEvent, AlchemistTransmuterUpdatedEvent, AlchemistUnderlyingTokenEnabledEvent, @@ -68,6 +69,7 @@ import { Repay1, Liquidate1, Liquidate2, + SweepTokens, } from '../generated/AlchemistV2_alUSD/Alchemist'; import { ERC20 as ERC20Contract } from '../generated/AlchemistV2_alUSD/ERC20'; import { @@ -358,6 +360,13 @@ export function handleSnap(event: Snap): void { entity.save(); } +export function handleSweepTokens(event: SweepTokens): void { + const entity = createAlchemistEvent(event); + entity.rewardToken = event.params.rewardToken; + entity.amount = event.params.amount; + entity.save(); +} + export function handleTokenAdapterUpdated(event: TokenAdapterUpdated): void { const entity = createAlchemistEvent(event); entity.tokenAdapter = event.params.tokenAdapter; diff --git a/subgraph/handlers/EthAssetManager.ts b/subgraph/handlers/EthAssetManager.ts index c5a8f8e..bbd1e88 100644 --- a/subgraph/handlers/EthAssetManager.ts +++ b/subgraph/handlers/EthAssetManager.ts @@ -11,6 +11,8 @@ import { PendingAdminUpdated, ReclaimEth, RewardReceiverUpdated, + SweepEth, + SweepToken, TransmuterBufferUpdated, WithdrawMetaPoolTokens, } from '../generated/EthAssetManager/EthAssetManager'; @@ -26,6 +28,8 @@ import { EthAssetManagerPendingAdminUpdatedEvent, EthAssetManagerReclaimEthEvent, EthAssetManagerRewardReceiverUpdatedEvent, + EthAssetManagerSweepEthEvent, + EthAssetManagerSweepTokenEvent, EthAssetManagerTransmuterBufferUpdatedEvent, EthAssetManagerWithdrawMetaPoolTokensEvent, } from '../generated/schema'; @@ -81,6 +85,18 @@ export function handleRewardReceiverUpdated(event: RewardReceiverUpdated): void entity.save(); } +export function handleSweepEth(event: SweepEth): void { + const entity = createEthAssetManagerEvent(event); + entity.amount = event.params.amount; + entity.save(); +} + +export function handleSweepToken(event: SweepToken): void { + const entity = createEthAssetManagerEvent(event); + entity.amount = event.params.amount; + entity.save(); +} + export function handleTransmuterBufferUpdated(event: TransmuterBufferUpdated): void { const entity = createEthAssetManagerEvent(event); entity.transmuterBuffer = event.params.transmuterBuffer; diff --git a/subgraph/handlers/FactoryPool.ts b/subgraph/handlers/FactoryPool.ts index 6ea83c6..7fe5627 100644 --- a/subgraph/handlers/FactoryPool.ts +++ b/subgraph/handlers/FactoryPool.ts @@ -4,9 +4,11 @@ import { getDailyTradeVolume, getHourlyTradeVolume, getWeeklyTradeVolume } from import { AddLiquidity, FactoryPool, + RampA, RemoveLiquidity, RemoveLiquidityImbalance, RemoveLiquidityOne, + StopRampA, TokenExchange, } from '../generated/alETHFactoryPool/FactoryPool'; import { ERC20, Transfer } from '../generated/alETHFactoryPool/ERC20'; @@ -108,6 +110,9 @@ export function handleRemoveLiquidity(event: RemoveLiquidity): void { export function handleRemoveLiquidityImbalance(event: RemoveLiquidityImbalance): void {} +export function handleRampA(event: RampA): void {} +export function handleStopRampA(event: StopRampA): void {} + export function handleRemoveLiquidityOne(event: RemoveLiquidityOne): void { createFactoryPoolEvent(event); let pool = getOrCreatePool(event.address, event); diff --git a/subgraph/handlers/TransmuterBuffer.ts b/subgraph/handlers/TransmuterBuffer.ts index f0bf517..179ef16 100644 --- a/subgraph/handlers/TransmuterBuffer.ts +++ b/subgraph/handlers/TransmuterBuffer.ts @@ -11,6 +11,7 @@ import { TransmuterBufferSetSourceEvent, TransmuterBufferSetAmoEvent, TransmuterBufferSetDivertToAmoEvent, + TransmuterBufferSetTransmuterEvent, } from '../generated/schema'; import { RefreshStrategies, @@ -23,7 +24,7 @@ import { SetFlowRate, SetSource, } from '../generated/TransmuterBuffer_alETH/TransmuterBuffer'; -import { SetDivertToAmo } from '../generated/TransmuterBuffer_alUSD/TransmuterBuffer'; +import { SetDivertToAmo, SetTransmuter } from '../generated/TransmuterBuffer_alUSD/TransmuterBuffer'; import { createEvent, getOrCreateUnderlyingToken } from '../utils/entities'; function getOrCreateTransmuterBuffer(event: ethereum.Event): TransmuterBuffer { @@ -101,6 +102,13 @@ export function handleSetSource(event: SetSource): void { entity.save(); } +export function handleSetTransmuter(event: SetTransmuter): void { + const entity = createTransmuterBufferEvent(event); + entity.underlyingToken = event.params.underlyingToken; + entity.transmuter = event.params.transmuter; + entity.save(); +} + export function handleSetAmo(event: SetAmo): void { const entity = createTransmuterBufferEvent(event); let underlyingToken = getOrCreateUnderlyingToken(event.params.underlyingToken);