@paraswap/dex-lib 2.12.12-rfqtests.1 → 2.12.12
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/abi/augustus.json +375 -0
- package/build/abi/woo-fi-v2/IntegrationHelper.abi.json +116 -0
- package/build/abi/woo-fi-v2/WooOracleV2.abi.json +358 -0
- package/build/abi/woo-fi-v2/WooPPV2.abi.json +580 -0
- package/build/config.js +3 -3
- package/build/dex/aave-v3/tokens/arbitrum.json +20 -20
- package/build/dex/aave-v3/tokens/avalanche.json +44 -20
- package/build/dex/aave-v3/tokens/fantom.json +30 -30
- package/build/dex/aave-v3/tokens/optimism.json +18 -18
- package/build/dex/aave-v3/tokens/polygon.json +60 -42
- package/build/dex/generic-rfq/rate-fetcher.js +0 -1
- package/build/dex/generic-rfq/rate-fetcher.js.map +1 -1
- package/build/dex/generic-rfq/validators.d.ts +1 -1
- package/build/dex/generic-rfq/validators.js +26 -36
- package/build/dex/generic-rfq/validators.js.map +1 -1
- package/build/dex/hashflow/rate-fetcher.d.ts +14 -0
- package/build/dex/hashflow/rate-fetcher.js +37 -0
- package/build/dex/hashflow/rate-fetcher.js.map +1 -0
- package/build/dex/hashflow/validators.d.ts +3 -0
- package/build/dex/hashflow/validators.js +12 -0
- package/build/dex/hashflow/validators.js.map +1 -0
- package/build/dex/{test-aave-v3 → test-dex}/config.d.ts +1 -1
- package/build/dex/{test-aave-v3 → test-dex}/config.js +3 -3
- package/build/dex/test-dex/config.js.map +1 -0
- package/build/dex/{test-aave-v3/test-aave-v3-pool.d.ts → test-dex/test-dex-pool.d.ts} +3 -3
- package/build/dex/{test-aave-v3/test-aave-v3-pool.js → test-dex/test-dex-pool.js} +7 -7
- package/build/dex/test-dex/test-dex-pool.js.map +1 -0
- package/build/dex/{test-aave-v3/test-aave-v3.d.ts → test-dex/test-dex.d.ts} +8 -8
- package/build/dex/{test-aave-v3/test-aave-v3.js → test-dex/test-dex.js} +7 -7
- package/build/dex/test-dex/test-dex.js.map +1 -0
- package/build/dex/{test-aave-v3 → test-dex}/types.d.ts +1 -1
- package/build/dex/{test-aave-v3 → test-dex}/types.js.map +1 -1
- package/build/dex/uniswap-v3/config.js +13 -0
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/dex/woo-fi-v2/config.d.ts +4 -0
- package/build/dex/woo-fi-v2/config.js +87 -0
- package/build/dex/woo-fi-v2/config.js.map +1 -0
- package/build/dex/woo-fi-v2/constants.d.ts +5 -0
- package/build/dex/woo-fi-v2/constants.js +15 -0
- package/build/dex/woo-fi-v2/constants.js.map +1 -0
- package/build/dex/woo-fi-v2/decoders.d.ts +6 -0
- package/build/dex/woo-fi-v2/decoders.js +29 -0
- package/build/dex/woo-fi-v2/decoders.js.map +1 -0
- package/build/dex/woo-fi-v2/types.d.ts +41 -0
- package/build/dex/woo-fi-v2/types.js +3 -0
- package/build/dex/woo-fi-v2/types.js.map +1 -0
- package/build/dex/woo-fi-v2/utils.d.ts +2 -0
- package/build/dex/woo-fi-v2/utils.js +24 -0
- package/build/dex/woo-fi-v2/utils.js.map +1 -0
- package/build/dex/woo-fi-v2/woo-fi-math.d.ts +16 -0
- package/build/dex/woo-fi-v2/woo-fi-math.js +137 -0
- package/build/dex/woo-fi-v2/woo-fi-math.js.map +1 -0
- package/build/dex/woo-fi-v2/woo-fi-v2-math.d.ts +16 -0
- package/build/dex/woo-fi-v2/woo-fi-v2-math.js +137 -0
- package/build/dex/woo-fi-v2/woo-fi-v2-math.js.map +1 -0
- package/build/dex/woo-fi-v2/woo-fi-v2-pool.d.ts +12 -0
- package/build/dex/woo-fi-v2/woo-fi-v2-pool.js +79 -0
- package/build/dex/woo-fi-v2/woo-fi-v2-pool.js.map +1 -0
- package/build/dex/woo-fi-v2/woo-fi-v2.d.ts +52 -0
- package/build/dex/woo-fi-v2/woo-fi-v2.js +310 -0
- package/build/dex/woo-fi-v2/woo-fi-v2.js.map +1 -0
- package/build/lib/log-messages-suppressor.d.ts +30 -0
- package/build/lib/log-messages-suppressor.js +107 -0
- package/build/lib/log-messages-suppressor.js.map +1 -0
- package/build/lib/stateful-rpc-poller/state-polling-manager.d.ts +23 -0
- package/build/lib/stateful-rpc-poller/state-polling-manager.js +173 -0
- package/build/lib/stateful-rpc-poller/state-polling-manager.js.map +1 -0
- package/build/lib/stateful-rpc-poller/stateful-rpc-poller.d.ts +72 -0
- package/build/lib/stateful-rpc-poller/stateful-rpc-poller.js +369 -0
- package/build/lib/stateful-rpc-poller/stateful-rpc-poller.js.map +1 -0
- package/build/lib/stateful-rpc-poller/types.d.ts +35 -0
- package/build/lib/stateful-rpc-poller/types.js +10 -0
- package/build/lib/stateful-rpc-poller/types.js.map +1 -0
- package/build/lib/stateful-rpc-poller/utils.d.ts +4 -0
- package/build/lib/stateful-rpc-poller/utils.js +17 -0
- package/build/lib/stateful-rpc-poller/utils.js.map +1 -0
- package/build/lib/validators.d.ts +7 -0
- package/build/lib/validators.js +27 -0
- package/build/lib/validators.js.map +1 -0
- package/package.json +1 -1
- package/src/config.ts +3 -3
- package/src/dex/generic-rfq/generic-rfq-e2e.test.ts +71 -85
- package/src/dex/generic-rfq/rate-fetcher.ts +0 -1
- package/src/dex/generic-rfq/validators.test.ts +32 -6
- package/src/dex/generic-rfq/validators.ts +32 -57
- package/src/dex/uniswap-v3/config.ts +13 -0
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +76 -0
- package/tests/constants-e2e.ts +0 -2
- package/tests/utils-e2e.ts +48 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.vscode/launch.json +0 -21
- package/build/dex/aave-v3/tokens/mainnet.json +0 -44
- package/build/dex/balancer-v2/VirtualBoostedPool.d.ts +0 -79
- package/build/dex/balancer-v2/VirtualBoostedPool.js +0 -382
- package/build/dex/balancer-v2/VirtualBoostedPool.js.map +0 -1
- package/build/dex/test-aave-v3/config.js.map +0 -1
- package/build/dex/test-aave-v3/test-aave-v3-pool.js.map +0 -1
- package/build/dex/test-aave-v3/test-aave-v3.js.map +0 -1
- package/src/dex/generic-rfq/generic-rfq-e2e-arbitrum.test.ts +0 -360
- package/src/dex/generic-rfq/generic-rfq-e2e-bsc.test.ts +0 -346
- package/src/dex/generic-rfq/generic-rfq-e2e-polygon.test.ts +0 -360
- /package/build/dex/{test-aave-v3 → test-dex}/types.js +0 -0
|
@@ -126,4 +126,80 @@ describe('UniswapV3 E2E', () => {
|
|
|
126
126
|
}),
|
|
127
127
|
);
|
|
128
128
|
});
|
|
129
|
+
|
|
130
|
+
describe('UniswapV3 BSC', () => {
|
|
131
|
+
const network = Network.BSC;
|
|
132
|
+
const tokens = Tokens[network];
|
|
133
|
+
const holders = Holders[network];
|
|
134
|
+
const provider = new StaticJsonRpcProvider(
|
|
135
|
+
generateConfig(network).privateHttpProvider,
|
|
136
|
+
network,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const tokenASymbol: string = 'BUSD';
|
|
140
|
+
const tokenBSymbol: string = 'WBNB';
|
|
141
|
+
const nativeTokenSymbol = NativeTokenSymbols[network];
|
|
142
|
+
|
|
143
|
+
const tokenAAmount: string = '100000000000000000000';
|
|
144
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
145
|
+
const nativeTokenAmount = '1000000000000000000';
|
|
146
|
+
|
|
147
|
+
const sideToContractMethods = new Map([
|
|
148
|
+
[
|
|
149
|
+
SwapSide.SELL,
|
|
150
|
+
[
|
|
151
|
+
ContractMethod.simpleSwap,
|
|
152
|
+
ContractMethod.multiSwap,
|
|
153
|
+
ContractMethod.megaSwap,
|
|
154
|
+
],
|
|
155
|
+
],
|
|
156
|
+
[SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
|
|
157
|
+
]);
|
|
158
|
+
|
|
159
|
+
sideToContractMethods.forEach((contractMethods, side) =>
|
|
160
|
+
contractMethods.forEach((contractMethod: ContractMethod) => {
|
|
161
|
+
describe(`${contractMethod}`, () => {
|
|
162
|
+
it(`${network} ${side} ${contractMethod} ${nativeTokenSymbol} -> ${tokenASymbol}`, async () => {
|
|
163
|
+
await testE2E(
|
|
164
|
+
tokens[nativeTokenSymbol],
|
|
165
|
+
tokens[tokenASymbol],
|
|
166
|
+
holders[nativeTokenSymbol],
|
|
167
|
+
side === SwapSide.SELL ? nativeTokenAmount : tokenAAmount,
|
|
168
|
+
side,
|
|
169
|
+
dexKey,
|
|
170
|
+
contractMethod,
|
|
171
|
+
network,
|
|
172
|
+
provider,
|
|
173
|
+
);
|
|
174
|
+
});
|
|
175
|
+
it(`${network} ${side} ${contractMethod} ${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
|
|
176
|
+
await testE2E(
|
|
177
|
+
tokens[tokenASymbol],
|
|
178
|
+
tokens[nativeTokenSymbol],
|
|
179
|
+
holders[tokenASymbol],
|
|
180
|
+
side === SwapSide.SELL ? tokenAAmount : nativeTokenAmount,
|
|
181
|
+
side,
|
|
182
|
+
dexKey,
|
|
183
|
+
contractMethod,
|
|
184
|
+
network,
|
|
185
|
+
provider,
|
|
186
|
+
);
|
|
187
|
+
});
|
|
188
|
+
it(`${network} ${side} ${contractMethod} ${tokenASymbol} -> ${tokenBSymbol}`, async () => {
|
|
189
|
+
await testE2E(
|
|
190
|
+
tokens[tokenASymbol],
|
|
191
|
+
tokens[tokenBSymbol],
|
|
192
|
+
holders[tokenASymbol],
|
|
193
|
+
side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
|
|
194
|
+
side,
|
|
195
|
+
dexKey,
|
|
196
|
+
contractMethod,
|
|
197
|
+
network,
|
|
198
|
+
provider,
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
}),
|
|
203
|
+
);
|
|
204
|
+
});
|
|
129
205
|
});
|
package/tests/constants-e2e.ts
CHANGED
package/tests/utils-e2e.ts
CHANGED
|
@@ -297,7 +297,6 @@ export type TestParamE2E = {
|
|
|
297
297
|
destTokenBalanceOverrides?: Record<Address, string>;
|
|
298
298
|
destTokenAllowanceOverrides?: Record<Address, string>;
|
|
299
299
|
sleepMs?: number;
|
|
300
|
-
skipTenderly?: boolean;
|
|
301
300
|
};
|
|
302
301
|
|
|
303
302
|
const makeFakeTransferToSenderAddress = (
|
|
@@ -331,19 +330,14 @@ export async function newTestE2E({
|
|
|
331
330
|
limitOrderProvider,
|
|
332
331
|
transferFees,
|
|
333
332
|
sleepMs,
|
|
334
|
-
skipTenderly,
|
|
335
333
|
}: TestParamE2E) {
|
|
336
|
-
const useTenderly = !skipTenderly;
|
|
337
334
|
const amount = BigInt(_amount);
|
|
338
335
|
const twiceAmount = BigInt(_amount) * 2n;
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
ts = new TenderlySimulation(network);
|
|
342
|
-
await ts.setup();
|
|
343
|
-
}
|
|
336
|
+
const ts = new TenderlySimulation(network);
|
|
337
|
+
await ts.setup();
|
|
344
338
|
|
|
345
|
-
if (
|
|
346
|
-
const deployTx = await
|
|
339
|
+
if (adapterBytecode) {
|
|
340
|
+
const deployTx = await ts.simulate(
|
|
347
341
|
deployAdapterParams(adapterBytecode, network),
|
|
348
342
|
);
|
|
349
343
|
|
|
@@ -358,13 +352,13 @@ export async function newTestE2E({
|
|
|
358
352
|
'gas',
|
|
359
353
|
);
|
|
360
354
|
|
|
361
|
-
const whitelistTx = await
|
|
355
|
+
const whitelistTx = await ts.simulate(
|
|
362
356
|
whiteListAdapterParams(adapterAddress, network),
|
|
363
357
|
);
|
|
364
358
|
expect(whitelistTx.success).toEqual(true);
|
|
365
359
|
}
|
|
366
360
|
|
|
367
|
-
if (
|
|
361
|
+
if (thirdPartyAddress) {
|
|
368
362
|
const stateOverrides: StateOverrides = {
|
|
369
363
|
networkID: `${network}`,
|
|
370
364
|
stateOverrides: {},
|
|
@@ -381,15 +375,43 @@ export async function newTestE2E({
|
|
|
381
375
|
: (BigInt(MAX_UINT) / 4n).toString(),
|
|
382
376
|
);
|
|
383
377
|
|
|
384
|
-
await
|
|
378
|
+
await ts.simulate(giftTx, stateOverrides);
|
|
385
379
|
}
|
|
386
380
|
|
|
381
|
+
const stateOverrides: StateOverrides = {
|
|
382
|
+
networkID: `${network}`,
|
|
383
|
+
stateOverrides: {},
|
|
384
|
+
};
|
|
385
|
+
srcToken.applyOverrides(stateOverrides);
|
|
386
|
+
destToken.applyOverrides(stateOverrides);
|
|
387
|
+
|
|
388
|
+
if (swapSide === SwapSide.SELL) {
|
|
389
|
+
srcToken
|
|
390
|
+
.addBalance(senderAddress, twiceAmount.toString())
|
|
391
|
+
.addAllowance(
|
|
392
|
+
senderAddress,
|
|
393
|
+
config.tokenTransferProxyAddress,
|
|
394
|
+
amount.toString(),
|
|
395
|
+
);
|
|
396
|
+
} else {
|
|
397
|
+
srcToken
|
|
398
|
+
.addBalance(senderAddress, MAX_UINT)
|
|
399
|
+
.addAllowance(
|
|
400
|
+
senderAddress,
|
|
401
|
+
config.tokenTransferProxyAddress,
|
|
402
|
+
(BigInt(MAX_UINT) / 8n).toString(),
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
srcToken.applyOverrides(stateOverrides);
|
|
407
|
+
destToken.applyOverrides(stateOverrides);
|
|
408
|
+
|
|
387
409
|
const useAPI = testingEndpoint && !poolIdentifiers;
|
|
388
410
|
// The API currently doesn't allow for specifying poolIdentifiers
|
|
389
411
|
const paraswap: IParaSwapSDK = new LocalParaswapSDK(
|
|
390
412
|
network,
|
|
391
413
|
dexKey,
|
|
392
|
-
|
|
414
|
+
`https://rpc.tenderly.co/fork/${ts.forkId}`,
|
|
393
415
|
limitOrderProvider,
|
|
394
416
|
);
|
|
395
417
|
|
|
@@ -425,52 +447,19 @@ export async function newTestE2E({
|
|
|
425
447
|
senderAddress,
|
|
426
448
|
);
|
|
427
449
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
.addBalance(senderAddress, twiceAmount.toString())
|
|
439
|
-
.addAllowance(
|
|
440
|
-
senderAddress,
|
|
441
|
-
config.tokenTransferProxyAddress,
|
|
442
|
-
amount.toString(),
|
|
443
|
-
);
|
|
444
|
-
} else {
|
|
445
|
-
srcToken
|
|
446
|
-
.addBalance(senderAddress, MAX_UINT)
|
|
447
|
-
.addAllowance(
|
|
448
|
-
senderAddress,
|
|
449
|
-
config.tokenTransferProxyAddress,
|
|
450
|
-
(BigInt(MAX_UINT) / 8n).toString(),
|
|
451
|
-
);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
srcToken.applyOverrides(stateOverrides);
|
|
455
|
-
destToken.applyOverrides(stateOverrides);
|
|
456
|
-
|
|
457
|
-
const swapTx = await (ts as TenderlySimulation).simulate(
|
|
458
|
-
swapParams,
|
|
459
|
-
stateOverrides,
|
|
450
|
+
const swapTx = await ts.simulate(swapParams, stateOverrides);
|
|
451
|
+
console.log(`${srcToken.address}_${destToken.address}_${dexKey!}`);
|
|
452
|
+
// Only log gas estimate if testing against API
|
|
453
|
+
if (useAPI)
|
|
454
|
+
console.log(
|
|
455
|
+
`Gas Estimate API: ${priceRoute.gasCost}, Simulated: ${
|
|
456
|
+
swapTx!.gasUsed
|
|
457
|
+
}, Difference: ${
|
|
458
|
+
parseInt(priceRoute.gasCost) - parseInt(swapTx!.gasUsed)
|
|
459
|
+
}`,
|
|
460
460
|
);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if (useAPI)
|
|
464
|
-
console.log(
|
|
465
|
-
`Gas Estimate API: ${priceRoute.gasCost}, Simulated: ${
|
|
466
|
-
swapTx!.gasUsed
|
|
467
|
-
}, Difference: ${
|
|
468
|
-
parseInt(priceRoute.gasCost) - parseInt(swapTx!.gasUsed)
|
|
469
|
-
}`,
|
|
470
|
-
);
|
|
471
|
-
console.log(`Tenderly URL: ${swapTx!.tenderlyUrl}`);
|
|
472
|
-
expect(swapTx!.success).toEqual(true);
|
|
473
|
-
}
|
|
461
|
+
console.log(`Tenderly URL: ${swapTx!.tenderlyUrl}`);
|
|
462
|
+
expect(swapTx!.success).toEqual(true);
|
|
474
463
|
} finally {
|
|
475
464
|
if (paraswap.releaseResources) {
|
|
476
465
|
await paraswap.releaseResources();
|
package/.idea/misc.xml
DELETED
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/paraswap-dex-lib.iml" filepath="$PROJECT_DIR$/paraswap-dex-lib.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/vcs.xml
DELETED
package/.vscode/launch.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"type": "node",
|
|
9
|
-
"request": "launch",
|
|
10
|
-
"name": "Launch Program",
|
|
11
|
-
"skipFiles": [
|
|
12
|
-
"<node_internals>/**"
|
|
13
|
-
],
|
|
14
|
-
"program": "${workspaceFolder}/build/index.js",
|
|
15
|
-
"preLaunchTask": "tsc: build - tsconfig.json",
|
|
16
|
-
"outFiles": [
|
|
17
|
-
"${workspaceFolder}/build/**/*.js"
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"aSymbol": "aDAI",
|
|
4
|
-
"aAddress": "0x018008bfb33d285247A21d44E50697654f754e63",
|
|
5
|
-
"address": "0x6b175474e89094c44da98b954eedeac495271d0f",
|
|
6
|
-
"decimals": 18
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"aSymbol": "aUSDC",
|
|
10
|
-
"aAddress": "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c",
|
|
11
|
-
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
12
|
-
"decimals": 6
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"aSymbol": "aAAVE",
|
|
16
|
-
"aAddress": "0xA700b4eB416Be35b2911fd5Dee80678ff64fF6C9",
|
|
17
|
-
"address": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
|
|
18
|
-
"decimals": 18
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"aSymbol": "aLINK",
|
|
22
|
-
"aAddress": "0x5E8C8A7243651DB1384C0dDfDbE39761E8e7E51a",
|
|
23
|
-
"address": "0x514910771af9ca656af840dff83e8264ecf986ca",
|
|
24
|
-
"decimals": 18
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"aSymbol": "aWBTC",
|
|
28
|
-
"aAddress": "0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8",
|
|
29
|
-
"address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
|
|
30
|
-
"decimals": 8
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"aSymbol": "aWETH",
|
|
34
|
-
"aAddress": "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
|
|
35
|
-
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
36
|
-
"decimals": 18
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"aSymbol": "awstETH",
|
|
40
|
-
"aAddress": "0x0B925eD163218f6662a35e0f0371Ac234f9E9371",
|
|
41
|
-
"address": "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0",
|
|
42
|
-
"decimals": 18
|
|
43
|
-
}
|
|
44
|
-
]
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { PoolState, SubgraphPoolBase, callData, BalancerSwap } from './types';
|
|
3
|
-
import { SwapSide } from '../../constants';
|
|
4
|
-
export declare type BoostedPools = {
|
|
5
|
-
[id: string]: BoostedPool;
|
|
6
|
-
};
|
|
7
|
-
export declare type BoostedPool = {
|
|
8
|
-
mainTokens: MainToken[];
|
|
9
|
-
phantomStablePoolAddr: string;
|
|
10
|
-
};
|
|
11
|
-
export declare type MainToken = {
|
|
12
|
-
address: string;
|
|
13
|
-
decimals: number;
|
|
14
|
-
linearPoolAddr: string;
|
|
15
|
-
linearPoolId: string;
|
|
16
|
-
};
|
|
17
|
-
export declare type VirtualBoostedPools = {
|
|
18
|
-
dictionary: BoostedPools;
|
|
19
|
-
subgraph: SubgraphPoolBase[];
|
|
20
|
-
};
|
|
21
|
-
declare type BoostedPoolPairData = {
|
|
22
|
-
tokenIn: string;
|
|
23
|
-
tokenOut: string;
|
|
24
|
-
phantomPoolId: any;
|
|
25
|
-
poolStates: {
|
|
26
|
-
[address: string]: PoolState;
|
|
27
|
-
};
|
|
28
|
-
boostedPools: BoostedPools;
|
|
29
|
-
gasCost: number;
|
|
30
|
-
};
|
|
31
|
-
export declare type SwapData = {
|
|
32
|
-
swaps: BalancerSwap[];
|
|
33
|
-
assets: string[];
|
|
34
|
-
};
|
|
35
|
-
export declare class VirtualBoostedPool {
|
|
36
|
-
/**
|
|
37
|
-
* Creates VirtualBoostedPools from list of input pools. A VirtualBoostedPool is a combination of Linear pools nested in a PhantomStable pool. i.e. bb-a-USD.
|
|
38
|
-
* @param pools Array of subgraph pools (should contain Phantom/Linear pools of interest)
|
|
39
|
-
* @returns Array of VirtualBoosted subgraph pools. Dictionary object of virtualBoosted pool data.
|
|
40
|
-
*/
|
|
41
|
-
static createPools(pools: SubgraphPoolBase[]): VirtualBoostedPools;
|
|
42
|
-
static poolType: string;
|
|
43
|
-
vaultAddress: string;
|
|
44
|
-
vaultInterface: Interface;
|
|
45
|
-
linearPoolInterface: Interface;
|
|
46
|
-
phantomStablePoolInterface: Interface;
|
|
47
|
-
constructor(vaultAddress: string, vaultInterface: Interface, linearPoolInterface: Interface, metaStablePoolInterface: Interface);
|
|
48
|
-
getOnChainCalls(pool: SubgraphPoolBase, virtualBoostedPools: BoostedPools): callData[];
|
|
49
|
-
decodeOnChainCalls(pool: SubgraphPoolBase, data: {
|
|
50
|
-
success: boolean;
|
|
51
|
-
returnData: any;
|
|
52
|
-
}[], startIndex: number, boostedPools: BoostedPools): [{
|
|
53
|
-
[address: string]: PoolState;
|
|
54
|
-
}, number];
|
|
55
|
-
static getTokenPool(phantomPoolAddr: string, phantomPoolId: string, tokenAddr: string, boostedPools: BoostedPools): {
|
|
56
|
-
address: string;
|
|
57
|
-
type: string;
|
|
58
|
-
id: string;
|
|
59
|
-
};
|
|
60
|
-
parsePoolPairData(pool: SubgraphPoolBase, poolStates: {
|
|
61
|
-
[address: string]: PoolState;
|
|
62
|
-
}, tokenIn: string, tokenOut: string, boostedPools: BoostedPools): BoostedPoolPairData;
|
|
63
|
-
checkBalance(amounts: bigint[], unitVolume: bigint, side: SwapSide, poolPairData: BoostedPoolPairData): boolean;
|
|
64
|
-
onSell(amounts: bigint[], poolPairData: BoostedPoolPairData): bigint[];
|
|
65
|
-
_calcOutGivenIn(tokenAmountsIn: bigint[], tokenIn: string, tokenOut: string, phantomPoolId: string, poolStates: {
|
|
66
|
-
[address: string]: PoolState;
|
|
67
|
-
}, boostedPools: BoostedPools): bigint[];
|
|
68
|
-
/**
|
|
69
|
-
* Creates Balancer multihop swaps and asset info required to swap a pair of underlying tokens through the Boosted pools.
|
|
70
|
-
* @param tokenIn Underlying token in.
|
|
71
|
-
* @param tokenOut Underlying token out.
|
|
72
|
-
* @param boostedPoolId ID of the VirtualBoostedPool that tokenIn/Out belong to.
|
|
73
|
-
* @param amount Amount being traded.
|
|
74
|
-
* @param boostedPools Dictionary of boosted pools.
|
|
75
|
-
* @returns Swaps and assets.
|
|
76
|
-
*/
|
|
77
|
-
static getSwapData(tokenIn: string, tokenOut: string, boostedPoolId: string, amount: string, boostedPools: BoostedPools): SwapData;
|
|
78
|
-
}
|
|
79
|
-
export {};
|