@paraswap/dex-lib 3.8.12 → 3.8.13-arusd-fxusd.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/.vscode/launch.json +6 -43
- package/.vscode/settings.json +2 -1
- package/build/abi/Uncompressor.json +250 -0
- package/build/abi/concentrator/arUSD.json +568 -0
- package/build/abi/concentrator/arUSD5115.json +1746 -0
- package/build/abi/fx-protocol/FxMarket.json +1284 -0
- package/build/abi/{wombat/pool.json → fx-protocol/FxUSD.json} +541 -603
- package/build/abi/fx-protocol/weETHOralce.json +676 -0
- package/build/abi/integral/factory.json +333 -0
- package/build/abi/integral/oracle.json +501 -0
- package/build/abi/integral/pool.json +1041 -0
- package/build/abi/integral/relayer.json +1536 -0
- package/build/abi/oswap/oswap.abi.json +452 -0
- package/build/config.js +6 -6
- package/build/dex/aave-v1/aave-v1.d.ts +1 -2
- package/build/dex/aave-v1/aave-v1.js +0 -23
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/compound.js +1 -1
- package/build/dex/compound.js.map +1 -1
- package/build/dex/concentrator-arusd/concentrator-arusd-event.d.ts +16 -0
- package/build/dex/concentrator-arusd/concentrator-arusd-event.js +53 -0
- package/build/dex/concentrator-arusd/concentrator-arusd-event.js.map +1 -0
- package/build/dex/concentrator-arusd/concentrator-arusd.d.ts +41 -0
- package/build/dex/concentrator-arusd/concentrator-arusd.js +180 -0
- package/build/dex/concentrator-arusd/concentrator-arusd.js.map +1 -0
- package/build/dex/concentrator-arusd/config.d.ts +4 -0
- package/build/dex/concentrator-arusd/config.js +18 -0
- package/build/dex/concentrator-arusd/config.js.map +1 -0
- package/build/dex/concentrator-arusd/types.d.ts +14 -0
- package/build/dex/concentrator-arusd/types.js +3 -0
- package/build/dex/concentrator-arusd/types.js.map +1 -0
- package/build/dex/concentrator-arusd/utils.d.ts +4 -0
- package/build/dex/concentrator-arusd/utils.js +27 -0
- package/build/dex/concentrator-arusd/utils.js.map +1 -0
- package/build/dex/etherfi/etherfi.d.ts +26 -0
- package/build/dex/etherfi/etherfi.js +96 -0
- package/build/dex/etherfi/etherfi.js.map +1 -0
- package/build/dex/fx-protocol-rusd/config.d.ts +3 -0
- package/build/dex/fx-protocol-rusd/config.js +15 -0
- package/build/dex/fx-protocol-rusd/config.js.map +1 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.d.ts +18 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js +63 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd-event.js.map +1 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.d.ts +39 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js +213 -0
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js.map +1 -0
- package/build/dex/fx-protocol-rusd/types.d.ts +13 -0
- package/build/dex/fx-protocol-rusd/types.js +3 -0
- package/build/dex/fx-protocol-rusd/types.js.map +1 -0
- package/build/dex/fx-protocol-rusd/utils.d.ts +4 -0
- package/build/dex/fx-protocol-rusd/utils.js +26 -0
- package/build/dex/fx-protocol-rusd/utils.js.map +1 -0
- package/build/dex/index.js +4 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/integral/config.d.ts +4 -0
- package/build/dex/integral/config.js +20 -0
- package/build/dex/integral/config.js.map +1 -0
- package/build/dex/integral/context.d.ts +40 -0
- package/build/dex/integral/context.js +158 -0
- package/build/dex/integral/context.js.map +1 -0
- package/build/dex/integral/helpers.d.ts +17 -0
- package/build/dex/integral/helpers.js +157 -0
- package/build/dex/integral/helpers.js.map +1 -0
- package/build/dex/integral/integral-factory.d.ts +24 -0
- package/build/dex/integral/integral-factory.js +95 -0
- package/build/dex/integral/integral-factory.js.map +1 -0
- package/build/dex/integral/integral-pool.d.ts +50 -0
- package/build/dex/integral/integral-pool.js +149 -0
- package/build/dex/integral/integral-pool.js.map +1 -0
- package/build/dex/integral/integral-pricing.d.ts +18 -0
- package/build/dex/integral/integral-pricing.js +114 -0
- package/build/dex/integral/integral-pricing.js.map +1 -0
- package/build/dex/integral/integral-relayer.d.ts +42 -0
- package/build/dex/integral/integral-relayer.js +192 -0
- package/build/dex/integral/integral-relayer.js.map +1 -0
- package/build/dex/integral/integral-token.d.ts +27 -0
- package/build/dex/integral/integral-token.js +59 -0
- package/build/dex/integral/integral-token.js.map +1 -0
- package/build/dex/integral/integral.d.ts +41 -0
- package/build/dex/integral/integral.js +377 -0
- package/build/dex/integral/integral.js.map +1 -0
- package/build/dex/integral/types.d.ts +84 -0
- package/build/dex/integral/types.js +9 -0
- package/build/dex/integral/types.js.map +1 -0
- package/build/dex/integral/utils-e2e.d.ts +9 -0
- package/build/dex/integral/utils-e2e.js +131 -0
- package/build/dex/integral/utils-e2e.js.map +1 -0
- package/build/dex/integral/utils.d.ts +17 -0
- package/build/dex/integral/utils.js +94 -0
- package/build/dex/integral/utils.js.map +1 -0
- package/build/dex/oswap/config.d.ts +5 -0
- package/build/dex/oswap/config.js +31 -0
- package/build/dex/oswap/config.js.map +1 -0
- package/build/dex/oswap/oswap-pool.d.ts +51 -0
- package/build/dex/oswap/oswap-pool.js +150 -0
- package/build/dex/oswap/oswap-pool.js.map +1 -0
- package/build/dex/oswap/oswap.d.ts +46 -0
- package/build/dex/oswap/oswap.js +266 -0
- package/build/dex/oswap/oswap.js.map +1 -0
- package/build/dex/oswap/types.d.ts +20 -0
- package/build/dex/oswap/types.js +3 -0
- package/build/dex/oswap/types.js.map +1 -0
- package/build/dex/platypus/platypus.d.ts +1 -2
- package/build/dex/platypus/platypus.js +0 -45
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/sdai/config.d.ts +11 -0
- package/build/dex/sdai/config.js +21 -0
- package/build/dex/sdai/config.js.map +1 -0
- package/build/dex/sdai/constants.d.ts +2 -0
- package/build/dex/sdai/constants.js +6 -0
- package/build/dex/sdai/constants.js.map +1 -0
- package/build/dex/sdai/scripts/validate-state.js +102 -0
- package/build/dex/sdai/scripts/validate-state.js.map +1 -0
- package/build/dex/sdai/sdai-pool.d.ts +16 -0
- package/build/dex/sdai/sdai-pool.js +85 -0
- package/build/dex/sdai/sdai-pool.js.map +1 -0
- package/build/dex/sdai/sdai.d.ts +51 -0
- package/build/dex/sdai/sdai.js +172 -0
- package/build/dex/sdai/sdai.js.map +1 -0
- package/build/dex/sdai/types.d.ts +21 -0
- package/build/dex/sdai/types.js +11 -0
- package/build/dex/sdai/types.js.map +1 -0
- package/build/dex/sdai/utils.d.ts +4 -0
- package/build/dex/sdai/utils.js +39 -0
- package/build/dex/sdai/utils.js.map +1 -0
- package/build/dex/solidly-v3/config.js +39 -0
- package/build/dex/solidly-v3/config.js.map +1 -1
- package/build/dex/stable-pool.js +8 -1
- package/build/dex/stable-pool.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
- package/build/dex/swaap-v1/swaap-v1.js +0 -14
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/executor/compressor/Compressor.d.ts +23 -0
- package/build/executor/compressor/Compressor.js +144 -0
- package/build/executor/compressor/Compressor.js.map +1 -0
- package/build/executor/compressor/compress.d.ts +17 -0
- package/build/executor/compressor/compress.js +187 -0
- package/build/executor/compressor/compress.js.map +1 -0
- package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +6 -0
- package/build/executor/compressor/compress_functions/addressSubstitution.js +29 -0
- package/build/executor/compressor/compress_functions/addressSubstitution.js.map +1 -0
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +10 -0
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +40 -0
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +1 -0
- package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +11 -0
- package/build/executor/compressor/compress_functions/byteSubstitution.js +64 -0
- package/build/executor/compressor/compress_functions/byteSubstitution.js.map +1 -0
- package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +7 -0
- package/build/executor/compressor/compress_functions/ffSubstitution.js +54 -0
- package/build/executor/compressor/compress_functions/ffSubstitution.js.map +1 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +8 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +67 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +1 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +8 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +61 -0
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +1 -0
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +6 -0
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +37 -0
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +1 -0
- package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +9 -0
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js +33 -0
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +1 -0
- package/build/executor/compressor/fetchSaved.js +17 -0
- package/build/executor/compressor/fetchSaved.js.map +1 -0
- package/build/executor/compressor/utils/computeCostL2.d.ts +2 -0
- package/build/executor/compressor/utils/computeCostL2.js +14 -0
- package/build/executor/compressor/utils/computeCostL2.js.map +1 -0
- package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +2 -0
- package/build/executor/compressor/utils/findLongestDuplicatedString.js +30 -0
- package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +1 -0
- package/build/executor/compressor/utils/getAllIndexes.d.ts +2 -0
- package/build/executor/compressor/utils/getAllIndexes.js +12 -0
- package/build/executor/compressor/utils/getAllIndexes.js.map +1 -0
- package/build/executor/compressor/utils/getByteForAddress.d.ts +2 -0
- package/build/executor/compressor/utils/getByteForAddress.js +14 -0
- package/build/executor/compressor/utils/getByteForAddress.js.map +1 -0
- package/build/executor/compressor/utils/intTo2Bytes.d.ts +2 -0
- package/build/executor/compressor/utils/intTo2Bytes.js +14 -0
- package/build/executor/compressor/utils/intTo2Bytes.js.map +1 -0
- package/build/executor/compressor/utils/intTo3Bytes.d.ts +2 -0
- package/build/executor/compressor/utils/intTo3Bytes.js +18 -0
- package/build/executor/compressor/utils/intTo3Bytes.js.map +1 -0
- package/build/executor/compressor/utils/intToByte.d.ts +2 -0
- package/build/executor/compressor/utils/intToByte.js +10 -0
- package/build/executor/compressor/utils/intToByte.js.map +1 -0
- package/build/implementations/local-paraswap-sdk.d.ts +2 -0
- package/build/implementations/local-paraswap-sdk.js +7 -0
- package/build/implementations/local-paraswap-sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/concentrator/arUSD.json +568 -0
- package/src/abi/concentrator/arUSD5115.json +1746 -0
- package/src/abi/fx-protocol/FxMarket.json +1284 -0
- package/src/abi/fx-protocol/FxUSD.json +1227 -0
- package/src/abi/fx-protocol/weETHOralce.json +676 -0
- package/src/config.ts +6 -6
- package/src/dex/concentrator-arusd/concentrator-arusd-e2e.test.ts +92 -0
- package/src/dex/concentrator-arusd/concentrator-arusd-event.ts +70 -0
- package/src/dex/concentrator-arusd/concentrator-arusd-integration.test.ts +104 -0
- package/src/dex/concentrator-arusd/concentrator-arusd.ts +255 -0
- package/src/dex/concentrator-arusd/concetrator-arusd-events.test.ts +97 -0
- package/src/dex/concentrator-arusd/config.ts +18 -0
- package/src/dex/concentrator-arusd/types.ts +16 -0
- package/src/dex/concentrator-arusd/utils.ts +36 -0
- package/src/dex/fx-protocol-rusd/config.ts +14 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-e2e.test.ts +96 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-events.test.ts +101 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-integration.test.ts +104 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-rusd-event.ts +80 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-rusd.ts +303 -0
- package/src/dex/fx-protocol-rusd/types.ts +16 -0
- package/src/dex/fx-protocol-rusd/utils.ts +46 -0
- package/src/dex/index.ts +4 -0
- package/src/dex/solidly-v3/config.ts +42 -0
- package/src/dex/solidly-v3/solidly-v3-e2e.test.ts +114 -3
- package/src/dex/wsteth/wsteth-integration.test.ts +0 -1
- package/src/implementations/local-paraswap-sdk.ts +8 -0
- package/tests/constants-e2e.ts +11 -1
- package/.vscode/tasks.json +0 -15
- package/build/abi/uniswap-v3/AlienBaseV3Router.abi.json +0 -52
- package/build/dex/aave-v2/tokens-avalanche.json +0 -44
- package/build/dex/aave-v2/tokens-mainnet.json +0 -188
- package/build/dex/aave-v2/tokens-polygon.json +0 -44
- package/build/dex/maker-psm/scripts/gem.abi.json +0 -136
- package/build/dex/maker-psm/scripts/validate-state.js +0 -185
- package/build/dex/maker-psm/scripts/validate-state.js.map +0 -1
- package/build/dex/maker-psm/scripts/vat.abi.json +0 -243
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js +0 -53
- package/build/dex/solidly-v3/scripts/check-event-pool-event.js.map +0 -1
- package/build/dex/trader-joe-v2.1/base.d.ts +0 -18
- package/build/dex/trader-joe-v2.1/base.js +0 -99
- package/build/dex/trader-joe-v2.1/base.js.map +0 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.d.ts +0 -7
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js +0 -20
- package/build/dex/trader-joe-v2.1/trader-joe-v2.1-new.js.map +0 -1
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.d.ts +0 -7
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js +0 -20
- package/build/dex/trader-joe-v2.1/trader-joe-v2.2.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js +0 -64
- package/build/dex/uniswap-v3/forks/alien-base-v3/alien-base-v3.js.map +0 -1
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.d.ts +0 -17
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js +0 -79
- package/build/dex/uniswap-v3/forks/alien-v3/alien-v3.js.map +0 -1
- package/config.ts +0 -1946
- package/src/dex/dexs.txt +0 -58
- /package/build/dex/{solidly-v3/scripts/check-event-pool-event.d.ts → sdai/scripts/validate-state.d.ts} +0 -0
- /package/build/{dex/maker-psm/scripts/validate-state.d.ts → executor/compressor/fetchSaved.d.ts} +0 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Token,
|
|
3
|
+
Address,
|
|
4
|
+
ExchangePrices,
|
|
5
|
+
PoolPrices,
|
|
6
|
+
AdapterExchangeParam,
|
|
7
|
+
Logger,
|
|
8
|
+
NumberAsString,
|
|
9
|
+
DexExchangeParam,
|
|
10
|
+
PoolLiquidity,
|
|
11
|
+
} from '../../types';
|
|
12
|
+
import { SwapSide, Network } from '../../constants';
|
|
13
|
+
import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
|
|
14
|
+
import { getDexKeysWithNetwork } from '../../utils';
|
|
15
|
+
import { IDex } from '../idex';
|
|
16
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
17
|
+
import { DexParams, FxProtocolData } from './types';
|
|
18
|
+
import { SimpleExchange } from '../simple-exchange';
|
|
19
|
+
import { FxProtocolConfig } from './config';
|
|
20
|
+
import { Interface, JsonFragment } from '@ethersproject/abi';
|
|
21
|
+
import FxUSD_ABI from '../../abi/fx-protocol/FxUSD.json';
|
|
22
|
+
import FxMarket_ABI from '../../abi/fx-protocol/FxMarket.json';
|
|
23
|
+
import EthWeETHOralce_ABI from '../../abi/fx-protocol/weETHOralce.json';
|
|
24
|
+
|
|
25
|
+
import { extractReturnAmountPosition } from '../../executor/utils';
|
|
26
|
+
import { fxProtocolRusdEvent } from './fx-protocol-rusd-event';
|
|
27
|
+
import { BI_POWS } from '../../bigint-constants';
|
|
28
|
+
|
|
29
|
+
export class FxProtocolRusd
|
|
30
|
+
extends SimpleExchange
|
|
31
|
+
implements IDex<FxProtocolData>
|
|
32
|
+
{
|
|
33
|
+
protected config: DexParams;
|
|
34
|
+
|
|
35
|
+
readonly hasConstantPriceLargeAmounts = true;
|
|
36
|
+
|
|
37
|
+
readonly needWrapNative = false;
|
|
38
|
+
|
|
39
|
+
readonly isFeeOnTransferSupported = false;
|
|
40
|
+
|
|
41
|
+
public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
|
|
42
|
+
getDexKeysWithNetwork(FxProtocolConfig);
|
|
43
|
+
|
|
44
|
+
fxUSDIface: Interface;
|
|
45
|
+
rUSDMarketIface: Interface;
|
|
46
|
+
weETHOracleIface: Interface;
|
|
47
|
+
fxProtocolRusdPool: fxProtocolRusdEvent;
|
|
48
|
+
logger: Logger;
|
|
49
|
+
|
|
50
|
+
constructor(
|
|
51
|
+
readonly network: Network,
|
|
52
|
+
readonly dexKey: string,
|
|
53
|
+
readonly dexHelper: IDexHelper,
|
|
54
|
+
) {
|
|
55
|
+
super(dexHelper, dexKey);
|
|
56
|
+
const config = FxProtocolConfig[dexKey][network];
|
|
57
|
+
this.fxUSDIface = new Interface(FxUSD_ABI as JsonFragment[]);
|
|
58
|
+
this.rUSDMarketIface = new Interface(FxMarket_ABI as JsonFragment[]);
|
|
59
|
+
this.weETHOracleIface = new Interface(EthWeETHOralce_ABI as JsonFragment[]);
|
|
60
|
+
this.config = {
|
|
61
|
+
rUSDAddress: config.rUSDAddress.toLowerCase(),
|
|
62
|
+
weETHAddress: config.weETHAddress.toLowerCase(),
|
|
63
|
+
rUSDWeETHMarketAddress: config.rUSDWeETHMarketAddress.toLowerCase(),
|
|
64
|
+
weETHOracleAddress: config.weETHOracleAddress.toLowerCase(),
|
|
65
|
+
};
|
|
66
|
+
this.logger = dexHelper.getLogger(dexKey);
|
|
67
|
+
this.fxProtocolRusdPool = new fxProtocolRusdEvent(
|
|
68
|
+
this.dexKey,
|
|
69
|
+
dexHelper,
|
|
70
|
+
this.config.rUSDWeETHMarketAddress,
|
|
71
|
+
this.rUSDMarketIface,
|
|
72
|
+
this.config.weETHOracleAddress,
|
|
73
|
+
this.weETHOracleIface,
|
|
74
|
+
this.logger,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async initializePricing(blockNumber: number) {
|
|
79
|
+
const data: { returnData: any[] } =
|
|
80
|
+
await this.dexHelper.multiContract.methods
|
|
81
|
+
.aggregate([
|
|
82
|
+
{
|
|
83
|
+
target: this.config.rUSDWeETHMarketAddress,
|
|
84
|
+
callData: this.rUSDMarketIface.encodeFunctionData(
|
|
85
|
+
'fTokenRedeemFeeRatio',
|
|
86
|
+
[],
|
|
87
|
+
),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
target: this.config.weETHOracleAddress,
|
|
91
|
+
callData: this.weETHOracleIface.encodeFunctionData(
|
|
92
|
+
'latestAnswer',
|
|
93
|
+
[],
|
|
94
|
+
),
|
|
95
|
+
},
|
|
96
|
+
])
|
|
97
|
+
.call({}, blockNumber);
|
|
98
|
+
|
|
99
|
+
const redeemFee = BigInt(
|
|
100
|
+
this.rUSDMarketIface.decodeFunctionResult(
|
|
101
|
+
'fTokenRedeemFeeRatio',
|
|
102
|
+
data.returnData[0],
|
|
103
|
+
)[0],
|
|
104
|
+
);
|
|
105
|
+
const weETHPrice = BigInt(
|
|
106
|
+
this.weETHOracleIface.decodeFunctionResult(
|
|
107
|
+
'latestAnswer',
|
|
108
|
+
data.returnData[1],
|
|
109
|
+
)[0],
|
|
110
|
+
);
|
|
111
|
+
await Promise.all([
|
|
112
|
+
this.fxProtocolRusdPool.initialize(blockNumber, {
|
|
113
|
+
state: {
|
|
114
|
+
nav: 1000000000000000000n,
|
|
115
|
+
redeemFee,
|
|
116
|
+
weETHPrice,
|
|
117
|
+
},
|
|
118
|
+
}),
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
getConfig() {
|
|
123
|
+
return this.config;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
is_weETH(token: string) {
|
|
127
|
+
return token.toLowerCase() === this.config.weETHAddress.toLowerCase();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
is_rUSD(token: string) {
|
|
131
|
+
return token.toLowerCase() === this.config.rUSDAddress.toLowerCase();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
is_rUSD_swap_token(srcToken: string, destToken: string) {
|
|
135
|
+
return (
|
|
136
|
+
(this.is_weETH(srcToken) && this.is_rUSD(destToken)) ||
|
|
137
|
+
(this.is_rUSD(srcToken) && this.is_weETH(destToken))
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
// Returns the list of contract adapters (name and index)
|
|
141
|
+
// for a buy/sell. Return null if there are no adapters.
|
|
142
|
+
getAdapters() {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async getPoolIdentifiers(
|
|
147
|
+
srcToken: Token,
|
|
148
|
+
destToken: Token,
|
|
149
|
+
side: SwapSide,
|
|
150
|
+
blockNumber: number,
|
|
151
|
+
): Promise<string[]> {
|
|
152
|
+
if (!this.is_rUSD_swap_token(srcToken.address, destToken.address)) {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
return [`${this.dexKey}_${this.config.rUSDAddress}`];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async getPricesVolume(
|
|
159
|
+
srcToken: Token,
|
|
160
|
+
destToken: Token,
|
|
161
|
+
amounts: bigint[],
|
|
162
|
+
side: SwapSide,
|
|
163
|
+
blockNumber: number,
|
|
164
|
+
limitPools?: string[],
|
|
165
|
+
): Promise<null | ExchangePrices<FxProtocolData>> {
|
|
166
|
+
if (side == SwapSide.BUY) {
|
|
167
|
+
// note: BUY is not supported
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const isRUSDSwapToken = this.is_rUSD_swap_token(
|
|
172
|
+
srcToken.address,
|
|
173
|
+
destToken.address,
|
|
174
|
+
);
|
|
175
|
+
if (!isRUSDSwapToken) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
const pool = this.fxProtocolRusdPool;
|
|
179
|
+
if (!pool.getState(blockNumber)) return null;
|
|
180
|
+
|
|
181
|
+
const is_redeem = this.is_weETH(destToken.address);
|
|
182
|
+
const unitIn = BI_POWS[18];
|
|
183
|
+
const unitOut = pool.getPrice(blockNumber, unitIn, is_redeem);
|
|
184
|
+
const amountsOut = amounts.map(_amountIn =>
|
|
185
|
+
pool.getPrice(blockNumber, _amountIn, is_redeem),
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
return [
|
|
189
|
+
{
|
|
190
|
+
unit: unitOut,
|
|
191
|
+
prices: amountsOut,
|
|
192
|
+
data: {},
|
|
193
|
+
poolAddresses: [this.config.rUSDAddress],
|
|
194
|
+
exchange: this.dexKey,
|
|
195
|
+
gasCost: 1000000,
|
|
196
|
+
},
|
|
197
|
+
];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
201
|
+
getCalldataGasCost(
|
|
202
|
+
poolPrices: PoolPrices<FxProtocolData>,
|
|
203
|
+
): number | number[] {
|
|
204
|
+
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Encode params required by the exchange adapter
|
|
208
|
+
// V5: Used for multiSwap, buy & megaSwap
|
|
209
|
+
// V6: Not used, can be left blank
|
|
210
|
+
// Hint: abiCoder.encodeParameter() could be useful
|
|
211
|
+
getAdapterParam(
|
|
212
|
+
srcToken: string,
|
|
213
|
+
destToken: string,
|
|
214
|
+
srcAmount: string,
|
|
215
|
+
destAmount: string,
|
|
216
|
+
data: FxProtocolData,
|
|
217
|
+
side: SwapSide,
|
|
218
|
+
): AdapterExchangeParam {
|
|
219
|
+
const payload = '0x';
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
targetExchange: this.config.rUSDAddress,
|
|
223
|
+
payload,
|
|
224
|
+
networkFee: '0',
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async getDexParam(
|
|
229
|
+
srcToken: Address,
|
|
230
|
+
destToken: Address,
|
|
231
|
+
srcAmount: NumberAsString,
|
|
232
|
+
destAmount: NumberAsString,
|
|
233
|
+
recipient: Address,
|
|
234
|
+
data: FxProtocolData,
|
|
235
|
+
side: SwapSide,
|
|
236
|
+
): Promise<DexExchangeParam> {
|
|
237
|
+
const is_rUSD_src = this.is_rUSD(srcToken);
|
|
238
|
+
const is_weETH_src = this.is_weETH(srcToken);
|
|
239
|
+
const is_rUSD_dest = this.is_rUSD(destToken);
|
|
240
|
+
const is_weETH_dest = this.is_weETH(destToken);
|
|
241
|
+
|
|
242
|
+
if (is_weETH_src && is_rUSD_dest) {
|
|
243
|
+
const exchangeData = this.fxUSDIface.encodeFunctionData('mint', [
|
|
244
|
+
this.config.weETHAddress,
|
|
245
|
+
srcAmount,
|
|
246
|
+
this.dexHelper.config.data.executorsAddresses?.Executor01,
|
|
247
|
+
'0',
|
|
248
|
+
]);
|
|
249
|
+
return {
|
|
250
|
+
needWrapNative: false,
|
|
251
|
+
dexFuncHasRecipient: false,
|
|
252
|
+
exchangeData,
|
|
253
|
+
targetExchange: this.config.rUSDAddress,
|
|
254
|
+
returnAmountPos: extractReturnAmountPosition(
|
|
255
|
+
this.fxUSDIface,
|
|
256
|
+
'mint',
|
|
257
|
+
'_amountOut',
|
|
258
|
+
),
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
if (is_rUSD_src && is_weETH_dest) {
|
|
262
|
+
const exchangeData = this.fxUSDIface.encodeFunctionData('redeem', [
|
|
263
|
+
this.config.weETHAddress,
|
|
264
|
+
srcAmount,
|
|
265
|
+
this.dexHelper.config.data.executorsAddresses?.Executor01,
|
|
266
|
+
'0',
|
|
267
|
+
]);
|
|
268
|
+
return {
|
|
269
|
+
needWrapNative: false,
|
|
270
|
+
dexFuncHasRecipient: false,
|
|
271
|
+
exchangeData,
|
|
272
|
+
targetExchange: this.config.rUSDAddress,
|
|
273
|
+
returnAmountPos: extractReturnAmountPosition(
|
|
274
|
+
this.fxUSDIface,
|
|
275
|
+
'redeem',
|
|
276
|
+
'_amountOut',
|
|
277
|
+
),
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
throw new Error('LOGIC ERROR');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Returns list of top pools based on liquidity. Max
|
|
284
|
+
// limit number pools should be returned.
|
|
285
|
+
async getTopPoolsForToken(
|
|
286
|
+
tokenAddress: Address,
|
|
287
|
+
limit: number,
|
|
288
|
+
): Promise<PoolLiquidity[]> {
|
|
289
|
+
return [
|
|
290
|
+
{
|
|
291
|
+
exchange: this.dexKey,
|
|
292
|
+
address: this.config.rUSDAddress,
|
|
293
|
+
connectorTokens: [
|
|
294
|
+
{
|
|
295
|
+
decimals: 18,
|
|
296
|
+
address: this.config.rUSDAddress,
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
|
|
300
|
+
},
|
|
301
|
+
];
|
|
302
|
+
}
|
|
303
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Address } from '../../types';
|
|
2
|
+
|
|
3
|
+
export type FxProtocolPoolState = {
|
|
4
|
+
nav: bigint;
|
|
5
|
+
redeemFee: bigint;
|
|
6
|
+
weETHPrice: bigint;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type FxProtocolData = {};
|
|
10
|
+
|
|
11
|
+
export type DexParams = {
|
|
12
|
+
rUSDAddress: Address;
|
|
13
|
+
weETHAddress: Address;
|
|
14
|
+
rUSDWeETHMarketAddress: Address;
|
|
15
|
+
weETHOracleAddress: Address;
|
|
16
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Contract } from 'web3-eth-contract';
|
|
2
|
+
import { FxProtocolPoolState } from './types';
|
|
3
|
+
import { Interface } from '@ethersproject/abi';
|
|
4
|
+
|
|
5
|
+
export async function getOnChainState(
|
|
6
|
+
multiContract: Contract,
|
|
7
|
+
marketAddress: string,
|
|
8
|
+
marketInterface: Interface,
|
|
9
|
+
ethWeETHOracleAddress: string,
|
|
10
|
+
ethWeETHOracleIface: Interface,
|
|
11
|
+
blockNumber: number | 'latest',
|
|
12
|
+
): Promise<FxProtocolPoolState> {
|
|
13
|
+
const data: { returnData: any[] } = await multiContract.methods
|
|
14
|
+
.aggregate([
|
|
15
|
+
{
|
|
16
|
+
target: marketAddress,
|
|
17
|
+
callData: marketInterface.encodeFunctionData(
|
|
18
|
+
'fTokenRedeemFeeRatio',
|
|
19
|
+
[],
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
target: ethWeETHOracleAddress,
|
|
24
|
+
callData: ethWeETHOracleIface.encodeFunctionData('latestAnswer', []),
|
|
25
|
+
},
|
|
26
|
+
])
|
|
27
|
+
.call({}, blockNumber);
|
|
28
|
+
|
|
29
|
+
const redeemFee = BigInt(
|
|
30
|
+
marketInterface.decodeFunctionResult(
|
|
31
|
+
'fTokenRedeemFeeRatio',
|
|
32
|
+
data.returnData[0],
|
|
33
|
+
)[0],
|
|
34
|
+
);
|
|
35
|
+
const weETHPrice = BigInt(
|
|
36
|
+
ethWeETHOracleIface.decodeFunctionResult(
|
|
37
|
+
'latestAnswer',
|
|
38
|
+
data.returnData[1],
|
|
39
|
+
)[0],
|
|
40
|
+
);
|
|
41
|
+
return {
|
|
42
|
+
nav: 1000000000000000000n,
|
|
43
|
+
redeemFee,
|
|
44
|
+
weETHPrice,
|
|
45
|
+
};
|
|
46
|
+
}
|
package/src/dex/index.ts
CHANGED
|
@@ -81,6 +81,8 @@ import { EtherFi } from './etherfi';
|
|
|
81
81
|
import { Spark } from './spark/spark';
|
|
82
82
|
import { VelodromeSlipstream } from './uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream';
|
|
83
83
|
import { AaveV3Stata } from './aave-v3-stata/aave-v3-stata';
|
|
84
|
+
import { ConcentratorArusd } from './concentrator-arusd/concentrator-arusd';
|
|
85
|
+
import { FxProtocolRusd } from './fx-protocol-rusd/fx-protocol-rusd';
|
|
84
86
|
|
|
85
87
|
const LegacyDexes = [
|
|
86
88
|
CurveV2,
|
|
@@ -157,6 +159,8 @@ const Dexes = [
|
|
|
157
159
|
PharaohV1,
|
|
158
160
|
Spark,
|
|
159
161
|
AaveV3Stata,
|
|
162
|
+
ConcentratorArusd,
|
|
163
|
+
FxProtocolRusd,
|
|
160
164
|
];
|
|
161
165
|
|
|
162
166
|
export type LegacyDexConstructor = new (dexHelper: IDexHelper) => IDexTxBuilder<
|
|
@@ -61,6 +61,36 @@ export const SolidlyV3Config: DexConfigMap<DexParams> = {
|
|
|
61
61
|
'0xe9b68c5f77858eecac2e651646e208175e9b1359d68d0e14fc69f8c54e5010bf',
|
|
62
62
|
subgraphURL: 'HDNu25S2uqr13BHrQdPv2PfTpwxJgPB7QEnC8fsgKcM9',
|
|
63
63
|
},
|
|
64
|
+
[Network.BASE]: {
|
|
65
|
+
factory: '0x70Fe4a44EA505cFa3A57b95cF2862D4fd5F0f687',
|
|
66
|
+
supportedTickSpacings: SUPPORTED_TICK_SPACINGS,
|
|
67
|
+
stateMulticall: '0x000c5dd531b3e2327c0E3a382bC8B21a284E6F61',
|
|
68
|
+
chunksCount: 10,
|
|
69
|
+
initRetryFrequency: 10,
|
|
70
|
+
initHash:
|
|
71
|
+
'0xe9b68c5f77858eecac2e651646e208175e9b1359d68d0e14fc69f8c54e5010bf',
|
|
72
|
+
subgraphURL: 'C8G1vfqsgWTg4ydzxWdsLj1jCKsxAKFamP5GjuSdRF8W',
|
|
73
|
+
},
|
|
74
|
+
[Network.ARBITRUM]: {
|
|
75
|
+
factory: '0x70Fe4a44EA505cFa3A57b95cF2862D4fd5F0f687',
|
|
76
|
+
supportedTickSpacings: SUPPORTED_TICK_SPACINGS,
|
|
77
|
+
stateMulticall: '0x000c5dd531b3e2327c0E3a382bC8B21a284E6F61',
|
|
78
|
+
chunksCount: 10,
|
|
79
|
+
initRetryFrequency: 10,
|
|
80
|
+
initHash:
|
|
81
|
+
'0xe9b68c5f77858eecac2e651646e208175e9b1359d68d0e14fc69f8c54e5010bf',
|
|
82
|
+
subgraphURL: 'ALCsbp7jWC6EQjwgicvZkG6dDEFGMV32QUZJvJGqL9Kx',
|
|
83
|
+
},
|
|
84
|
+
[Network.OPTIMISM]: {
|
|
85
|
+
factory: '0x70Fe4a44EA505cFa3A57b95cF2862D4fd5F0f687',
|
|
86
|
+
supportedTickSpacings: SUPPORTED_TICK_SPACINGS,
|
|
87
|
+
stateMulticall: '0x000c5dd531b3e2327c0E3a382bC8B21a284E6F61',
|
|
88
|
+
chunksCount: 10,
|
|
89
|
+
initRetryFrequency: 10,
|
|
90
|
+
initHash:
|
|
91
|
+
'0xe9b68c5f77858eecac2e651646e208175e9b1359d68d0e14fc69f8c54e5010bf',
|
|
92
|
+
subgraphURL: 'HCThb3gJC45qUYmNEaYmZZTqJW3pSq7X6tb4MqNHEvZf',
|
|
93
|
+
},
|
|
64
94
|
},
|
|
65
95
|
};
|
|
66
96
|
|
|
@@ -73,4 +103,16 @@ export const Adapters: Record<number, AdapterMappings> = {
|
|
|
73
103
|
[SwapSide.SELL]: [{ name: 'FantomAdapter02', index: 1 }],
|
|
74
104
|
[SwapSide.BUY]: [{ name: 'FantomBuyAdapter', index: 5 }],
|
|
75
105
|
},
|
|
106
|
+
[Network.BASE]: {
|
|
107
|
+
[SwapSide.SELL]: [{ name: 'BaseAdapter02', index: 5 }],
|
|
108
|
+
[SwapSide.BUY]: [{ name: 'BaseBuyAdapter', index: 11 }],
|
|
109
|
+
},
|
|
110
|
+
[Network.ARBITRUM]: {
|
|
111
|
+
[SwapSide.SELL]: [{ name: 'ArbitrumAdapter03', index: 4 }],
|
|
112
|
+
[SwapSide.BUY]: [{ name: 'ArbitrumBuyAdapter', index: 14 }],
|
|
113
|
+
},
|
|
114
|
+
[Network.OPTIMISM]: {
|
|
115
|
+
[SwapSide.SELL]: [{ name: 'OptimismAdapter02', index: 4 }],
|
|
116
|
+
[SwapSide.BUY]: [{ name: 'OptimismBuyAdapter', index: 10 }],
|
|
117
|
+
},
|
|
76
118
|
};
|
|
@@ -79,7 +79,7 @@ function testForNetwork(
|
|
|
79
79
|
describe('SolidlyV3 E2E', () => {
|
|
80
80
|
const dexKey = 'SolidlyV3';
|
|
81
81
|
|
|
82
|
-
describe('
|
|
82
|
+
describe('Mainnet', () => {
|
|
83
83
|
const network = Network.MAINNET;
|
|
84
84
|
|
|
85
85
|
const pairs = [
|
|
@@ -110,12 +110,12 @@ describe('SolidlyV3 E2E', () => {
|
|
|
110
110
|
[
|
|
111
111
|
{
|
|
112
112
|
name: 'USDC',
|
|
113
|
-
sellAmount: '
|
|
113
|
+
sellAmount: '4000000',
|
|
114
114
|
buyAmount: '4000000',
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
name: 'USDT',
|
|
118
|
-
sellAmount: '
|
|
118
|
+
sellAmount: '5000000',
|
|
119
119
|
buyAmount: '5000000',
|
|
120
120
|
},
|
|
121
121
|
],
|
|
@@ -156,4 +156,115 @@ describe('SolidlyV3 E2E', () => {
|
|
|
156
156
|
|
|
157
157
|
testForNetwork(network, dexKey, pairs);
|
|
158
158
|
});
|
|
159
|
+
|
|
160
|
+
describe('Base', () => {
|
|
161
|
+
const network = Network.BASE;
|
|
162
|
+
|
|
163
|
+
const pairs = [
|
|
164
|
+
[
|
|
165
|
+
{
|
|
166
|
+
name: NativeTokenSymbols[network],
|
|
167
|
+
sellAmount: '100000000000000', //0.0001 ETH
|
|
168
|
+
buyAmount: '100000000',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: 'USDC',
|
|
172
|
+
sellAmount: '1000000', // $1
|
|
173
|
+
buyAmount: '1000000', // $1
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
[
|
|
177
|
+
{
|
|
178
|
+
name: 'USDC',
|
|
179
|
+
sellAmount: '100000',
|
|
180
|
+
buyAmount: '100000',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'WETH',
|
|
184
|
+
sellAmount: '100000000000000', //0.0001 ETH
|
|
185
|
+
buyAmount: '100000000',
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
[
|
|
189
|
+
{
|
|
190
|
+
name: 'USDC',
|
|
191
|
+
sellAmount: '100000',
|
|
192
|
+
buyAmount: '100000',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'USDbC',
|
|
196
|
+
sellAmount: '100000',
|
|
197
|
+
buyAmount: '100000',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
];
|
|
201
|
+
|
|
202
|
+
testForNetwork(network, dexKey, pairs);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
describe('Optimism', () => {
|
|
206
|
+
const network = Network.OPTIMISM;
|
|
207
|
+
|
|
208
|
+
const pairs = [
|
|
209
|
+
[
|
|
210
|
+
{
|
|
211
|
+
name: NativeTokenSymbols[network],
|
|
212
|
+
sellAmount: '10000',
|
|
213
|
+
buyAmount: '1000000000',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'wstETH',
|
|
217
|
+
sellAmount: '1000000000',
|
|
218
|
+
buyAmount: '1000000000',
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
[
|
|
222
|
+
{
|
|
223
|
+
name: 'USDC',
|
|
224
|
+
sellAmount: '1000000000',
|
|
225
|
+
buyAmount: '1000000000',
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'USDT',
|
|
229
|
+
sellAmount: '100000',
|
|
230
|
+
buyAmount: '1000000000',
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
];
|
|
234
|
+
|
|
235
|
+
testForNetwork(network, dexKey, pairs);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
describe('Arbitrum', () => {
|
|
239
|
+
const network = Network.ARBITRUM;
|
|
240
|
+
|
|
241
|
+
const pairs = [
|
|
242
|
+
[
|
|
243
|
+
{
|
|
244
|
+
name: NativeTokenSymbols[network],
|
|
245
|
+
sellAmount: '10000000000000',
|
|
246
|
+
buyAmount: '1000000000',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'USDC',
|
|
250
|
+
sellAmount: '1000000000',
|
|
251
|
+
buyAmount: '1000000000',
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
[
|
|
255
|
+
{
|
|
256
|
+
name: 'USDC',
|
|
257
|
+
sellAmount: '1000000000',
|
|
258
|
+
buyAmount: '1000000000',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'USDT',
|
|
262
|
+
sellAmount: '100000',
|
|
263
|
+
buyAmount: '1000000000',
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
testForNetwork(network, dexKey, pairs);
|
|
269
|
+
});
|
|
159
270
|
});
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
import { GenericSwapTransactionBuilder } from '../generic-swap-transaction-builder';
|
|
25
25
|
import { AddressOrSymbol } from '@paraswap/sdk';
|
|
26
26
|
import { ParaSwapVersion } from '@paraswap/core';
|
|
27
|
+
import { TransactionBuilder } from '../transaction-builder';
|
|
27
28
|
|
|
28
29
|
export interface IParaSwapSDK {
|
|
29
30
|
getPrices(
|
|
@@ -60,6 +61,7 @@ export class LocalParaswapSDK implements IParaSwapSDK {
|
|
|
60
61
|
pricingHelper: PricingHelper;
|
|
61
62
|
dexKeys: string[];
|
|
62
63
|
transactionBuilder: GenericSwapTransactionBuilder;
|
|
64
|
+
transactionBuilderV5: TransactionBuilder;
|
|
63
65
|
|
|
64
66
|
constructor(
|
|
65
67
|
protected network: number,
|
|
@@ -79,6 +81,7 @@ export class LocalParaswapSDK implements IParaSwapSDK {
|
|
|
79
81
|
this.transactionBuilder = new GenericSwapTransactionBuilder(
|
|
80
82
|
this.dexAdapterService,
|
|
81
83
|
);
|
|
84
|
+
this.transactionBuilderV5 = new TransactionBuilder(this.dexAdapterService);
|
|
82
85
|
|
|
83
86
|
this.dexKeys = Array.isArray(dexKeys) ? dexKeys : [dexKeys];
|
|
84
87
|
this.dexKeys.map(dexKey => {
|
|
@@ -196,8 +199,11 @@ export class LocalParaswapSDK implements IParaSwapSDK {
|
|
|
196
199
|
gasCost: '0',
|
|
197
200
|
others: [],
|
|
198
201
|
side,
|
|
202
|
+
// For V5 tests, put Augustus V5 address here
|
|
203
|
+
// contractAddress: '0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57',
|
|
199
204
|
contractAddress: '',
|
|
200
205
|
tokenTransferProxy: '',
|
|
206
|
+
// For V5 tests, put V5 version here
|
|
201
207
|
version: ParaSwapVersion.V6,
|
|
202
208
|
};
|
|
203
209
|
|
|
@@ -305,6 +311,8 @@ export class LocalParaswapSDK implements IParaSwapSDK {
|
|
|
305
311
|
throw e;
|
|
306
312
|
}
|
|
307
313
|
|
|
314
|
+
// For V5 use transactionBuilderV5
|
|
315
|
+
// return await this.transactionBuilderV5.build({
|
|
308
316
|
return await this.transactionBuilder.build({
|
|
309
317
|
priceRoute,
|
|
310
318
|
minMaxAmount: minMaxAmount.toString(),
|
package/tests/constants-e2e.ts
CHANGED
|
@@ -499,6 +499,14 @@ export const Tokens: {
|
|
|
499
499
|
address: '0x23878914efe38d27c4d67ab83ed1b93a74d4086a',
|
|
500
500
|
decimals: 6,
|
|
501
501
|
},
|
|
502
|
+
rUSD: {
|
|
503
|
+
address: '0x65D72AA8DA931F047169112fcf34f52DbaAE7D18',
|
|
504
|
+
decimals: 18,
|
|
505
|
+
},
|
|
506
|
+
arUSD: {
|
|
507
|
+
address: '0x07D1718fF05a8C53C8F05aDAEd57C0d672945f9a',
|
|
508
|
+
decimals: 18,
|
|
509
|
+
},
|
|
502
510
|
},
|
|
503
511
|
[Network.POLYGON]: {
|
|
504
512
|
jGBP: {
|
|
@@ -1569,6 +1577,8 @@ export const Holders: {
|
|
|
1569
1577
|
stataUSDT: '0x6803364AceD5181877abC11E865FB27cB654a426',
|
|
1570
1578
|
aaveUSDT: '0x32c98a981Fe7C333Bd4e8E7630E8e0CF5ce20987',
|
|
1571
1579
|
weETH: '0x267ed5f71EE47D3E45Bb1569Aa37889a2d10f91e',
|
|
1580
|
+
rUSD: '0xEC2eda1C4F981E468ABF62424a10B69B738b498E',
|
|
1581
|
+
arUSD: '0xeFc24206053a452e2299BF3b8f964512b041Db4C',
|
|
1572
1582
|
},
|
|
1573
1583
|
[Network.POLYGON]: {
|
|
1574
1584
|
jGBP: '0x02aa0B826c7BA6386DdBE04C0a8715A1c0A16B24',
|
|
@@ -1640,7 +1650,7 @@ export const Holders: {
|
|
|
1640
1650
|
FVM: '0x07BB65fAaC502d4996532F834A1B7ba5dC32Ff96',
|
|
1641
1651
|
lzUSDC: '0x06F1C4A56357bF3971C79063f2B58E58c547BC0B',
|
|
1642
1652
|
axlUSDC: '0xccf932cd565c21d2e516c8ff3a4f244eea27e09a',
|
|
1643
|
-
SOLID: '
|
|
1653
|
+
SOLID: '0xddf169bf228e6d6e701180e2e6f290739663a784',
|
|
1644
1654
|
scrvUSDC_e: '0xb8c1dAb69724da9d3225F14bfD76Ae97bB92BFda',
|
|
1645
1655
|
scrvUSDC_p: '0x74796478d7755a77807fADd2389A18DF1baf9e7c',
|
|
1646
1656
|
},
|
package/.vscode/tasks.json
DELETED