@paraswap/dex-lib 2.14.0 → 2.14.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/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.vscode/launch.json +21 -0
- package/build/config.js +23 -5
- package/build/config.js.map +1 -1
- package/build/dex/aave-v3/tokens/arbitrum.json +50 -0
- package/build/dex/aave-v3/tokens/avalanche.json +50 -0
- package/build/dex/aave-v3/tokens/fantom.json +62 -0
- package/build/dex/aave-v3/tokens/mainnet.json +44 -0
- package/build/dex/aave-v3/tokens/optimism.json +50 -0
- package/build/dex/aave-v3/tokens/polygon.json +98 -0
- package/build/dex/balancer-v2/VirtualBoostedPool.d.ts +79 -0
- package/build/dex/balancer-v2/VirtualBoostedPool.js +382 -0
- package/build/dex/balancer-v2/VirtualBoostedPool.js.map +1 -0
- package/build/dex/generic-rfq/e2e-test-config.d.ts +9 -0
- package/build/dex/generic-rfq/e2e-test-config.js +33 -0
- package/build/dex/generic-rfq/e2e-test-config.js.map +1 -0
- package/build/dex/generic-rfq/rate-fetcher.js +2 -0
- 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 +36 -26
- package/build/dex/generic-rfq/validators.js.map +1 -1
- package/build/dex/index.js +2 -2
- package/build/dex/index.js.map +1 -1
- package/build/dex/simple-exchange.d.ts +1 -0
- package/build/dex/simple-exchange.js +2 -0
- package/build/dex/simple-exchange.js.map +1 -1
- package/build/dex/test-aave-v3/config.d.ts +4 -0
- package/build/dex/test-aave-v3/config.js +15 -0
- package/build/dex/test-aave-v3/config.js.map +1 -0
- package/build/dex/test-aave-v3/test-aave-v3-pool.d.ts +39 -0
- package/build/dex/test-aave-v3/test-aave-v3-pool.js +63 -0
- package/build/dex/test-aave-v3/test-aave-v3-pool.js.map +1 -0
- package/build/dex/test-aave-v3/test-aave-v3.d.ts +37 -0
- package/build/dex/test-aave-v3/test-aave-v3.js +126 -0
- package/build/dex/test-aave-v3/test-aave-v3.js.map +1 -0
- package/build/dex/test-aave-v3/types.d.ts +6 -0
- package/build/dex/test-aave-v3/types.js +3 -0
- package/build/dex/test-aave-v3/types.js.map +1 -0
- package/build/lib/decoders.d.ts +2 -1
- package/build/lib/decoders.js +8 -1
- package/build/lib/decoders.js.map +1 -1
- package/build/lib/fetcher/fetcher.js +3 -0
- package/build/lib/fetcher/fetcher.js.map +1 -1
- package/build/lib/multi-wrapper.d.ts +2 -1
- package/build/lib/multi-wrapper.js.map +1 -1
- package/build/lib/tokens/balancer-fetcher.js +4 -5
- package/build/lib/tokens/balancer-fetcher.js.map +1 -1
- package/build/lib/tokens/utils.d.ts +2 -2
- package/build/lib/tokens/utils.js +1 -1
- package/build/lib/tokens/utils.js.map +1 -1
- package/build/types.d.ts +3 -0
- package/dex-template/__DexName__-e2e.test.ts.template +1 -0
- package/dex-template/__DexName__-events.test.ts.template +1 -0
- package/dex-template/__DexName__-integration.test.ts.template +1 -0
- package/dex-template/__DexName__-pool.ts.template +8 -5
- package/package.json +1 -1
- package/scripts/generate-bytecode.ts +2 -0
- package/src/abi/woo-fi-v2/IntegrationHelper.abi.json +116 -0
- package/src/abi/{woo-fi/Wooracle.abi.json → woo-fi-v2/WooOracleV2.abi.json} +148 -50
- package/src/abi/{woo-fi/WooPP.abi.json → woo-fi-v2/WooPPV2.abi.json} +201 -169
- package/src/config.ts +27 -5
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +0 -1
- package/src/dex/generic-rfq/e2e-test-config.ts +37 -0
- package/src/dex/generic-rfq/generic-rfq-e2e.test.ts +63 -258
- package/src/dex/generic-rfq/generic-rfq-local-e2e.test.ts +121 -0
- package/src/dex/generic-rfq/rate-fetcher.ts +2 -0
- package/src/dex/generic-rfq/validators.test.ts +6 -32
- package/src/dex/generic-rfq/validators.ts +57 -32
- package/src/dex/index.ts +2 -2
- package/src/dex/simple-exchange.ts +3 -0
- package/src/dex/woo-fi-v2/config.ts +87 -0
- package/src/dex/woo-fi-v2/constants.ts +22 -0
- package/src/dex/woo-fi-v2/decoders.ts +45 -0
- package/src/dex/woo-fi-v2/types.ts +63 -0
- package/src/dex/woo-fi-v2/utils.ts +19 -0
- package/src/dex/woo-fi-v2/woo-fi-v2-e2e.test.ts +216 -0
- package/src/dex/woo-fi-v2/woo-fi-v2-integration.test.ts +495 -0
- package/src/dex/woo-fi-v2/woo-fi-v2-math.ts +195 -0
- package/src/dex/woo-fi-v2/woo-fi-v2-pool.ts +112 -0
- package/src/dex/woo-fi-v2/woo-fi-v2.ts +487 -0
- package/src/lib/decoders.ts +12 -1
- package/src/lib/fetcher/fetcher.ts +6 -0
- package/src/lib/log-messages-suppressor.ts +173 -0
- package/src/lib/multi-wrapper.ts +2 -1
- package/src/lib/stateful-rpc-poller/state-polling-manager.ts +320 -0
- package/src/lib/stateful-rpc-poller/stateful-rpc-poller.ts +604 -0
- package/src/lib/stateful-rpc-poller/types.ts +66 -0
- package/src/lib/stateful-rpc-poller/utils.ts +23 -0
- package/src/lib/tokens/balancer-fetcher.ts +5 -6
- package/src/lib/tokens/utils.ts +5 -3
- package/src/types.ts +4 -0
- package/tests/constants-e2e.ts +10 -3
- package/tests/tenderly-simulation.ts +1 -1
- package/tests/utils-e2e.ts +61 -48
- package/tests/utils.ts +2 -0
- package/src/abi/woo-fi/WooFeeManager.abi.json +0 -318
- package/src/dex/woo-fi/config.ts +0 -141
- package/src/dex/woo-fi/constants.ts +0 -21
- package/src/dex/woo-fi/types.ts +0 -55
- package/src/dex/woo-fi/woo-fi-decimal-math.ts +0 -45
- package/src/dex/woo-fi/woo-fi-e2e.test.ts +0 -183
- package/src/dex/woo-fi/woo-fi-integration.test.ts +0 -416
- package/src/dex/woo-fi/woo-fi-math.ts +0 -527
- package/src/dex/woo-fi/woo-fi.ts +0 -693
|
@@ -59,7 +59,6 @@ export const getBalanceCallParams = (
|
|
|
59
59
|
}));
|
|
60
60
|
default:
|
|
61
61
|
throw new Error(`missing case for assetType ${req.assetType}`);
|
|
62
|
-
return [];
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
64
|
|
|
@@ -264,21 +263,21 @@ export const getBalances = async (
|
|
|
264
263
|
blockNumber,
|
|
265
264
|
);
|
|
266
265
|
|
|
267
|
-
const
|
|
266
|
+
const chunks = [];
|
|
268
267
|
let j = 0;
|
|
269
268
|
for (let i = 0; i < results.length; ) {
|
|
270
269
|
const batchSize = decodingInfo[j].length;
|
|
271
|
-
const
|
|
272
|
-
|
|
270
|
+
const chunk = results.slice(i, i + batchSize);
|
|
271
|
+
chunks.push(chunk);
|
|
273
272
|
j++;
|
|
274
273
|
i += batchSize;
|
|
275
274
|
}
|
|
276
275
|
|
|
277
|
-
return
|
|
276
|
+
return chunks.map((chunk, index) =>
|
|
278
277
|
decodeBalanceAndAllowanceMultiResult(
|
|
279
278
|
reqs[index],
|
|
280
279
|
decodingInfo[index].spenders,
|
|
281
|
-
|
|
280
|
+
chunk,
|
|
282
281
|
),
|
|
283
282
|
);
|
|
284
283
|
};
|
package/src/lib/tokens/utils.ts
CHANGED
|
@@ -53,7 +53,7 @@ export const uint256ArrayDecode = (
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export const booleanDecode = (
|
|
56
|
-
result: MultiResult<
|
|
56
|
+
result: MultiResult<BytesLike> | BytesLike,
|
|
57
57
|
): boolean => {
|
|
58
58
|
const [isSuccess, toDecode] = extractSuccessAndValue(result);
|
|
59
59
|
|
|
@@ -63,10 +63,12 @@ export const booleanDecode = (
|
|
|
63
63
|
return defaultAbiCoder.decode(['bool'], toDecode)[0];
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export const addressDecode = (
|
|
66
|
+
export const addressDecode = (
|
|
67
|
+
result: MultiResult<BytesLike> | BytesLike,
|
|
68
|
+
): string => {
|
|
67
69
|
const [isSuccess, toDecode] = extractSuccessAndValue(result);
|
|
68
70
|
|
|
69
|
-
if (isSuccess) {
|
|
71
|
+
if (!isSuccess) {
|
|
70
72
|
return '';
|
|
71
73
|
}
|
|
72
74
|
return defaultAbiCoder.decode(['address'], toDecode)[0].toLowerCase();
|
package/src/types.ts
CHANGED
|
@@ -270,6 +270,8 @@ export type Config = {
|
|
|
270
270
|
adapterAddresses: { [name: string]: Address };
|
|
271
271
|
uniswapV2ExchangeRouterAddress: Address;
|
|
272
272
|
rfqConfigs: Record<string, RFQConfig>;
|
|
273
|
+
rpcPollingMaxAllowedStateDelayInBlocks: number;
|
|
274
|
+
rpcPollingBlocksBackToTriggerUpdate: number;
|
|
273
275
|
hashFlowAuthToken?: string;
|
|
274
276
|
hashFlowDisabledMMs: string[];
|
|
275
277
|
uniswapV3EventLoggingSampleRate?: number;
|
|
@@ -294,3 +296,5 @@ export type TransferFeeParams = {
|
|
|
294
296
|
srcDexFee: number;
|
|
295
297
|
destDexFee: number;
|
|
296
298
|
};
|
|
299
|
+
|
|
300
|
+
export type LogLevels = 'info' | 'warn' | 'error' | 'trace' | 'debug';
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -50,6 +50,8 @@ export const Tokens: {
|
|
|
50
50
|
USDT: {
|
|
51
51
|
address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
|
52
52
|
decimals: 6,
|
|
53
|
+
addBalance: balancesFn,
|
|
54
|
+
addAllowance: allowedFn,
|
|
53
55
|
},
|
|
54
56
|
STETH: {
|
|
55
57
|
address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
|
|
@@ -470,6 +472,10 @@ export const Tokens: {
|
|
|
470
472
|
address: '0x841fad6eae12c286d1fd18d1d525dffa75c7effe',
|
|
471
473
|
decimals: 18,
|
|
472
474
|
},
|
|
475
|
+
ETH: {
|
|
476
|
+
address: '0x74b23882a30290451A17c44f4F05243b6b58C76d',
|
|
477
|
+
decimals: 18,
|
|
478
|
+
},
|
|
473
479
|
},
|
|
474
480
|
[Network.BSC]: {
|
|
475
481
|
POPS: {
|
|
@@ -887,7 +893,7 @@ export const Holders: {
|
|
|
887
893
|
DAI: '0x370f4b2dcf75c94d8d4450b493661a9c6170d0b5',
|
|
888
894
|
FTM: '0x431e81E5dfB5A24541b5Ff8762bDEF3f32F96354',
|
|
889
895
|
WFTM: '0x431e81E5dfB5A24541b5Ff8762bDEF3f32F96354',
|
|
890
|
-
USDC: '
|
|
896
|
+
USDC: '0xe48793b1533b351ae184e1c3119d0955dde7b330',
|
|
891
897
|
FUSDT: '0x9ade1c17d25246c405604344f89E8F23F8c1c632',
|
|
892
898
|
POPS: '0x4b78b52e7de4d8b7d367297cb8a87c1875a9d591',
|
|
893
899
|
aFanUSDT: '0x8EBc96fF91A30059E447bFC7C0a7394f8A5793E6',
|
|
@@ -900,6 +906,7 @@ export const Holders: {
|
|
|
900
906
|
wBOMB: '0x28aa4f9ffe21365473b64c161b566c3cdead0108',
|
|
901
907
|
TOR: '0x70de4b5ed310fd93da3c0bae824fb99cb4d44dd8',
|
|
902
908
|
BOO: '0xf778f4d7a14a8cb73d5261f9c61970ef4e7d7842',
|
|
909
|
+
ETH: '0xf48883940b4056801de30f12b934dcea90133ee6',
|
|
903
910
|
},
|
|
904
911
|
[Network.BSC]: {
|
|
905
912
|
DAI: '0xf68a4b64162906eff0ff6ae34e2bb1cd42fef62d',
|
|
@@ -919,10 +926,10 @@ export const Holders: {
|
|
|
919
926
|
[Network.AVALANCHE]: {
|
|
920
927
|
AVAX: '0xD6216fC19DB775Df9774a6E33526131dA7D19a2c',
|
|
921
928
|
avWAVAX: '0xc5ed2333f8a2C351fCA35E5EBAdb2A82F5d254C3',
|
|
922
|
-
WAVAX: '
|
|
929
|
+
WAVAX: '0xbbff2a8ec8d702e61faaccf7cf705968bb6a5bab',
|
|
923
930
|
sAVAX: '0xC73DF1e68FC203F6E4b6270240D6f82A850e8D38',
|
|
924
931
|
USDCe: '0x3a2434c698f8d79af1f5a9e43013157ca8b11a66',
|
|
925
|
-
USDC: '
|
|
932
|
+
USDC: '0xbf14db80d9275fb721383a77c00ae180fc40ae98',
|
|
926
933
|
USDTe: '0x84d34f4f83a87596cd3fb6887cff8f17bf5a7b83',
|
|
927
934
|
USDT: '0x715f3c533Cf264215Ba8BE00838a053284351086',
|
|
928
935
|
WETHe: '0xD291B51f7a1a1F4917D085F2a7731A447E4aF82D',
|
|
@@ -12,7 +12,7 @@ const TENDERLY_FORK_LAST_TX_ID = process.env.TENDERLY_FORK_LAST_TX_ID;
|
|
|
12
12
|
export class TenderlySimulation {
|
|
13
13
|
lastTx: string = '';
|
|
14
14
|
forkId: string = '';
|
|
15
|
-
maxGasLimit =
|
|
15
|
+
maxGasLimit = 80000000;
|
|
16
16
|
|
|
17
17
|
constructor(private network: Number = 1) {}
|
|
18
18
|
|
package/tests/utils-e2e.ts
CHANGED
|
@@ -45,6 +45,7 @@ const DEPLOYER_ADDRESS: { [nid: number]: string } = {
|
|
|
45
45
|
[Network.FANTOM]: '0x05182E579FDfCf69E4390c3411D8FeA1fb6467cf',
|
|
46
46
|
[Network.AVALANCHE]: '0xD6216fC19DB775Df9774a6E33526131dA7D19a2c',
|
|
47
47
|
[Network.OPTIMISM]: '0xf01121e808F782d7F34E857c27dA31AD1f151b39',
|
|
48
|
+
[Network.ARBITRUM]: '0xb38e8c17e38363af6ebdcb3dae12e0243582891d',
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
const MULTISIG: { [nid: number]: string } = {
|
|
@@ -54,6 +55,7 @@ const MULTISIG: { [nid: number]: string } = {
|
|
|
54
55
|
[Network.FANTOM]: '0xECaB2dac955b94e49Ec09D6d68672d3B397BbdAd',
|
|
55
56
|
[Network.AVALANCHE]: '0x1e2ECA5e812D08D2A7F8664D69035163ff5BfEC2',
|
|
56
57
|
[Network.OPTIMISM]: '0xf01121e808F782d7F34E857c27dA31AD1f151b39',
|
|
58
|
+
[Network.ARBITRUM]: '0x90DfD8a6454CFE19be39EaB42ac93CD850c7f339',
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
class APIParaswapSDK implements IParaSwapSDK {
|
|
@@ -297,6 +299,7 @@ export type TestParamE2E = {
|
|
|
297
299
|
destTokenBalanceOverrides?: Record<Address, string>;
|
|
298
300
|
destTokenAllowanceOverrides?: Record<Address, string>;
|
|
299
301
|
sleepMs?: number;
|
|
302
|
+
skipTenderly?: boolean;
|
|
300
303
|
};
|
|
301
304
|
|
|
302
305
|
const makeFakeTransferToSenderAddress = (
|
|
@@ -330,14 +333,19 @@ export async function newTestE2E({
|
|
|
330
333
|
limitOrderProvider,
|
|
331
334
|
transferFees,
|
|
332
335
|
sleepMs,
|
|
336
|
+
skipTenderly,
|
|
333
337
|
}: TestParamE2E) {
|
|
338
|
+
const useTenderly = !skipTenderly;
|
|
334
339
|
const amount = BigInt(_amount);
|
|
335
340
|
const twiceAmount = BigInt(_amount) * 2n;
|
|
336
|
-
|
|
337
|
-
|
|
341
|
+
let ts: TenderlySimulation | undefined = undefined;
|
|
342
|
+
if (useTenderly) {
|
|
343
|
+
ts = new TenderlySimulation(network);
|
|
344
|
+
await ts.setup();
|
|
345
|
+
}
|
|
338
346
|
|
|
339
|
-
if (adapterBytecode) {
|
|
340
|
-
const deployTx = await ts.simulate(
|
|
347
|
+
if (useTenderly && adapterBytecode) {
|
|
348
|
+
const deployTx = await (ts as TenderlySimulation).simulate(
|
|
341
349
|
deployAdapterParams(adapterBytecode, network),
|
|
342
350
|
);
|
|
343
351
|
|
|
@@ -352,13 +360,13 @@ export async function newTestE2E({
|
|
|
352
360
|
'gas',
|
|
353
361
|
);
|
|
354
362
|
|
|
355
|
-
const whitelistTx = await ts.simulate(
|
|
363
|
+
const whitelistTx = await (ts as TenderlySimulation).simulate(
|
|
356
364
|
whiteListAdapterParams(adapterAddress, network),
|
|
357
365
|
);
|
|
358
366
|
expect(whitelistTx.success).toEqual(true);
|
|
359
367
|
}
|
|
360
368
|
|
|
361
|
-
if (thirdPartyAddress) {
|
|
369
|
+
if (useTenderly && thirdPartyAddress) {
|
|
362
370
|
const stateOverrides: StateOverrides = {
|
|
363
371
|
networkID: `${network}`,
|
|
364
372
|
stateOverrides: {},
|
|
@@ -375,43 +383,15 @@ export async function newTestE2E({
|
|
|
375
383
|
: (BigInt(MAX_UINT) / 4n).toString(),
|
|
376
384
|
);
|
|
377
385
|
|
|
378
|
-
await ts.simulate(giftTx, stateOverrides);
|
|
386
|
+
await (ts as TenderlySimulation).simulate(giftTx, stateOverrides);
|
|
379
387
|
}
|
|
380
388
|
|
|
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
|
-
|
|
409
389
|
const useAPI = testingEndpoint && !poolIdentifiers;
|
|
410
390
|
// The API currently doesn't allow for specifying poolIdentifiers
|
|
411
391
|
const paraswap: IParaSwapSDK = new LocalParaswapSDK(
|
|
412
392
|
network,
|
|
413
393
|
dexKey,
|
|
414
|
-
|
|
394
|
+
'',
|
|
415
395
|
limitOrderProvider,
|
|
416
396
|
);
|
|
417
397
|
|
|
@@ -447,19 +427,52 @@ export async function newTestE2E({
|
|
|
447
427
|
senderAddress,
|
|
448
428
|
);
|
|
449
429
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
430
|
+
if (useTenderly) {
|
|
431
|
+
const stateOverrides: StateOverrides = {
|
|
432
|
+
networkID: `${network}`,
|
|
433
|
+
stateOverrides: {},
|
|
434
|
+
};
|
|
435
|
+
srcToken.applyOverrides(stateOverrides);
|
|
436
|
+
destToken.applyOverrides(stateOverrides);
|
|
437
|
+
|
|
438
|
+
if (swapSide === SwapSide.SELL) {
|
|
439
|
+
srcToken
|
|
440
|
+
.addBalance(senderAddress, twiceAmount.toString())
|
|
441
|
+
.addAllowance(
|
|
442
|
+
senderAddress,
|
|
443
|
+
config.tokenTransferProxyAddress,
|
|
444
|
+
amount.toString(),
|
|
445
|
+
);
|
|
446
|
+
} else {
|
|
447
|
+
srcToken
|
|
448
|
+
.addBalance(senderAddress, MAX_UINT)
|
|
449
|
+
.addAllowance(
|
|
450
|
+
senderAddress,
|
|
451
|
+
config.tokenTransferProxyAddress,
|
|
452
|
+
(BigInt(MAX_UINT) / 8n).toString(),
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
srcToken.applyOverrides(stateOverrides);
|
|
457
|
+
destToken.applyOverrides(stateOverrides);
|
|
458
|
+
|
|
459
|
+
const swapTx = await (ts as TenderlySimulation).simulate(
|
|
460
|
+
swapParams,
|
|
461
|
+
stateOverrides,
|
|
460
462
|
);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
+
console.log(`${srcToken.address}_${destToken.address}_${dexKey!}`);
|
|
464
|
+
// Only log gas estimate if testing against API
|
|
465
|
+
if (useAPI)
|
|
466
|
+
console.log(
|
|
467
|
+
`Gas Estimate API: ${priceRoute.gasCost}, Simulated: ${
|
|
468
|
+
swapTx!.gasUsed
|
|
469
|
+
}, Difference: ${
|
|
470
|
+
parseInt(priceRoute.gasCost) - parseInt(swapTx!.gasUsed)
|
|
471
|
+
}`,
|
|
472
|
+
);
|
|
473
|
+
console.log(`Tenderly URL: ${swapTx!.tenderlyUrl}`);
|
|
474
|
+
expect(swapTx!.success).toEqual(true);
|
|
475
|
+
}
|
|
463
476
|
} finally {
|
|
464
477
|
if (paraswap.releaseResources) {
|
|
465
478
|
await paraswap.releaseResources();
|
package/tests/utils.ts
CHANGED
|
@@ -57,6 +57,8 @@ export function checkPoolsLiquidity(
|
|
|
57
57
|
tokenAddress: Address,
|
|
58
58
|
dexKey: string,
|
|
59
59
|
) {
|
|
60
|
+
expect(poolsLiquidity.length).toBeGreaterThan(0);
|
|
61
|
+
|
|
60
62
|
poolsLiquidity.forEach(p => {
|
|
61
63
|
expect(p.exchange).toEqual(dexKey);
|
|
62
64
|
expect(p.liquidityUSD).toBeGreaterThanOrEqual(0);
|
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"inputs": [
|
|
4
|
-
{ "internalType": "address", "name": "newQuoteToken", "type": "address" },
|
|
5
|
-
{
|
|
6
|
-
"internalType": "address",
|
|
7
|
-
"name": "newRebateManager",
|
|
8
|
-
"type": "address"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"internalType": "address",
|
|
12
|
-
"name": "newVaultManager",
|
|
13
|
-
"type": "address"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"internalType": "address",
|
|
17
|
-
"name": "newAccessManager",
|
|
18
|
-
"type": "address"
|
|
19
|
-
},
|
|
20
|
-
{ "internalType": "address", "name": "newTreasury", "type": "address" }
|
|
21
|
-
],
|
|
22
|
-
"stateMutability": "nonpayable",
|
|
23
|
-
"type": "constructor"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"anonymous": false,
|
|
27
|
-
"inputs": [
|
|
28
|
-
{
|
|
29
|
-
"indexed": true,
|
|
30
|
-
"internalType": "address",
|
|
31
|
-
"name": "token",
|
|
32
|
-
"type": "address"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"indexed": false,
|
|
36
|
-
"internalType": "uint256",
|
|
37
|
-
"name": "newFeeRate",
|
|
38
|
-
"type": "uint256"
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
"name": "FeeRateUpdated",
|
|
42
|
-
"type": "event"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"anonymous": false,
|
|
46
|
-
"inputs": [
|
|
47
|
-
{
|
|
48
|
-
"indexed": true,
|
|
49
|
-
"internalType": "address",
|
|
50
|
-
"name": "previousOwner",
|
|
51
|
-
"type": "address"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"indexed": true,
|
|
55
|
-
"internalType": "address",
|
|
56
|
-
"name": "newOwner",
|
|
57
|
-
"type": "address"
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
"name": "OwnershipTransferPrepared",
|
|
61
|
-
"type": "event"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"anonymous": false,
|
|
65
|
-
"inputs": [
|
|
66
|
-
{
|
|
67
|
-
"indexed": true,
|
|
68
|
-
"internalType": "address",
|
|
69
|
-
"name": "previousOwner",
|
|
70
|
-
"type": "address"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"indexed": true,
|
|
74
|
-
"internalType": "address",
|
|
75
|
-
"name": "newOwner",
|
|
76
|
-
"type": "address"
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
"name": "OwnershipTransferred",
|
|
80
|
-
"type": "event"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"anonymous": false,
|
|
84
|
-
"inputs": [
|
|
85
|
-
{
|
|
86
|
-
"indexed": true,
|
|
87
|
-
"internalType": "address",
|
|
88
|
-
"name": "token",
|
|
89
|
-
"type": "address"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"indexed": true,
|
|
93
|
-
"internalType": "address",
|
|
94
|
-
"name": "to",
|
|
95
|
-
"type": "address"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"indexed": false,
|
|
99
|
-
"internalType": "uint256",
|
|
100
|
-
"name": "amount",
|
|
101
|
-
"type": "uint256"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"name": "Withdraw",
|
|
105
|
-
"type": "event"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"inputs": [],
|
|
109
|
-
"name": "_NEW_OWNER_",
|
|
110
|
-
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
111
|
-
"stateMutability": "view",
|
|
112
|
-
"type": "function"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"inputs": [],
|
|
116
|
-
"name": "_OWNER_",
|
|
117
|
-
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
118
|
-
"stateMutability": "view",
|
|
119
|
-
"type": "function"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"inputs": [],
|
|
123
|
-
"name": "accessManager",
|
|
124
|
-
"outputs": [
|
|
125
|
-
{
|
|
126
|
-
"internalType": "contract IWooAccessManager",
|
|
127
|
-
"name": "",
|
|
128
|
-
"type": "address"
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
"stateMutability": "view",
|
|
132
|
-
"type": "function"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"inputs": [],
|
|
136
|
-
"name": "claimOwnership",
|
|
137
|
-
"outputs": [],
|
|
138
|
-
"stateMutability": "nonpayable",
|
|
139
|
-
"type": "function"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"inputs": [
|
|
143
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
|
|
144
|
-
{ "internalType": "address", "name": "brokerAddr", "type": "address" }
|
|
145
|
-
],
|
|
146
|
-
"name": "collectFee",
|
|
147
|
-
"outputs": [],
|
|
148
|
-
"stateMutability": "nonpayable",
|
|
149
|
-
"type": "function"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"inputs": [],
|
|
153
|
-
"name": "distributeFees",
|
|
154
|
-
"outputs": [],
|
|
155
|
-
"stateMutability": "nonpayable",
|
|
156
|
-
"type": "function"
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"inputs": [
|
|
160
|
-
{ "internalType": "address", "name": "token", "type": "address" },
|
|
161
|
-
{ "internalType": "address", "name": "to", "type": "address" }
|
|
162
|
-
],
|
|
163
|
-
"name": "emergencyWithdraw",
|
|
164
|
-
"outputs": [],
|
|
165
|
-
"stateMutability": "nonpayable",
|
|
166
|
-
"type": "function"
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
170
|
-
"name": "feeRate",
|
|
171
|
-
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
172
|
-
"stateMutability": "view",
|
|
173
|
-
"type": "function"
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"inputs": [
|
|
177
|
-
{ "internalType": "address", "name": "newOwner", "type": "address" }
|
|
178
|
-
],
|
|
179
|
-
"name": "initOwner",
|
|
180
|
-
"outputs": [],
|
|
181
|
-
"stateMutability": "nonpayable",
|
|
182
|
-
"type": "function"
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
"inputs": [],
|
|
186
|
-
"name": "quoteToken",
|
|
187
|
-
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
188
|
-
"stateMutability": "view",
|
|
189
|
-
"type": "function"
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
"inputs": [],
|
|
193
|
-
"name": "rebateAmount",
|
|
194
|
-
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
195
|
-
"stateMutability": "view",
|
|
196
|
-
"type": "function"
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
"inputs": [],
|
|
200
|
-
"name": "rebateManager",
|
|
201
|
-
"outputs": [
|
|
202
|
-
{
|
|
203
|
-
"internalType": "contract IWooRebateManager",
|
|
204
|
-
"name": "",
|
|
205
|
-
"type": "address"
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
"stateMutability": "view",
|
|
209
|
-
"type": "function"
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"inputs": [
|
|
213
|
-
{
|
|
214
|
-
"internalType": "address",
|
|
215
|
-
"name": "newAccessManager",
|
|
216
|
-
"type": "address"
|
|
217
|
-
}
|
|
218
|
-
],
|
|
219
|
-
"name": "setAccessManager",
|
|
220
|
-
"outputs": [],
|
|
221
|
-
"stateMutability": "nonpayable",
|
|
222
|
-
"type": "function"
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"inputs": [
|
|
226
|
-
{ "internalType": "address", "name": "token", "type": "address" },
|
|
227
|
-
{ "internalType": "uint256", "name": "newFeeRate", "type": "uint256" }
|
|
228
|
-
],
|
|
229
|
-
"name": "setFeeRate",
|
|
230
|
-
"outputs": [],
|
|
231
|
-
"stateMutability": "nonpayable",
|
|
232
|
-
"type": "function"
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
"inputs": [
|
|
236
|
-
{
|
|
237
|
-
"internalType": "address",
|
|
238
|
-
"name": "newRebateManager",
|
|
239
|
-
"type": "address"
|
|
240
|
-
}
|
|
241
|
-
],
|
|
242
|
-
"name": "setRebateManager",
|
|
243
|
-
"outputs": [],
|
|
244
|
-
"stateMutability": "nonpayable",
|
|
245
|
-
"type": "function"
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
"inputs": [
|
|
249
|
-
{ "internalType": "address", "name": "newTreasury", "type": "address" }
|
|
250
|
-
],
|
|
251
|
-
"name": "setTreasury",
|
|
252
|
-
"outputs": [],
|
|
253
|
-
"stateMutability": "nonpayable",
|
|
254
|
-
"type": "function"
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
"inputs": [
|
|
258
|
-
{
|
|
259
|
-
"internalType": "address",
|
|
260
|
-
"name": "newVaultManager",
|
|
261
|
-
"type": "address"
|
|
262
|
-
}
|
|
263
|
-
],
|
|
264
|
-
"name": "setVaultManager",
|
|
265
|
-
"outputs": [],
|
|
266
|
-
"stateMutability": "nonpayable",
|
|
267
|
-
"type": "function"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
"inputs": [
|
|
271
|
-
{
|
|
272
|
-
"internalType": "uint256",
|
|
273
|
-
"name": "newVaultRewardRate",
|
|
274
|
-
"type": "uint256"
|
|
275
|
-
}
|
|
276
|
-
],
|
|
277
|
-
"name": "setVaultRewardRate",
|
|
278
|
-
"outputs": [],
|
|
279
|
-
"stateMutability": "nonpayable",
|
|
280
|
-
"type": "function"
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
"inputs": [
|
|
284
|
-
{ "internalType": "address", "name": "newOwner", "type": "address" }
|
|
285
|
-
],
|
|
286
|
-
"name": "transferOwnership",
|
|
287
|
-
"outputs": [],
|
|
288
|
-
"stateMutability": "nonpayable",
|
|
289
|
-
"type": "function"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
"inputs": [],
|
|
293
|
-
"name": "treasury",
|
|
294
|
-
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
295
|
-
"stateMutability": "view",
|
|
296
|
-
"type": "function"
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"inputs": [],
|
|
300
|
-
"name": "vaultManager",
|
|
301
|
-
"outputs": [
|
|
302
|
-
{
|
|
303
|
-
"internalType": "contract IWooVaultManager",
|
|
304
|
-
"name": "",
|
|
305
|
-
"type": "address"
|
|
306
|
-
}
|
|
307
|
-
],
|
|
308
|
-
"stateMutability": "view",
|
|
309
|
-
"type": "function"
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
"inputs": [],
|
|
313
|
-
"name": "vaultRewardRate",
|
|
314
|
-
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
|
|
315
|
-
"stateMutability": "view",
|
|
316
|
-
"type": "function"
|
|
317
|
-
}
|
|
318
|
-
]
|