@paraswap/dex-lib 3.8.17-insert-amount-solidly-v3.1 → 3.8.17
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/build/dex/index.js +1 -5
- package/build/dex/index.js.map +1 -1
- package/build/dex/trader-joe-v2.1/config.d.ts +0 -6
- package/build/dex/trader-joe-v2.1/config.js +1 -11
- package/build/dex/trader-joe-v2.1/config.js.map +1 -1
- 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/generic-swap-transaction-builder.js +3 -8
- package/build/generic-swap-transaction-builder.js.map +1 -1
- package/package.json +1 -1
- package/src/dex/index.ts +1 -5
- package/src/dex/trader-joe-v2.1/config.ts +0 -12
- package/src/dex/trader-joe-v2.1/trader-joe-v2.1.ts +5 -5
- package/src/generic-swap-transaction-builder.ts +3 -14
- package/config.ts +0 -1946
- package/src/dex/dexs.txt +0 -58
- package/src/dex/trader-joe-v2.1/base.ts +0 -178
- package/src/dex/trader-joe-v2.1/trader-joe-v2.1-new.ts +0 -23
- package/src/dex/trader-joe-v2.1/trader-joe-v2.2.ts +0 -23
package/src/dex/dexs.txt
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
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
|
|
@@ -1,178 +0,0 @@
|
|
|
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,23 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
}
|