@paraswap/dex-lib 3.8.25 → 3.8.26-aave-gsm.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/abi/Aave_GSM.json +751 -0
- package/build/abi/inception/inception-ineth-pool.json +1062 -0
- package/build/abi/inception/inception-ineth.json +609 -0
- package/build/abi/inception/inception-ratio-feed.json +93 -0
- package/build/abi/inception/inception-vault.json +991 -0
- package/build/abi/{integral/pool.json → usual-bond/usd0pp.abi.json} +389 -563
- package/build/dex/aave-gsm/aave-gsm.d.ts +33 -0
- package/build/dex/aave-gsm/aave-gsm.js +283 -0
- package/build/dex/aave-gsm/aave-gsm.js.map +1 -0
- package/build/dex/aave-gsm/config.d.ts +3 -0
- package/build/dex/aave-gsm/config.js +17 -0
- package/build/dex/aave-gsm/config.js.map +1 -0
- package/build/dex/aave-gsm/types.d.ts +11 -0
- package/build/dex/aave-gsm/types.js +3 -0
- package/build/dex/aave-gsm/types.js.map +1 -0
- package/build/dex/aave-v1/aave-v1.d.ts +2 -1
- package/build/dex/aave-v1/aave-v1.js +22 -0
- package/build/dex/aave-v1/aave-v1.js.map +1 -1
- package/build/dex/generic-rfq/rate-fetcher.js +1 -1
- package/build/dex/generic-rfq/rate-fetcher.js.map +1 -1
- package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
- package/build/dex/idle-dao/idle-dao-pool.js +176 -0
- package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
- package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
- package/build/dex/idle-dao/scripts.d.ts +9 -0
- package/build/dex/idle-dao/scripts.js +552 -0
- package/build/dex/idle-dao/scripts.js.map +1 -0
- package/build/dex/inception/config.d.ts +5 -0
- package/build/dex/inception/config.js +112 -0
- package/build/dex/inception/config.js.map +1 -0
- package/build/dex/inception/inception-event-pool.d.ts +25 -0
- package/build/dex/inception/inception-event-pool.js +57 -0
- package/build/dex/inception/inception-event-pool.js.map +1 -0
- package/build/dex/{integral/integral.d.ts → inception/inception-native.d.ts} +21 -19
- package/build/dex/inception/inception-native.js +131 -0
- package/build/dex/inception/inception-native.js.map +1 -0
- package/build/dex/inception/inception-pool.d.ts +18 -0
- package/build/dex/inception/inception-pool.js +32 -0
- package/build/dex/inception/inception-pool.js.map +1 -0
- package/build/dex/inception/inception-price-feed.d.ts +19 -0
- package/build/dex/inception/inception-price-feed.js +51 -0
- package/build/dex/inception/inception-price-feed.js.map +1 -0
- package/build/dex/inception/inception.d.ts +44 -0
- package/build/dex/inception/inception.js +177 -0
- package/build/dex/inception/inception.js.map +1 -0
- package/build/dex/inception/tokens.d.ts +9 -0
- package/build/dex/inception/tokens.js +28 -0
- package/build/dex/inception/tokens.js.map +1 -0
- package/build/dex/inception/types.d.ts +22 -0
- package/build/dex/inception/types.js +3 -0
- package/build/dex/inception/types.js.map +1 -0
- package/build/dex/inception/utils.d.ts +7 -0
- package/build/dex/inception/utils.js +58 -0
- package/build/dex/inception/utils.js.map +1 -0
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/dex/platypus/platypus.d.ts +2 -1
- package/build/dex/platypus/platypus.js +31 -0
- package/build/dex/platypus/platypus.js.map +1 -1
- package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
- package/build/dex/swaap-v1/swaap-v1.js +10 -0
- package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
- package/build/dex/usual-bond/config.d.ts +3 -0
- package/build/dex/usual-bond/config.js +13 -0
- package/build/dex/usual-bond/config.js.map +1 -0
- package/build/dex/usual-bond/types.d.ts +7 -0
- package/build/dex/usual-bond/types.js +3 -0
- package/build/dex/usual-bond/types.js.map +1 -0
- package/build/dex/usual-bond/usual-bond.d.ts +35 -0
- package/build/dex/usual-bond/usual-bond.js +162 -0
- package/build/dex/usual-bond/usual-bond.js.map +1 -0
- package/package.json +1 -1
- package/src/abi/Aave_GSM.json +751 -0
- package/src/dex/aave-gsm/aave-gsm-e2e.test.ts +109 -0
- package/src/dex/aave-gsm/aave-gsm-integration.test.ts +318 -0
- package/src/dex/aave-gsm/aave-gsm.ts +369 -0
- package/src/dex/aave-gsm/config.ts +16 -0
- package/src/dex/aave-gsm/types.ts +15 -0
- package/src/dex/generic-rfq/rate-fetcher.ts +6 -5
- package/src/dex/index.ts +2 -0
- package/.vscode/launch.json +0 -16
- package/.vscode/settings.json +0 -3
- package/build/abi/Uncompressor.json +0 -250
- package/build/abi/integral/factory.json +0 -333
- package/build/abi/integral/oracle.json +0 -501
- package/build/abi/integral/relayer.json +0 -1536
- 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/etherfi/etherfi.d.ts +0 -26
- package/build/dex/etherfi/etherfi.js +0 -96
- package/build/dex/etherfi/etherfi.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/helpers.d.ts +0 -17
- package/build/dex/integral/helpers.js +0 -157
- package/build/dex/integral/helpers.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.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/onebit.d.ts +0 -25
- package/build/dex/onebit.js +0 -42
- package/build/dex/onebit.js.map +0 -1
- package/build/dex/sdai/config.d.ts +0 -11
- package/build/dex/sdai/config.js +0 -21
- package/build/dex/sdai/config.js.map +0 -1
- package/build/dex/sdai/constants.d.ts +0 -2
- package/build/dex/sdai/constants.js +0 -6
- package/build/dex/sdai/constants.js.map +0 -1
- package/build/dex/sdai/scripts/validate-state.d.ts +0 -1
- package/build/dex/sdai/scripts/validate-state.js +0 -102
- package/build/dex/sdai/scripts/validate-state.js.map +0 -1
- package/build/dex/sdai/sdai-pool.d.ts +0 -16
- package/build/dex/sdai/sdai-pool.js +0 -85
- package/build/dex/sdai/sdai-pool.js.map +0 -1
- package/build/dex/sdai/sdai.d.ts +0 -51
- package/build/dex/sdai/sdai.js +0 -172
- package/build/dex/sdai/sdai.js.map +0 -1
- package/build/dex/sdai/types.d.ts +0 -21
- package/build/dex/sdai/types.js +0 -11
- package/build/dex/sdai/types.js.map +0 -1
- package/build/dex/sdai/utils.d.ts +0 -4
- package/build/dex/sdai/utils.js +0 -39
- package/build/dex/sdai/utils.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/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/trader-joe-v2.1/optimizer.d.ts +0 -2
- package/build/dex/trader-joe-v2.1/optimizer.js +0 -44
- package/build/dex/trader-joe-v2.1/optimizer.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/executor/compressor/Compressor.d.ts +0 -23
- package/build/executor/compressor/Compressor.js +0 -144
- package/build/executor/compressor/Compressor.js.map +0 -1
- package/build/executor/compressor/compress.d.ts +0 -17
- package/build/executor/compressor/compress.js +0 -187
- package/build/executor/compressor/compress.js.map +0 -1
- package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +0 -6
- package/build/executor/compressor/compress_functions/addressSubstitution.js +0 -29
- package/build/executor/compressor/compress_functions/addressSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +0 -10
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +0 -40
- package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +0 -1
- package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +0 -11
- package/build/executor/compressor/compress_functions/byteSubstitution.js +0 -64
- package/build/executor/compressor/compress_functions/byteSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +0 -7
- package/build/executor/compressor/compress_functions/ffSubstitution.js +0 -54
- package/build/executor/compressor/compress_functions/ffSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +0 -8
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +0 -67
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +0 -1
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +0 -8
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +0 -61
- package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +0 -1
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +0 -6
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +0 -37
- package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +0 -1
- package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +0 -9
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js +0 -33
- package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +0 -1
- package/build/executor/compressor/fetchSaved.d.ts +0 -0
- package/build/executor/compressor/fetchSaved.js +0 -17
- package/build/executor/compressor/fetchSaved.js.map +0 -1
- package/build/executor/compressor/utils/computeCostL2.d.ts +0 -2
- package/build/executor/compressor/utils/computeCostL2.js +0 -14
- package/build/executor/compressor/utils/computeCostL2.js.map +0 -1
- package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +0 -2
- package/build/executor/compressor/utils/findLongestDuplicatedString.js +0 -30
- package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +0 -1
- package/build/executor/compressor/utils/getAllIndexes.d.ts +0 -2
- package/build/executor/compressor/utils/getAllIndexes.js +0 -12
- package/build/executor/compressor/utils/getAllIndexes.js.map +0 -1
- package/build/executor/compressor/utils/getByteForAddress.d.ts +0 -2
- package/build/executor/compressor/utils/getByteForAddress.js +0 -14
- package/build/executor/compressor/utils/getByteForAddress.js.map +0 -1
- package/build/executor/compressor/utils/intTo2Bytes.d.ts +0 -2
- package/build/executor/compressor/utils/intTo2Bytes.js +0 -14
- package/build/executor/compressor/utils/intTo2Bytes.js.map +0 -1
- package/build/executor/compressor/utils/intTo3Bytes.d.ts +0 -2
- package/build/executor/compressor/utils/intTo3Bytes.js +0 -18
- package/build/executor/compressor/utils/intTo3Bytes.js.map +0 -1
- package/build/executor/compressor/utils/intToByte.d.ts +0 -2
- package/build/executor/compressor/utils/intToByte.js +0 -10
- package/build/executor/compressor/utils/intToByte.js.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsualBondConfig = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
exports.UsualBondConfig = {
|
|
6
|
+
UsualBond: {
|
|
7
|
+
[constants_1.Network.MAINNET]: {
|
|
8
|
+
usd0Address: '0x73A15FeD60Bf67631dC6cd7Bc5B6e8da8190aCF5',
|
|
9
|
+
usd0ppAddress: '0x35D8949372D46B7a3D5A56006AE77B215fc69bC0',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/usual-bond/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,eAAe,GAA4B;IACtD,SAAS,EAAE;QACT,CAAC,mBAAO,CAAC,OAAO,CAAC,EAAE;YACjB,WAAW,EAAE,4CAA4C;YACzD,aAAa,EAAE,4CAA4C;SAC5D;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/usual-bond/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, Logger, NumberAsString, DexExchangeParam, PoolLiquidity } from '../../types';
|
|
2
|
+
import { SwapSide, Network } from '../../constants';
|
|
3
|
+
import { IDex } from '../idex';
|
|
4
|
+
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
5
|
+
import { UsualBondData, DexParams } from './types';
|
|
6
|
+
import { SimpleExchange } from '../simple-exchange';
|
|
7
|
+
import { Interface } from '@ethersproject/abi';
|
|
8
|
+
export declare class UsualBond extends SimpleExchange implements IDex<UsualBondData> {
|
|
9
|
+
readonly network: Network;
|
|
10
|
+
readonly dexKey: string;
|
|
11
|
+
readonly dexHelper: IDexHelper;
|
|
12
|
+
protected config: DexParams;
|
|
13
|
+
readonly hasConstantPriceLargeAmounts = true;
|
|
14
|
+
readonly needWrapNative = false;
|
|
15
|
+
readonly isFeeOnTransferSupported = false;
|
|
16
|
+
static dexKeysWithNetwork: {
|
|
17
|
+
key: string;
|
|
18
|
+
networks: Network[];
|
|
19
|
+
}[];
|
|
20
|
+
usd0ppIface: Interface;
|
|
21
|
+
logger: Logger;
|
|
22
|
+
constructor(network: Network, dexKey: string, dexHelper: IDexHelper);
|
|
23
|
+
initializePricing(blockNumber: number): Promise<void>;
|
|
24
|
+
getConfig(): DexParams;
|
|
25
|
+
is_usd0(token: string): boolean;
|
|
26
|
+
is_usd0pp(token: string): boolean;
|
|
27
|
+
is_usd0_swap_token(srcToken: string, destToken: string): boolean;
|
|
28
|
+
getAdapters(): null;
|
|
29
|
+
getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
|
|
30
|
+
getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<UsualBondData>>;
|
|
31
|
+
getCalldataGasCost(poolPrices: PoolPrices<UsualBondData>): number | number[];
|
|
32
|
+
getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: UsualBondData, side: SwapSide): AdapterExchangeParam;
|
|
33
|
+
getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: UsualBondData, side: SwapSide): Promise<DexExchangeParam>;
|
|
34
|
+
getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.UsualBond = void 0;
|
|
30
|
+
const constants_1 = require("../../constants");
|
|
31
|
+
const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
|
|
32
|
+
const utils_1 = require("../../utils");
|
|
33
|
+
const simple_exchange_1 = require("../simple-exchange");
|
|
34
|
+
const config_1 = require("./config");
|
|
35
|
+
const abi_1 = require("@ethersproject/abi");
|
|
36
|
+
const usd0pp_abi_json_1 = __importDefault(require("../../abi/usual-bond/usd0pp.abi.json"));
|
|
37
|
+
const bigint_constants_1 = require("../../bigint-constants");
|
|
38
|
+
class UsualBond extends simple_exchange_1.SimpleExchange {
|
|
39
|
+
constructor(network, dexKey, dexHelper) {
|
|
40
|
+
super(dexHelper, dexKey);
|
|
41
|
+
this.network = network;
|
|
42
|
+
this.dexKey = dexKey;
|
|
43
|
+
this.dexHelper = dexHelper;
|
|
44
|
+
this.hasConstantPriceLargeAmounts = true;
|
|
45
|
+
this.needWrapNative = false;
|
|
46
|
+
this.isFeeOnTransferSupported = false;
|
|
47
|
+
const config = config_1.UsualBondConfig[dexKey][network];
|
|
48
|
+
this.usd0ppIface = new abi_1.Interface(usd0pp_abi_json_1.default);
|
|
49
|
+
this.config = {
|
|
50
|
+
usd0Address: config.usd0Address.toLowerCase(),
|
|
51
|
+
usd0ppAddress: config.usd0ppAddress.toLowerCase(),
|
|
52
|
+
};
|
|
53
|
+
this.logger = dexHelper.getLogger(dexKey);
|
|
54
|
+
}
|
|
55
|
+
async initializePricing(blockNumber) {
|
|
56
|
+
// No initialization needed for constant price
|
|
57
|
+
}
|
|
58
|
+
getConfig() {
|
|
59
|
+
return this.config;
|
|
60
|
+
}
|
|
61
|
+
is_usd0(token) {
|
|
62
|
+
return token.toLowerCase() === this.config.usd0Address.toLowerCase();
|
|
63
|
+
}
|
|
64
|
+
is_usd0pp(token) {
|
|
65
|
+
return token.toLowerCase() === this.config.usd0ppAddress.toLowerCase();
|
|
66
|
+
}
|
|
67
|
+
is_usd0_swap_token(srcToken, destToken) {
|
|
68
|
+
return this.is_usd0(srcToken) && this.is_usd0pp(destToken);
|
|
69
|
+
}
|
|
70
|
+
getAdapters() {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
|
|
74
|
+
if (side === constants_1.SwapSide.BUY)
|
|
75
|
+
return [];
|
|
76
|
+
if (!srcToken || !destToken) {
|
|
77
|
+
this.logger.error('Source or destination token is undefined');
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const srcTokenAddress = srcToken.address?.toLowerCase();
|
|
81
|
+
const destTokenAddress = destToken.address?.toLowerCase();
|
|
82
|
+
if (!srcTokenAddress || !destTokenAddress) {
|
|
83
|
+
this.logger.error('Source or destination token address is undefined');
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
if (this.is_usd0_swap_token(srcTokenAddress, destTokenAddress)) {
|
|
87
|
+
return [`${this.dexKey}_${this.config.usd0ppAddress}`];
|
|
88
|
+
}
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
|
|
92
|
+
if (side === constants_1.SwapSide.BUY)
|
|
93
|
+
return null;
|
|
94
|
+
const isUSD0SwapToken = this.is_usd0_swap_token(srcToken.address, destToken.address);
|
|
95
|
+
if (!isUSD0SwapToken) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const unitIn = bigint_constants_1.BI_POWS[18];
|
|
99
|
+
const unitOut = bigint_constants_1.BI_POWS[18]; // 1:1 swap
|
|
100
|
+
const amountsOut = amounts; // 1:1 swap, so output amounts are the same as input
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
unit: unitOut,
|
|
104
|
+
prices: amountsOut,
|
|
105
|
+
data: {},
|
|
106
|
+
poolAddresses: [this.config.usd0ppAddress],
|
|
107
|
+
exchange: this.dexKey,
|
|
108
|
+
gasCost: 70000,
|
|
109
|
+
poolIdentifier: this.dexKey,
|
|
110
|
+
},
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
getCalldataGasCost(poolPrices) {
|
|
114
|
+
return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
|
|
115
|
+
}
|
|
116
|
+
getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
|
|
117
|
+
const payload = '0x';
|
|
118
|
+
return {
|
|
119
|
+
targetExchange: this.config.usd0ppAddress,
|
|
120
|
+
payload,
|
|
121
|
+
networkFee: '0',
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
async getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
|
|
125
|
+
if (side === constants_1.SwapSide.BUY)
|
|
126
|
+
throw new Error('BUY not supported');
|
|
127
|
+
if (this.is_usd0(srcToken) && this.is_usd0pp(destToken)) {
|
|
128
|
+
const exchangeData = this.usd0ppIface.encodeFunctionData('mint', [
|
|
129
|
+
srcAmount,
|
|
130
|
+
]);
|
|
131
|
+
return {
|
|
132
|
+
needWrapNative: false,
|
|
133
|
+
dexFuncHasRecipient: false,
|
|
134
|
+
exchangeData,
|
|
135
|
+
targetExchange: this.config.usd0ppAddress,
|
|
136
|
+
returnAmountPos: undefined,
|
|
137
|
+
spender: this.config.usd0ppAddress, // Add this if it's the same as targetExchange
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
throw new Error('LOGIC ERROR');
|
|
141
|
+
}
|
|
142
|
+
async getTopPoolsForToken(tokenAddress, limit) {
|
|
143
|
+
if (!this.is_usd0(tokenAddress))
|
|
144
|
+
return [];
|
|
145
|
+
return [
|
|
146
|
+
{
|
|
147
|
+
exchange: this.dexKey,
|
|
148
|
+
address: this.config.usd0ppAddress,
|
|
149
|
+
connectorTokens: [
|
|
150
|
+
{
|
|
151
|
+
decimals: 18,
|
|
152
|
+
address: this.config.usd0ppAddress,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
|
|
156
|
+
},
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.UsualBond = UsualBond;
|
|
161
|
+
UsualBond.dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.UsualBondConfig);
|
|
162
|
+
//# sourceMappingURL=usual-bond.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usual-bond.js","sourceRoot":"","sources":["../../../src/dex/usual-bond/usual-bond.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,+CAAoD;AACpD,2EAA6D;AAC7D,uCAAoD;AAIpD,wDAAoD;AACpD,qCAA2C;AAC3C,4CAA6D;AAC7D,2FAA8D;AAE9D,6DAAiD;AAEjD,MAAa,SAAU,SAAQ,gCAAc;IAa3C,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB;QAE9B,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAJhB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QAbvB,iCAA4B,GAAG,IAAI,CAAC;QACpC,mBAAc,GAAG,KAAK,CAAC;QACvB,6BAAwB,GAAG,KAAK,CAAC;QAcxC,MAAM,MAAM,GAAG,wBAAe,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,IAAI,eAAS,CAAC,yBAA4B,CAAC,CAAC;QAC/D,IAAI,CAAC,MAAM,GAAG;YACZ,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW,EAAE;YAC7C,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE;SAClD,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,WAAmB;QACzC,8CAA8C;IAChD,CAAC;IAED,SAAS;QACP,OAAO,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