-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: v3 boosted adds/removes (#146)
* feat: unbalanced v3 boosted adds * chore: skip sepolia test-api related tests * fix: add wrapping tokens to boosted actionable * feat: explicit handler for boosted proportional removes * fix: use explicit boosted sign function
- Loading branch information
Showing
29 changed files
with
724 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ctions/add-liquidity/handlers/BoostedUnbalancedAddLiquidityV3.handler.integration.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* eslint-disable max-len */ | ||
import { getNetworkConfig } from '@repo/lib/config/app.config' | ||
import { HumanTokenAmountWithAddress } from '@repo/lib/modules/tokens/token.types' | ||
import { GqlChain, GqlPoolElement } from '@repo/lib/shared/services/api/generated/graphql' | ||
import { defaultTestUserAccount } from '@repo/lib/test/anvil/anvil-setup' | ||
import { getPoolMock } from '../../../__mocks__/getPoolMock' | ||
import { BoostedUnbalancedAddLiquidityV3Handler } from './BoostedUnbalancedAddLiquidityV3.handler' | ||
import { selectAddLiquidityHandler } from './selectAddLiquidityHandler' | ||
|
||
// TODO: unskip this test when sepolia V3 pools are available in production api | ||
describe.skip('When adding unbalanced liquidity for a V3 BOOSTED pool', async () => { | ||
// Sepolia | ||
const poolId = '0x6dbdd7a36d900083a5b86a55583d90021e9f33e8' // Sepolia stataEthUSDC stataEthUSDT | ||
|
||
const usdcAaveAddress = '0x94a9d9ac8a22534e3faca9f4e7f2e2cf85d5e4c8' // Sepolia underlying usdcAave faucet address (temporary until we have the real one) | ||
const usdtAaveAddress = '0xaA8E23Fb1079EA71e0a56F48a2aA51851D8433D0' // Sepolia underlying usdcAave faucet address (temporary until we have the real one) | ||
// const v3Pool = await getPoolMock(poolId, GqlChain.Sepolia) | ||
const v3Pool = {} as GqlPoolElement | ||
|
||
const handler = selectAddLiquidityHandler(v3Pool) as BoostedUnbalancedAddLiquidityV3Handler | ||
|
||
const humanAmountsIn: HumanTokenAmountWithAddress[] = [ | ||
{ humanAmount: '0.1', tokenAddress: usdcAaveAddress }, | ||
{ humanAmount: '0.1', tokenAddress: usdtAaveAddress }, | ||
] | ||
|
||
it('calculates price impact', async () => { | ||
const priceImpact = await handler.getPriceImpact(humanAmountsIn) | ||
expect(priceImpact).toBe(0) | ||
}) | ||
|
||
it('queries bptOut', async () => { | ||
const result = await handler.simulate(humanAmountsIn) | ||
|
||
expect(result.bptOut.amount).toBeGreaterThan(100000000000000n) | ||
expect(result.bptOut.token.address).toBe(poolId) | ||
}) | ||
|
||
it('builds Tx Config', async () => { | ||
const queryOutput = await handler.simulate(humanAmountsIn) | ||
|
||
const result = await handler.buildCallData({ | ||
humanAmountsIn, | ||
account: defaultTestUserAccount, | ||
slippagePercent: '0.2', | ||
queryOutput, | ||
}) | ||
const router = getNetworkConfig(GqlChain.Sepolia).contracts.balancer.compositeLiquidityRouter | ||
expect(result.to).toBe(router) | ||
expect(result.data).toBeDefined() | ||
}) | ||
}) |
Oops, something went wrong.