@paraswap/dex-lib 3.8.16 → 3.8.17-insert-amount-solidly-v3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +53 -0
- package/.vscode/settings.json +2 -0
- package/.vscode/tasks.json +15 -0
- package/build/abi/maverick-v2/MaverickV2Router.json +778 -0
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +52 -0
- package/build/abi/wombat/pool.json +1289 -0
- package/build/dex/aave-v1/aave-v1.js +1 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/aave-v2/tokens-avalanche.json +44 -0
- package/build/dex/aave-v2/tokens-mainnet.json +188 -0
- package/build/dex/aave-v2/tokens-polygon.json +44 -0
- package/build/dex/bProtocol.d.ts +18 -0
- package/build/dex/bProtocol.js +39 -0
- package/build/dex/bProtocol.js.map +1 -0
- package/build/dex/bancor.d.ts +26 -0
- package/build/dex/bancor.js +58 -0
- package/build/dex/bancor.js.map +1 -0
- package/build/dex/compound.d.ts +18 -0
- package/build/dex/compound.js +46 -0
- package/build/dex/compound.js.map +1 -0
- package/build/dex/curve-v2.d.ts +58 -0
- package/build/dex/curve-v2.js +180 -0
- package/build/dex/curve-v2.js.map +1 -0
- package/build/dex/dodo-v1.d.ts +33 -0
- package/build/dex/dodo-v1.js +63 -0
- package/build/dex/dodo-v1.js.map +1 -0
- package/build/dex/index.js +5 -1
- package/build/dex/index.js.map +1 -1
- package/build/dex/lido.d.ts +19 -0
- package/build/dex/lido.js +42 -0
- package/build/dex/lido.js.map +1 -0
- package/build/dex/maker-psm/scripts/gem.abi.json +136 -0
- package/build/dex/maker-psm/scripts/validate-state.d.ts +0 -0
- package/build/dex/maker-psm/scripts/validate-state.js +185 -0
- package/build/dex/maker-psm/scripts/validate-state.js.map +1 -0
- package/build/dex/maker-psm/scripts/vat.abi.json +243 -0
- package/build/dex/onebit.d.ts +25 -0
- package/build/dex/onebit.js +42 -0
- package/build/dex/onebit.js.map +1 -0
- package/build/dex/platypus/platypus.js +17 -3
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/smoothy.d.ts +26 -0
- package/build/dex/smoothy.js +48 -0
- package/build/dex/smoothy.js.map +1 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.d.ts +1 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +53 -0
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +1 -0
- package/build/dex/solidly-v3/solidly-v3.js +7 -0
- package/build/dex/solidly-v3/solidly-v3.js.map +1 -1
- package/build/dex/stable-pool.d.ts +28 -0
- package/build/dex/stable-pool.js +55 -0
- package/build/dex/stable-pool.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1.js +4 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1/base.d.ts +18 -0
- package/build/dex/trader-joe-v2.1/base.js +99 -0
- package/build/dex/trader-joe-v2.1/base.js.map +1 -0
- package/build/dex/trader-joe-v2.1/config.d.ts +6 -0
- package/build/dex/trader-joe-v2.1/config.js +11 -1
- package/build/dex/trader-joe-v2.1/config.js.map +1 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +7 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +20 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +1 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1.d.ts +1 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1.js +6 -6
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.d.ts +7 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js +20 -0
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js.map +1 -0
- package/build/dex/trader-joe-v2.1.d.ts +43 -0
- package/build/dex/trader-joe-v2.1.js +79 -0
- package/build/dex/trader-joe-v2.1.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +64 -0
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +1 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +17 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +79 -0
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +1 -0
- package/build/executor/types.d.ts +2 -1
- package/build/executor/types.js +1 -0
- package/build/executor/types.js.map +1 -1
- package/build/generic-swap-transaction-builder.js +8 -3
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/config.ts +1946 -0
- package/package.json +1 -1
- package/src/dex/dexs.txt +58 -0
- package/src/dex/index.ts +5 -1
- package/src/dex/solidly-v3/solidly-v3.ts +7 -0
- package/src/dex/trader-joe-v2.1/base.ts +178 -0
- package/src/dex/trader-joe-v2.1/config.ts +12 -0
- package/src/dex/trader-joe-v2.1/trader-joe-v2.1-new.ts +23 -0
- package/src/dex/trader-joe-v2.1/trader-joe-v2.1.ts +5 -5
- package/src/dex/trader-joe-v2.1/trader-joe-v2.2.ts +23 -0
- package/src/executor/types.ts +1 -0
- package/src/generic-swap-transaction-builder.ts +14 -3
- package/build/abi/inception/inception-ineth-pool.json +0 -1062
- package/build/abi/inception/inception-ineth.json +0 -609
- package/build/abi/inception/inception-ratio-feed.json +0 -93
- package/build/abi/inception/inception-vault.json +0 -991
- package/build/abi/infusion/InfusionFactory.json +0 -147
- package/build/abi/infusion/InfusionPair.json +0 -658
- package/build/abi/infusion/InfusionRouter.json +0 -442
- package/build/abi/oswap/oswap.abi.json +0 -452
- package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
- package/build/dex/idle-dao/idle-dao-pool.js +0 -176
- package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
- package/build/dex/idle-dao/scripts.d.ts +0 -9
- package/build/dex/idle-dao/scripts.js +0 -552
- package/build/dex/idle-dao/scripts.js.map +0 -1
- package/build/dex/inception/config.d.ts +0 -5
- package/build/dex/inception/config.js +0 -112
- package/build/dex/inception/config.js.map +0 -1
- package/build/dex/inception/inception-event-pool.d.ts +0 -23
- package/build/dex/inception/inception-event-pool.js +0 -34
- package/build/dex/inception/inception-event-pool.js.map +0 -1
- package/build/dex/inception/inception-native.d.ts +0 -43
- package/build/dex/inception/inception-native.js +0 -131
- package/build/dex/inception/inception-native.js.map +0 -1
- package/build/dex/inception/inception-pool.d.ts +0 -18
- package/build/dex/inception/inception-pool.js +0 -32
- package/build/dex/inception/inception-pool.js.map +0 -1
- package/build/dex/inception/inception-price-feed.d.ts +0 -19
- package/build/dex/inception/inception-price-feed.js +0 -51
- package/build/dex/inception/inception-price-feed.js.map +0 -1
- package/build/dex/inception/inception.d.ts +0 -44
- package/build/dex/inception/inception.js +0 -162
- package/build/dex/inception/inception.js.map +0 -1
- package/build/dex/inception/tokens.d.ts +0 -9
- package/build/dex/inception/tokens.js +0 -28
- package/build/dex/inception/tokens.js.map +0 -1
- package/build/dex/inception/types.d.ts +0 -22
- package/build/dex/inception/types.js +0 -3
- package/build/dex/inception/types.js.map +0 -1
- package/build/dex/inception/utils.d.ts +0 -7
- package/build/dex/inception/utils.js +0 -58
- package/build/dex/inception/utils.js.map +0 -1
- package/build/dex/infusion/config.d.ts +0 -4
- package/build/dex/infusion/config.js +0 -25
- package/build/dex/infusion/config.js.map +0 -1
- package/build/dex/infusion/infusion-stable-pool.d.ts +0 -4
- package/build/dex/infusion/infusion-stable-pool.js +0 -74
- package/build/dex/infusion/infusion-stable-pool.js.map +0 -1
- package/build/dex/infusion/infusion.d.ts +0 -54
- package/build/dex/infusion/infusion.js +0 -510
- package/build/dex/infusion/infusion.js.map +0 -1
- package/build/dex/infusion/types.d.ts +0 -47
- package/build/dex/infusion/types.js +0 -3
- package/build/dex/infusion/types.js.map +0 -1
- package/build/dex/infusion/utils/isStablePair.d.ts +0 -2
- package/build/dex/infusion/utils/isStablePair.js +0 -18
- package/build/dex/infusion/utils/isStablePair.js.map +0 -1
- package/build/dex/oswap/config.d.ts +0 -5
- package/build/dex/oswap/config.js +0 -31
- package/build/dex/oswap/config.js.map +0 -1
- package/build/dex/oswap/oswap-pool.d.ts +0 -51
- package/build/dex/oswap/oswap-pool.js +0 -150
- package/build/dex/oswap/oswap-pool.js.map +0 -1
- package/build/dex/oswap/oswap.d.ts +0 -46
- package/build/dex/oswap/oswap.js +0 -263
- package/build/dex/oswap/oswap.js.map +0 -1
- package/build/dex/oswap/types.d.ts +0 -20
- package/build/dex/oswap/types.js +0 -3
- package/build/dex/oswap/types.js.map +0 -1
package/package.json
CHANGED
package/src/dex/dexs.txt
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
aave-v2
|
|
2
|
+
aave-v3
|
|
3
|
+
aave-v3-stata
|
|
4
|
+
algebra
|
|
5
|
+
angle-staked-stable
|
|
6
|
+
angle-transmuter
|
|
7
|
+
augustus-approvals.ts
|
|
8
|
+
augustus-rfq.ts
|
|
9
|
+
balancer-v1
|
|
10
|
+
balancer-v2
|
|
11
|
+
bancor
|
|
12
|
+
camelot
|
|
13
|
+
compound
|
|
14
|
+
curve-v1
|
|
15
|
+
curve-v1-factory
|
|
16
|
+
curve-v1-stable-ng
|
|
17
|
+
curve-v2
|
|
18
|
+
dexalot
|
|
19
|
+
dexs.txt
|
|
20
|
+
dodo-v1
|
|
21
|
+
dodo-v2.ts
|
|
22
|
+
etherfi.ts
|
|
23
|
+
generic-rfq
|
|
24
|
+
gmx
|
|
25
|
+
hashflow
|
|
26
|
+
idex.ts
|
|
27
|
+
idle-dao
|
|
28
|
+
index.ts
|
|
29
|
+
jarvis-v6
|
|
30
|
+
kyberdmm
|
|
31
|
+
lido
|
|
32
|
+
limit-order-exchange.ts
|
|
33
|
+
maker-psm
|
|
34
|
+
maverick-v1
|
|
35
|
+
maverick-v2
|
|
36
|
+
nerve
|
|
37
|
+
pancakeswap-v3
|
|
38
|
+
paraswap-limit-orders
|
|
39
|
+
polygon-migrator
|
|
40
|
+
quick-perps
|
|
41
|
+
quickswap
|
|
42
|
+
simple-exchange.ts
|
|
43
|
+
smoothy
|
|
44
|
+
solidly
|
|
45
|
+
solidly-v3
|
|
46
|
+
spark
|
|
47
|
+
stable-pool
|
|
48
|
+
swaap-v2
|
|
49
|
+
swell
|
|
50
|
+
synthetix
|
|
51
|
+
trader-joe-v2.1
|
|
52
|
+
uniswap-v2
|
|
53
|
+
uniswap-v3
|
|
54
|
+
uniswap-v3.ts
|
|
55
|
+
weth
|
|
56
|
+
wombat
|
|
57
|
+
woo-fi-v2
|
|
58
|
+
wsteth
|
package/src/dex/index.ts
CHANGED
|
@@ -66,7 +66,9 @@ import { MaverickV2 } from './maverick-v2/maverick-v2';
|
|
|
66
66
|
import { QuickSwapV3 } from './quickswap/quickswap-v3';
|
|
67
67
|
import { ThenaFusion } from './quickswap/thena-fusion';
|
|
68
68
|
import { SwaapV2 } from './swaap-v2/swaap-v2';
|
|
69
|
-
import {
|
|
69
|
+
import { TraderJoeV20 } from './trader-joe-v2.1/trader-joe-v2.1';
|
|
70
|
+
import { TraderJoeV21 } from './trader-joe-v2.1/trader-joe-v2.1-new';
|
|
71
|
+
import { TraderJoeV22 } from './trader-joe-v2.1/trader-joe-v2.2';
|
|
70
72
|
import { PancakeswapV3 } from './pancakeswap-v3/pancakeswap-v3';
|
|
71
73
|
import { Algebra } from './algebra/algebra';
|
|
72
74
|
import { AngleTransmuter } from './angle-transmuter/angle-transmuter';
|
|
@@ -94,7 +96,9 @@ const LegacyDexes = [
|
|
|
94
96
|
DodoV2,
|
|
95
97
|
QuickSwapV3,
|
|
96
98
|
ThenaFusion,
|
|
99
|
+
TraderJoeV20,
|
|
97
100
|
TraderJoeV21,
|
|
101
|
+
TraderJoeV22,
|
|
98
102
|
Lido,
|
|
99
103
|
AugustusRFQOrder,
|
|
100
104
|
EtherFi,
|
|
@@ -49,6 +49,7 @@ import { Contract } from 'web3-eth-contract';
|
|
|
49
49
|
import { AbiItem } from 'web3-utils';
|
|
50
50
|
import { TickMath } from './contract-math/TickMath';
|
|
51
51
|
import { OnPoolCreatedCallback, SolidlyV3Factory } from './solidly-v3-factory';
|
|
52
|
+
import { SpecialDex } from '../../executor/types';
|
|
52
53
|
|
|
53
54
|
type PoolPairsInfo = {
|
|
54
55
|
token0: Address;
|
|
@@ -727,6 +728,12 @@ export class SolidlyV3
|
|
|
727
728
|
exchangeData: swapData,
|
|
728
729
|
targetExchange: data.poolAddress,
|
|
729
730
|
returnAmountPos: undefined,
|
|
731
|
+
...(side === SwapSide.BUY
|
|
732
|
+
? {
|
|
733
|
+
specialDexSupportsInsertFromAmount: true,
|
|
734
|
+
specialDexFlag: SpecialDex.BUY_ON_SOLIDLY_V3,
|
|
735
|
+
}
|
|
736
|
+
: {}),
|
|
730
737
|
};
|
|
731
738
|
}
|
|
732
739
|
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { SwapSide } from '../../constants';
|
|
2
|
+
import {
|
|
3
|
+
AdapterExchangeParam,
|
|
4
|
+
Address,
|
|
5
|
+
DexExchangeParam,
|
|
6
|
+
SimpleExchangeParam,
|
|
7
|
+
} from '../../types';
|
|
8
|
+
import { IDexTxBuilder } from '../idex';
|
|
9
|
+
import { IDexHelper } from '../../dex-helper';
|
|
10
|
+
import {
|
|
11
|
+
getLocalDeadlineAsFriendlyPlaceholder,
|
|
12
|
+
SimpleExchange,
|
|
13
|
+
} from '../simple-exchange';
|
|
14
|
+
import { NumberAsString } from '@paraswap/core';
|
|
15
|
+
import { AsyncOrSync } from 'ts-essentials';
|
|
16
|
+
import { Interface, JsonFragment } from '@ethersproject/abi';
|
|
17
|
+
import TraderJoeV21RouterABI from '../../abi/TraderJoeV21Router.json';
|
|
18
|
+
import {
|
|
19
|
+
TraderJoeV2Data,
|
|
20
|
+
TraderJoeV2RouterFunctions,
|
|
21
|
+
TraderJoeV2RouterParam,
|
|
22
|
+
} from './types';
|
|
23
|
+
import { extractReturnAmountPosition } from '../../executor/utils';
|
|
24
|
+
|
|
25
|
+
export class BaseTraderJoeV2
|
|
26
|
+
extends SimpleExchange
|
|
27
|
+
implements IDexTxBuilder<TraderJoeV2Data, TraderJoeV2RouterParam>
|
|
28
|
+
{
|
|
29
|
+
exchangeRouterInterface: Interface;
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
dexHelper: IDexHelper,
|
|
33
|
+
dexKey: string,
|
|
34
|
+
protected routerAddress: string,
|
|
35
|
+
protected versionIndex: string,
|
|
36
|
+
) {
|
|
37
|
+
super(dexHelper, dexKey);
|
|
38
|
+
|
|
39
|
+
this.exchangeRouterInterface = new Interface(
|
|
40
|
+
TraderJoeV21RouterABI as JsonFragment[],
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
getAdapterParam(
|
|
45
|
+
srcToken: Address,
|
|
46
|
+
destToken: Address,
|
|
47
|
+
srcAmount: NumberAsString,
|
|
48
|
+
destAmount: NumberAsString,
|
|
49
|
+
data: TraderJoeV2Data,
|
|
50
|
+
side: SwapSide,
|
|
51
|
+
): AdapterExchangeParam {
|
|
52
|
+
let payload = this.abiCoder.encodeParameters(
|
|
53
|
+
['tuple(tuple(uint256[],uint8[],address[]),uint256)'],
|
|
54
|
+
[
|
|
55
|
+
[
|
|
56
|
+
[
|
|
57
|
+
[
|
|
58
|
+
data.binStep, // _pairBinSteps: uint256[]
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
this.versionIndex, // _versions: uint8[]
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
data.tokenIn,
|
|
65
|
+
data.tokenOut, // _tokenPath: address[]
|
|
66
|
+
],
|
|
67
|
+
],
|
|
68
|
+
getLocalDeadlineAsFriendlyPlaceholder(), // _deadline: uint256
|
|
69
|
+
],
|
|
70
|
+
],
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
targetExchange: this.routerAddress,
|
|
75
|
+
payload,
|
|
76
|
+
networkFee: '0',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
getSimpleParam(
|
|
81
|
+
srcToken: Address,
|
|
82
|
+
destToken: Address,
|
|
83
|
+
srcAmount: NumberAsString,
|
|
84
|
+
destAmount: NumberAsString,
|
|
85
|
+
data: TraderJoeV2Data,
|
|
86
|
+
side: SwapSide,
|
|
87
|
+
): AsyncOrSync<SimpleExchangeParam> {
|
|
88
|
+
const swapFunction =
|
|
89
|
+
side === SwapSide.SELL
|
|
90
|
+
? TraderJoeV2RouterFunctions.swapExactTokensForTokens
|
|
91
|
+
: TraderJoeV2RouterFunctions.swapTokensForExactTokens;
|
|
92
|
+
|
|
93
|
+
const swapFunctionParams: TraderJoeV2RouterParam =
|
|
94
|
+
side === SwapSide.SELL
|
|
95
|
+
? [
|
|
96
|
+
srcAmount,
|
|
97
|
+
destAmount,
|
|
98
|
+
[[data.binStep], [this.versionIndex], [srcToken, destToken]],
|
|
99
|
+
this.augustusAddress,
|
|
100
|
+
getLocalDeadlineAsFriendlyPlaceholder(),
|
|
101
|
+
]
|
|
102
|
+
: [
|
|
103
|
+
destAmount,
|
|
104
|
+
srcAmount,
|
|
105
|
+
[[data.binStep], [this.versionIndex], [srcToken, destToken]],
|
|
106
|
+
this.augustusAddress,
|
|
107
|
+
getLocalDeadlineAsFriendlyPlaceholder(),
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
const swapData = this.exchangeRouterInterface.encodeFunctionData(
|
|
111
|
+
swapFunction,
|
|
112
|
+
swapFunctionParams,
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
return this.buildSimpleParamWithoutWETHConversion(
|
|
116
|
+
srcToken,
|
|
117
|
+
srcAmount,
|
|
118
|
+
destToken,
|
|
119
|
+
destAmount,
|
|
120
|
+
swapData,
|
|
121
|
+
this.routerAddress,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
getDexParam(
|
|
126
|
+
srcToken: Address,
|
|
127
|
+
destToken: Address,
|
|
128
|
+
srcAmount: NumberAsString,
|
|
129
|
+
destAmount: NumberAsString,
|
|
130
|
+
recipient: Address,
|
|
131
|
+
data: TraderJoeV2Data,
|
|
132
|
+
side: SwapSide,
|
|
133
|
+
): DexExchangeParam {
|
|
134
|
+
const swapFunction =
|
|
135
|
+
side === SwapSide.SELL
|
|
136
|
+
? TraderJoeV2RouterFunctions.swapExactTokensForTokens
|
|
137
|
+
: TraderJoeV2RouterFunctions.swapTokensForExactTokens;
|
|
138
|
+
|
|
139
|
+
const placeholder = getLocalDeadlineAsFriendlyPlaceholder();
|
|
140
|
+
|
|
141
|
+
const swapFunctionParams: TraderJoeV2RouterParam =
|
|
142
|
+
side === SwapSide.SELL
|
|
143
|
+
? [
|
|
144
|
+
srcAmount,
|
|
145
|
+
destAmount,
|
|
146
|
+
[[data.binStep], [this.versionIndex], [srcToken, destToken]],
|
|
147
|
+
recipient,
|
|
148
|
+
placeholder,
|
|
149
|
+
]
|
|
150
|
+
: [
|
|
151
|
+
destAmount,
|
|
152
|
+
srcAmount,
|
|
153
|
+
[[data.binStep], [this.versionIndex], [srcToken, destToken]],
|
|
154
|
+
recipient,
|
|
155
|
+
placeholder,
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
const swapData = this.exchangeRouterInterface.encodeFunctionData(
|
|
159
|
+
swapFunction,
|
|
160
|
+
swapFunctionParams,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
needWrapNative: this.needWrapNative,
|
|
165
|
+
dexFuncHasRecipient: true,
|
|
166
|
+
exchangeData: swapData,
|
|
167
|
+
targetExchange: this.routerAddress,
|
|
168
|
+
returnAmountPos:
|
|
169
|
+
side === SwapSide.SELL
|
|
170
|
+
? extractReturnAmountPosition(
|
|
171
|
+
this.exchangeRouterInterface,
|
|
172
|
+
swapFunction,
|
|
173
|
+
'amountOut',
|
|
174
|
+
)
|
|
175
|
+
: undefined,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { Address } from '@paraswap/core';
|
|
2
2
|
import { Network } from '../../constants';
|
|
3
3
|
|
|
4
|
+
export const TRADERJOE_V2_0_ROUTER_ADDRESS: { [network: number]: Address } = {
|
|
5
|
+
[Network.AVALANCHE]: '0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30',
|
|
6
|
+
[Network.ARBITRUM]: '0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30',
|
|
7
|
+
[Network.BSC]: '0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30',
|
|
8
|
+
[Network.MAINNET]: '0x9A93a421b74F1c5755b83dD2C211614dC419C44b',
|
|
9
|
+
};
|
|
10
|
+
|
|
4
11
|
export const TRADERJOE_V2_1_ROUTER_ADDRESS: { [network: number]: Address } = {
|
|
5
12
|
[Network.AVALANCHE]: '0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30',
|
|
6
13
|
[Network.ARBITRUM]: '0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30',
|
|
7
14
|
[Network.BSC]: '0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30',
|
|
8
15
|
[Network.MAINNET]: '0x9A93a421b74F1c5755b83dD2C211614dC419C44b',
|
|
9
16
|
};
|
|
17
|
+
|
|
18
|
+
export const TRADERJOE_V2_2_ROUTER_ADDRESS: { [network: number]: Address } = {
|
|
19
|
+
[Network.AVALANCHE]: '0x18556da13313f3532c54711497a8fedac273220e',
|
|
20
|
+
[Network.ARBITRUM]: '0x18556da13313f3532c54711497a8fedac273220e',
|
|
21
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IDexHelper } from '../../dex-helper';
|
|
2
|
+
import { Interface, JsonFragment } from '@ethersproject/abi';
|
|
3
|
+
import TraderJoeV21RouterABI from '../../abi/TraderJoeV21Router.json';
|
|
4
|
+
import { TRADERJOE_V2_1_ROUTER_ADDRESS } from './config';
|
|
5
|
+
import { BaseTraderJoeV2 } from './base';
|
|
6
|
+
|
|
7
|
+
export class TraderJoeV21 extends BaseTraderJoeV2 {
|
|
8
|
+
static dexKeys = ['traderjoev2.1'];
|
|
9
|
+
needWrapNative = true;
|
|
10
|
+
|
|
11
|
+
constructor(dexHelper: IDexHelper) {
|
|
12
|
+
super(
|
|
13
|
+
dexHelper,
|
|
14
|
+
'traderjoev2.1',
|
|
15
|
+
TRADERJOE_V2_1_ROUTER_ADDRESS[dexHelper.config.data.network],
|
|
16
|
+
'2',
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
this.exchangeRouterInterface = new Interface(
|
|
20
|
+
TraderJoeV21RouterABI as JsonFragment[],
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -20,23 +20,23 @@ import {
|
|
|
20
20
|
TraderJoeV2RouterFunctions,
|
|
21
21
|
TraderJoeV2RouterParam,
|
|
22
22
|
} from './types';
|
|
23
|
-
import {
|
|
23
|
+
import { TRADERJOE_V2_0_ROUTER_ADDRESS } from './config';
|
|
24
24
|
import { extractReturnAmountPosition } from '../../executor/utils';
|
|
25
25
|
|
|
26
|
-
export class
|
|
26
|
+
export class TraderJoeV20
|
|
27
27
|
extends SimpleExchange
|
|
28
28
|
implements IDexTxBuilder<TraderJoeV2Data, TraderJoeV2RouterParam>
|
|
29
29
|
{
|
|
30
|
-
static dexKeys = ['traderjoev2.
|
|
30
|
+
static dexKeys = ['traderjoev2.0'];
|
|
31
31
|
protected routerAddress: string;
|
|
32
32
|
exchangeRouterInterface: Interface;
|
|
33
33
|
needWrapNative = true;
|
|
34
34
|
|
|
35
35
|
constructor(dexHelper: IDexHelper) {
|
|
36
|
-
super(dexHelper, 'traderjoev2.
|
|
36
|
+
super(dexHelper, 'traderjoev2.0');
|
|
37
37
|
|
|
38
38
|
this.routerAddress =
|
|
39
|
-
|
|
39
|
+
TRADERJOE_V2_0_ROUTER_ADDRESS[dexHelper.config.data.network];
|
|
40
40
|
|
|
41
41
|
this.exchangeRouterInterface = new Interface(
|
|
42
42
|
TraderJoeV21RouterABI as JsonFragment[],
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IDexHelper } from '../../dex-helper';
|
|
2
|
+
import { Interface, JsonFragment } from '@ethersproject/abi';
|
|
3
|
+
import TraderJoeV21RouterABI from '../../abi/TraderJoeV21Router.json';
|
|
4
|
+
import { TRADERJOE_V2_2_ROUTER_ADDRESS } from './config';
|
|
5
|
+
import { BaseTraderJoeV2 } from './base';
|
|
6
|
+
|
|
7
|
+
export class TraderJoeV22 extends BaseTraderJoeV2 {
|
|
8
|
+
static dexKeys = ['traderjoev2.2'];
|
|
9
|
+
needWrapNative = true;
|
|
10
|
+
|
|
11
|
+
constructor(dexHelper: IDexHelper) {
|
|
12
|
+
super(
|
|
13
|
+
dexHelper,
|
|
14
|
+
'traderjoev2.2',
|
|
15
|
+
TRADERJOE_V2_2_ROUTER_ADDRESS[dexHelper.config.data.network],
|
|
16
|
+
'3',
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
this.exchangeRouterInterface = new Interface(
|
|
20
|
+
TraderJoeV21RouterABI as JsonFragment[],
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/executor/types.ts
CHANGED
|
@@ -251,9 +251,20 @@ export class GenericSwapTransactionBuilder {
|
|
|
251
251
|
[
|
|
252
252
|
priceRoute.srcToken,
|
|
253
253
|
priceRoute.destToken,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
// TODO: temporary artificially increase total amounts by 10% to test insert from amount
|
|
255
|
+
(
|
|
256
|
+
(BigInt(isSell ? priceRoute.srcAmount : minMaxAmount) * 11n) /
|
|
257
|
+
10n
|
|
258
|
+
).toString(),
|
|
259
|
+
(
|
|
260
|
+
(BigInt(isSell ? minMaxAmount : priceRoute.destAmount) * 11n) /
|
|
261
|
+
10n
|
|
262
|
+
).toString(),
|
|
263
|
+
(
|
|
264
|
+
(BigInt(isSell ? priceRoute.destAmount : priceRoute.srcAmount) *
|
|
265
|
+
11n) /
|
|
266
|
+
10n
|
|
267
|
+
).toString(),
|
|
257
268
|
hexConcat([
|
|
258
269
|
hexZeroPad(uuidToBytes16(uuid), 16),
|
|
259
270
|
hexZeroPad(hexlify(priceRoute.blockNumber), 16),
|