Skip to content

Commit

Permalink
fix: update pool fee upon first liquidity add
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulydev committed Sep 12, 2024
1 parent ffc66b7 commit 99e04a2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/mappings/amm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import { getAccount } from "../entities/Account"
import { updateAccountAssetBalance } from "../entities/AccountAsset"
import { getAsset } from "../entities/Asset"
import { getAssetAmount } from "../entities/AssetAmount"
import { getPoolLastPrices, getPoolLPToken } from "../entities/CurvePool"
import {
getPoolFee,
getPoolLastPrices,
getPoolLPToken,
} from "../entities/CurvePool"
import { getERC20Decimals, getERC20TotalSupply } from "../entities/ERC20"
import { updateFutureDailyStats } from "../entities/FutureDailyStats"
import { createTransaction } from "../entities/Transaction"
Expand Down Expand Up @@ -138,6 +142,13 @@ export function handleAddLiquidity(event: AddLiquidity): void {
pool.totalFees = pool.totalFees.plus(fee)
pool.totalAdminFees = pool.totalAdminFees.plus(adminFee)

if (
poolIBTAssetAmount.amount.equals(ZERO_BI) &&
poolPTAssetAmount.amount.equals(ZERO_BI)
) {
pool.feeRate = getPoolFee(pool.address)
}

pool.save()

poolIBTAssetAmount.amount = poolIBTAssetAmount.amount.plus(
Expand Down

0 comments on commit 99e04a2

Please sign in to comment.