Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
add buy fee test case
Browse files Browse the repository at this point in the history
  • Loading branch information
tinaszheng committed Sep 19, 2023
1 parent 95629cc commit af4936f
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/entities/trade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ describe('Trade', () => {
})
// v3 sdk price impact tests
describe('#priceImpact', () => {
describe('with FOT fees', () => {
describe('with FOT sell fees', () => {
const routev3 = new V3RouteSDK([pool_tax_output], weth, token4WithTax)
const trade = new Trade({
v2Routes: [],
Expand All @@ -1214,6 +1214,28 @@ describe('Trade', () => {
})
})

describe('with FOT buy fees', () => {
const routev3 = new V3RouteSDK([pool_tax_input], token5WithTax, weth)
const trade = new Trade({
v2Routes: [],
v3Routes: [
{
routev3,
inputAmount: CurrencyAmount.fromRawAmount(token5WithTax, 100),
outputAmount: CurrencyAmount.fromRawAmount(weth, 69),
},
],
tradeType: TradeType.EXACT_INPUT,
})

it('is cached', () => {
expect(trade.priceImpact === trade.priceImpact).toStrictEqual(true)
})
it('is correct', () => {
expect(trade.priceImpact.toSignificant(3)).toEqual('00.0')
})
})

describe('tradeType = EXACT_INPUT', () => {
const routev3 = new V3RouteSDK([pool_0_1, pool_1_2], token0, token2)
const mixedRoute = new MixedRouteSDK([pool_0_1, pool_1_2], token0, token2)
Expand Down

0 comments on commit af4936f

Please sign in to comment.