@paraswap/dex-lib 2.16.3 → 2.16.4-balancer-v2-buy.2
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/.idea/aws.xml +17 -0
- package/.idea/codeStyles/Project.xml +19 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/paraswap-dex-lib.iml +9 -0
- package/.idea/vcs.xml +6 -0
- package/build/abi/TraderJoeV21Router.json +1489 -0
- package/build/config.js +10 -10
- package/build/dex/balancer-v2/balancer-v2.d.ts +9 -14
- package/build/dex/balancer-v2/balancer-v2.js +19 -16
- package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
- package/build/dex/balancer-v2/config.d.ts +2 -7
- package/build/dex/balancer-v2/config.js +20 -30
- package/build/dex/balancer-v2/config.js.map +1 -1
- package/build/dex/balancer-v2/pools/balancer-v2-pool.d.ts +25 -0
- package/build/dex/balancer-v2/pools/balancer-v2-pool.js +107 -0
- package/build/dex/balancer-v2/pools/balancer-v2-pool.js.map +1 -0
- package/build/dex/balancer-v2/pools/linear/LinearMath.d.ts +20 -0
- package/build/dex/balancer-v2/pools/linear/LinearMath.js +186 -0
- package/build/dex/balancer-v2/pools/linear/LinearMath.js.map +1 -0
- package/build/dex/balancer-v2/pools/linear/LinearPool.d.ts +51 -0
- package/build/dex/balancer-v2/pools/linear/LinearPool.js +477 -0
- package/build/dex/balancer-v2/pools/linear/LinearPool.js.map +1 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStableMath.d.ts +10 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStableMath.js +314 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStableMath.js.map +1 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStablePool.d.ts +50 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStablePool.js +367 -0
- package/build/dex/balancer-v2/pools/phantom-stable/PhantomStablePool.js.map +1 -0
- package/build/dex/balancer-v2/pools/stable/StableMath.d.ts +7 -0
- package/build/dex/balancer-v2/pools/stable/StableMath.js +111 -0
- package/build/dex/balancer-v2/pools/stable/StableMath.js.map +1 -0
- package/build/dex/balancer-v2/pools/stable/StablePool.d.ts +30 -0
- package/build/dex/balancer-v2/pools/stable/StablePool.js +129 -0
- package/build/dex/balancer-v2/pools/stable/StablePool.js.map +1 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedMath.d.ts +6 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedMath.js +61 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedMath.js.map +1 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedPool.d.ts +30 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedPool.js +112 -0
- package/build/dex/balancer-v2/pools/weighted/WeightedPool.js.map +1 -0
- package/build/dex/balancer-v2/types.d.ts +1 -0
- package/build/dex/balancer-v2/types.js.map +1 -1
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/trader-joe-v2.1.d.ts +43 -0
- package/build/dex/trader-joe-v2.1.js +78 -0
- package/build/dex/trader-joe-v2.1.js.map +1 -0
- package/package.json +1 -1
- package/src/abi/TraderJoeV21Router.json +1489 -0
- package/src/config.ts +10 -10
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +207 -224
- package/src/dex/balancer-v2/balancer-v2.ts +41 -29
- package/src/dex/balancer-v2/config.ts +23 -35
- package/src/dex/balancer-v2/pools/balancer-v2-pool.ts +274 -0
- package/src/dex/balancer-v2/{LinearMath.ts → pools/linear/LinearMath.ts} +81 -23
- package/src/dex/balancer-v2/{LinearPool.ts → pools/linear/LinearPool.ts} +241 -5
- package/src/dex/balancer-v2/{StableMath.ts → pools/phantom-stable/PhantomStableMath.ts} +101 -21
- package/src/dex/balancer-v2/{PhantomStablePool.ts → pools/phantom-stable/PhantomStablePool.ts} +165 -11
- package/src/dex/balancer-v2/pools/stable/StableMath.ts +204 -0
- package/src/dex/balancer-v2/pools/stable/StablePool.ts +221 -0
- package/src/dex/balancer-v2/pools/weighted/WeightedMath.ts +84 -0
- package/src/dex/balancer-v2/pools/weighted/WeightedPool.ts +189 -0
- package/src/dex/balancer-v2/types.ts +1 -0
- package/src/dex/index.ts +2 -0
- package/src/dex/trader-joe-v2.1.ts +155 -0
- package/tests/constants-e2e.ts +9 -4
- package/build/abi/DirectSwap.json +0 -970
- package/build/dex/test-dex/config.d.ts +0 -4
- package/build/dex/test-dex/config.js +0 -15
- package/build/dex/test-dex/config.js.map +0 -1
- package/build/dex/test-dex/test-dex-pool.d.ts +0 -39
- package/build/dex/test-dex/test-dex-pool.js +0 -63
- package/build/dex/test-dex/test-dex-pool.js.map +0 -1
- package/build/dex/test-dex/test-dex.d.ts +0 -37
- package/build/dex/test-dex/test-dex.js +0 -126
- package/build/dex/test-dex/test-dex.js.map +0 -1
- package/build/dex/test-dex/types.d.ts +0 -6
- package/build/dex/test-dex/types.js +0 -3
- package/build/dex/test-dex/types.js.map +0 -1
- package/build/dex/woo-fi-v2/woo-fi-math.d.ts +0 -16
- package/build/dex/woo-fi-v2/woo-fi-math.js +0 -137
- package/build/dex/woo-fi-v2/woo-fi-math.js.map +0 -1
- package/src/dex/balancer-v2/balancer-v2-pool.ts +0 -744
package/src/config.ts
CHANGED
|
@@ -50,7 +50,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
50
50
|
Adapter02: '0xFC2Ba6E830a04C25e207B8214b26d8C713F6881F',
|
|
51
51
|
Adapter03: '0x7c7f62e5ba00783f57b39df0530e32c195696a57',
|
|
52
52
|
Adapter04: '0x21ab8aeb35bfc0b3fd84ca810b0aa85938357be2',
|
|
53
|
-
BuyAdapter: '
|
|
53
|
+
BuyAdapter: '0xb2634b3cbc1e401ab3c2743db44d459c5c9aa662',
|
|
54
54
|
},
|
|
55
55
|
uniswapV2ExchangeRouterAddress:
|
|
56
56
|
'0xF9234CB08edb93c0d4a4d4c70cC3FfD070e78e07',
|
|
@@ -158,8 +158,8 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
158
158
|
process.env[`HASHFLOW_DISABLED_MMS_56`]?.split(',') || [],
|
|
159
159
|
adapterAddresses: {
|
|
160
160
|
BscAdapter01: '0xA31d9C571DF00e0F428B0bD24c34D103E8112222',
|
|
161
|
-
BscAdapter02: '
|
|
162
|
-
BscBuyAdapter: '
|
|
161
|
+
BscAdapter02: '0x1d2Fd92a1942A92a51198168eFCd626ed441CEC0',
|
|
162
|
+
BscBuyAdapter: '0x64C856fafE4C83a818514cBDfD661a3563a71B98',
|
|
163
163
|
},
|
|
164
164
|
rpcPollingMaxAllowedStateDelayInBlocks: 1,
|
|
165
165
|
rpcPollingBlocksBackToTriggerUpdate: 1,
|
|
@@ -186,7 +186,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
186
186
|
adapterAddresses: {
|
|
187
187
|
PolygonAdapter01: '0xE44769f42E1e9592f86B82f206407a8f7C84b4ed',
|
|
188
188
|
PolygonAdapter02: '0xfb2a3de6c7B8c77b520E3da16021f3D8A4E93168',
|
|
189
|
-
PolygonBuyAdapter: '
|
|
189
|
+
PolygonBuyAdapter: '0xb2634B3CBc1E401AB3C2743DB44d459C5c9aA662',
|
|
190
190
|
},
|
|
191
191
|
uniswapV2ExchangeRouterAddress:
|
|
192
192
|
'0xf3938337F7294fEf84e9B2c6D548A93F956Cc281',
|
|
@@ -213,8 +213,8 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
213
213
|
process.env[`HASHFLOW_DISABLED_MMS_43114`]?.split(',') || [],
|
|
214
214
|
adapterAddresses: {
|
|
215
215
|
AvalancheAdapter01: '0x745Ec73855CeC7249E5fF4c9DD81cc65b4D297a9',
|
|
216
|
-
AvalancheAdapter02: '
|
|
217
|
-
AvalancheBuyAdapter: '
|
|
216
|
+
AvalancheAdapter02: '0xa003dFBA51C9e1e56C67ae445b852bdEd7aC5EEd',
|
|
217
|
+
AvalancheBuyAdapter: '0xfa072107a2CCfE5664794282EF36400735ABB70F',
|
|
218
218
|
},
|
|
219
219
|
uniswapV2ExchangeRouterAddress:
|
|
220
220
|
'0x53e693c6C7FFC4446c53B205Cf513105Bf140D7b',
|
|
@@ -241,7 +241,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
241
241
|
|
|
242
242
|
adapterAddresses: {
|
|
243
243
|
FantomAdapter01: '0x434C1Cca4842629230067674Dd54E21a14D9FD5D',
|
|
244
|
-
FantomBuyAdapter: '
|
|
244
|
+
FantomBuyAdapter: '0xb2634B3CBc1E401AB3C2743DB44d459C5c9aA662',
|
|
245
245
|
},
|
|
246
246
|
uniswapV2ExchangeRouterAddress:
|
|
247
247
|
'0xAB86e2bC9ec5485a9b60E684BA6d49bf4686ACC2',
|
|
@@ -267,8 +267,8 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
267
267
|
process.env[`HASHFLOW_DISABLED_MMS_42161`]?.split(',') || [],
|
|
268
268
|
adapterAddresses: {
|
|
269
269
|
ArbitrumAdapter01: '0x745Ec73855CeC7249E5fF4c9DD81cc65b4D297a9',
|
|
270
|
-
ArbitrumAdapter02: '
|
|
271
|
-
ArbitrumBuyAdapter: '
|
|
270
|
+
ArbitrumAdapter02: '0x3ad7f275E27AC579cA88e0b4765828242A9E8C49',
|
|
271
|
+
ArbitrumBuyAdapter: '0x6c33C7f6CBB4a428fe9ee31ca500a787c9f1525b',
|
|
272
272
|
},
|
|
273
273
|
uniswapV2ExchangeRouterAddress:
|
|
274
274
|
'0xB41dD984730dAf82f5C41489E21ac79D5e3B61bC',
|
|
@@ -296,7 +296,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
296
296
|
|
|
297
297
|
adapterAddresses: {
|
|
298
298
|
OptimismAdapter01: '0x4669D27A649f5451e0D44C20a2b246431F1B0572',
|
|
299
|
-
OptimismBuyAdapter: '
|
|
299
|
+
OptimismBuyAdapter: '0xb2634B3CBc1E401AB3C2743DB44d459C5c9aA662',
|
|
300
300
|
},
|
|
301
301
|
uniswapV2ExchangeRouterAddress:
|
|
302
302
|
'0xB41dD984730dAf82f5C41489E21ac79D5e3B61bC',
|
|
@@ -2,9 +2,10 @@ import dotenv from 'dotenv';
|
|
|
2
2
|
dotenv.config();
|
|
3
3
|
|
|
4
4
|
import { testE2E } from '../../../tests/utils-e2e';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Holders, Tokens } from '../../../tests/constants-e2e';
|
|
6
|
+
import { ContractMethod, Network, SwapSide } from '../../constants';
|
|
7
7
|
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
8
|
+
|
|
8
9
|
import { generateConfig } from '../../config';
|
|
9
10
|
|
|
10
11
|
jest.setTimeout(50 * 1000);
|
|
@@ -20,6 +21,140 @@ describe('BalancerV2 E2E', () => {
|
|
|
20
21
|
network,
|
|
21
22
|
);
|
|
22
23
|
|
|
24
|
+
describe('Popular tokens', () => {
|
|
25
|
+
const sideToContractMethods = new Map([
|
|
26
|
+
[
|
|
27
|
+
SwapSide.SELL,
|
|
28
|
+
[
|
|
29
|
+
ContractMethod.simpleSwap,
|
|
30
|
+
ContractMethod.multiSwap,
|
|
31
|
+
ContractMethod.megaSwap,
|
|
32
|
+
],
|
|
33
|
+
],
|
|
34
|
+
[SwapSide.BUY, [
|
|
35
|
+
ContractMethod.simpleBuy,
|
|
36
|
+
ContractMethod.buy
|
|
37
|
+
]],
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
const pairs: { name: string; sellAmount: string; buyAmount: string }[][] =
|
|
41
|
+
[
|
|
42
|
+
[
|
|
43
|
+
{
|
|
44
|
+
name: 'ETH',
|
|
45
|
+
sellAmount: '2000000000000',
|
|
46
|
+
buyAmount: '100000000',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'USDC',
|
|
50
|
+
sellAmount: '37690000',
|
|
51
|
+
buyAmount: '20035947428035770',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
{
|
|
56
|
+
name: 'WETH',
|
|
57
|
+
sellAmount: '70000000000000',
|
|
58
|
+
buyAmount: '100000000',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'USDC',
|
|
62
|
+
sellAmount: '1000000000',
|
|
63
|
+
buyAmount: '20000947428035770',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
{
|
|
68
|
+
name: 'USDC',
|
|
69
|
+
sellAmount: '10000000000',
|
|
70
|
+
buyAmount: '10000000000000000000',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'DAI',
|
|
74
|
+
sellAmount: '200000000000000',
|
|
75
|
+
buyAmount: '2000000000000',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
{
|
|
80
|
+
name: 'wstETH',
|
|
81
|
+
sellAmount: '3000000000000000000',
|
|
82
|
+
buyAmount: '3000000000000000000',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'ETH',
|
|
86
|
+
sellAmount: '200000000000',
|
|
87
|
+
buyAmount: '7000000000000000000',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
{
|
|
92
|
+
name: 'WETH',
|
|
93
|
+
sellAmount: '20000000000',
|
|
94
|
+
buyAmount: '100000000000000000000000',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'PSP',
|
|
98
|
+
sellAmount: '200000000000000',
|
|
99
|
+
buyAmount: '1871289184941469675',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
{
|
|
104
|
+
name: 'WETH',
|
|
105
|
+
sellAmount: '200000000000000000',
|
|
106
|
+
buyAmount: '20000',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'WBTC',
|
|
110
|
+
sellAmount: '20000',
|
|
111
|
+
buyAmount: '200000000000000000',
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
sideToContractMethods.forEach((contractMethods, side) =>
|
|
117
|
+
describe(`${side}`, () => {
|
|
118
|
+
contractMethods.forEach((contractMethod: ContractMethod) => {
|
|
119
|
+
pairs.forEach(pair => {
|
|
120
|
+
describe(`${contractMethod}`, () => {
|
|
121
|
+
it(`${pair[0].name} -> ${pair[1].name}`, async () => {
|
|
122
|
+
await testE2E(
|
|
123
|
+
tokens[pair[0].name],
|
|
124
|
+
tokens[pair[1].name],
|
|
125
|
+
holders[pair[0].name],
|
|
126
|
+
side === SwapSide.SELL
|
|
127
|
+
? pair[0].sellAmount
|
|
128
|
+
: pair[0].buyAmount,
|
|
129
|
+
side,
|
|
130
|
+
dexKey,
|
|
131
|
+
contractMethod,
|
|
132
|
+
network,
|
|
133
|
+
provider,
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
it(`${pair[1].name} -> ${pair[0].name}`, async () => {
|
|
137
|
+
await testE2E(
|
|
138
|
+
tokens[pair[1].name],
|
|
139
|
+
tokens[pair[0].name],
|
|
140
|
+
holders[pair[1].name],
|
|
141
|
+
side === SwapSide.SELL
|
|
142
|
+
? pair[1].sellAmount
|
|
143
|
+
: pair[1].buyAmount,
|
|
144
|
+
side,
|
|
145
|
+
dexKey,
|
|
146
|
+
contractMethod,
|
|
147
|
+
network,
|
|
148
|
+
provider,
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
}),
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
|
|
23
158
|
describe('GearboxLinear pool', () => {
|
|
24
159
|
const sideToContractMethods = new Map([
|
|
25
160
|
[
|
|
@@ -30,12 +165,13 @@ describe('BalancerV2 E2E', () => {
|
|
|
30
165
|
ContractMethod.megaSwap,
|
|
31
166
|
],
|
|
32
167
|
],
|
|
168
|
+
[SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
|
|
33
169
|
]);
|
|
34
170
|
|
|
35
|
-
const pairs: { name: string;
|
|
171
|
+
const pairs: { name: string; amount: string }[][] = [
|
|
36
172
|
[
|
|
37
|
-
{ name: 'USDC',
|
|
38
|
-
{ name: 'dUSDC',
|
|
173
|
+
{ name: 'USDC', amount: '1000000000' },
|
|
174
|
+
{ name: 'dUSDC', amount: '100000000000' },
|
|
39
175
|
],
|
|
40
176
|
];
|
|
41
177
|
|
|
@@ -49,7 +185,7 @@ describe('BalancerV2 E2E', () => {
|
|
|
49
185
|
tokens[pair[0].name],
|
|
50
186
|
tokens[pair[1].name],
|
|
51
187
|
holders[pair[0].name],
|
|
52
|
-
pair[0].
|
|
188
|
+
pair[0].amount,
|
|
53
189
|
side,
|
|
54
190
|
dexKey,
|
|
55
191
|
contractMethod,
|
|
@@ -62,7 +198,7 @@ describe('BalancerV2 E2E', () => {
|
|
|
62
198
|
tokens[pair[1].name],
|
|
63
199
|
tokens[pair[0].name],
|
|
64
200
|
holders[pair[1].name],
|
|
65
|
-
pair[1].
|
|
201
|
+
pair[1].amount,
|
|
66
202
|
side,
|
|
67
203
|
dexKey,
|
|
68
204
|
contractMethod,
|
|
@@ -77,61 +213,8 @@ describe('BalancerV2 E2E', () => {
|
|
|
77
213
|
);
|
|
78
214
|
});
|
|
79
215
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
await testE2E(
|
|
83
|
-
tokens['ETH'],
|
|
84
|
-
tokens['USDC'],
|
|
85
|
-
holders['ETH'],
|
|
86
|
-
'7000000000000000000',
|
|
87
|
-
SwapSide.SELL,
|
|
88
|
-
dexKey,
|
|
89
|
-
ContractMethod.simpleSwap,
|
|
90
|
-
network,
|
|
91
|
-
provider,
|
|
92
|
-
);
|
|
93
|
-
});
|
|
94
|
-
it('TOKEN -> ETH', async () => {
|
|
95
|
-
await testE2E(
|
|
96
|
-
tokens['USDC'],
|
|
97
|
-
tokens['ETH'],
|
|
98
|
-
holders['USDC'],
|
|
99
|
-
'2000000000',
|
|
100
|
-
SwapSide.SELL,
|
|
101
|
-
dexKey,
|
|
102
|
-
ContractMethod.simpleSwap,
|
|
103
|
-
network,
|
|
104
|
-
provider,
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
it('TOKEN -> TOKEN', async () => {
|
|
108
|
-
await testE2E(
|
|
109
|
-
tokens['USDC'],
|
|
110
|
-
tokens['WETH'],
|
|
111
|
-
holders['USDC'],
|
|
112
|
-
'20000000',
|
|
113
|
-
SwapSide.SELL,
|
|
114
|
-
dexKey,
|
|
115
|
-
ContractMethod.simpleSwap,
|
|
116
|
-
network,
|
|
117
|
-
provider,
|
|
118
|
-
);
|
|
119
|
-
});
|
|
120
|
-
it('USDC -> USDT ComposableStable', async () => {
|
|
121
|
-
await testE2E(
|
|
122
|
-
tokens['USDC'],
|
|
123
|
-
tokens['USDT'],
|
|
124
|
-
holders['USDC'],
|
|
125
|
-
'10000001000000',
|
|
126
|
-
SwapSide.SELL,
|
|
127
|
-
dexKey,
|
|
128
|
-
ContractMethod.simpleSwap,
|
|
129
|
-
network,
|
|
130
|
-
provider,
|
|
131
|
-
);
|
|
132
|
-
});
|
|
133
|
-
//daniel: BPT swaps are currently not supported, we've refactored to focus on mainToken paths
|
|
134
|
-
/*it('MAIN TOKEN -> BPT, LinearPool', async () => {
|
|
216
|
+
//daniel: BPT swaps are currently not supported, we've refactored to focus on mainToken paths
|
|
217
|
+
/*it('MAIN TOKEN -> BPT, LinearPool', async () => {
|
|
135
218
|
// Linear Pools allow swaps between main token (i.e. USDT) and pools BPT
|
|
136
219
|
await testE2E(
|
|
137
220
|
tokens['USDT'],
|
|
@@ -158,67 +241,67 @@ describe('BalancerV2 E2E', () => {
|
|
|
158
241
|
provider,
|
|
159
242
|
);
|
|
160
243
|
});*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
244
|
+
// NO HOLDERS OF waUSDT (ONLY VAULT)
|
|
245
|
+
// it('WRAPPED TOKEN -> BPT, LinearPool', async () => {
|
|
246
|
+
// // Linear Pools allow swaps between wrapped token (i.e. waUSDT) and pools BPT
|
|
247
|
+
// await testE2E(
|
|
248
|
+
// tokens['waUSDT'],
|
|
249
|
+
// tokens['BBAUSDT'],
|
|
250
|
+
// holders['waUSDT'],
|
|
251
|
+
// '20000000',
|
|
252
|
+
// SwapSide.SELL,
|
|
253
|
+
// dexKey,
|
|
254
|
+
// ContractMethod.simpleSwap,
|
|
255
|
+
// network,
|
|
256
|
+
// provider,
|
|
257
|
+
// );
|
|
258
|
+
// });
|
|
259
|
+
// NO HOLDERS OF BBADAI (ONLY VAULT)
|
|
260
|
+
// it('WRAPPED TOKEN -> MAIN TOKEN, LinearPool', async () => {
|
|
261
|
+
// await testE2E(
|
|
262
|
+
// tokens['waUSDT'],
|
|
263
|
+
// tokens['BBAUSDT'],
|
|
264
|
+
// holders['waUSDT'],
|
|
265
|
+
// '20000000',
|
|
266
|
+
// SwapSide.SELL,
|
|
267
|
+
// dexKey,
|
|
268
|
+
// ContractMethod.simpleSwap,
|
|
269
|
+
// network,
|
|
270
|
+
// provider,
|
|
271
|
+
// );
|
|
272
|
+
// });
|
|
273
|
+
// NO HOLDERS OF BBADAI (ONLY VAULT)
|
|
274
|
+
// it('BPT -> MAIN TOKEN, LinearPool', async () => {
|
|
275
|
+
// // Linear Pools allow swaps between main token (i.e. USDT) and pools BPT
|
|
276
|
+
// await testE2E(
|
|
277
|
+
// tokens['BBADAI'],
|
|
278
|
+
// tokens['DAI'],
|
|
279
|
+
// holders['BBADAI'],
|
|
280
|
+
// '20000000',
|
|
281
|
+
// SwapSide.SELL,
|
|
282
|
+
// dexKey,
|
|
283
|
+
// ContractMethod.simpleSwap,
|
|
284
|
+
// network,
|
|
285
|
+
// provider,
|
|
286
|
+
// );
|
|
287
|
+
// });
|
|
288
|
+
// it('BPT -> WRAPPED TOKEN, LinearPool', async () => {
|
|
289
|
+
// // Linear Pools allow swaps between wrapped token (i.e. waDAI) and pools BPT
|
|
290
|
+
// await testE2E(
|
|
291
|
+
// tokens['BBADAI'],
|
|
292
|
+
// tokens['waDAI'],
|
|
293
|
+
// holders['BBADAI'],
|
|
294
|
+
// '20000000',
|
|
295
|
+
// SwapSide.SELL,
|
|
296
|
+
// dexKey,
|
|
297
|
+
// ContractMethod.simpleSwap,
|
|
298
|
+
// network,
|
|
299
|
+
// provider,
|
|
300
|
+
// );
|
|
301
|
+
// });
|
|
219
302
|
|
|
220
|
-
|
|
221
|
-
|
|
303
|
+
//daniel: BPT swaps are currently not supported, we've refactored to focus on mainToken paths
|
|
304
|
+
/*it('BPT -> TOKEN, PhantomStablePool', async () => {
|
|
222
305
|
// PhantomStable allows swaps between BPT and tokens
|
|
223
306
|
await testE2E(
|
|
224
307
|
tokens['BBAUSD'],
|
|
@@ -246,64 +329,8 @@ describe('BalancerV2 E2E', () => {
|
|
|
246
329
|
);
|
|
247
330
|
});*/
|
|
248
331
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
tokens['wstETH'],
|
|
252
|
-
tokens['ETH'],
|
|
253
|
-
holders['wstETH'],
|
|
254
|
-
'3000000000000000000',
|
|
255
|
-
SwapSide.SELL,
|
|
256
|
-
dexKey,
|
|
257
|
-
ContractMethod.simpleSwap,
|
|
258
|
-
network,
|
|
259
|
-
provider,
|
|
260
|
-
);
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
describe('Multiswap', () => {
|
|
265
|
-
it('ETH -> TOKEN', async () => {
|
|
266
|
-
await testE2E(
|
|
267
|
-
tokens['ETH'],
|
|
268
|
-
tokens['WBTC'],
|
|
269
|
-
holders['ETH'],
|
|
270
|
-
'7000000000000000000',
|
|
271
|
-
SwapSide.SELL,
|
|
272
|
-
dexKey,
|
|
273
|
-
ContractMethod.multiSwap,
|
|
274
|
-
network,
|
|
275
|
-
provider,
|
|
276
|
-
);
|
|
277
|
-
});
|
|
278
|
-
it('TOKEN -> ETH', async () => {
|
|
279
|
-
await testE2E(
|
|
280
|
-
tokens['USDC'],
|
|
281
|
-
tokens['ETH'],
|
|
282
|
-
holders['USDC'],
|
|
283
|
-
'2000000000',
|
|
284
|
-
SwapSide.SELL,
|
|
285
|
-
dexKey,
|
|
286
|
-
ContractMethod.multiSwap,
|
|
287
|
-
network,
|
|
288
|
-
provider,
|
|
289
|
-
);
|
|
290
|
-
});
|
|
291
|
-
it('TOKEN -> TOKEN', async () => {
|
|
292
|
-
await testE2E(
|
|
293
|
-
tokens['USDC'],
|
|
294
|
-
tokens['WBTC'],
|
|
295
|
-
holders['USDC'],
|
|
296
|
-
'20000000',
|
|
297
|
-
SwapSide.SELL,
|
|
298
|
-
dexKey,
|
|
299
|
-
ContractMethod.multiSwap,
|
|
300
|
-
network,
|
|
301
|
-
provider,
|
|
302
|
-
);
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
//daniel: BPT swaps are currently not supported, we've refactored to focus on mainToken paths
|
|
306
|
-
/*
|
|
332
|
+
//daniel: BPT swaps are currently not supported, we've refactored to focus on mainToken paths
|
|
333
|
+
/*
|
|
307
334
|
it('MAIN TOKEN -> BPT, LinearPool', async () => {
|
|
308
335
|
// Linear Pools allow swaps between main token (i.e. USDT) and pools BPT
|
|
309
336
|
await testE2E(
|
|
@@ -359,50 +386,6 @@ describe('BalancerV2 E2E', () => {
|
|
|
359
386
|
);
|
|
360
387
|
});
|
|
361
388
|
*/
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
//BUY is not currently supported for BalancerV2
|
|
365
|
-
//describe('SimpleBuy', () => {
|
|
366
|
-
// it('ETH -> TOKEN buy', async () => {
|
|
367
|
-
// await testE2E(
|
|
368
|
-
// tokens['ETH'],
|
|
369
|
-
// tokens['WBTC'],
|
|
370
|
-
// holders['ETH'],
|
|
371
|
-
// '35000000',
|
|
372
|
-
// SwapSide.BUY,
|
|
373
|
-
// dexKey,
|
|
374
|
-
// ContractMethod.simpleBuy,
|
|
375
|
-
// network,
|
|
376
|
-
// provider,
|
|
377
|
-
// );
|
|
378
|
-
// });
|
|
379
|
-
// it('TOKEN -> ETH buy', async () => {
|
|
380
|
-
// await testE2E(
|
|
381
|
-
// tokens['USDC'],
|
|
382
|
-
// tokens['ETH'],
|
|
383
|
-
// holders['USDC'],
|
|
384
|
-
// '1000000000000000000',
|
|
385
|
-
// SwapSide.BUY,
|
|
386
|
-
// dexKey,
|
|
387
|
-
// ContractMethod.simpleBuy,
|
|
388
|
-
// network,
|
|
389
|
-
// provider,
|
|
390
|
-
// );
|
|
391
|
-
// });
|
|
392
|
-
// it('TOKEN -> TOKEN buy', async () => {
|
|
393
|
-
// await testE2E(
|
|
394
|
-
// tokens['USDC'],
|
|
395
|
-
// tokens['WETH'],
|
|
396
|
-
// holders['USDC'],
|
|
397
|
-
// '1000000000000000000',
|
|
398
|
-
// SwapSide.BUY,
|
|
399
|
-
// dexKey,
|
|
400
|
-
// ContractMethod.simpleBuy,
|
|
401
|
-
// network,
|
|
402
|
-
// provider,
|
|
403
|
-
// );
|
|
404
|
-
// });
|
|
405
|
-
//});
|
|
406
389
|
});
|
|
407
390
|
|
|
408
391
|
describe('BalancerV2 ARBITRUM', () => {
|