Skip to content

Commit

Permalink
feat: follow lp transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
matstyler committed May 20, 2024
1 parent f38048e commit 55709e0
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 @@ -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())
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 55709e0

Please sign in to comment.