Skip to content

Commit

Permalink
add missing event handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
toyv0 committed Jan 21, 2024
1 parent fcbddb3 commit bd1ce6d
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 1 deletion.
48 changes: 48 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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!
Expand Down Expand Up @@ -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!
Expand Down
9 changes: 9 additions & 0 deletions subgraph/handlers/Alchemist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
AlchemistRepayLimitUpdatedEvent,
AlchemistSentinelSetEvent,
AlchemistSnapEvent,
AlchemistSweepTokensEvent,
AlchemistTokenAdapterUpdatedEvent,
AlchemistTransmuterUpdatedEvent,
AlchemistUnderlyingTokenEnabledEvent,
Expand Down Expand Up @@ -68,6 +69,7 @@ import {
Repay1,
Liquidate1,
Liquidate2,
SweepTokens,
} from '../generated/AlchemistV2_alUSD/Alchemist';
import { ERC20 as ERC20Contract } from '../generated/AlchemistV2_alUSD/ERC20';
import {
Expand Down Expand Up @@ -358,6 +360,13 @@ export function handleSnap(event: Snap): void {
entity.save();
}

export function handleSweepTokens(event: SweepTokens): void {
const entity = createAlchemistEvent<AlchemistSweepTokensEvent>(event);
entity.rewardToken = event.params.rewardToken;
entity.amount = event.params.amount;
entity.save();
}

export function handleTokenAdapterUpdated(event: TokenAdapterUpdated): void {
const entity = createAlchemistEvent<AlchemistTokenAdapterUpdatedEvent>(event);
entity.tokenAdapter = event.params.tokenAdapter;
Expand Down
16 changes: 16 additions & 0 deletions subgraph/handlers/EthAssetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
PendingAdminUpdated,
ReclaimEth,
RewardReceiverUpdated,
SweepEth,
SweepToken,
TransmuterBufferUpdated,
WithdrawMetaPoolTokens,
} from '../generated/EthAssetManager/EthAssetManager';
Expand All @@ -26,6 +28,8 @@ import {
EthAssetManagerPendingAdminUpdatedEvent,
EthAssetManagerReclaimEthEvent,
EthAssetManagerRewardReceiverUpdatedEvent,
EthAssetManagerSweepEthEvent,
EthAssetManagerSweepTokenEvent,
EthAssetManagerTransmuterBufferUpdatedEvent,
EthAssetManagerWithdrawMetaPoolTokensEvent,
} from '../generated/schema';
Expand Down Expand Up @@ -81,6 +85,18 @@ export function handleRewardReceiverUpdated(event: RewardReceiverUpdated): void
entity.save();
}

export function handleSweepEth(event: SweepEth): void {
const entity = createEthAssetManagerEvent<EthAssetManagerSweepEthEvent>(event);
entity.amount = event.params.amount;
entity.save();
}

export function handleSweepToken(event: SweepToken): void {
const entity = createEthAssetManagerEvent<EthAssetManagerSweepTokenEvent>(event);
entity.amount = event.params.amount;
entity.save();
}

export function handleTransmuterBufferUpdated(event: TransmuterBufferUpdated): void {
const entity = createEthAssetManagerEvent<EthAssetManagerTransmuterBufferUpdatedEvent>(event);
entity.transmuterBuffer = event.params.transmuterBuffer;
Expand Down
5 changes: 5 additions & 0 deletions subgraph/handlers/FactoryPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<PoolRemoveLiquidityOneEvent>(event);
let pool = getOrCreatePool(event.address, event);
Expand Down
10 changes: 9 additions & 1 deletion subgraph/handlers/TransmuterBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
TransmuterBufferSetSourceEvent,
TransmuterBufferSetAmoEvent,
TransmuterBufferSetDivertToAmoEvent,
TransmuterBufferSetTransmuterEvent,
} from '../generated/schema';
import {
RefreshStrategies,
Expand All @@ -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 {
Expand Down Expand Up @@ -101,6 +102,13 @@ export function handleSetSource(event: SetSource): void {
entity.save();
}

export function handleSetTransmuter(event: SetTransmuter): void {
const entity = createTransmuterBufferEvent<TransmuterBufferSetTransmuterEvent>(event);
entity.underlyingToken = event.params.underlyingToken;
entity.transmuter = event.params.transmuter;
entity.save();
}

export function handleSetAmo(event: SetAmo): void {
const entity = createTransmuterBufferEvent<TransmuterBufferSetAmoEvent>(event);
let underlyingToken = getOrCreateUnderlyingToken(event.params.underlyingToken);
Expand Down

0 comments on commit bd1ce6d

Please sign in to comment.