@paraswap/dex-lib 3.8.12-solidlyv3 → 3.8.13-arusd-fxusd.1
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 +16 -0
- package/.vscode/settings.json +3 -0
- package/build/abi/Uncompressor.json +250 -0
- package/build/abi/concentrator/arUSD5115.json +1746 -0
- package/build/abi/fx-protocol/FxMarket.json +1284 -0
- 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/{inception/inception-ineth-pool.json → integral/pool.json} +522 -543
- package/build/abi/integral/relayer.json +1536 -0
- package/build/abi/maverick-v2/MaverickV2Router.json +778 -0
- package/build/dex/aave-v1/aave-v1.d.ts +1 -2
- package/build/dex/aave-v1/aave-v1.js +0 -22
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/bProtocol.d.ts +18 -0
- package/build/dex/bProtocol.js +39 -0
- package/build/dex/bProtocol.js.map +1 -0
- package/build/dex/bancor.d.ts +26 -0
- package/build/dex/bancor.js +58 -0
- package/build/dex/bancor.js.map +1 -0
- package/build/dex/compound.d.ts +18 -0
- package/build/dex/compound.js +46 -0
- package/build/dex/compound.js.map +1 -0
- 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 +4 -1
- package/build/dex/concentrator-arusd/concentrator-arusd.js +24 -33
- package/build/dex/concentrator-arusd/concentrator-arusd.js.map +1 -1
- package/build/dex/concentrator-arusd/config.js +1 -1
- package/build/dex/concentrator-arusd/config.js.map +1 -1
- package/build/dex/concentrator-arusd/types.d.ts +6 -2
- 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/curve-v2.d.ts +58 -0
- package/build/dex/curve-v2.js +180 -0
- package/build/dex/curve-v2.js.map +1 -0
- package/build/dex/dodo-v1.d.ts +33 -0
- package/build/dex/dodo-v1.js +63 -0
- package/build/dex/dodo-v1.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 +1 -2
- package/build/dex/fx-protocol-rusd/config.js +3 -6
- package/build/dex/fx-protocol-rusd/config.js.map +1 -1
- 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 +10 -10
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js +82 -65
- package/build/dex/fx-protocol-rusd/fx-protocol-rusd.js.map +1 -1
- package/build/dex/fx-protocol-rusd/types.d.ts +5 -2
- 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/{infusion → integral}/config.d.ts +1 -1
- 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/{inception/inception.d.ts → integral/integral.d.ts} +19 -20
- 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/lido.d.ts +19 -0
- package/build/dex/lido.js +42 -0
- package/build/dex/lido.js.map +1 -0
- package/build/dex/onebit.d.ts +25 -0
- package/build/dex/onebit.js +42 -0
- package/build/dex/onebit.js.map +1 -0
- package/build/dex/oswap/oswap.js +4 -1
- package/build/dex/oswap/oswap.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +1 -2
- package/build/dex/platypus/platypus.js +0 -31
- 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.d.ts +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/smoothy.d.ts +26 -0
- package/build/dex/smoothy.js +48 -0
- package/build/dex/smoothy.js.map +1 -0
- package/build/dex/stable-pool.d.ts +28 -0
- package/build/dex/stable-pool.js +62 -0
- package/build/dex/stable-pool.js.map +1 -0
- package/build/dex/swaap-v1/swaap-v1.d.ts +1 -2
- package/build/dex/swaap-v1/swaap-v1.js +0 -10
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/trader-joe-v2.1.d.ts +43 -0
- package/build/dex/trader-joe-v2.1.js +79 -0
- package/build/dex/trader-joe-v2.1.js.map +1 -0
- 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.d.ts +0 -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/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/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 +251 -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/wsteth/wsteth-integration.test.ts +0 -1
- package/tests/constants-e2e.ts +10 -0
- package/build/abi/inception/inception-ineth.json +0 -609
- package/build/abi/inception/inception-vault.json +0 -991
- package/build/abi/infusion/InfusionFactory.json +0 -147
- package/build/abi/infusion/InfusionPair.json +0 -658
- package/build/abi/infusion/InfusionRouter.json +0 -442
- package/build/dex/idle-dao/idle-dao-pool.d.ts +0 -56
- package/build/dex/idle-dao/idle-dao-pool.js +0 -176
- package/build/dex/idle-dao/idle-dao-pool.js.map +0 -1
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +0 -16
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +0 -57
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +0 -1
- package/build/dex/idle-dao/scripts.d.ts +0 -9
- package/build/dex/idle-dao/scripts.js +0 -552
- package/build/dex/idle-dao/scripts.js.map +0 -1
- package/build/dex/inception/config.d.ts +0 -5
- package/build/dex/inception/config.js +0 -100
- package/build/dex/inception/config.js.map +0 -1
- package/build/dex/inception/inception-native.d.ts +0 -43
- package/build/dex/inception/inception-native.js +0 -131
- package/build/dex/inception/inception-native.js.map +0 -1
- package/build/dex/inception/inception-pool.d.ts +0 -18
- package/build/dex/inception/inception-pool.js +0 -32
- package/build/dex/inception/inception-pool.js.map +0 -1
- package/build/dex/inception/inception.js +0 -128
- package/build/dex/inception/inception.js.map +0 -1
- package/build/dex/inception/types.d.ts +0 -11
- package/build/dex/inception/types.js +0 -3
- package/build/dex/inception/types.js.map +0 -1
- package/build/dex/inception/utils.d.ts +0 -4
- package/build/dex/inception/utils.js +0 -22
- package/build/dex/inception/utils.js.map +0 -1
- package/build/dex/infusion/config.js +0 -25
- package/build/dex/infusion/config.js.map +0 -1
- package/build/dex/infusion/infusion-stable-pool.d.ts +0 -4
- package/build/dex/infusion/infusion-stable-pool.js +0 -74
- package/build/dex/infusion/infusion-stable-pool.js.map +0 -1
- package/build/dex/infusion/infusion.d.ts +0 -54
- package/build/dex/infusion/infusion.js +0 -532
- package/build/dex/infusion/infusion.js.map +0 -1
- package/build/dex/infusion/types.d.ts +0 -47
- package/build/dex/infusion/types.js +0 -3
- package/build/dex/infusion/types.js.map +0 -1
- package/build/dex/infusion/utils/isStablePair.d.ts +0 -2
- package/build/dex/infusion/utils/isStablePair.js +0 -18
- package/build/dex/infusion/utils/isStablePair.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Interface } from '@ethersproject/abi';
|
|
2
|
-
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger
|
|
2
|
+
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger } from '../../types';
|
|
3
3
|
import { SwapSide, Network } from '../../constants';
|
|
4
4
|
import { IDex } from '../../dex/idex';
|
|
5
5
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
@@ -28,7 +28,6 @@ export declare class AaveV1 extends SimpleExchange implements IDex<AaveV1Data, A
|
|
|
28
28
|
getCalldataGasCost(poolPrices: PoolPrices<AaveV1Data>): number | number[];
|
|
29
29
|
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: AaveV1Data, side: SwapSide): AdapterExchangeParam;
|
|
30
30
|
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: AaveV1Data, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
31
|
-
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: AaveV1Data, side: SwapSide): DexExchangeParam;
|
|
32
31
|
updatePoolState(): Promise<void>;
|
|
33
32
|
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
34
33
|
}
|
|
@@ -139,28 +139,6 @@ class AaveV1 extends simple_exchange_1.SimpleExchange {
|
|
|
139
139
|
const swapData = Interface.encodeFunctionData(swapFunction, swapFunctionParams);
|
|
140
140
|
return this.buildSimpleParamWithoutWETHConversion(srcToken, amount, destToken, destAmount, swapData, swapCallee, spender);
|
|
141
141
|
}
|
|
142
|
-
// DEAD
|
|
143
|
-
getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
144
|
-
const amount = side === constants_1.SwapSide.SELL ? srcAmount : destAmount;
|
|
145
|
-
const [Interface, swapFunction, swapFunctionParams, swapCallee] = (() => {
|
|
146
|
-
if (data.fromAToken) {
|
|
147
|
-
return [this.aContract, AaveV1Functions.redeem, [amount], srcToken];
|
|
148
|
-
}
|
|
149
|
-
return [
|
|
150
|
-
this.aavePool,
|
|
151
|
-
AaveV1Functions.deposit,
|
|
152
|
-
[srcToken, amount, REF_CODE],
|
|
153
|
-
AAVE_LENDING_POOL,
|
|
154
|
-
];
|
|
155
|
-
})();
|
|
156
|
-
const exchangeData = Interface.encodeFunctionData(swapFunction, swapFunctionParams);
|
|
157
|
-
return {
|
|
158
|
-
needWrapNative: this.needWrapNative,
|
|
159
|
-
dexFuncHasRecipient: false,
|
|
160
|
-
exchangeData,
|
|
161
|
-
targetExchange: swapCallee,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
142
|
// This is called once before getTopPoolsForToken is
|
|
165
143
|
// called for multiple tokens. This can be helpful to
|
|
166
144
|
// update common state required for calculating
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aave-v1.js","sourceRoot":"","sources":["../../../src/dex/aave-v1/aave-v1.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA6D;
|
|
1
|
+
{"version":3,"file":"aave-v1.js","sourceRoot":"","sources":["../../../src/dex/aave-v1/aave-v1.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA6D;A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C,YAAY,EACZ,kBAAkB,CACnB,CAAC;QAEF,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,MAAM,EACN,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;IAED,oDAAoD;IACpD,qDAAqD;IACrD,+CAA+C;IAC/C,gDAAgD;IAChD,oBAAoB;IACpB,eAAe;QACb,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,oDAAoD;IACpD,yCAAyC;IACzC,KAAK,CAAC,mBAAmB,CACvB,YAAqB,EACrB,KAAa;QAEb,OAAO,EAAE,CAAC;IACZ,CAAC;;AApLH,wBAqLC;AA9Ke,yBAAkB,GAC9B,IAAA,6BAAqB,EAAC,qBAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { SwapSide } from '../constants';
|
|
3
|
+
import { AdapterExchangeParam, SimpleExchangeParam } from '../types';
|
|
4
|
+
import { IDexTxBuilder } from './idex';
|
|
5
|
+
import { SimpleExchange } from './simple-exchange';
|
|
6
|
+
import { IDexHelper } from '../dex-helper';
|
|
7
|
+
export declare type BProtocolData = {
|
|
8
|
+
exchange: string;
|
|
9
|
+
};
|
|
10
|
+
declare type BProtocolParam = [lusdAmount: string, minEthReturn: string, dest: string];
|
|
11
|
+
export declare class BProtocol extends SimpleExchange implements IDexTxBuilder<BProtocolData, BProtocolParam> {
|
|
12
|
+
static dexKeys: string[];
|
|
13
|
+
exchangeRouterInterface: Interface;
|
|
14
|
+
constructor(dexHelper: IDexHelper);
|
|
15
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: BProtocolData, side: SwapSide): AdapterExchangeParam;
|
|
16
|
+
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: BProtocolData, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
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.BProtocol = void 0;
|
|
7
|
+
const abi_1 = require("@ethersproject/abi");
|
|
8
|
+
const simple_exchange_1 = require("./simple-exchange");
|
|
9
|
+
const BProtocol_json_1 = __importDefault(require("../abi/BProtocol.json"));
|
|
10
|
+
var BProtocolFunctions;
|
|
11
|
+
(function (BProtocolFunctions) {
|
|
12
|
+
BProtocolFunctions["swap"] = "swap";
|
|
13
|
+
})(BProtocolFunctions || (BProtocolFunctions = {}));
|
|
14
|
+
class BProtocol extends simple_exchange_1.SimpleExchange {
|
|
15
|
+
constructor(dexHelper) {
|
|
16
|
+
super(dexHelper, 'bprotocol');
|
|
17
|
+
this.exchangeRouterInterface = new abi_1.Interface(BProtocol_json_1.default);
|
|
18
|
+
}
|
|
19
|
+
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
20
|
+
return {
|
|
21
|
+
targetExchange: data.exchange,
|
|
22
|
+
payload: '0x',
|
|
23
|
+
networkFee: '0',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
27
|
+
const swapFunction = BProtocolFunctions.swap;
|
|
28
|
+
const swapFunctionParams = [
|
|
29
|
+
srcAmount,
|
|
30
|
+
destAmount,
|
|
31
|
+
this.augustusAddress,
|
|
32
|
+
];
|
|
33
|
+
const swapData = this.exchangeRouterInterface.encodeFunctionData(swapFunction, swapFunctionParams);
|
|
34
|
+
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, data.exchange);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.BProtocol = BProtocol;
|
|
38
|
+
BProtocol.dexKeys = ['bprotocol'];
|
|
39
|
+
//# sourceMappingURL=bProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bProtocol.js","sourceRoot":"","sources":["../../src/dex/bProtocol.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAI7D,uDAAmD;AACnD,2EAAiD;AAOjD,IAAK,kBAEJ;AAFD,WAAK,kBAAkB;IACrB,mCAAa,CAAA;AACf,CAAC,EAFI,kBAAkB,KAAlB,kBAAkB,QAEtB;AAED,MAAa,SACX,SAAQ,gCAAc;IAMtB,YAAY,SAAqB;QAC/B,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC9B,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAS,CAC1C,wBAA8B,CAC/B,CAAC;IACJ,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAmB,EACnB,IAAc;QAEd,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,QAAQ;YAC7B,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAmB,EACnB,IAAc;QAEd,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC;QAC7C,MAAM,kBAAkB,GAAmB;YACzC,SAAS;YACT,UAAU;YACV,IAAI,CAAC,eAAe;SACrB,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,CAC9D,YAAY,EACZ,kBAAkB,CACnB,CAAC;QAEF,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,IAAI,CAAC,QAAQ,CACd,CAAC;IACJ,CAAC;;AAxDH,8BAyDC;AArDQ,iBAAO,GAAG,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { SwapSide } from '../constants';
|
|
3
|
+
import { AdapterExchangeParam, Address, SimpleExchangeParam } from '../types';
|
|
4
|
+
import { IDexTxBuilder } from './idex';
|
|
5
|
+
import { SimpleExchange } from './simple-exchange';
|
|
6
|
+
import { IDexHelper } from '../dex-helper';
|
|
7
|
+
export declare type BancorData = {
|
|
8
|
+
minDestToken: string;
|
|
9
|
+
path: Address[];
|
|
10
|
+
bancorNetwork?: string;
|
|
11
|
+
};
|
|
12
|
+
declare type BancorParam = [
|
|
13
|
+
path: Address[],
|
|
14
|
+
srcAmount: string,
|
|
15
|
+
minDestToken: string,
|
|
16
|
+
affiliateAccount: string,
|
|
17
|
+
affiliateFee: string
|
|
18
|
+
];
|
|
19
|
+
export declare class Bancor extends SimpleExchange implements IDexTxBuilder<BancorData, BancorParam> {
|
|
20
|
+
static dexKeys: string[];
|
|
21
|
+
exchangeRouterInterface: Interface;
|
|
22
|
+
constructor(dexHelper: IDexHelper);
|
|
23
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: BancorData, side: SwapSide): AdapterExchangeParam;
|
|
24
|
+
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: BancorData, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
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.Bancor = 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 Bancor_json_1 = __importDefault(require("../abi/Bancor.json"));
|
|
11
|
+
const BANCOR_NETWORK = {
|
|
12
|
+
1: '0x2F9EC37d6CcFFf1caB21733BdaDEdE11c823cCB0',
|
|
13
|
+
};
|
|
14
|
+
const BancorRegistry = {
|
|
15
|
+
1: '0x52ae12abe5d8bd778bd5397f99ca900624cfadd4',
|
|
16
|
+
};
|
|
17
|
+
var BancorFunctions;
|
|
18
|
+
(function (BancorFunctions) {
|
|
19
|
+
BancorFunctions["convert2"] = "convert2";
|
|
20
|
+
})(BancorFunctions || (BancorFunctions = {}));
|
|
21
|
+
class Bancor extends simple_exchange_1.SimpleExchange {
|
|
22
|
+
constructor(dexHelper) {
|
|
23
|
+
super(dexHelper, 'bancor');
|
|
24
|
+
this.exchangeRouterInterface = new abi_1.Interface(Bancor_json_1.default);
|
|
25
|
+
}
|
|
26
|
+
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
27
|
+
if (side === constants_1.SwapSide.BUY)
|
|
28
|
+
throw new Error(`Buy not supported`);
|
|
29
|
+
const { path } = data;
|
|
30
|
+
const payload = this.abiCoder.encodeParameter({
|
|
31
|
+
ParentStruct: {
|
|
32
|
+
path: 'address[]',
|
|
33
|
+
},
|
|
34
|
+
}, { path });
|
|
35
|
+
return {
|
|
36
|
+
targetExchange: BancorRegistry[this.network],
|
|
37
|
+
payload,
|
|
38
|
+
networkFee: '0',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
42
|
+
if (side === constants_1.SwapSide.BUY)
|
|
43
|
+
throw new Error(`Buy not supported`);
|
|
44
|
+
const defaultArgs = [
|
|
45
|
+
data.path,
|
|
46
|
+
srcAmount,
|
|
47
|
+
data.minDestToken || '1',
|
|
48
|
+
constants_1.NULL_ADDRESS,
|
|
49
|
+
'0',
|
|
50
|
+
];
|
|
51
|
+
const swapMethod = BancorFunctions.convert2;
|
|
52
|
+
const swapData = this.exchangeRouterInterface.encodeFunctionData(swapMethod, defaultArgs);
|
|
53
|
+
return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, data.bancorNetwork || BANCOR_NETWORK[this.network]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.Bancor = Bancor;
|
|
57
|
+
Bancor.dexKeys = ['bancor'];
|
|
58
|
+
//# sourceMappingURL=bancor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bancor.js","sourceRoot":"","sources":["../../src/dex/bancor.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA6D;AAC7D,4CAAsD;AAGtD,uDAAmD;AACnD,qEAA2C;AAI3C,MAAM,cAAc,GAAkC;IACpD,CAAC,EAAE,4CAA4C;CAChD,CAAC;AAEF,MAAM,cAAc,GAAkC;IACpD,CAAC,EAAE,4CAA4C;CAChD,CAAC;AAgBF,IAAK,eAEJ;AAFD,WAAK,eAAe;IAClB,wCAAqB,CAAA;AACvB,CAAC,EAFI,eAAe,KAAf,eAAe,QAEnB;AAED,MAAa,MACX,SAAQ,gCAAc;IAMtB,YAAY,SAAqB;QAC/B,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC3B,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAS,CAAC,qBAA2B,CAAC,CAAC;IAC5E,CAAC;IAED,eAAe,CACb,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAgB,EAChB,IAAc;QAEd,IAAI,IAAI,KAAK,oBAAQ,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEhE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QACtB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,CAC3C;YACE,YAAY,EAAE;gBACZ,IAAI,EAAE,WAAW;aAClB;SACF,EACD,EAAE,IAAI,EAAE,CACT,CAAC;QAEF,OAAO;YACL,cAAc,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC;YAC5C,OAAO;YACP,UAAU,EAAE,GAAG;SAChB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,IAAgB,EAChB,IAAc;QAEd,IAAI,IAAI,KAAK,oBAAQ,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEhE,MAAM,WAAW,GAAG;YAClB,IAAI,CAAC,IAAI;YACT,SAAS;YACT,IAAI,CAAC,YAAY,IAAI,GAAG;YACxB,wBAAY;YACZ,GAAG;SACJ,CAAC;QACF,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,CAAC;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,CAC9D,UAAU,EACV,WAAW,CACZ,CAAC;QAEF,OAAO,IAAI,CAAC,qCAAqC,CAC/C,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,IAAI,CAAC,aAAa,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CACnD,CAAC;IACJ,CAAC;;AAtEH,wBAuEC;AAnEQ,cAAO,GAAG,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { SwapSide } from '../constants';
|
|
3
|
+
import { AdapterExchangeParam, SimpleExchangeParam } from '../types';
|
|
4
|
+
import { IDexTxBuilder } from './idex';
|
|
5
|
+
import { SimpleExchange } from './simple-exchange';
|
|
6
|
+
import { IDexHelper } from '../dex-helper';
|
|
7
|
+
export declare type CompoundData = {
|
|
8
|
+
fromCToken: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare type CompoundParam = [srcAmount: string];
|
|
11
|
+
export declare class Compound extends SimpleExchange implements IDexTxBuilder<CompoundData, CompoundParam> {
|
|
12
|
+
static dexKeys: string[];
|
|
13
|
+
cethInterface: Interface;
|
|
14
|
+
constructor(dexHelper: IDexHelper);
|
|
15
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: CompoundData, side: SwapSide): AdapterExchangeParam;
|
|
16
|
+
getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: CompoundData, side: SwapSide): Promise<SimpleExchangeParam>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
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, undefined, undefined, undefined, data.fromCToken);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Compound = Compound;
|
|
45
|
+
Compound.dexKeys = ['compound'];
|
|
46
|
+
//# sourceMappingURL=compound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;I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
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Interface } from '@ethersproject/abi';
|
|
2
|
+
import { IDexHelper } from '../../dex-helper';
|
|
3
|
+
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
4
|
+
import { Address, Log, Logger } from '../../types';
|
|
5
|
+
import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
6
|
+
import { ConcentratorArusdState } from './types';
|
|
7
|
+
export declare class ConcentratorArusdEvent extends StatefulEventSubscriber<ConcentratorArusdState> {
|
|
8
|
+
protected dexHelper: IDexHelper;
|
|
9
|
+
private poolAddress;
|
|
10
|
+
private poolInterface;
|
|
11
|
+
decoder: (log: Log) => import("@ethersproject/abi").LogDescription;
|
|
12
|
+
constructor(parentName: string, dexHelper: IDexHelper, poolAddress: Address, poolInterface: Interface, logger: Logger);
|
|
13
|
+
protected processLog(state: DeepReadonly<ConcentratorArusdState>, log: Readonly<Log>): AsyncOrSync<DeepReadonly<ConcentratorArusdState> | null>;
|
|
14
|
+
generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<ConcentratorArusdState>>;
|
|
15
|
+
getPrice(blockNumber: number, ethAmount: bigint, is_deposit: boolean): bigint;
|
|
16
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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.ConcentratorArusdEvent = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
|
|
9
|
+
const bigint_constants_1 = require("../../bigint-constants");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
|
+
const utils_2 = require("./utils");
|
|
12
|
+
class ConcentratorArusdEvent extends stateful_event_subscriber_1.StatefulEventSubscriber {
|
|
13
|
+
constructor(parentName, dexHelper, poolAddress, poolInterface, logger) {
|
|
14
|
+
super(parentName, 'ConcentratorArusd', dexHelper, logger);
|
|
15
|
+
this.dexHelper = dexHelper;
|
|
16
|
+
this.poolAddress = poolAddress;
|
|
17
|
+
this.poolInterface = poolInterface;
|
|
18
|
+
this.decoder = (log) => this.poolInterface.parseLog(log);
|
|
19
|
+
this.addressesSubscribed = [poolAddress];
|
|
20
|
+
}
|
|
21
|
+
processLog(state, log) {
|
|
22
|
+
const event = this.decoder(log);
|
|
23
|
+
const _state = lodash_1.default.cloneDeep(state);
|
|
24
|
+
if (event.name === 'Deposit') {
|
|
25
|
+
_state.totalSupply += (0, utils_1.bigIntify)(event.args.amountSyOut);
|
|
26
|
+
_state.totalAssets += (0, utils_1.bigIntify)(event.args.amountDeposited);
|
|
27
|
+
return _state;
|
|
28
|
+
}
|
|
29
|
+
else if (event.name === 'Redeem') {
|
|
30
|
+
_state.totalSupply -= (0, utils_1.bigIntify)(event.args.amountSyToRedeem);
|
|
31
|
+
_state.totalAssets -= (0, utils_1.bigIntify)(event.args.amountTokenOut);
|
|
32
|
+
return _state;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
async generateState(blockNumber = 'latest') {
|
|
37
|
+
const state = await (0, utils_2.getOnChainState)(this.dexHelper.multiContract, this.poolAddress, this.poolInterface, blockNumber);
|
|
38
|
+
return state;
|
|
39
|
+
}
|
|
40
|
+
getPrice(blockNumber, ethAmount, is_deposit) {
|
|
41
|
+
const state = this.getState(blockNumber);
|
|
42
|
+
if (!state)
|
|
43
|
+
throw new Error('Cannot compute price');
|
|
44
|
+
const { totalSupply, totalAssets } = state;
|
|
45
|
+
const nav = (BigInt(totalAssets) * bigint_constants_1.BI_POWS[18]) / BigInt(totalSupply);
|
|
46
|
+
if (is_deposit) {
|
|
47
|
+
return BigInt((ethAmount * bigint_constants_1.BI_POWS[18]) / nav);
|
|
48
|
+
}
|
|
49
|
+
return BigInt((nav * ethAmount) / bigint_constants_1.BI_POWS[18]);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.ConcentratorArusdEvent = ConcentratorArusdEvent;
|
|
53
|
+
//# sourceMappingURL=concentrator-arusd-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concentrator-arusd-event.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/concentrator-arusd-event.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAGvB,+EAA0E;AAI1E,6DAAiD;AACjD,uCAAwC;AACxC,mCAA0C;AAE1C,MAAa,sBAAuB,SAAQ,mDAA+C;IAGzF,YACE,UAAkB,EACR,SAAqB,EACvB,WAAoB,EACpB,aAAwB,EAChC,MAAc;QAEd,KAAK,CAAC,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QALhD,cAAS,GAAT,SAAS,CAAY;QACvB,gBAAW,GAAX,WAAW,CAAS;QACpB,kBAAa,GAAb,aAAa,CAAW;QANlC,YAAO,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAUvD,IAAI,CAAC,mBAAmB,GAAG,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAES,UAAU,CAClB,KAA2C,EAC3C,GAAkB;QAElB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,MAAM,GAA2B,gBAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;YAC5B,MAAM,CAAC,WAAW,IAAI,IAAA,iBAAS,EAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACxD,MAAM,CAAC,WAAW,IAAI,IAAA,iBAAS,EAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YA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} from '../../dex-helper/idex-helper';
|
|
|
5
5
|
import { ConcentratorArusdData, DexParams } from './types';
|
|
6
6
|
import { SimpleExchange } from '../simple-exchange';
|
|
7
7
|
import { Interface } from '@ethersproject/abi';
|
|
8
|
+
import { ConcentratorArusdEvent } from './concentrator-arusd-event';
|
|
8
9
|
export declare class ConcentratorArusd extends SimpleExchange implements IDex<ConcentratorArusdData> {
|
|
9
10
|
readonly network: Network;
|
|
10
11
|
readonly dexKey: string;
|
|
@@ -19,11 +20,13 @@ export declare class ConcentratorArusd extends SimpleExchange implements IDex<Co
|
|
|
19
20
|
key: string;
|
|
20
21
|
networks: Network[];
|
|
21
22
|
}[];
|
|
23
|
+
arUSD5115Iface: Interface;
|
|
24
|
+
concentratorArusdEvent: ConcentratorArusdEvent;
|
|
22
25
|
logger: Logger;
|
|
23
26
|
constructor(network: Network, dexKey: string, dexHelper: IDexHelper, adapters?: import("../../types").AdapterMappings);
|
|
27
|
+
initializePricing(blockNumber: number): Promise<void>;
|
|
24
28
|
is_arUSD(token: string): boolean;
|
|
25
29
|
is_rUSD(token: string): boolean;
|
|
26
|
-
is_weETH(token: string): boolean;
|
|
27
30
|
is_arUSD_swap_token(srcToken: string, destToken: string): boolean;
|
|
28
31
|
getAdapters(side: SwapSide): {
|
|
29
32
|
name: string;
|
|
@@ -33,7 +33,11 @@ const simple_exchange_1 = require("../simple-exchange");
|
|
|
33
33
|
const config_1 = require("./config");
|
|
34
34
|
const abi_1 = require("@ethersproject/abi");
|
|
35
35
|
const arUSD_json_1 = __importDefault(require("../../abi/concentrator/arUSD.json"));
|
|
36
|
+
const arUSD5115_json_1 = __importDefault(require("../../abi/concentrator/arUSD5115.json"));
|
|
36
37
|
const utils_2 = require("../../executor/utils");
|
|
38
|
+
const bigint_constants_1 = require("../../bigint-constants");
|
|
39
|
+
const concentrator_arusd_event_1 = require("./concentrator-arusd-event");
|
|
40
|
+
const utils_3 = require("./utils");
|
|
37
41
|
class ConcentratorArusd extends simple_exchange_1.SimpleExchange {
|
|
38
42
|
constructor(network, dexKey, dexHelper, adapters = config_1.Adapters[network] || {}) {
|
|
39
43
|
super(dexHelper, dexKey);
|
|
@@ -48,9 +52,17 @@ class ConcentratorArusd extends simple_exchange_1.SimpleExchange {
|
|
|
48
52
|
this.config = {
|
|
49
53
|
rUSDAddress: config.rUSDAddress.toLowerCase(),
|
|
50
54
|
arUSDAddress: config.arUSDAddress.toLowerCase(),
|
|
51
|
-
|
|
55
|
+
arUSD5115Address: config.arUSD5115Address.toLowerCase(),
|
|
52
56
|
};
|
|
57
|
+
this.arUSD5115Iface = new abi_1.Interface(arUSD5115_json_1.default);
|
|
53
58
|
this.logger = dexHelper.getLogger(dexKey);
|
|
59
|
+
this.concentratorArusdEvent = new concentrator_arusd_event_1.ConcentratorArusdEvent(this.dexKey, dexHelper, this.config.arUSD5115Address, this.arUSD5115Iface, this.logger);
|
|
60
|
+
}
|
|
61
|
+
async initializePricing(blockNumber) {
|
|
62
|
+
const poolState = await (0, utils_3.getOnChainState)(this.dexHelper.multiContract, this.config.arUSD5115Address, this.arUSD5115Iface, blockNumber);
|
|
63
|
+
await this.concentratorArusdEvent.initialize(blockNumber, {
|
|
64
|
+
state: poolState,
|
|
65
|
+
});
|
|
54
66
|
}
|
|
55
67
|
is_arUSD(token) {
|
|
56
68
|
return token.toLowerCase() === this.config.arUSDAddress;
|
|
@@ -58,9 +70,6 @@ class ConcentratorArusd extends simple_exchange_1.SimpleExchange {
|
|
|
58
70
|
is_rUSD(token) {
|
|
59
71
|
return token.toLowerCase() === this.config.rUSDAddress;
|
|
60
72
|
}
|
|
61
|
-
is_weETH(token) {
|
|
62
|
-
return token.toLowerCase() === this.config.weETHAddress;
|
|
63
|
-
}
|
|
64
73
|
is_arUSD_swap_token(srcToken, destToken) {
|
|
65
74
|
if (this.is_rUSD(srcToken) && this.is_arUSD(destToken)) {
|
|
66
75
|
return true;
|
|
@@ -68,9 +77,6 @@ class ConcentratorArusd extends simple_exchange_1.SimpleExchange {
|
|
|
68
77
|
if (this.is_arUSD(srcToken) && this.is_rUSD(destToken)) {
|
|
69
78
|
return true;
|
|
70
79
|
}
|
|
71
|
-
if (this.is_arUSD(srcToken) && this.is_weETH(destToken)) {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
80
|
return false;
|
|
75
81
|
}
|
|
76
82
|
getAdapters(side) {
|
|
@@ -87,26 +93,22 @@ class ConcentratorArusd extends simple_exchange_1.SimpleExchange {
|
|
|
87
93
|
if (!isArUSDSwapToken) {
|
|
88
94
|
return null;
|
|
89
95
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// true,
|
|
99
|
-
// readerCallData,
|
|
100
|
-
// blockNumber,
|
|
101
|
-
// );
|
|
96
|
+
const is_deposit = !!this.is_rUSD(srcToken.address);
|
|
97
|
+
const pool = this.concentratorArusdEvent;
|
|
98
|
+
const unitIn = bigint_constants_1.BI_POWS[18];
|
|
99
|
+
const unitOut = pool.getPrice(blockNumber, unitIn, is_deposit);
|
|
100
|
+
const amountsOut = amounts.map(amountIn => {
|
|
101
|
+
const _newPrice = pool.getPrice(blockNumber, amountIn, is_deposit);
|
|
102
|
+
return _newPrice;
|
|
103
|
+
});
|
|
102
104
|
return [
|
|
103
105
|
{
|
|
104
|
-
unit:
|
|
105
|
-
prices:
|
|
106
|
+
unit: unitOut,
|
|
107
|
+
prices: amountsOut,
|
|
106
108
|
data: {},
|
|
107
109
|
poolAddresses: [this.config.arUSDAddress],
|
|
108
110
|
exchange: this.dexKey,
|
|
109
|
-
gasCost:
|
|
111
|
+
gasCost: 1000000,
|
|
110
112
|
},
|
|
111
113
|
];
|
|
112
114
|
}
|
|
@@ -127,7 +129,6 @@ class ConcentratorArusd extends simple_exchange_1.SimpleExchange {
|
|
|
127
129
|
const is_arUSD_src = this.is_arUSD(srcToken);
|
|
128
130
|
const is_rUSD_dest = this.is_rUSD(destToken);
|
|
129
131
|
const is_arUSD_dest = this.is_arUSD(destToken);
|
|
130
|
-
const is_weETH_dest = this.is_weETH(destToken);
|
|
131
132
|
if (is_rUSD_src && is_arUSD_dest) {
|
|
132
133
|
const exchangeData = ConcentratorArusd.arUSDIface.encodeFunctionData('deposit', [srcAmount, recipient]);
|
|
133
134
|
return {
|
|
@@ -148,16 +149,6 @@ class ConcentratorArusd extends simple_exchange_1.SimpleExchange {
|
|
|
148
149
|
returnAmountPos: (0, utils_2.extractReturnAmountPosition)(ConcentratorArusd.arUSDIface, 'redeem', 'assets'),
|
|
149
150
|
};
|
|
150
151
|
}
|
|
151
|
-
if (is_arUSD_src && is_weETH_dest) {
|
|
152
|
-
const exchangeData = ConcentratorArusd.arUSDIface.encodeFunctionData('redeemToBaseToken', [srcAmount, recipient, executorAddress, 0]);
|
|
153
|
-
return {
|
|
154
|
-
needWrapNative: false,
|
|
155
|
-
dexFuncHasRecipient: true,
|
|
156
|
-
exchangeData,
|
|
157
|
-
targetExchange: this.config.arUSDAddress,
|
|
158
|
-
returnAmountPos: (0, utils_2.extractReturnAmountPosition)(ConcentratorArusd.arUSDIface, 'redeemToBaseToken', 'assets'),
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
152
|
throw new Error('LOGIC ERROR');
|
|
162
153
|
}
|
|
163
154
|
// Returns list of top pools based on liquidity. Max
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concentrator-arusd.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/concentrator-arusd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,2EAA6D;AAC7D,uCAAoD;AAIpD,wDAAoD;AACpD,qCAA6D;AAC7D,4CAA+C;AAC/C,mFAA0D;AAC1D,gDAAmE;
|
|
1
|
+
{"version":3,"file":"concentrator-arusd.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/concentrator-arusd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;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ACT;aACF,CAAC;SACH;QACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;IAED,oDAAoD;IACpD,yCAAyC;IACzC,KAAK,CAAC,mBAAmB,CACvB,YAAqB,EACrB,KAAa;QAEb,OAAO;YACL;gBACE,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;gBACjC,eAAe,EAAE;oBACf;wBACE,QAAQ,EAAE,EAAE;wBACZ,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;qBAClC;iBACF;gBACD,YAAY,EAAE,UAAU,EAAE,4DAA4D;aACvF;SACF,CAAC;IACJ,CAAC;;AA9NH,8CA+NC;AA3NiB,4BAAU,GAAG,IAAI,eAAS,CAAC,oBAAS,CAAC,CAAC;AASxC,oCAAkB,GAC9B,IAAA,6BAAqB,EAAC,gCAAuB,CAAC,CAAC"}
|
|
@@ -7,7 +7,7 @@ exports.ConcentratorArusdConfig = {
|
|
|
7
7
|
[constants_1.Network.MAINNET]: {
|
|
8
8
|
rUSDAddress: '0x65D72AA8DA931F047169112fcf34f52DbaAE7D18',
|
|
9
9
|
arUSDAddress: '0x07D1718fF05a8C53C8F05aDAEd57C0d672945f9a',
|
|
10
|
-
|
|
10
|
+
arUSD5115Address: '0x549716F858aefF9CB845d4C78c67A7599B0Df240',
|
|
11
11
|
},
|
|
12
12
|
},
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,uBAAuB,GAA4B;IAC9D,iBAAiB,EAAE;QACjB,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,WAAW,EAAE,4CAA4C;YACzD,YAAY,EAAE,4CAA4C;YAC1D,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/config.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AAEvC,QAAA,uBAAuB,GAA4B;IAC9D,iBAAiB,EAAE;QACjB,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,WAAW,EAAE,4CAA4C;YACzD,YAAY,EAAE,4CAA4C;YAC1D,gBAAgB,EAAE,4CAA4C;SAC/D;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAAoC;IACvD,6BAA6B;IAC7B,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,oBAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE;CAC1E,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Address } from '../../types';
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type ConcentratorArusdState = {
|
|
3
|
+
totalSupply: bigint;
|
|
4
|
+
totalAssets: bigint;
|
|
5
|
+
};
|
|
6
|
+
export declare type ConcentratorArusdNavState = {
|
|
3
7
|
nav: bigint;
|
|
4
8
|
};
|
|
5
9
|
export declare type ConcentratorArusdData = {};
|
|
6
10
|
export declare type DexParams = {
|
|
7
11
|
arUSDAddress: Address;
|
|
8
12
|
rUSDAddress: Address;
|
|
9
|
-
|
|
13
|
+
arUSD5115Address: Address;
|
|
10
14
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Contract } from 'web3-eth-contract';
|
|
2
|
+
import { ConcentratorArusdState } from './types';
|
|
3
|
+
import { Interface } from '@ethersproject/abi';
|
|
4
|
+
export declare function getOnChainState(multiContract: Contract, poolAddress: string, poolInterface: Interface, blockNumber: number | 'latest'): Promise<ConcentratorArusdState>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOnChainState = void 0;
|
|
4
|
+
const abi_1 = require("@ethersproject/abi");
|
|
5
|
+
const coder = new abi_1.AbiCoder();
|
|
6
|
+
async function getOnChainState(multiContract, poolAddress, poolInterface, blockNumber) {
|
|
7
|
+
const data = await multiContract.methods
|
|
8
|
+
.aggregate([
|
|
9
|
+
{
|
|
10
|
+
target: poolAddress,
|
|
11
|
+
callData: poolInterface.encodeFunctionData('totalSupply', []),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
target: poolAddress,
|
|
15
|
+
callData: poolInterface.encodeFunctionData('getTotalAssets', []),
|
|
16
|
+
},
|
|
17
|
+
])
|
|
18
|
+
.call({}, blockNumber);
|
|
19
|
+
const totalSupply = BigInt(poolInterface.decodeFunctionResult('totalSupply', data.returnData[0])[0]);
|
|
20
|
+
const totalAssets = BigInt(poolInterface.decodeFunctionResult('getTotalAssets', data.returnData[1])[0]);
|
|
21
|
+
return {
|
|
22
|
+
totalSupply,
|
|
23
|
+
totalAssets,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.getOnChainState = getOnChainState;
|
|
27
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/dex/concentrator-arusd/utils.ts"],"names":[],"mappings":";;;AAEA,4CAAyD;AAEzD,MAAM,KAAK,GAAG,IAAI,cAAQ,EAAE,CAAC;AAEtB,KAAK,UAAU,eAAe,CACnC,aAAuB,EACvB,WAAmB,EACnB,aAAwB,EACxB,WAA8B;IAE9B,MAAM,IAAI,GAA0B,MAAM,aAAa,CAAC,OAAO;SAC5D,SAAS,CAAC;QACT;YACE,MAAM,EAAE,WAAW;YACnB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,aAAa,EAAE,EAAE,CAAC;SAC9D;QACD;YACE,MAAM,EAAE,WAAW;YACnB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,EAAE,CAAC;SACjE;KACF,CAAC;SACD,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAEzB,MAAM,WAAW,GAAG,MAAM,CACxB,aAAa,CAAC,oBAAoB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACzE,CAAC;IACF,MAAM,WAAW,GAAG,MAAM,CACxB,aAAa,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC5E,CAAC;IACF,OAAO;QACL,WAAW;QACX,WAAW;KACZ,CAAC;AACJ,CAAC;AA7BD,0CA6BC"}
|