@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.
Files changed (234) hide show
  1. package/build/abi/Aave_GSM.json +751 -0
  2. package/build/abi/inception/inception-ineth-pool.json +1062 -0
  3. package/build/abi/inception/inception-ineth.json +609 -0
  4. package/build/abi/inception/inception-ratio-feed.json +93 -0
  5. package/build/abi/inception/inception-vault.json +991 -0
  6. package/build/abi/{integral/pool.json → usual-bond/usd0pp.abi.json} +389 -563
  7. package/build/dex/aave-gsm/aave-gsm.d.ts +33 -0
  8. package/build/dex/aave-gsm/aave-gsm.js +283 -0
  9. package/build/dex/aave-gsm/aave-gsm.js.map +1 -0
  10. package/build/dex/aave-gsm/config.d.ts +3 -0
  11. package/build/dex/aave-gsm/config.js +17 -0
  12. package/build/dex/aave-gsm/config.js.map +1 -0
  13. package/build/dex/aave-gsm/types.d.ts +11 -0
  14. package/build/dex/aave-gsm/types.js +3 -0
  15. package/build/dex/aave-gsm/types.js.map +1 -0
  16. package/build/dex/aave-v1/aave-v1.d.ts +2 -1
  17. package/build/dex/aave-v1/aave-v1.js +22 -0
  18. package/build/dex/aave-v1/aave-v1.js.map +1 -1
  19. package/build/dex/generic-rfq/rate-fetcher.js +1 -1
  20. package/build/dex/generic-rfq/rate-fetcher.js.map +1 -1
  21. package/build/dex/idle-dao/idle-dao-pool.d.ts +56 -0
  22. package/build/dex/idle-dao/idle-dao-pool.js +176 -0
  23. package/build/dex/idle-dao/idle-dao-pool.js.map +1 -0
  24. package/build/dex/idle-dao/idle-dao-pooling-pool.d.ts +16 -0
  25. package/build/dex/idle-dao/idle-dao-pooling-pool.js +57 -0
  26. package/build/dex/idle-dao/idle-dao-pooling-pool.js.map +1 -0
  27. package/build/dex/idle-dao/scripts.d.ts +9 -0
  28. package/build/dex/idle-dao/scripts.js +552 -0
  29. package/build/dex/idle-dao/scripts.js.map +1 -0
  30. package/build/dex/inception/config.d.ts +5 -0
  31. package/build/dex/inception/config.js +112 -0
  32. package/build/dex/inception/config.js.map +1 -0
  33. package/build/dex/inception/inception-event-pool.d.ts +25 -0
  34. package/build/dex/inception/inception-event-pool.js +57 -0
  35. package/build/dex/inception/inception-event-pool.js.map +1 -0
  36. package/build/dex/{integral/integral.d.ts → inception/inception-native.d.ts} +21 -19
  37. package/build/dex/inception/inception-native.js +131 -0
  38. package/build/dex/inception/inception-native.js.map +1 -0
  39. package/build/dex/inception/inception-pool.d.ts +18 -0
  40. package/build/dex/inception/inception-pool.js +32 -0
  41. package/build/dex/inception/inception-pool.js.map +1 -0
  42. package/build/dex/inception/inception-price-feed.d.ts +19 -0
  43. package/build/dex/inception/inception-price-feed.js +51 -0
  44. package/build/dex/inception/inception-price-feed.js.map +1 -0
  45. package/build/dex/inception/inception.d.ts +44 -0
  46. package/build/dex/inception/inception.js +177 -0
  47. package/build/dex/inception/inception.js.map +1 -0
  48. package/build/dex/inception/tokens.d.ts +9 -0
  49. package/build/dex/inception/tokens.js +28 -0
  50. package/build/dex/inception/tokens.js.map +1 -0
  51. package/build/dex/inception/types.d.ts +22 -0
  52. package/build/dex/inception/types.js +3 -0
  53. package/build/dex/inception/types.js.map +1 -0
  54. package/build/dex/inception/utils.d.ts +7 -0
  55. package/build/dex/inception/utils.js +58 -0
  56. package/build/dex/inception/utils.js.map +1 -0
  57. package/build/dex/index.js +2 -0
  58. package/build/dex/index.js.map +1 -1
  59. package/build/dex/platypus/platypus.d.ts +2 -1
  60. package/build/dex/platypus/platypus.js +31 -0
  61. package/build/dex/platypus/platypus.js.map +1 -1
  62. package/build/dex/swaap-v1/swaap-v1.d.ts +2 -1
  63. package/build/dex/swaap-v1/swaap-v1.js +10 -0
  64. package/build/dex/swaap-v1/swaap-v1.js.map +1 -1
  65. package/build/dex/usual-bond/config.d.ts +3 -0
  66. package/build/dex/usual-bond/config.js +13 -0
  67. package/build/dex/usual-bond/config.js.map +1 -0
  68. package/build/dex/usual-bond/types.d.ts +7 -0
  69. package/build/dex/usual-bond/types.js +3 -0
  70. package/build/dex/usual-bond/types.js.map +1 -0
  71. package/build/dex/usual-bond/usual-bond.d.ts +35 -0
  72. package/build/dex/usual-bond/usual-bond.js +162 -0
  73. package/build/dex/usual-bond/usual-bond.js.map +1 -0
  74. package/package.json +1 -1
  75. package/src/abi/Aave_GSM.json +751 -0
  76. package/src/dex/aave-gsm/aave-gsm-e2e.test.ts +109 -0
  77. package/src/dex/aave-gsm/aave-gsm-integration.test.ts +318 -0
  78. package/src/dex/aave-gsm/aave-gsm.ts +369 -0
  79. package/src/dex/aave-gsm/config.ts +16 -0
  80. package/src/dex/aave-gsm/types.ts +15 -0
  81. package/src/dex/generic-rfq/rate-fetcher.ts +6 -5
  82. package/src/dex/index.ts +2 -0
  83. package/.vscode/launch.json +0 -16
  84. package/.vscode/settings.json +0 -3
  85. package/build/abi/Uncompressor.json +0 -250
  86. package/build/abi/integral/factory.json +0 -333
  87. package/build/abi/integral/oracle.json +0 -501
  88. package/build/abi/integral/relayer.json +0 -1536
  89. package/build/dex/bProtocol.d.ts +0 -18
  90. package/build/dex/bProtocol.js +0 -39
  91. package/build/dex/bProtocol.js.map +0 -1
  92. package/build/dex/bancor.d.ts +0 -26
  93. package/build/dex/bancor.js +0 -58
  94. package/build/dex/bancor.js.map +0 -1
  95. package/build/dex/compound.d.ts +0 -18
  96. package/build/dex/compound.js +0 -46
  97. package/build/dex/compound.js.map +0 -1
  98. package/build/dex/curve-v2.d.ts +0 -58
  99. package/build/dex/curve-v2.js +0 -180
  100. package/build/dex/curve-v2.js.map +0 -1
  101. package/build/dex/dodo-v1.d.ts +0 -33
  102. package/build/dex/dodo-v1.js +0 -63
  103. package/build/dex/dodo-v1.js.map +0 -1
  104. package/build/dex/etherfi/etherfi.d.ts +0 -26
  105. package/build/dex/etherfi/etherfi.js +0 -96
  106. package/build/dex/etherfi/etherfi.js.map +0 -1
  107. package/build/dex/integral/config.d.ts +0 -4
  108. package/build/dex/integral/config.js +0 -20
  109. package/build/dex/integral/config.js.map +0 -1
  110. package/build/dex/integral/context.d.ts +0 -40
  111. package/build/dex/integral/context.js +0 -158
  112. package/build/dex/integral/context.js.map +0 -1
  113. package/build/dex/integral/helpers.d.ts +0 -17
  114. package/build/dex/integral/helpers.js +0 -157
  115. package/build/dex/integral/helpers.js.map +0 -1
  116. package/build/dex/integral/integral-factory.d.ts +0 -24
  117. package/build/dex/integral/integral-factory.js +0 -95
  118. package/build/dex/integral/integral-factory.js.map +0 -1
  119. package/build/dex/integral/integral-pool.d.ts +0 -50
  120. package/build/dex/integral/integral-pool.js +0 -149
  121. package/build/dex/integral/integral-pool.js.map +0 -1
  122. package/build/dex/integral/integral-pricing.d.ts +0 -18
  123. package/build/dex/integral/integral-pricing.js +0 -114
  124. package/build/dex/integral/integral-pricing.js.map +0 -1
  125. package/build/dex/integral/integral-relayer.d.ts +0 -42
  126. package/build/dex/integral/integral-relayer.js +0 -192
  127. package/build/dex/integral/integral-relayer.js.map +0 -1
  128. package/build/dex/integral/integral-token.d.ts +0 -27
  129. package/build/dex/integral/integral-token.js +0 -59
  130. package/build/dex/integral/integral-token.js.map +0 -1
  131. package/build/dex/integral/integral.js +0 -376
  132. package/build/dex/integral/integral.js.map +0 -1
  133. package/build/dex/integral/types.d.ts +0 -85
  134. package/build/dex/integral/types.js +0 -9
  135. package/build/dex/integral/types.js.map +0 -1
  136. package/build/dex/integral/utils-e2e.d.ts +0 -9
  137. package/build/dex/integral/utils-e2e.js +0 -131
  138. package/build/dex/integral/utils-e2e.js.map +0 -1
  139. package/build/dex/integral/utils.d.ts +0 -17
  140. package/build/dex/integral/utils.js +0 -94
  141. package/build/dex/integral/utils.js.map +0 -1
  142. package/build/dex/lido.d.ts +0 -19
  143. package/build/dex/lido.js +0 -42
  144. package/build/dex/lido.js.map +0 -1
  145. package/build/dex/onebit.d.ts +0 -25
  146. package/build/dex/onebit.js +0 -42
  147. package/build/dex/onebit.js.map +0 -1
  148. package/build/dex/sdai/config.d.ts +0 -11
  149. package/build/dex/sdai/config.js +0 -21
  150. package/build/dex/sdai/config.js.map +0 -1
  151. package/build/dex/sdai/constants.d.ts +0 -2
  152. package/build/dex/sdai/constants.js +0 -6
  153. package/build/dex/sdai/constants.js.map +0 -1
  154. package/build/dex/sdai/scripts/validate-state.d.ts +0 -1
  155. package/build/dex/sdai/scripts/validate-state.js +0 -102
  156. package/build/dex/sdai/scripts/validate-state.js.map +0 -1
  157. package/build/dex/sdai/sdai-pool.d.ts +0 -16
  158. package/build/dex/sdai/sdai-pool.js +0 -85
  159. package/build/dex/sdai/sdai-pool.js.map +0 -1
  160. package/build/dex/sdai/sdai.d.ts +0 -51
  161. package/build/dex/sdai/sdai.js +0 -172
  162. package/build/dex/sdai/sdai.js.map +0 -1
  163. package/build/dex/sdai/types.d.ts +0 -21
  164. package/build/dex/sdai/types.js +0 -11
  165. package/build/dex/sdai/types.js.map +0 -1
  166. package/build/dex/sdai/utils.d.ts +0 -4
  167. package/build/dex/sdai/utils.js +0 -39
  168. package/build/dex/sdai/utils.js.map +0 -1
  169. package/build/dex/smoothy.d.ts +0 -26
  170. package/build/dex/smoothy.js +0 -48
  171. package/build/dex/smoothy.js.map +0 -1
  172. package/build/dex/stable-pool.d.ts +0 -28
  173. package/build/dex/stable-pool.js +0 -62
  174. package/build/dex/stable-pool.js.map +0 -1
  175. package/build/dex/trader-joe-v2.1/optimizer.d.ts +0 -2
  176. package/build/dex/trader-joe-v2.1/optimizer.js +0 -44
  177. package/build/dex/trader-joe-v2.1/optimizer.js.map +0 -1
  178. package/build/dex/trader-joe-v2.1.d.ts +0 -43
  179. package/build/dex/trader-joe-v2.1.js +0 -79
  180. package/build/dex/trader-joe-v2.1.js.map +0 -1
  181. package/build/executor/compressor/Compressor.d.ts +0 -23
  182. package/build/executor/compressor/Compressor.js +0 -144
  183. package/build/executor/compressor/Compressor.js.map +0 -1
  184. package/build/executor/compressor/compress.d.ts +0 -17
  185. package/build/executor/compressor/compress.js +0 -187
  186. package/build/executor/compressor/compress.js.map +0 -1
  187. package/build/executor/compressor/compress_functions/addressSubstitution.d.ts +0 -6
  188. package/build/executor/compressor/compress_functions/addressSubstitution.js +0 -29
  189. package/build/executor/compressor/compress_functions/addressSubstitution.js.map +0 -1
  190. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.d.ts +0 -10
  191. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js +0 -40
  192. package/build/executor/compressor/compress_functions/addressSubstitutionFromObject.js.map +0 -1
  193. package/build/executor/compressor/compress_functions/byteSubstitution.d.ts +0 -11
  194. package/build/executor/compressor/compress_functions/byteSubstitution.js +0 -64
  195. package/build/executor/compressor/compress_functions/byteSubstitution.js.map +0 -1
  196. package/build/executor/compressor/compress_functions/ffSubstitution.d.ts +0 -7
  197. package/build/executor/compressor/compress_functions/ffSubstitution.js +0 -54
  198. package/build/executor/compressor/compress_functions/ffSubstitution.js.map +0 -1
  199. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.d.ts +0 -8
  200. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js +0 -67
  201. package/build/executor/compressor/compress_functions/findLongestAndSubstitute.js.map +0 -1
  202. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.d.ts +0 -8
  203. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js +0 -61
  204. package/build/executor/compressor/compress_functions/findLongestAndSubstitute_old.js.map +0 -1
  205. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.d.ts +0 -6
  206. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js +0 -37
  207. package/build/executor/compressor/compress_functions/reverseAddressSubstitution.js.map +0 -1
  208. package/build/executor/compressor/compress_functions/searchUnusedBytes.d.ts +0 -9
  209. package/build/executor/compressor/compress_functions/searchUnusedBytes.js +0 -33
  210. package/build/executor/compressor/compress_functions/searchUnusedBytes.js.map +0 -1
  211. package/build/executor/compressor/fetchSaved.d.ts +0 -0
  212. package/build/executor/compressor/fetchSaved.js +0 -17
  213. package/build/executor/compressor/fetchSaved.js.map +0 -1
  214. package/build/executor/compressor/utils/computeCostL2.d.ts +0 -2
  215. package/build/executor/compressor/utils/computeCostL2.js +0 -14
  216. package/build/executor/compressor/utils/computeCostL2.js.map +0 -1
  217. package/build/executor/compressor/utils/findLongestDuplicatedString.d.ts +0 -2
  218. package/build/executor/compressor/utils/findLongestDuplicatedString.js +0 -30
  219. package/build/executor/compressor/utils/findLongestDuplicatedString.js.map +0 -1
  220. package/build/executor/compressor/utils/getAllIndexes.d.ts +0 -2
  221. package/build/executor/compressor/utils/getAllIndexes.js +0 -12
  222. package/build/executor/compressor/utils/getAllIndexes.js.map +0 -1
  223. package/build/executor/compressor/utils/getByteForAddress.d.ts +0 -2
  224. package/build/executor/compressor/utils/getByteForAddress.js +0 -14
  225. package/build/executor/compressor/utils/getByteForAddress.js.map +0 -1
  226. package/build/executor/compressor/utils/intTo2Bytes.d.ts +0 -2
  227. package/build/executor/compressor/utils/intTo2Bytes.js +0 -14
  228. package/build/executor/compressor/utils/intTo2Bytes.js.map +0 -1
  229. package/build/executor/compressor/utils/intTo3Bytes.d.ts +0 -2
  230. package/build/executor/compressor/utils/intTo3Bytes.js +0 -18
  231. package/build/executor/compressor/utils/intTo3Bytes.js.map +0 -1
  232. package/build/executor/compressor/utils/intToByte.d.ts +0 -2
  233. package/build/executor/compressor/utils/intToByte.js +0 -10
  234. 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,7 @@
1
+ import { Address } from '../../types';
2
+ export declare type PoolState = {};
3
+ export declare type UsualBondData = {};
4
+ export declare type DexParams = {
5
+ usd0Address: Address;
6
+ usd0ppAddress: Address;
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -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;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ACE,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;gBAClC,eAAe,EAAE;oBACf;wBACE,QAAQ,EAAE,EAAE;wBACZ,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;qBACnC;iBACF;gBACD,YAAY,EAAE,UAAU,EAAE,4DAA4D;aACvF;SACF,CAAC;IACJ,CAAC;;AAtLH,8BAuLC;AAhLe,4BAAkB,GAC9B,IAAA,6BAAqB,EAAC,wBAAe,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraswap/dex-lib",
3
- "version": "3.8.25",
3
+ "version": "3.8.26-aave-gsm.2",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "repository": "https://github.com/paraswap/paraswap-dex-lib",