From 55709e0acd5ff6092b3e96e877671621bf5c7f15 Mon Sep 17 00:00:00 2001 From: matstyler Date: Mon, 20 May 2024 16:08:52 +0200 Subject: [PATCH] feat: follow lp transfers --- src/entities/Pool.ts | 3 ++- src/mappings/futures.ts | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/entities/Pool.ts b/src/entities/Pool.ts index 43fd251..604b2f4 100644 --- a/src/entities/Pool.ts +++ b/src/entities/Pool.ts @@ -21,6 +21,7 @@ class PoolDetails { ibtAddress: Address ptAddress: Address factoryAddress: Address + lpAddress: Address timestamp: BigInt blockNumber: BigInt logIndex: BigInt @@ -69,7 +70,7 @@ export function createPool(params: PoolDetails): Pool { // Asset - Future relation let lpToken = getAsset( - getPoolLPToken(params.poolAddress).toHex(), + params.lpAddress.toHex(), params.timestamp, AssetType.LP ) diff --git a/src/mappings/futures.ts b/src/mappings/futures.ts index bebfd47..39738db 100644 --- a/src/mappings/futures.ts +++ b/src/mappings/futures.ts @@ -58,6 +58,7 @@ import { AssetType, generateFeeClaimId } from "../utils" import transactionType from "../utils/TransactionType" // import { calculateLpVaultAPR } from "../utils/calculateAPR" import { generateTransactionId } from "../utils/idGenerators" +import { getPoolLPToken } from "../entities/CurvePool"; export function handleRegistryChange(event: RegistryChange): void { let factory = Factory.load(event.address.toHex()) @@ -401,16 +402,22 @@ export function handleCurveFactoryChange(event: CurveFactoryChange): void { } export function handleCurvePoolDeployed(event: CurvePoolDeployed): void { + const lpAddress = getPoolLPToken(event.params.poolAddress) + createPool({ poolAddress: event.params.poolAddress, ibtAddress: event.params.ibt, factoryAddress: event.address, ptAddress: event.params.pt, + lpAddress: lpAddress, timestamp: event.block.timestamp, logIndex: event.logIndex, transactionHash: event.transaction.hash, blockNumber: event.block.number, }) + + // Create dynamic data source for LP token events + ERC20.create(lpAddress) } export function handleYieldUpdated(event: YieldUpdated): void {