From 12211bab4e60f628bb2cdae06365a92dc9ccad96 Mon Sep 17 00:00:00 2001 From: Mat <63294765+matstyler@users.noreply.github.com> Date: Mon, 20 May 2024 20:12:34 +0200 Subject: [PATCH] feat: follow lp transfers (#150) * feat: follow lp transfers * Run prettier --------- Co-authored-by: Jean Chambras --- 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..8df1ec9 100644 --- a/src/mappings/futures.ts +++ b/src/mappings/futures.ts @@ -35,6 +35,7 @@ import { } from "../entities/AccountAsset" import { getAsset } from "../entities/Asset" import { getAssetAmount } from "../entities/AssetAmount" +import { getPoolLPToken } from "../entities/CurvePool" import { createFactory, getCurveFactory } from "../entities/Factory" import { updateFutureDailyStats } from "../entities/FutureDailyStats" import { @@ -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 {