@paraswap/dex-lib 4.1.7 → 4.1.8
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/Project.xml +44 -4
- package/.idea/codeStyles/codeStyleConfig.xml +1 -1
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/paraswap-dex-lib.iml +7 -4
- package/build/dex/angle-staked-stable/angle-staked-stable.js +2 -1
- package/build/dex/angle-staked-stable/angle-staked-stable.js.map +1 -1
- package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -1
- package/build/dex/balancer-v1/config.js +2 -1
- package/build/dex/balancer-v1/config.js.map +1 -1
- package/build/dex/jarvis.d.ts +2 -1
- package/build/dex/jarvis.js +58 -0
- package/build/dex/jarvis.js.map +1 -1
- package/build/dex/weth/weth.js +2 -1
- package/build/dex/weth/weth.js.map +1 -1
- package/build/dex/zerox/index.d.ts +3 -25
- package/build/dex/zerox/index.js +50 -42
- package/build/dex/zerox/index.js.map +1 -1
- package/build/dex/zerox/types.d.ts +29 -0
- package/build/dex/zerox/types.js +8 -1
- package/build/dex/zerox/types.js.map +1 -1
- package/package.json +1 -1
- package/scripts/get-uniswap-v3-dexes.ts +64 -0
- package/src/dex/aave-gsm/aave-gsm-gas-estimation.test.ts +32 -0
- package/src/dex/aave-v2/aave-v2-gas-estimation.test.ts +28 -0
- package/src/dex/aave-v3/aave-v3-gas-estimation.test.ts +66 -0
- package/src/dex/aave-v3-stata/aave-v3-stata-gas-estimation.test.ts +41 -0
- package/src/dex/aave-v3-stata-v2/aave-v3-stata-v2-gas-estimation.test.ts +41 -0
- package/src/dex/angle-staked-stable/angle-staked-stable-gas-estimation.test.ts +29 -0
- package/src/dex/angle-staked-stable/angle-staked-stable.ts +2 -1
- package/src/dex/angle-transmuter/angle-transmuter-gas-estimation.test.ts +41 -0
- package/src/dex/angle-transmuter/angle-transmuter.ts +0 -1
- package/src/dex/balancer-v1/balancer-v1-gas-estimation.test.ts +29 -0
- package/src/dex/balancer-v1/config.ts +2 -1
- package/src/dex/balancer-v2/balancer-v2-gas-estimation.test.ts +98 -0
- package/src/dex/balancer-v3/balancer-v3-gas-estimation.test.ts +30 -0
- package/src/dex/bancor/bancor-gas-estimation.test.ts +30 -0
- package/src/dex/bebop/bebop-gas-estimation.test.ts +30 -0
- package/src/dex/concentrator-arusd/concentrator-arusd-gas-estimation.test.ts +29 -0
- package/src/dex/curve-v1/curve-v1-gas-estimation.test.ts +29 -0
- package/src/dex/curve-v2/curve-v2-gas-estimation.test.ts +29 -0
- package/src/dex/fluid-dex/fluid-dex-gas-estimation.test.ts +29 -0
- package/src/dex/fx-protocol-rusd/fx-protocol-rusd-gas-estimation.test.ts +29 -0
- package/src/dex/hashflow/hashflow-gas-estimation.test.ts +30 -0
- package/src/dex/idle-dao/idle-dao--gas-estimation.test.ts +30 -0
- package/src/dex/lido/lido-gas-estimation.test.ts +29 -0
- package/src/dex/lite-psm/lite-psm-gas-estimation.test.ts +34 -0
- package/src/dex/maker-psm/maker-psm-gas-estimation.test.ts +34 -0
- package/src/dex/maverick-v1/maverick-v1-gas-estimation.test.ts +29 -0
- package/src/dex/maverick-v2/maverick-v2-gas-estimation.test.ts +29 -0
- package/src/dex/pancakeswap-v3/pancakeswap-v3-gas-estimation.test.ts +29 -0
- package/src/dex/polygon-migrator/polygon-migrator-gas-estimation.test.ts +41 -0
- package/src/dex/sky-converter/sky-converter-gas-estimation.test.ts +78 -0
- package/src/dex/solidly/solidly-gas-estimation.test.ts +29 -0
- package/src/dex/solidly-v3/solidly-v3-gas-estimation.test.ts +29 -0
- package/src/dex/spark/spark-gas-estimation.test.ts +29 -0
- package/src/dex/stader/stader-gas-estimation.test.ts +29 -0
- package/src/dex/stkgho/stkgho-gas-estimation.test.ts +29 -0
- package/src/dex/swaap-v2/swaap-v2-estimation.test.ts +29 -0
- package/src/dex/swell/swell-estimation.test.ts +29 -0
- package/src/dex/trader-joe-v2.1/trader-joe-v2.1-gas-estimation.test.ts +29 -0
- package/src/dex/uniswap-v2/uniswap-v2-gas-estimation.test.ts +98 -0
- package/src/dex/uniswap-v3/uniswap-v3-gas-estimation.test.ts +98 -0
- package/src/dex/usual/usual-gas-estimation.test.ts +54 -0
- package/src/dex/usual-pp/usual-pp-gas-estimation.test.ts +29 -0
- package/src/dex/weth/weth-gas-estimation.test.ts +42 -0
- package/src/dex/weth/weth.ts +3 -1
- package/src/dex/wombat/wombat-gas-estimation.test.ts +29 -0
- package/src/dex/wsteth/wsteth-gas-estimation.test.ts +41 -0
- package/src/dex/wusdm/wusdm-gas-estimation.test.ts +41 -0
- package/tests/constants-e2e.ts +8 -0
- package/tests/tenderly-simulation-new.test.ts +151 -0
- package/tests/tenderly-simulation-new.ts +698 -0
- package/tests/token-storage-slots.json +532 -0
- package/tests/utils-e2e.ts +137 -1
- package/.idea/aws.xml +0 -17
- package/.idea/misc.xml +0 -6
- package/.idea/prettier.xml +0 -7
- package/build/abi/AaveV1_lending_pool.json +0 -27
- package/build/abi/integral/factory.json +0 -333
- package/build/abi/integral/oracle.json +0 -501
- package/build/abi/integral/pool.json +0 -1041
- package/build/abi/integral/relayer.json +0 -1536
- package/build/abi/platypus/asset.json +0 -490
- package/build/abi/platypus/avax-pool.json +0 -820
- package/build/abi/platypus/oracle.json +0 -119
- package/build/abi/platypus/pool.json +0 -677
- package/build/abi/smardex/all/smardex-router.json +0 -648
- package/build/abi/smardex/layer-1/smardex-factory.json +0 -242
- package/build/abi/smardex/layer-1/smardex-pool.json +0 -506
- package/build/abi/smardex/layer-2/smardex-factory.json +0 -185
- package/build/abi/smardex/layer-2/smardex-pool.json +0 -578
- package/build/abi/swaap-v1/pool.json +0 -1346
- package/build/dex/aave-v1/aave-v1.d.ts +0 -33
- package/build/dex/aave-v1/aave-v1.js +0 -158
- package/build/dex/aave-v1/aave-v1.js.map +0 -1
- package/build/dex/aave-v1/config.d.ts +0 -11
- package/build/dex/aave-v1/config.js +0 -20
- package/build/dex/aave-v1/config.js.map +0 -1
- package/build/dex/aave-v1/tokens-mainnet.json +0 -134
- package/build/dex/aave-v1/tokens.d.ts +0 -3
- package/build/dex/aave-v1/tokens.js +0 -50
- package/build/dex/aave-v1/tokens.js.map +0 -1
- package/build/dex/aave-v1/types.d.ts +0 -12
- package/build/dex/aave-v1/types.js +0 -3
- package/build/dex/aave-v1/types.js.map +0 -1
- package/build/dex/bProtocol.d.ts +0 -18
- package/build/dex/bProtocol.js +0 -39
- package/build/dex/bProtocol.js.map +0 -1
- package/build/dex/bancor.d.ts +0 -26
- package/build/dex/bancor.js +0 -58
- package/build/dex/bancor.js.map +0 -1
- package/build/dex/compound.d.ts +0 -18
- package/build/dex/compound.js +0 -46
- package/build/dex/compound.js.map +0 -1
- package/build/dex/curve-v2.d.ts +0 -58
- package/build/dex/curve-v2.js +0 -180
- package/build/dex/curve-v2.js.map +0 -1
- package/build/dex/dodo-v1.d.ts +0 -33
- package/build/dex/dodo-v1.js +0 -63
- package/build/dex/dodo-v1.js.map +0 -1
- package/build/dex/fluid-dex/fluid-dex-generate-pool.d.ts +0 -49
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js +0 -104
- package/build/dex/fluid-dex/fluid-dex-generate-pool.js.map +0 -1
- package/build/dex/integral/config.d.ts +0 -4
- package/build/dex/integral/config.js +0 -20
- package/build/dex/integral/config.js.map +0 -1
- package/build/dex/integral/context.d.ts +0 -40
- package/build/dex/integral/context.js +0 -158
- package/build/dex/integral/context.js.map +0 -1
- package/build/dex/integral/integral-factory.d.ts +0 -24
- package/build/dex/integral/integral-factory.js +0 -95
- package/build/dex/integral/integral-factory.js.map +0 -1
- package/build/dex/integral/integral-pool.d.ts +0 -50
- package/build/dex/integral/integral-pool.js +0 -149
- package/build/dex/integral/integral-pool.js.map +0 -1
- package/build/dex/integral/integral-pricing.d.ts +0 -18
- package/build/dex/integral/integral-pricing.js +0 -114
- package/build/dex/integral/integral-pricing.js.map +0 -1
- package/build/dex/integral/integral-relayer.d.ts +0 -42
- package/build/dex/integral/integral-relayer.js +0 -192
- package/build/dex/integral/integral-relayer.js.map +0 -1
- package/build/dex/integral/integral-token.d.ts +0 -27
- package/build/dex/integral/integral-token.js +0 -59
- package/build/dex/integral/integral-token.js.map +0 -1
- package/build/dex/integral/integral.d.ts +0 -41
- package/build/dex/integral/integral.js +0 -376
- package/build/dex/integral/integral.js.map +0 -1
- package/build/dex/integral/types.d.ts +0 -85
- package/build/dex/integral/types.js +0 -9
- package/build/dex/integral/types.js.map +0 -1
- package/build/dex/integral/utils-e2e.d.ts +0 -9
- package/build/dex/integral/utils-e2e.js +0 -131
- package/build/dex/integral/utils-e2e.js.map +0 -1
- package/build/dex/integral/utils.d.ts +0 -17
- package/build/dex/integral/utils.js +0 -94
- package/build/dex/integral/utils.js.map +0 -1
- package/build/dex/lido.d.ts +0 -19
- package/build/dex/lido.js +0 -42
- package/build/dex/lido.js.map +0 -1
- package/build/dex/m-token/config.d.ts +0 -3
- package/build/dex/m-token/config.js +0 -19
- package/build/dex/m-token/config.js.map +0 -1
- package/build/dex/m-token/m-token.d.ts +0 -29
- package/build/dex/m-token/m-token.js +0 -145
- package/build/dex/m-token/m-token.js.map +0 -1
- package/build/dex/m-token/m-wrapped-m.d.ts +0 -17
- package/build/dex/m-token/m-wrapped-m.js +0 -50
- package/build/dex/m-token/m-wrapped-m.js.map +0 -1
- package/build/dex/m-token/types.d.ts +0 -12
- package/build/dex/m-token/types.js +0 -3
- package/build/dex/m-token/types.js.map +0 -1
- package/build/dex/onebit.d.ts +0 -25
- package/build/dex/onebit.js +0 -42
- package/build/dex/onebit.js.map +0 -1
- package/build/dex/platypus/asset.d.ts +0 -14
- package/build/dex/platypus/asset.js +0 -97
- package/build/dex/platypus/asset.js.map +0 -1
- package/build/dex/platypus/config.d.ts +0 -11
- package/build/dex/platypus/config.js +0 -69
- package/build/dex/platypus/config.js.map +0 -1
- package/build/dex/platypus/platypus.d.ts +0 -62
- package/build/dex/platypus/platypus.js +0 -442
- package/build/dex/platypus/platypus.js.map +0 -1
- package/build/dex/platypus/pool-avax.d.ts +0 -8
- package/build/dex/platypus/pool-avax.js +0 -54
- package/build/dex/platypus/pool-avax.js.map +0 -1
- package/build/dex/platypus/pool-base.d.ts +0 -19
- package/build/dex/platypus/pool-base.js +0 -86
- package/build/dex/platypus/pool-base.js.map +0 -1
- package/build/dex/platypus/pool-pure.d.ts +0 -8
- package/build/dex/platypus/pool-pure.js +0 -37
- package/build/dex/platypus/pool-pure.js.map +0 -1
- package/build/dex/platypus/pool-subscriber.d.ts +0 -14
- package/build/dex/platypus/pool-subscriber.js +0 -167
- package/build/dex/platypus/pool-subscriber.js.map +0 -1
- package/build/dex/platypus/pool.d.ts +0 -8
- package/build/dex/platypus/pool.js +0 -58
- package/build/dex/platypus/pool.js.map +0 -1
- package/build/dex/platypus/types.d.ts +0 -92
- package/build/dex/platypus/types.js +0 -10
- package/build/dex/platypus/types.js.map +0 -1
- package/build/dex/quickswap/spiritswap-v3.d.ts +0 -6
- package/build/dex/quickswap/spiritswap-v3.js +0 -19
- package/build/dex/quickswap/spiritswap-v3.js.map +0 -1
- package/build/dex/smardex/config.d.ts +0 -4
- package/build/dex/smardex/config.js +0 -64
- package/build/dex/smardex/config.js.map +0 -1
- package/build/dex/smardex/constants.d.ts +0 -18
- package/build/dex/smardex/constants.js +0 -33
- package/build/dex/smardex/constants.js.map +0 -1
- package/build/dex/smardex/sdk/constants.d.ts +0 -6
- package/build/dex/smardex/sdk/constants.js +0 -13
- package/build/dex/smardex/sdk/constants.js.map +0 -1
- package/build/dex/smardex/sdk/core.d.ts +0 -113
- package/build/dex/smardex/sdk/core.js +0 -499
- package/build/dex/smardex/sdk/core.js.map +0 -1
- package/build/dex/smardex/sdk/errors.d.ts +0 -15
- package/build/dex/smardex/sdk/errors.js +0 -22
- package/build/dex/smardex/sdk/errors.js.map +0 -1
- package/build/dex/smardex/sdk/types.d.ts +0 -62
- package/build/dex/smardex/sdk/types.js +0 -3
- package/build/dex/smardex/sdk/types.js.map +0 -1
- package/build/dex/smardex/sdk/utils.d.ts +0 -44
- package/build/dex/smardex/sdk/utils.js +0 -133
- package/build/dex/smardex/sdk/utils.js.map +0 -1
- package/build/dex/smardex/smardex-event-pool.d.ts +0 -28
- package/build/dex/smardex/smardex-event-pool.js +0 -119
- package/build/dex/smardex/smardex-event-pool.js.map +0 -1
- package/build/dex/smardex/smardex.d.ts +0 -65
- package/build/dex/smardex/smardex.js +0 -519
- package/build/dex/smardex/smardex.js.map +0 -1
- package/build/dex/smardex/types.d.ts +0 -55
- package/build/dex/smardex/types.js +0 -3
- package/build/dex/smardex/types.js.map +0 -1
- package/build/dex/smoothy.d.ts +0 -26
- package/build/dex/smoothy.js +0 -48
- package/build/dex/smoothy.js.map +0 -1
- package/build/dex/solidly/forks-override/cone.d.ts +0 -22
- package/build/dex/solidly/forks-override/cone.js +0 -53
- package/build/dex/solidly/forks-override/cone.js.map +0 -1
- package/build/dex/solidly/forks-override/solisnek.d.ts +0 -8
- package/build/dex/solidly/forks-override/solisnek.js +0 -15
- package/build/dex/solidly/forks-override/solisnek.js.map +0 -1
- package/build/dex/stable-pool.d.ts +0 -28
- package/build/dex/stable-pool.js +0 -62
- package/build/dex/stable-pool.js.map +0 -1
- package/build/dex/swaap-v1/config.d.ts +0 -17
- package/build/dex/swaap-v1/config.js +0 -56
- package/build/dex/swaap-v1/config.js.map +0 -1
- package/build/dex/swaap-v1/constants.d.ts +0 -6
- package/build/dex/swaap-v1/constants.js +0 -17
- package/build/dex/swaap-v1/constants.js.map +0 -1
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.d.ts +0 -25
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js +0 -62
- package/build/dex/swaap-v1/libraries/ChainlinkUtils.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Const.d.ts +0 -18
- package/build/dex/swaap-v1/libraries/Const.js +0 -26
- package/build/dex/swaap-v1/libraries/Const.js.map +0 -1
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.d.ts +0 -77
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js +0 -316
- package/build/dex/swaap-v1/libraries/GeometricBrownianMotion.js.map +0 -1
- package/build/dex/swaap-v1/libraries/LogExpMath.d.ts +0 -75
- package/build/dex/swaap-v1/libraries/LogExpMath.js +0 -418
- package/build/dex/swaap-v1/libraries/LogExpMath.js.map +0 -1
- package/build/dex/swaap-v1/libraries/MathMMM.d.ts +0 -185
- package/build/dex/swaap-v1/libraries/MathMMM.js +0 -453
- package/build/dex/swaap-v1/libraries/MathMMM.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Num.d.ts +0 -31
- package/build/dex/swaap-v1/libraries/Num.js +0 -167
- package/build/dex/swaap-v1/libraries/Num.js.map +0 -1
- package/build/dex/swaap-v1/libraries/PoolQuotations.d.ts +0 -23
- package/build/dex/swaap-v1/libraries/PoolQuotations.js +0 -131
- package/build/dex/swaap-v1/libraries/PoolQuotations.js.map +0 -1
- package/build/dex/swaap-v1/libraries/Struct.d.ts +0 -56
- package/build/dex/swaap-v1/libraries/Struct.js +0 -3
- package/build/dex/swaap-v1/libraries/Struct.js.map +0 -1
- package/build/dex/swaap-v1/swaap-v1-pool.d.ts +0 -45
- package/build/dex/swaap-v1/swaap-v1-pool.js +0 -656
- package/build/dex/swaap-v1/swaap-v1-pool.js.map +0 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +0 -61
- package/build/dex/swaap-v1/swaap-v1.js +0 -369
- package/build/dex/swaap-v1/swaap-v1.js.map +0 -1
- package/build/dex/swaap-v1/types.d.ts +0 -106
- package/build/dex/swaap-v1/types.js +0 -9
- package/build/dex/swaap-v1/types.js.map +0 -1
- package/build/dex/trader-joe-v2.1/optimizer.d.ts +0 -2
- package/build/dex/trader-joe-v2.1/optimizer.js +0 -47
- package/build/dex/trader-joe-v2.1/optimizer.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.d.ts +0 -43
- package/build/dex/trader-joe-v2.1.js +0 -79
- package/build/dex/trader-joe-v2.1.js.map +0 -1
package/build/dex/compound.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Compound = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const simple_exchange_1 = require("./simple-exchange");
|
|
10
|
-
const Compound_CETH_json_1 = __importDefault(require("../abi/Compound_CETH.json")); // CETH abi
|
|
11
|
-
const utils_1 = require("../utils");
|
|
12
|
-
var CompoundFunctions;
|
|
13
|
-
(function (CompoundFunctions) {
|
|
14
|
-
CompoundFunctions["redeem"] = "redeem";
|
|
15
|
-
CompoundFunctions["mint"] = "mint";
|
|
16
|
-
})(CompoundFunctions || (CompoundFunctions = {}));
|
|
17
|
-
class Compound extends simple_exchange_1.SimpleExchange {
|
|
18
|
-
constructor(dexHelper) {
|
|
19
|
-
super(dexHelper, 'compound');
|
|
20
|
-
this.cethInterface = new abi_1.Interface(Compound_CETH_json_1.default);
|
|
21
|
-
}
|
|
22
|
-
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
23
|
-
const cToken = data.fromCToken ? srcToken : destToken; // Warning
|
|
24
|
-
const payload = this.abiCoder.encodeParameter({
|
|
25
|
-
ParentStruct: {
|
|
26
|
-
cToken: 'address',
|
|
27
|
-
},
|
|
28
|
-
}, { cToken });
|
|
29
|
-
return {
|
|
30
|
-
// target exchange is not used by the contract
|
|
31
|
-
targetExchange: constants_1.NULL_ADDRESS,
|
|
32
|
-
payload,
|
|
33
|
-
networkFee: '0',
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
37
|
-
const cToken = data.fromCToken ? srcToken : destToken;
|
|
38
|
-
const swapData = (0, utils_1.isETHAddress)(srcToken)
|
|
39
|
-
? this.cethInterface.encodeFunctionData(CompoundFunctions.mint)
|
|
40
|
-
: this.erc20Interface.encodeFunctionData(data.fromCToken ? CompoundFunctions.redeem : CompoundFunctions.mint, [srcAmount]);
|
|
41
|
-
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, cToken);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.Compound = Compound;
|
|
45
|
-
Compound.dexKeys = ['compound'];
|
|
46
|
-
//# sourceMappingURL=compound.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compound.js","sourceRoot":"","sources":["../../src/dex/compound.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAsD;AAGtD,uDAAmD;AACnD,mFAA6C,CAAC,WAAW;AACzD,oCAAwC;AAQxC,IAAK,iBAGJ;AAHD,WAAK,iBAAiB;IACpB,sCAAiB,CAAA;IACjB,kCAAa,CAAA;AACf,CAAC,EAHI,iBAAiB,KAAjB,iBAAiB,QAGrB;AAED,MAAa,QACX,SAAQ,gCAAc;IAMtB,YAAY,SAAqB;QAC/B,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,eAAS,CAAC,4BAAsB,CAAC,CAAC;IAC7D,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAkB,EAClB,IAAc;QAEd,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU;QAEjE,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAC3C;YACE,YAAY,EAAE;gBACZ,MAAM,EAAE,SAAS;aAClB;SACF,EACD,EAAE,MAAM,EAAE,CACX,CAAC;QAEF,OAAO;YACL,8CAA8C;YAC9C,cAAc,EAAE,wBAAY;YAC5B,OAAO;YACP,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAkB,EAClB,IAAc;QAEd,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QACtD,MAAM,QAAQ,GAAG,IAAA,oBAAY,EAAC,QAAQ,CAAC;YACrC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC;YAC/D,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,kBAAkB,CACpC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,EACnE,CAAC,SAAS,CAAC,CACZ,CAAC;QAEN,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,CACP,CAAC;IACJ,CAAC;;AA/DH,4BAgEC;AA5DQ,gBAAO,GAAG,CAAC,UAAU,CAAC,CAAC"}
|
package/build/dex/curve-v2.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { SwapSide } from '../constants';
|
|
3
|
-
import { AdapterExchangeParam, Address, ExchangeTxInfo, NumberAsString, PreprocessTransactionOptions, SimpleExchangeParam, Token, TxInfo } from '../types';
|
|
4
|
-
import { IDexTxBuilder } from './idex';
|
|
5
|
-
import { SimpleExchange } from './simple-exchange';
|
|
6
|
-
import { IDexHelper } from '../dex-helper';
|
|
7
|
-
import { Logger } from 'log4js';
|
|
8
|
-
import { OptimalSwapExchange } from '@paraswap/core';
|
|
9
|
-
export declare enum CurveV2SwapType {
|
|
10
|
-
EXCHANGE = 0,
|
|
11
|
-
EXCHANGE_UNDERLYING = 1,
|
|
12
|
-
EXCHANGE_GENERIC_FACTORY_ZAP = 2
|
|
13
|
-
}
|
|
14
|
-
declare type CurveV2Data = {
|
|
15
|
-
i: number;
|
|
16
|
-
j: number;
|
|
17
|
-
exchange: string;
|
|
18
|
-
originalPoolAddress: Address;
|
|
19
|
-
swapType: CurveV2SwapType;
|
|
20
|
-
isApproved?: boolean;
|
|
21
|
-
};
|
|
22
|
-
export declare type DirectCurveV2Param = [
|
|
23
|
-
fromToken: Address,
|
|
24
|
-
toToken: Address,
|
|
25
|
-
exchange: Address,
|
|
26
|
-
poolAddress: Address,
|
|
27
|
-
fromAmount: NumberAsString,
|
|
28
|
-
toAmount: NumberAsString,
|
|
29
|
-
expectedAmount: NumberAsString,
|
|
30
|
-
feePercent: NumberAsString,
|
|
31
|
-
i: NumberAsString,
|
|
32
|
-
j: NumberAsString,
|
|
33
|
-
partner: Address,
|
|
34
|
-
isApproved: boolean,
|
|
35
|
-
swapType: CurveV2SwapType,
|
|
36
|
-
beneficiary: Address,
|
|
37
|
-
needWrapNative: boolean,
|
|
38
|
-
permit: string,
|
|
39
|
-
uuid: string
|
|
40
|
-
];
|
|
41
|
-
export declare class CurveV2 extends SimpleExchange implements IDexTxBuilder<CurveV2Data, DirectCurveV2Param> {
|
|
42
|
-
readonly dexHelper: IDexHelper;
|
|
43
|
-
static dexKeys: string[];
|
|
44
|
-
exchangeRouterInterface: Interface;
|
|
45
|
-
genericFactoryZapIface: Interface;
|
|
46
|
-
minConversionRate: string;
|
|
47
|
-
needWrapNative: boolean;
|
|
48
|
-
logger: Logger;
|
|
49
|
-
readonly directSwapIface: Interface;
|
|
50
|
-
constructor(dexHelper: IDexHelper);
|
|
51
|
-
getAdapterParam(_0: string, _1: string, _2: string, _3: string, data: CurveV2Data, side: SwapSide): AdapterExchangeParam;
|
|
52
|
-
getTokenFromAddress(address: Address): Token;
|
|
53
|
-
preProcessTransaction(optimalSwapExchange: OptimalSwapExchange<CurveV2Data>, srcToken: Token, _0: Token, _1: SwapSide, options: PreprocessTransactionOptions): Promise<[OptimalSwapExchange<CurveV2Data>, ExchangeTxInfo]>;
|
|
54
|
-
getDirectParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, expectedAmount: NumberAsString, data: CurveV2Data, side: SwapSide, permit: string, uuid: string, feePercent: NumberAsString, _0: NumberAsString, partner: string, beneficiary: string, contractMethod?: string): TxInfo<DirectCurveV2Param>;
|
|
55
|
-
static getDirectFunctionName(): string[];
|
|
56
|
-
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: CurveV2Data, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
57
|
-
}
|
|
58
|
-
export {};
|
package/build/dex/curve-v2.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CurveV2 = exports.CurveV2SwapType = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const simple_exchange_1 = require("./simple-exchange");
|
|
10
|
-
const GenericFactoryZap_json_1 = __importDefault(require("../abi/curve-v2/GenericFactoryZap.json"));
|
|
11
|
-
const DirectSwap_json_1 = __importDefault(require("../abi/DirectSwap.json"));
|
|
12
|
-
const CurveV2_json_1 = __importDefault(require("../abi/CurveV2.json"));
|
|
13
|
-
const ts_essentials_1 = require("ts-essentials");
|
|
14
|
-
const utils_1 = require("../utils");
|
|
15
|
-
var CurveV2SwapType;
|
|
16
|
-
(function (CurveV2SwapType) {
|
|
17
|
-
CurveV2SwapType[CurveV2SwapType["EXCHANGE"] = 0] = "EXCHANGE";
|
|
18
|
-
CurveV2SwapType[CurveV2SwapType["EXCHANGE_UNDERLYING"] = 1] = "EXCHANGE_UNDERLYING";
|
|
19
|
-
CurveV2SwapType[CurveV2SwapType["EXCHANGE_GENERIC_FACTORY_ZAP"] = 2] = "EXCHANGE_GENERIC_FACTORY_ZAP";
|
|
20
|
-
})(CurveV2SwapType = exports.CurveV2SwapType || (exports.CurveV2SwapType = {}));
|
|
21
|
-
const DIRECT_METHOD_NAME = 'directCurveV2Swap';
|
|
22
|
-
var CurveV2SwapFunctions;
|
|
23
|
-
(function (CurveV2SwapFunctions) {
|
|
24
|
-
CurveV2SwapFunctions["exchange"] = "exchange(uint256 i, uint256 j, uint256 dx, uint256 minDy)";
|
|
25
|
-
CurveV2SwapFunctions["exchange_underlying"] = "exchange_underlying(uint256 i, uint256 j, uint256 dx, uint256 minDy)";
|
|
26
|
-
CurveV2SwapFunctions["exchange_in_generic_factory_zap"] = "exchange(address _pool, uint256 i, uint256 j, uint256 _dx, uint256 _min_dy)";
|
|
27
|
-
})(CurveV2SwapFunctions || (CurveV2SwapFunctions = {}));
|
|
28
|
-
class CurveV2 extends simple_exchange_1.SimpleExchange {
|
|
29
|
-
constructor(dexHelper) {
|
|
30
|
-
super(dexHelper, 'curvev2');
|
|
31
|
-
this.dexHelper = dexHelper;
|
|
32
|
-
this.minConversionRate = '1';
|
|
33
|
-
this.needWrapNative = true;
|
|
34
|
-
this.directSwapIface = new abi_1.Interface(DirectSwap_json_1.default);
|
|
35
|
-
this.exchangeRouterInterface = new abi_1.Interface(CurveV2_json_1.default);
|
|
36
|
-
this.genericFactoryZapIface = new abi_1.Interface(GenericFactoryZap_json_1.default);
|
|
37
|
-
this.logger = dexHelper.getLogger(`CurveV2_${dexHelper.config.data.network}`);
|
|
38
|
-
}
|
|
39
|
-
getAdapterParam(_0, _1, _2, _3, data, side) {
|
|
40
|
-
if (side === constants_1.SwapSide.BUY)
|
|
41
|
-
throw new Error(`Buy not supported`);
|
|
42
|
-
const { i, j, originalPoolAddress, swapType } = data;
|
|
43
|
-
const payload = this.abiCoder.encodeParameter({
|
|
44
|
-
ParentStruct: {
|
|
45
|
-
i: 'uint256',
|
|
46
|
-
j: 'uint256',
|
|
47
|
-
originalPoolAddress: 'address',
|
|
48
|
-
swapType: 'uint8',
|
|
49
|
-
},
|
|
50
|
-
}, {
|
|
51
|
-
i,
|
|
52
|
-
j,
|
|
53
|
-
originalPoolAddress,
|
|
54
|
-
swapType,
|
|
55
|
-
});
|
|
56
|
-
return {
|
|
57
|
-
targetExchange: data.exchange,
|
|
58
|
-
payload,
|
|
59
|
-
networkFee: '0',
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
getTokenFromAddress(address) {
|
|
63
|
-
// In this Dex decimals are not used
|
|
64
|
-
return { address, decimals: 0 };
|
|
65
|
-
}
|
|
66
|
-
async preProcessTransaction(optimalSwapExchange, srcToken, _0, _1, options) {
|
|
67
|
-
if (!options.isDirectMethod) {
|
|
68
|
-
return [
|
|
69
|
-
optimalSwapExchange,
|
|
70
|
-
{
|
|
71
|
-
deadline: BigInt((0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)()),
|
|
72
|
-
},
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
(0, ts_essentials_1.assert)(optimalSwapExchange.data !== undefined, `preProcessTransaction: data field is missing`);
|
|
76
|
-
let isApproved;
|
|
77
|
-
try {
|
|
78
|
-
this.erc20Contract.options.address =
|
|
79
|
-
this.dexHelper.config.wrapETH(srcToken).address;
|
|
80
|
-
const allowance = await this.erc20Contract.methods
|
|
81
|
-
.allowance(this.augustusAddress, optimalSwapExchange.data.exchange)
|
|
82
|
-
.call(undefined, 'latest');
|
|
83
|
-
isApproved =
|
|
84
|
-
BigInt(allowance.toString()) >= BigInt(optimalSwapExchange.srcAmount);
|
|
85
|
-
}
|
|
86
|
-
catch (e) {
|
|
87
|
-
this.logger.error(`preProcessTransaction failed to retrieve allowance info: `, e);
|
|
88
|
-
}
|
|
89
|
-
return [
|
|
90
|
-
{
|
|
91
|
-
...optimalSwapExchange,
|
|
92
|
-
data: {
|
|
93
|
-
...optimalSwapExchange.data,
|
|
94
|
-
isApproved,
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
deadline: BigInt((0, simple_exchange_1.getLocalDeadlineAsFriendlyPlaceholder)()),
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
}
|
|
102
|
-
getDirectParam(srcToken, destToken, srcAmount, destAmount, expectedAmount, data, side, permit, uuid, feePercent, _0, partner, beneficiary, contractMethod) {
|
|
103
|
-
if (contractMethod !== DIRECT_METHOD_NAME) {
|
|
104
|
-
throw new Error(`Invalid contract method ${contractMethod}`);
|
|
105
|
-
}
|
|
106
|
-
(0, ts_essentials_1.assert)(side === constants_1.SwapSide.SELL, 'Buy not supported');
|
|
107
|
-
let isApproved = !!data.isApproved;
|
|
108
|
-
if (data.isApproved === undefined) {
|
|
109
|
-
this.logger.warn(`isApproved is undefined, defaulting to false`);
|
|
110
|
-
}
|
|
111
|
-
const swapParams = [
|
|
112
|
-
srcToken,
|
|
113
|
-
destToken,
|
|
114
|
-
data.exchange,
|
|
115
|
-
data.originalPoolAddress,
|
|
116
|
-
srcAmount,
|
|
117
|
-
destAmount,
|
|
118
|
-
expectedAmount,
|
|
119
|
-
feePercent,
|
|
120
|
-
data.i.toString(),
|
|
121
|
-
data.j.toString(),
|
|
122
|
-
partner,
|
|
123
|
-
isApproved,
|
|
124
|
-
data.swapType,
|
|
125
|
-
beneficiary,
|
|
126
|
-
// For now we always wrap native. We don't support non native trade
|
|
127
|
-
true,
|
|
128
|
-
permit,
|
|
129
|
-
(0, utils_1.uuidToBytes16)(uuid),
|
|
130
|
-
];
|
|
131
|
-
const encoder = (...params) => {
|
|
132
|
-
return this.directSwapIface.encodeFunctionData(DIRECT_METHOD_NAME, [
|
|
133
|
-
params,
|
|
134
|
-
]);
|
|
135
|
-
};
|
|
136
|
-
return {
|
|
137
|
-
params: swapParams,
|
|
138
|
-
encoder,
|
|
139
|
-
networkFee: '0',
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
static getDirectFunctionName() {
|
|
143
|
-
return [DIRECT_METHOD_NAME];
|
|
144
|
-
}
|
|
145
|
-
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
146
|
-
if (side === constants_1.SwapSide.BUY)
|
|
147
|
-
throw new Error(`Buy not supported`);
|
|
148
|
-
const { exchange, i, j, originalPoolAddress, swapType } = data;
|
|
149
|
-
const args = swapType === CurveV2SwapType.EXCHANGE_GENERIC_FACTORY_ZAP
|
|
150
|
-
? [
|
|
151
|
-
originalPoolAddress,
|
|
152
|
-
i.toString(),
|
|
153
|
-
j.toString(),
|
|
154
|
-
srcAmount,
|
|
155
|
-
this.minConversionRate,
|
|
156
|
-
]
|
|
157
|
-
: [i.toString(), j.toString(), srcAmount, this.minConversionRate];
|
|
158
|
-
let swapMethod;
|
|
159
|
-
switch (swapType) {
|
|
160
|
-
case CurveV2SwapType.EXCHANGE:
|
|
161
|
-
swapMethod = CurveV2SwapFunctions.exchange;
|
|
162
|
-
break;
|
|
163
|
-
case CurveV2SwapType.EXCHANGE_UNDERLYING:
|
|
164
|
-
swapMethod = CurveV2SwapFunctions.exchange_underlying;
|
|
165
|
-
break;
|
|
166
|
-
case CurveV2SwapType.EXCHANGE_GENERIC_FACTORY_ZAP:
|
|
167
|
-
swapMethod = CurveV2SwapFunctions.exchange_in_generic_factory_zap;
|
|
168
|
-
break;
|
|
169
|
-
default:
|
|
170
|
-
throw new Error(`getSimpleParam: not all cases covered for CurveV2SwapTypes`);
|
|
171
|
-
}
|
|
172
|
-
const swapData = swapMethod === CurveV2SwapFunctions.exchange_in_generic_factory_zap
|
|
173
|
-
? this.genericFactoryZapIface.encodeFunctionData(swapMethod, args)
|
|
174
|
-
: this.exchangeRouterInterface.encodeFunctionData(swapMethod, args);
|
|
175
|
-
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, exchange);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
exports.CurveV2 = CurveV2;
|
|
179
|
-
CurveV2.dexKeys = ['curvev2'];
|
|
180
|
-
//# sourceMappingURL=curve-v2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"curve-v2.js","sourceRoot":"","sources":["../../src/dex/curve-v2.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAwC;AAYxC,uDAG2B;AAC3B,oGAA0E;AAC1E,6EAAmD;AACnD,uEAA6C;AAE7C,iDAAuC;AAGvC,oCAAyC;AAEzC,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,6DAAQ,CAAA;IACR,mFAAmB,CAAA;IACnB,qGAA4B,CAAA;AAC9B,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAED,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AA+C/C,IAAK,oBAIJ;AAJD,WAAK,oBAAoB;IACvB,8FAAsE,CAAA;IACtE,oHAA4F,CAAA;IAC5F,uIAA+G,CAAA;AACjH,CAAC,EAJI,oBAAoB,KAApB,oBAAoB,QAIxB;AAED,MAAa,OACX,SAAQ,gCAAc;IAYtB,YAAqB,SAAqB;QACxC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QADT,cAAS,GAAT,SAAS,CAAY;QAN1C,sBAAiB,GAAG,GAAG,CAAC;QACxB,mBAAc,GAAG,IAAI,CAAC;QAGb,oBAAe,GAAG,IAAI,eAAS,CAAC,yBAAa,CAAC,CAAC;QAItD,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAS,CAAC,sBAA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ants';
|
|
3
|
-
import { AdapterExchangeParam, Address, SimpleExchangeParam } from '../types';
|
|
4
|
-
import { IDexTxBuilder } from './idex';
|
|
5
|
-
import { SimpleExchange } from './simple-exchange';
|
|
6
|
-
import { NumberAsString } from '@paraswap/core';
|
|
7
|
-
import { IDexHelper } from '../dex-helper';
|
|
8
|
-
export declare type DodoV1Data = {
|
|
9
|
-
fromToken: Address;
|
|
10
|
-
toToken: Address;
|
|
11
|
-
dodoPairs: Address[];
|
|
12
|
-
directions: string;
|
|
13
|
-
isIncentive: boolean;
|
|
14
|
-
deadLine: string;
|
|
15
|
-
};
|
|
16
|
-
declare type DodoV1Param = [
|
|
17
|
-
fromToken: Address,
|
|
18
|
-
toToken: Address,
|
|
19
|
-
fromTokenAmount: NumberAsString,
|
|
20
|
-
minReturnAmount: NumberAsString,
|
|
21
|
-
dodoPairs: Address[],
|
|
22
|
-
directions: NumberAsString,
|
|
23
|
-
isIncentive: boolean,
|
|
24
|
-
deadLine: NumberAsString
|
|
25
|
-
];
|
|
26
|
-
export declare class DodoV1 extends SimpleExchange implements IDexTxBuilder<DodoV1Data, DodoV1Param> {
|
|
27
|
-
static dexKeys: string[];
|
|
28
|
-
dodoV2Proxy: Interface;
|
|
29
|
-
constructor(dexHelper: IDexHelper);
|
|
30
|
-
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: DodoV1Data, side: SwapSide): AdapterExchangeParam;
|
|
31
|
-
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: DodoV1Data, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
package/build/dex/dodo-v1.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DodoV1 = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const simple_exchange_1 = require("./simple-exchange");
|
|
10
|
-
const dodo_v2_proxy_json_1 = __importDefault(require("../abi/dodo-v2-proxy.json"));
|
|
11
|
-
// We use dodo-v2 proxy as the new proxy supports both v1 and v2
|
|
12
|
-
const DODOV2ProxyAddress = {
|
|
13
|
-
1: '0xa356867fdcea8e71aeaf87805808803806231fdc',
|
|
14
|
-
56: '0x8F8Dd7DB1bDA5eD3da8C9daf3bfa471c12d58486',
|
|
15
|
-
42161: '0x88CBf433471A0CD8240D2a12354362988b4593E5',
|
|
16
|
-
};
|
|
17
|
-
const DODOAproveAddress = {
|
|
18
|
-
1: '0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149',
|
|
19
|
-
56: '0xa128Ba44B2738A558A1fdC06d6303d52D3Cef8c1',
|
|
20
|
-
42161: '0xA867241cDC8d3b0C07C85cC06F25a0cD3b5474d8',
|
|
21
|
-
};
|
|
22
|
-
var DodoV1Functions;
|
|
23
|
-
(function (DodoV1Functions) {
|
|
24
|
-
DodoV1Functions["dodoSwapV1"] = "dodoSwapV1";
|
|
25
|
-
})(DodoV1Functions || (DodoV1Functions = {}));
|
|
26
|
-
class DodoV1 extends simple_exchange_1.SimpleExchange {
|
|
27
|
-
constructor(dexHelper) {
|
|
28
|
-
super(dexHelper, 'dodov1');
|
|
29
|
-
this.dodoV2Proxy = new abi_1.Interface(dodo_v2_proxy_json_1.default);
|
|
30
|
-
}
|
|
31
|
-
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
32
|
-
const { dodoPairs, directions } = data;
|
|
33
|
-
const payload = this.abiCoder.encodeParameter({
|
|
34
|
-
ParentStruct: {
|
|
35
|
-
dodoPairs: 'address[]',
|
|
36
|
-
directions: 'uint256',
|
|
37
|
-
},
|
|
38
|
-
}, { dodoPairs, directions });
|
|
39
|
-
return {
|
|
40
|
-
targetExchange: DODOV2ProxyAddress[this.network],
|
|
41
|
-
payload,
|
|
42
|
-
networkFee: '0',
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
46
|
-
const swapFunction = DodoV1Functions.dodoSwapV1;
|
|
47
|
-
const swapFunctionParams = [
|
|
48
|
-
srcToken,
|
|
49
|
-
destToken,
|
|
50
|
-
srcAmount,
|
|
51
|
-
destAmount,
|
|
52
|
-
data.dodoPairs,
|
|
53
|
-
data.directions,
|
|
54
|
-
data.isIncentive,
|
|
55
|
-
constants_1.MAX_UINT,
|
|
56
|
-
];
|
|
57
|
-
const swapData = this.dodoV2Proxy.encodeFunctionData(swapFunction, swapFunctionParams);
|
|
58
|
-
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, DODOV2ProxyAddress[this.network], DODOAproveAddress[this.network]);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.DodoV1 = DodoV1;
|
|
62
|
-
DodoV1.dexKeys = ['dodov1'];
|
|
63
|
-
//# sourceMappingURL=dodo-v1.js.map
|
package/build/dex/dodo-v1.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dodo-v1.js","sourceRoot":"","sources":["../../src/dex/dodo-v1.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAkD;AAGlD,uDAAmD;AACnD,mFAAuD;AAKvD,gEAAgE;AAChE,MAAM,kBAAkB,GAAmC;IACzD,CAAC,EAAE,4CAA4C;IAC/C,EAAE,EAAE,4CAA4C;IAChD,KAAK,EAAE,4CAA4C;CACpD,CAAC;AAEF,MAAM,iBAAiB,GAAmC;IACxD,CAAC,EAAE,4CAA4C;IAC/C,EAAE,EAAE,4CAA4C;IAChD,KAAK,EAAE,4CAA4C;CACpD,CAAC;AAqBF,IAAK,eAEJ;AAFD,WAAK,eAAe;IAClB,4CA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AC,OAAO,CAAC,EAChC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAChC,CAAC;IACJ,CAAC;;AAvEH,wBAwEC;AApEQ,cAAO,GAAG,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { BytesLike } from 'ethers/lib/utils';
|
|
3
|
-
import { DeepReadonly } from 'ts-essentials';
|
|
4
|
-
import { Log, Logger } from '../../types';
|
|
5
|
-
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
6
|
-
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
7
|
-
import { CommonAddresses, Pool } from './types';
|
|
8
|
-
import { MultiResult } from '../../lib/multi-wrapper';
|
|
9
|
-
import { Address } from '../../types';
|
|
10
|
-
export declare class FluidDexCommonAddresses extends StatefulEventSubscriber<Pool[]> {
|
|
11
|
-
readonly parentName: string;
|
|
12
|
-
readonly commonAddresses: CommonAddresses;
|
|
13
|
-
protected network: number;
|
|
14
|
-
protected dexHelper: IDexHelper;
|
|
15
|
-
handlers: {
|
|
16
|
-
[event: string]: (event: any, state: DeepReadonly<Pool[]>, log: Readonly<Log>) => Promise<DeepReadonly<Pool[]> | null>;
|
|
17
|
-
};
|
|
18
|
-
logDecoder: (log: Log) => any;
|
|
19
|
-
addressesSubscribed: Address[];
|
|
20
|
-
protected dexFactoryIface: Interface;
|
|
21
|
-
protected resolverIface: Interface;
|
|
22
|
-
constructor(parentName: string, commonAddresses: CommonAddresses, network: number, dexHelper: IDexHelper, logger: Logger);
|
|
23
|
-
/**
|
|
24
|
-
* Handle a trade rate change on the pool.
|
|
25
|
-
*/
|
|
26
|
-
handleDexDeployed(event: any, state: DeepReadonly<Pool[]>, log: Readonly<Log>): Promise<DeepReadonly<Pool[]> | null>;
|
|
27
|
-
decodePool: (result: MultiResult<BytesLike> | BytesLike) => Pool;
|
|
28
|
-
/**
|
|
29
|
-
* The function is called every time any of the subscribed
|
|
30
|
-
* addresses release log. The function accepts the current
|
|
31
|
-
* state, updates the state according to the log, and returns
|
|
32
|
-
* the updated state.
|
|
33
|
-
* @param state - Current state of event subscriber
|
|
34
|
-
* @param log - Log released by one of the subscribed addresses
|
|
35
|
-
* @returns Updates state of the event subscriber after the log
|
|
36
|
-
*/
|
|
37
|
-
processLog(state: DeepReadonly<Pool[]>, log: Readonly<Log>): Promise<DeepReadonly<Pool[]> | null>;
|
|
38
|
-
getStateOrGenerate(blockNumber: number, readonly?: boolean): Promise<DeepReadonly<Pool[]>>;
|
|
39
|
-
/**
|
|
40
|
-
* The function generates state using on-chain calls. This
|
|
41
|
-
* function is called to regenerate state if the event based
|
|
42
|
-
* system fails to fetch events and the local state is no
|
|
43
|
-
* more correct.
|
|
44
|
-
* @param blockNumber - Blocknumber for which the state should
|
|
45
|
-
* should be generated
|
|
46
|
-
* @returns state of the event subscriber at blocknumber
|
|
47
|
-
*/
|
|
48
|
-
generateState(blockNumber: number): Promise<DeepReadonly<Pool[]>>;
|
|
49
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FluidDexCommonAddresses = void 0;
|
|
7
|
-
const abi_1 = require("@ethersproject/abi");
|
|
8
|
-
const utils_1 = require("../../utils");
|
|
9
|
-
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
10
|
-
const resolver_abi_json_1 = __importDefault(require("../../abi/fluid-dex/resolver.abi.json"));
|
|
11
|
-
const dexFactory_abi_json_1 = __importDefault(require("../../abi/fluid-dex/dexFactory.abi.json"));
|
|
12
|
-
const decoders_1 = require("../../lib/decoders");
|
|
13
|
-
const ethers_1 = require("ethers");
|
|
14
|
-
class FluidDexCommonAddresses extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
15
|
-
constructor(parentName, commonAddresses, network, dexHelper, logger) {
|
|
16
|
-
super(parentName, 'getAllPools', dexHelper, logger);
|
|
17
|
-
this.parentName = parentName;
|
|
18
|
-
this.commonAddresses = commonAddresses;
|
|
19
|
-
this.network = network;
|
|
20
|
-
this.dexHelper = dexHelper;
|
|
21
|
-
this.handlers = {};
|
|
22
|
-
this.dexFactoryIface = new abi_1.Interface(dexFactory_abi_json_1.default);
|
|
23
|
-
this.resolverIface = new abi_1.Interface(resolver_abi_json_1.default);
|
|
24
|
-
this.decodePool = (result) => {
|
|
25
|
-
return (0, decoders_1.generalDecoder)(result, ['tuple(address pool, address token0, address token1, uint256 fee)'], undefined, decoded => {
|
|
26
|
-
return {
|
|
27
|
-
address: decoded[0].toLowerCase(),
|
|
28
|
-
token0: decoded[1].toLowerCase(),
|
|
29
|
-
token1: decoded[2].toLowerCase(),
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
this.logDecoder = (log) => this.dexFactoryIface.parseLog(log);
|
|
34
|
-
this.addressesSubscribed = [commonAddresses.dexFactory];
|
|
35
|
-
// Add handlers
|
|
36
|
-
this.handlers['DexDeployed'] = this.handleDexDeployed.bind(this);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Handle a trade rate change on the pool.
|
|
40
|
-
*/
|
|
41
|
-
async handleDexDeployed(event, state, log) {
|
|
42
|
-
const blockNumber_ = await this.dexHelper.provider.getBlockNumber();
|
|
43
|
-
return this.getStateOrGenerate(blockNumber_, false);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The function is called every time any of the subscribed
|
|
47
|
-
* addresses release log. The function accepts the current
|
|
48
|
-
* state, updates the state according to the log, and returns
|
|
49
|
-
* the updated state.
|
|
50
|
-
* @param state - Current state of event subscriber
|
|
51
|
-
* @param log - Log released by one of the subscribed addresses
|
|
52
|
-
* @returns Updates state of the event subscriber after the log
|
|
53
|
-
*/
|
|
54
|
-
async processLog(state, log) {
|
|
55
|
-
try {
|
|
56
|
-
let event;
|
|
57
|
-
try {
|
|
58
|
-
event = this.logDecoder(log);
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
if (event.name in this.handlers) {
|
|
64
|
-
return await this.handlers[event.name](event, state, log);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
(0, utils_1.catchParseLogError)(e, this.logger);
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
async getStateOrGenerate(blockNumber, readonly = false) {
|
|
73
|
-
let state = this.getState(blockNumber);
|
|
74
|
-
if (!state) {
|
|
75
|
-
state = await this.generateState(blockNumber);
|
|
76
|
-
if (!readonly)
|
|
77
|
-
this.setState(state, blockNumber);
|
|
78
|
-
}
|
|
79
|
-
return state;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* The function generates state using on-chain calls. This
|
|
83
|
-
* function is called to regenerate state if the event based
|
|
84
|
-
* system fails to fetch events and the local state is no
|
|
85
|
-
* more correct.
|
|
86
|
-
* @param blockNumber - Blocknumber for which the state should
|
|
87
|
-
* should be generated
|
|
88
|
-
* @returns state of the event subscriber at blocknumber
|
|
89
|
-
*/
|
|
90
|
-
async generateState(blockNumber) {
|
|
91
|
-
const resolverContract = new ethers_1.Contract(this.commonAddresses.resolver, resolver_abi_json_1.default, this.dexHelper.provider);
|
|
92
|
-
const rawResult = await resolverContract.callStatic.getAllPools({
|
|
93
|
-
blockTag: blockNumber,
|
|
94
|
-
});
|
|
95
|
-
const pools = rawResult.map((result) => ({
|
|
96
|
-
address: result[0],
|
|
97
|
-
token0: result[1],
|
|
98
|
-
token1: result[2],
|
|
99
|
-
}));
|
|
100
|
-
return pools;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.FluidDexCommonAddresses = FluidDexCommonAddresses;
|
|
104
|
-
//# sourceMappingURL=fluid-dex-generate-pool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fluid-dex-generate-pool.js","sourceRoot":"","sources":["../../../src/dex/fluid-dex/fluid-dex-generate-pool.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAI/C,uCAAiD;AACjD,+EAA0E;AAE1E,8FAAgE;AAChE,kGAAoE;AAIpE,iDAAoD;AACpD,mCAAkC;AAElC,MAAa,uBAAwB,SAAQ,mDAA+B;IAe1E,YACW,UAAkB,EAClB,eAAgC,EAC/B,OAAe,EACf,SAAqB,EAC/B,MAAc;QAEd,KAAK,CAAC,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAN3C,eAAU,GAAV,UAAU,CAAQ;QAClB,oBAAe,GAAf,eAAe,CAAiB;QAC/B,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAlBjC,aAAQ,GAMJ,EAAE,CAAC;QAKG,oBAAe,GAAG,IAAI,eAAS,CAAC,6BAAa,CAAC,CAAC;QAC/C,kBAAa,GAAG,IAAI,eAAS,CAAC,2BAAW,CAAC,CAAC;QA8BrD,eAAU,GAAG,CAAC,MAA0C,EAAQ,EAAE;YAChE,OAAO,IAAA,yBAAc,EACnB,MAAM,EACN,CAAC,kEAAkE,CAAC,EACpE,SAAS,EACT,OAAO,CAAC,EAAE;gBACR,OAAO;oBACL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;oBACjC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;oBAChC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;iBACjC,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;QAhCA,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC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CAAC;YAC9C,IAAI,CAAC,QAAQ;gBAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;SAClD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,MAAM,gBAAgB,GAAG,IAAI,iBAAQ,CACnC,IAAI,CAAC,eAAe,CAAC,QAAQ,EAC7B,2BAAW,EACX,IAAI,CAAC,SAAS,CAAC,QAAQ,CACxB,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC;YAC9D,QAAQ,EAAE,WAAW;SACtB,CAAC,CAAC;QAEH,MAAM,KAAK,GAAW,SAAS,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC;YACpD,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;YACjB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;SAClB,CAAC,CAAC,CAAC;QAEJ,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA/HD,0DA+HC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Adapters = exports.IntegralConfig = void 0;
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
5
|
-
exports.IntegralConfig = {
|
|
6
|
-
Integral: {
|
|
7
|
-
[constants_1.Network.MAINNET]: {
|
|
8
|
-
factoryAddress: '0xC480b33eE5229DE3FbDFAD1D2DCD3F3BAD0C56c6',
|
|
9
|
-
relayerAddress: '0xd17b3c9784510E33cD5B87b490E79253BcD81e2E',
|
|
10
|
-
subgraphURL: 'ANd5QJuYtyfngmXvBMu9kZAv935vhcqp4xAGBkmCADN3',
|
|
11
|
-
},
|
|
12
|
-
[constants_1.Network.ARBITRUM]: {
|
|
13
|
-
factoryAddress: '0x717EF162cf831db83c51134734A15D1EBe9E516a',
|
|
14
|
-
relayerAddress: '0x3c6951FDB433b5b8442e7aa126D50fBFB54b5f42',
|
|
15
|
-
subgraphURL: 'HXeVedRK7VgogXwbK5Sc4mjyLkhBAS5akskRvbSYnkHU',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
exports.Adapters = {};
|
|
20
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/integral/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,cAAc,GAA4B;IACrD,QAAQ,EAAE;QACR,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,cAAc,EAAE,4CAA4C;YAC5D,cAAc,EAAE,4CAA4C;YAC5D,WAAW,EAAE,8CAA8C;SAC5D;QACD,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;YAClB,cAAc,EAAE,4CAA4C;YAC5D,cAAc,EAAE,4CAA4C;YAC5D,WAAW,EAAE,8CAA8C;SAC5D;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAAoC,EAAE,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Address } from '@paraswap/core';
|
|
2
|
-
import { IntegralFactory } from './integral-factory';
|
|
3
|
-
import { IntegralRelayer } from './integral-relayer';
|
|
4
|
-
import { Network } from '../../constants';
|
|
5
|
-
import { IDexHelper } from '../../dex-helper';
|
|
6
|
-
import { Logger } from 'log4js';
|
|
7
|
-
import { Interface } from '@ethersproject/abi';
|
|
8
|
-
import { IntegralPool, PoolInitProps, RelayerPoolState } from './types';
|
|
9
|
-
import { IntegralToken } from './integral-token';
|
|
10
|
-
export declare class IntegralContext {
|
|
11
|
-
readonly network: Network;
|
|
12
|
-
readonly dexKey: string;
|
|
13
|
-
readonly dexHelper: IDexHelper;
|
|
14
|
-
readonly erc20Interface: Interface;
|
|
15
|
-
readonly factoryAddress: Address;
|
|
16
|
-
readonly relayerAddress: Address;
|
|
17
|
-
static instances: {
|
|
18
|
-
[network: number]: IntegralContext;
|
|
19
|
-
};
|
|
20
|
-
pools: {
|
|
21
|
-
[poolId: string]: IntegralPool;
|
|
22
|
-
};
|
|
23
|
-
tokens: {
|
|
24
|
-
[tokenAddress: Address]: IntegralToken;
|
|
25
|
-
};
|
|
26
|
-
factory: IntegralFactory;
|
|
27
|
-
relayer: IntegralRelayer;
|
|
28
|
-
logger: Logger;
|
|
29
|
-
private constructor();
|
|
30
|
-
addPools(pools: PoolInitProps, blockNumber: number, initPhase?: boolean): Promise<void>;
|
|
31
|
-
getPoolAddresses(): string[];
|
|
32
|
-
private removeDisabledPoolInitProps;
|
|
33
|
-
static initialize(network: Network, dexKey: string, dexHelper: IDexHelper, erc20Interface: Interface, factoryAddress: Address, relayerAddress: Address): IntegralContext;
|
|
34
|
-
static getInstance(network: Network): IntegralContext;
|
|
35
|
-
onRelayerPoolEnabledSet(poolAddress: Address, state: RelayerPoolState, blockNumber: number): Promise<void>;
|
|
36
|
-
onRebalanceSellOrderExecuted(blockNumber: number, orderId: bigint): void;
|
|
37
|
-
onPoolCreatedAddPool(token0: Address, token1: Address, poolAddress: Address, blockNumber: number): Promise<void>;
|
|
38
|
-
onPoolSwapForRelayer(blockNumber: number, poolAddress: Address, recipient: Address, amount0Out: bigint, amount1Out: bigint): Promise<void>;
|
|
39
|
-
onTransferUpdateBalance(token: Address, from: Address, to: Address, amount: bigint, blockNumber: number): Promise<void>;
|
|
40
|
-
}
|