Skip to content

Commit

Permalink
feat: follow lp transfers (#150)
Browse files Browse the repository at this point in the history
* feat: follow lp transfers

* Run prettier

---------

Co-authored-by: Jean Chambras <[email protected]>
  • Loading branch information
matstyler and jeanchambras authored May 20, 2024
1 parent f38048e commit 12211ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/entities/Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class PoolDetails {
ibtAddress: Address
ptAddress: Address
factoryAddress: Address
lpAddress: Address
timestamp: BigInt
blockNumber: BigInt
logIndex: BigInt
Expand Down Expand Up @@ -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
)
Expand Down
7 changes: 7 additions & 0 deletions src/mappings/futures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 12211ba

Please sign in to comment.