Skip to content

Commit dc249b2

Browse files
committed
calculate both fees
1 parent 780379c commit dc249b2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

scripts/curve.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ async function getTokenBalances(lpAddress: string, token: any) {
5353
])
5454

5555
const lpPool = await ethers.getContractAt("UniswapV3Pool", lpAddress)
56+
const token0 = await lpPool.token0()
57+
const isPartyPool = await bnbPartyFactory.isTokenOnPartyLP(token0 === wethAddress ? await token.getAddress() : token0)
5658
const [feeGrowthGlobal0X128, feeGrowthGlobal1X128, liquidity, getFeeGlobal] = await Promise.all([
5759
lpPool.feeGrowthGlobal0X128(),
5860
lpPool.feeGrowthGlobal1X128(),
5961
lpPool.liquidity(),
60-
bnbPartyFactory.getFeeGrowthInsideLastX128(lpAddress, BNBPositionManager),
62+
bnbPartyFactory.getFeeGrowthInsideLastX128(lpAddress, isPartyPool ? BNBPositionManager : positionManager),
6163
])
62-
const token0 = await lpPool.token0()
6364
let wbnbFee, memeFee
64-
6565
if (token0 === wethAddress) {
6666
wbnbFee = await bnbPartyFactory.calculateFees(liquidity, feeGrowthGlobal0X128 - getFeeGlobal.feeGrowthInside0LastX128)
6767
memeFee = await bnbPartyFactory.calculateFees(liquidity, feeGrowthGlobal1X128 - getFeeGlobal.feeGrowthInside1LastX128)

test/SwapRouter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe("Smart Router", function () {
5050

5151
it("user should receive meme token after join party", async () => {
5252
const amountIn = ethers.parseUnits("5", 17)
53-
53+
5454
const balanceBefore = await MEMEToken.balanceOf(await signers[0].getAddress())
5555
await bnbPartyFactory.joinParty(MEME, 0, { value: amountIn })
5656
const balanceAfter = await MEMEToken.balanceOf(await signers[0].getAddress())

0 commit comments

Comments
 (0)