@paraswap/dex-lib 2.47.4 → 2.47.5

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 (142) hide show
  1. package/build/abi/Redstone.json +739 -0
  2. package/build/abi/angle/stagToken.json +963 -0
  3. package/build/abi/angle-transmuter/Pyth.json +1534 -0
  4. package/build/abi/angle-transmuter/Transmuter.json +1719 -0
  5. package/build/abi/smardex/smardex-factory.json +185 -0
  6. package/build/abi/smardex/smardex-pool.json +578 -0
  7. package/build/abi/smardex/smardex-router.json +648 -0
  8. package/build/abi/trader-joe-v2_1/FactoryABI.json +1208 -0
  9. package/build/abi/trader-joe-v2_1/PairABI.json +1493 -0
  10. package/build/abi/trader-joe-v2_1/RouterABI.json +1489 -0
  11. package/build/abi/trader-joe-v2_1/StateMulticall.json +193 -0
  12. package/build/abi/wombat/pool.json +1289 -0
  13. package/build/dex/angle-staked-stable/angle-staked-stable-pool.d.ts +53 -0
  14. package/build/dex/angle-staked-stable/angle-staked-stable-pool.js +175 -0
  15. package/build/dex/angle-staked-stable/angle-staked-stable-pool.js.map +1 -0
  16. package/build/dex/angle-staked-stable/angle-staked-stable.d.ts +42 -0
  17. package/build/dex/angle-staked-stable/angle-staked-stable.js +232 -0
  18. package/build/dex/angle-staked-stable/angle-staked-stable.js.map +1 -0
  19. package/build/dex/angle-staked-stable/config.d.ts +4 -0
  20. package/build/dex/angle-staked-stable/config.js +26 -0
  21. package/build/dex/angle-staked-stable/config.js.map +1 -0
  22. package/build/dex/angle-staked-stable/types.d.ts +15 -0
  23. package/build/dex/angle-staked-stable/types.js +3 -0
  24. package/build/dex/angle-staked-stable/types.js.map +1 -0
  25. package/build/dex/angle-transmuter/angle-transmuter-pool.d.ts +43 -0
  26. package/build/dex/angle-transmuter/angle-transmuter-pool.js +309 -0
  27. package/build/dex/angle-transmuter/angle-transmuter-pool.js.map +1 -0
  28. package/build/dex/angle-transmuter/angle-transmuter.d.ts +46 -0
  29. package/build/dex/angle-transmuter/angle-transmuter.js +233 -0
  30. package/build/dex/angle-transmuter/angle-transmuter.js.map +1 -0
  31. package/build/dex/angle-transmuter/backedOracle.d.ts +19 -0
  32. package/build/dex/angle-transmuter/backedOracle.js +56 -0
  33. package/build/dex/angle-transmuter/backedOracle.js.map +1 -0
  34. package/build/dex/angle-transmuter/config.d.ts +4 -0
  35. package/build/dex/angle-transmuter/config.js +20 -0
  36. package/build/dex/angle-transmuter/config.js.map +1 -0
  37. package/build/dex/angle-transmuter/constants.d.ts +4 -0
  38. package/build/dex/angle-transmuter/constants.js +8 -0
  39. package/build/dex/angle-transmuter/constants.js.map +1 -0
  40. package/build/dex/angle-transmuter/pyth.d.ts +19 -0
  41. package/build/dex/angle-transmuter/pyth.js +71 -0
  42. package/build/dex/angle-transmuter/pyth.js.map +1 -0
  43. package/build/dex/angle-transmuter/redstone.d.ts +20 -0
  44. package/build/dex/angle-transmuter/redstone.js +73 -0
  45. package/build/dex/angle-transmuter/redstone.js.map +1 -0
  46. package/build/dex/angle-transmuter/transmuter.d.ts +50 -0
  47. package/build/dex/angle-transmuter/transmuter.js +314 -0
  48. package/build/dex/angle-transmuter/transmuter.js.map +1 -0
  49. package/build/dex/angle-transmuter/types.d.ts +144 -0
  50. package/build/dex/angle-transmuter/types.js +31 -0
  51. package/build/dex/angle-transmuter/types.js.map +1 -0
  52. package/build/dex/angle-transmuter/utils.d.ts +9 -0
  53. package/build/dex/angle-transmuter/utils.js +264 -0
  54. package/build/dex/angle-transmuter/utils.js.map +1 -0
  55. package/build/dex/balancer-v2/balancer-v2.d.ts +3 -6
  56. package/build/dex/balancer-v2/balancer-v2.js +35 -55
  57. package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
  58. package/build/dex/balancer-v2/types.d.ts +1 -24
  59. package/build/dex/balancer-v2/types.js +0 -2
  60. package/build/dex/balancer-v2/types.js.map +1 -1
  61. package/build/dex/balancer-v2/utils.d.ts +0 -8
  62. package/build/dex/balancer-v2/utils.js +1 -17
  63. package/build/dex/balancer-v2/utils.js.map +1 -1
  64. package/build/dex/hashflow/hashflow.js +2 -1
  65. package/build/dex/hashflow/hashflow.js.map +1 -1
  66. package/build/dex/smardex/subgraph-queries.d.ts +1 -0
  67. package/build/dex/smardex/subgraph-queries.js +17 -0
  68. package/build/dex/smardex/subgraph-queries.js.map +1 -0
  69. package/build/dex/smardex/usd-reserves.d.ts +23 -0
  70. package/build/dex/smardex/usd-reserves.js +86 -0
  71. package/build/dex/smardex/usd-reserves.js.map +1 -0
  72. package/build/dex/trader-joe-v2-1-2/config.d.ts +4 -0
  73. package/build/dex/trader-joe-v2-1-2/config.js +47 -0
  74. package/build/dex/trader-joe-v2-1-2/config.js.map +1 -0
  75. package/build/dex/trader-joe-v2-1-2/constants.d.ts +20 -0
  76. package/build/dex/trader-joe-v2-1-2/constants.js +22 -0
  77. package/build/dex/trader-joe-v2-1-2/constants.js.map +1 -0
  78. package/build/dex/trader-joe-v2-1-2/math/index.d.ts +37 -0
  79. package/build/dex/trader-joe-v2-1-2/math/index.js +291 -0
  80. package/build/dex/trader-joe-v2-1-2/math/index.js.map +1 -0
  81. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.d.ts +60 -0
  82. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js +248 -0
  83. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2-pool.js.map +1 -0
  84. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.d.ts +53 -0
  85. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js +307 -0
  86. package/build/dex/trader-joe-v2-1-2/trader-joe-v2-1-2.js.map +1 -0
  87. package/build/dex/trader-joe-v2-1-2/types.d.ts +82 -0
  88. package/build/dex/trader-joe-v2-1-2/types.js +9 -0
  89. package/build/dex/trader-joe-v2-1-2/types.js.map +1 -0
  90. package/build/dex/trader-joe-v2_1/config.d.ts +4 -0
  91. package/build/dex/trader-joe-v2_1/config.js +47 -0
  92. package/build/dex/trader-joe-v2_1/config.js.map +1 -0
  93. package/build/dex/trader-joe-v2_1/constants.d.ts +20 -0
  94. package/build/dex/trader-joe-v2_1/constants.js +22 -0
  95. package/build/dex/trader-joe-v2_1/constants.js.map +1 -0
  96. package/build/dex/trader-joe-v2_1/math/index.d.ts +37 -0
  97. package/build/dex/trader-joe-v2_1/math/index.js +291 -0
  98. package/build/dex/trader-joe-v2_1/math/index.js.map +1 -0
  99. package/build/dex/trader-joe-v2_1/trader-joe-v2.1.d.ts +0 -0
  100. package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js +384 -0
  101. package/build/dex/trader-joe-v2_1/trader-joe-v2.1.js.map +1 -0
  102. package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.d.ts +60 -0
  103. package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js +247 -0
  104. package/build/dex/trader-joe-v2_1/trader-joe-v2_1-pool.js.map +1 -0
  105. package/build/dex/trader-joe-v2_1/trader-joe-v2_1.d.ts +53 -0
  106. package/build/dex/trader-joe-v2_1/trader-joe-v2_1.js +307 -0
  107. package/build/dex/trader-joe-v2_1/trader-joe-v2_1.js.map +1 -0
  108. package/build/dex/trader-joe-v2_1/types.d.ts +82 -0
  109. package/build/dex/trader-joe-v2_1/types.js +9 -0
  110. package/build/dex/trader-joe-v2_1/types.js.map +1 -0
  111. package/build/dex/wombat/wombat-pool-poller.d.ts +22 -0
  112. package/build/dex/wombat/wombat-pool-poller.js +164 -0
  113. package/build/dex/wombat/wombat-pool-poller.js.map +1 -0
  114. package/package.json +1 -2
  115. package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +0 -94
  116. package/src/dex/balancer-v2/balancer-v2-integration.test.ts +112 -253
  117. package/src/dex/balancer-v2/balancer-v2.ts +69 -105
  118. package/src/dex/balancer-v2/types.ts +0 -26
  119. package/src/dex/balancer-v2/utils.ts +0 -16
  120. package/src/dex/hashflow/hashflow.ts +4 -1
  121. package/src/dex/synthetix/synthetix-state.ts +2 -2
  122. package/tests/constants-e2e.ts +0 -26
  123. package/build/abi/balancer-v2/gyro-e.abi.json +0 -1595
  124. package/build/dex/balancer-v2/pools/gyro/Gyro3Pool.d.ts +0 -32
  125. package/build/dex/balancer-v2/pools/gyro/Gyro3Pool.js +0 -149
  126. package/build/dex/balancer-v2/pools/gyro/Gyro3Pool.js.map +0 -1
  127. package/build/dex/balancer-v2/pools/gyro/GyroEPool.d.ts +0 -37
  128. package/build/dex/balancer-v2/pools/gyro/GyroEPool.js +0 -222
  129. package/build/dex/balancer-v2/pools/gyro/GyroEPool.js.map +0 -1
  130. package/build/dex/balancer-v2/pools/gyro/gyro-helpers.d.ts +0 -2
  131. package/build/dex/balancer-v2/pools/gyro/gyro-helpers.js +0 -19
  132. package/build/dex/balancer-v2/pools/gyro/gyro-helpers.js.map +0 -1
  133. package/build/dex/balancer-v2/queryOnChain.d.ts +0 -1
  134. package/build/dex/balancer-v2/queryOnChain.js +0 -40
  135. package/build/dex/balancer-v2/queryOnChain.js.map +0 -1
  136. package/src/abi/balancer-v2/gyro-e.abi.json +0 -1595
  137. package/src/dex/balancer-v2/balancer-v2-gyro3.test.ts +0 -268
  138. package/src/dex/balancer-v2/balancer-v2-gyroE.test.ts +0 -401
  139. package/src/dex/balancer-v2/pools/gyro/Gyro3Pool.ts +0 -255
  140. package/src/dex/balancer-v2/pools/gyro/GyroEPool.ts +0 -403
  141. package/src/dex/balancer-v2/pools/gyro/gyro-helpers.ts +0 -15
  142. package/src/dex/balancer-v2/queryOnChain.ts +0 -48
@@ -0,0 +1,82 @@
1
+ import { Address } from '../../types';
2
+ import { BigNumber } from 'ethers';
3
+ import { NumberAsString } from '@paraswap/core';
4
+ export declare type Bin = {
5
+ id: bigint;
6
+ reserveX: bigint;
7
+ reserveY: bigint;
8
+ };
9
+ export declare type PoolState = {
10
+ tokenX: Address;
11
+ tokenY: Address;
12
+ binStep: bigint;
13
+ bins: Bin[];
14
+ pairAddress: string;
15
+ blockTimestamp: bigint;
16
+ reserves: {
17
+ reserveX: bigint;
18
+ reserveY: bigint;
19
+ };
20
+ activeId: bigint;
21
+ protocolFees: {
22
+ protocolFeeX: bigint;
23
+ protocolFeeY: bigint;
24
+ };
25
+ staticFeeParameters: {
26
+ baseFactor: bigint;
27
+ filterPeriod: bigint;
28
+ decayPeriod: bigint;
29
+ reductionFactor: bigint;
30
+ variableFeeControl: bigint;
31
+ protocolShare: bigint;
32
+ maxVolatilityAccumulator: bigint;
33
+ };
34
+ variableFeeParameters: {
35
+ volatilityAccumulator: bigint;
36
+ volatilityReference: bigint;
37
+ idReference: bigint;
38
+ timeOfLastUpdate: bigint;
39
+ };
40
+ };
41
+ export declare type DecodedStateMultiCallResult = {};
42
+ export declare type TraderJoeV2_1Data = {
43
+ tokenIn: string;
44
+ tokenOut: string;
45
+ binStep: string;
46
+ };
47
+ export declare type DexParams = {
48
+ factory: Address;
49
+ router: Address;
50
+ stateMulticall: Address;
51
+ };
52
+ export declare type LBPairsAvailable = {
53
+ binStep: BigNumber;
54
+ LBPair: string;
55
+ createdByOwner: boolean;
56
+ ignoredForRouting: boolean;
57
+ tokenX: string;
58
+ };
59
+ export declare type RouterPath = [
60
+ pairBinSteps: NumberAsString[],
61
+ versions: NumberAsString[],
62
+ tokenPath: Address[]
63
+ ];
64
+ export declare type TraderJoeV2RouterSellParams = [
65
+ _amountIn: NumberAsString,
66
+ _amountOutMin: NumberAsString,
67
+ _routerPath: RouterPath,
68
+ to: Address,
69
+ _deadline: string
70
+ ];
71
+ export declare type TraderJoeV2RouterBuyParams = [
72
+ _amountOut: NumberAsString,
73
+ _amountInMax: NumberAsString,
74
+ _routerPath: RouterPath,
75
+ to: Address,
76
+ _deadline: string
77
+ ];
78
+ export declare type TraderJoeV2RouterParam = TraderJoeV2RouterSellParams | TraderJoeV2RouterBuyParams;
79
+ export declare enum TraderJoeV2RouterFunctions {
80
+ swapExactTokensForTokens = "swapExactTokensForTokens",
81
+ swapTokensForExactTokens = "swapTokensForExactTokens"
82
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TraderJoeV2RouterFunctions = void 0;
4
+ var TraderJoeV2RouterFunctions;
5
+ (function (TraderJoeV2RouterFunctions) {
6
+ TraderJoeV2RouterFunctions["swapExactTokensForTokens"] = "swapExactTokensForTokens";
7
+ TraderJoeV2RouterFunctions["swapTokensForExactTokens"] = "swapTokensForExactTokens";
8
+ })(TraderJoeV2RouterFunctions = exports.TraderJoeV2RouterFunctions || (exports.TraderJoeV2RouterFunctions = {}));
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/trader-joe-v2_1/types.ts"],"names":[],"mappings":";;;AAyGA,IAAY,0BAGX;AAHD,WAAY,0BAA0B;IACpC,mFAAqD,CAAA;IACrD,mFAAqD,CAAA;AACvD,CAAC,EAHW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAGrC"}
@@ -0,0 +1,22 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { Address } from '@paraswap/core';
3
+ import { MultiCallParams, MultiResult } from '../../lib/multi-wrapper';
4
+ import { IDexHelper } from '../../dex-helper';
5
+ import { StatefulRpcPoller } from '../../lib/stateful-rpc-poller/stateful-rpc-poller';
6
+ import { ObjWithUpdateInfo } from '../../lib/stateful-rpc-poller/types';
7
+ import { MulticallResultOutputs, PoolState } from './types';
8
+ export declare class WombatPool extends StatefulRpcPoller<PoolState, MulticallResultOutputs> {
9
+ protected poolAddress: Address;
10
+ protected asset2TokenMap: Map<Address, Address>;
11
+ static readonly poolInterface: Interface;
12
+ static readonly assetInterface: Interface;
13
+ constructor(dexKey: string, poolIdentifier: string, dexHelper: IDexHelper, poolAddress: Address, asset2TokenMap: Map<Address, Address>);
14
+ protected _getFetchStateMultiCalls(): MultiCallParams<MulticallResultOutputs>[];
15
+ protected _parseStateFromMultiResults(multiOutputs: MulticallResultOutputs[]): PoolState;
16
+ fetchLatestStateFromRpc(): Promise<ObjWithUpdateInfo<PoolState> | null>;
17
+ parseStateFromMultiResultsWithBlockInfo(multiOutputs: [
18
+ MultiResult<number>,
19
+ ...MultiResult<MulticallResultOutputs>[]
20
+ ], lastUpdatedAtMs: number): ObjWithUpdateInfo<PoolState>;
21
+ addAssets(asset2TokenMap: Map<Address, Address>): void;
22
+ }
@@ -0,0 +1,164 @@
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.WombatPool = void 0;
7
+ const abi_1 = require("@ethersproject/abi");
8
+ const lodash_1 = __importDefault(require("lodash"));
9
+ const stateful_rpc_poller_1 = require("../../lib/stateful-rpc-poller/stateful-rpc-poller");
10
+ const state_polling_manager_1 = require("../../lib/stateful-rpc-poller/state-polling-manager");
11
+ const utils_1 = require("../../lib/stateful-rpc-poller/utils");
12
+ const decoders_1 = require("../../lib/decoders");
13
+ const pool_json_1 = __importDefault(require("../../abi/wombat/pool.json"));
14
+ const asset_json_1 = __importDefault(require("../../abi/wombat/asset.json"));
15
+ const utils_2 = require("./utils");
16
+ class WombatPool extends stateful_rpc_poller_1.StatefulRpcPoller {
17
+ constructor(dexKey, poolIdentifier, dexHelper, poolAddress, asset2TokenMap) {
18
+ const callbacks = (0, utils_1.pollingManagerCbExtractor)(state_polling_manager_1.StatePollingManager.getInstance(dexHelper));
19
+ super(dexKey, poolIdentifier, dexHelper, 0, 0, false, callbacks);
20
+ this.poolAddress = poolAddress;
21
+ this.asset2TokenMap = asset2TokenMap;
22
+ }
23
+ _getFetchStateMultiCalls() {
24
+ const params = [];
25
+ params.push({
26
+ target: this.poolAddress,
27
+ callData: WombatPool.poolInterface.encodeFunctionData('paused'),
28
+ decodeFunction: decoders_1.booleanDecode,
29
+ });
30
+ params.push({
31
+ target: this.poolAddress,
32
+ callData: WombatPool.poolInterface.encodeFunctionData('ampFactor'),
33
+ decodeFunction: decoders_1.uint256ToBigInt,
34
+ });
35
+ params.push({
36
+ target: this.poolAddress,
37
+ callData: WombatPool.poolInterface.encodeFunctionData('haircutRate'),
38
+ decodeFunction: decoders_1.uint256ToBigInt,
39
+ });
40
+ params.push({
41
+ target: this.poolAddress,
42
+ callData: WombatPool.poolInterface.encodeFunctionData('startCovRatio'),
43
+ decodeFunction: decoders_1.uint256ToBigInt,
44
+ });
45
+ params.push({
46
+ target: this.poolAddress,
47
+ callData: WombatPool.poolInterface.encodeFunctionData('endCovRatio'),
48
+ decodeFunction: decoders_1.uint256ToBigInt,
49
+ });
50
+ params.push({
51
+ target: this.poolAddress,
52
+ callData: WombatPool.poolInterface.encodeFunctionData('getTokens'),
53
+ decodeFunction: decoders_1.addressArrayDecode,
54
+ });
55
+ this.asset2TokenMap.forEach((token, asset) => {
56
+ params.push({
57
+ target: this.poolAddress,
58
+ callData: WombatPool.poolInterface.encodeFunctionData('isPaused', [
59
+ token,
60
+ ]),
61
+ decodeFunction: decoders_1.booleanDecode,
62
+ });
63
+ params.push({
64
+ target: asset,
65
+ callData: WombatPool.assetInterface.encodeFunctionData('cash'),
66
+ decodeFunction: utils_2.uint120ToBigInt,
67
+ });
68
+ params.push({
69
+ target: asset,
70
+ callData: WombatPool.assetInterface.encodeFunctionData('liability'),
71
+ decodeFunction: utils_2.uint120ToBigInt,
72
+ });
73
+ params.push({
74
+ target: asset,
75
+ callData: WombatPool.assetInterface.encodeFunctionData('underlyingTokenDecimals'),
76
+ decodeFunction: decoders_1.uint8ToNumber,
77
+ });
78
+ params.push({
79
+ target: asset,
80
+ callData: WombatPool.assetInterface.encodeFunctionData('getRelativePrice'),
81
+ decodeFunction: decoders_1.uint256ToBigInt,
82
+ });
83
+ });
84
+ return params;
85
+ }
86
+ _parseStateFromMultiResults(multiOutputs) {
87
+ const [paused, ampFactor, haircutRate, startCovRatio, endCovRatio, tokens, ...remained] = multiOutputs;
88
+ const assetTokenArray = Array.from(this.asset2TokenMap.entries());
89
+ const token2AssetStates = new Map();
90
+ lodash_1.default.chunk(remained, 5).forEach((chunk, i) => {
91
+ const [paused, cash, liability, underlyingTokenDecimals, relativePrice] = chunk;
92
+ const [asset, token] = assetTokenArray[i];
93
+ token2AssetStates.set(token, {
94
+ address: asset,
95
+ paused,
96
+ cash,
97
+ liability,
98
+ underlyingTokenDecimals,
99
+ relativePrice,
100
+ });
101
+ });
102
+ const poolState = {
103
+ params: {
104
+ paused,
105
+ ampFactor,
106
+ haircutRate,
107
+ startCovRatio,
108
+ endCovRatio,
109
+ },
110
+ underlyingAddresses: tokens,
111
+ asset: {},
112
+ };
113
+ const isMainPool = Array.from(token2AssetStates.values()).filter(assetState => assetState.relativePrice === undefined).length > 0;
114
+ for (const token of poolState.underlyingAddresses) {
115
+ if (!token2AssetStates.has(token)) {
116
+ // this happens when asset has been added to pool but is not added to BMW yet
117
+ continue;
118
+ }
119
+ poolState.asset[token] = token2AssetStates.get(token);
120
+ if (isMainPool) {
121
+ poolState.asset[token].relativePrice = undefined;
122
+ }
123
+ }
124
+ return poolState;
125
+ }
126
+ async fetchLatestStateFromRpc() {
127
+ const multiCalls = this.getFetchStateWithBlockInfoMultiCalls();
128
+ try {
129
+ const lastUpdatedAtMs = Date.now();
130
+ const aggregatedResults = (await this.dexHelper.multiWrapper.tryAggregate(false, multiCalls, undefined, undefined,
131
+ // multiCalls includes calls asset.isPaused, asset.getRelativePrice
132
+ // some of the contracts don't have these methods, so prevent logging errors
133
+ false));
134
+ return this.parseStateFromMultiResultsWithBlockInfo(aggregatedResults, lastUpdatedAtMs);
135
+ }
136
+ catch (e) {
137
+ this._logMessageWithSuppression('ERROR_FETCHING_STATE_FROM_RPC', e);
138
+ }
139
+ return null;
140
+ }
141
+ parseStateFromMultiResultsWithBlockInfo(multiOutputs, lastUpdatedAtMs) {
142
+ const [blockNumber, ...outputsForAbstract] = multiOutputs.map((m, i) => {
143
+ return m.returnData;
144
+ });
145
+ return {
146
+ value: this._parseStateFromMultiResults(outputsForAbstract),
147
+ blockNumber,
148
+ lastUpdatedAtMs,
149
+ };
150
+ }
151
+ addAssets(asset2TokenMap) {
152
+ for (const [asset, token] of asset2TokenMap) {
153
+ if (this.asset2TokenMap.has(asset)) {
154
+ continue;
155
+ }
156
+ this.asset2TokenMap.set(asset, token);
157
+ this._cachedMultiCallData = undefined;
158
+ }
159
+ }
160
+ }
161
+ exports.WombatPool = WombatPool;
162
+ WombatPool.poolInterface = new abi_1.Interface(pool_json_1.default);
163
+ WombatPool.assetInterface = new abi_1.Interface(asset_json_1.default);
164
+ //# sourceMappingURL=wombat-pool-poller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wombat-pool-poller.js","sourceRoot":"","sources":["../../../src/dex/wombat/wombat-pool-poller.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA+C;AAE/C,oDAAuB;AAIvB,2FAAsF;AACtF,+FAA0F;AAE1F,+DAAgF;AAChF,iDAK4B;AAC5B,2EAAiD;AACjD,6EAAmD;AACnD,mCAA0C;AAG1C,MAAa,UAAW,SAAQ,uCAG/B;IAIC,YACE,MAAc,EACd,cAAsB,EACtB,SAAqB,EACX,WAAoB,EACpB,cAAqC;QAE/C,MAAM,SAAS,GAAG,IAAA,iCAAyB,EACzC,2CAAmB,CAAC,WAAW,CAAC,SAAS,CAAC,CAC3C,CAAC;QAEF,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAPvD,gBAAW,GAAX,WAAW,CAAS;QACpB,mBAAc,GAAd,cAAc,CAAuB;IAOjD,CAAC;IAES,wBAAwB;QAChC,MAAM,MAAM,GAA8C,EAAE,CAAC;QAE7D,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,kBAAkB,CAAC,QAAQ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,CAGvE,KAAK,EACL,UAAgE,EAChE,SAAS,EACT,SAAS;YACT,mEAAmE;YACnE,4EAA4E;YAC5E,KAAK,CACN,CAAoE,CAAC;YAEtE,OAAO,IAAI,CAAC,uCAAuC,CACjD,iBAAiB,EACjB,eAAe,CAChB,CAAC;SACH;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,0BAA0B,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAC;SACrE;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,uCAAuC,CAC5C,YAGC,EACD,eAAuB;QAEvB,MAAM,CAAC,WAAW,EAAE,GAAG,kBAAkB,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACrE,OAAO,CAAC,CAAC,UAAU,CAAC;QACtB,CAAC,CAA0C,CAAC;QAE5C,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,2BAA2B,CAAC,kBAAkB,CAAC;YAC3D,WAAW;YACX,eAAe;SAChB,CAAC;IACJ,CAAC;IAEM,SAAS,CAAC,cAAqC;QACpD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,cAAc,EAAE;YAC3C,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBAClC,SAAS;aACV;YAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACtC,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;SACvC;IACH,CAAC;;AArNH,gCAsNC;AAlNiB,wBAAa,GAAG,IAAI,eAAS,CAAC,mBAAO,CAAC,CAAC;AACvC,yBAAc,GAAG,IAAI,eAAS,CAAC,oBAAQ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraswap/dex-lib",
3
- "version": "2.47.4",
3
+ "version": "2.47.5",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "repository": "https://github.com/paraswap/paraswap-dex-lib",
@@ -51,7 +51,6 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@0x/utils": "^4.5.2",
54
- "@balancer-labs/sor": "4.1.1-beta.4",
55
54
  "@bgd-labs/aave-address-book": "2.21.1",
56
55
  "@ethersproject/abi": "^5.7.0",
57
56
  "@hashflow/sdk": "1.2.4",
@@ -469,70 +469,6 @@ describe('BalancerV2 E2E', () => {
469
469
  );
470
470
  });
471
471
 
472
- describe('GyroE pool', () => {
473
- const sideToContractMethods = new Map([
474
- [
475
- SwapSide.SELL,
476
- [
477
- ContractMethod.simpleSwap,
478
- // ContractMethod.multiSwap,
479
- // ContractMethod.megaSwap,
480
- ],
481
- ],
482
- // [
483
- // SwapSide.BUY,
484
- // [
485
- // ContractMethod.simpleBuy,
486
- // ContractMethod.buy
487
- // ],
488
- // ],
489
- ]);
490
-
491
- const pairs: { name: string; amount: string }[][] = [
492
- [
493
- { name: 'GYD', amount: '10000000000000000000' },
494
- { name: 'sDAI', amount: '10000000000000000000' },
495
- ],
496
- ];
497
-
498
- sideToContractMethods.forEach((contractMethods, side) =>
499
- describe(`${side}`, () => {
500
- contractMethods.forEach((contractMethod: ContractMethod) => {
501
- pairs.forEach(pair => {
502
- describe(`${contractMethod}`, () => {
503
- it(`${pair[0].name} -> ${pair[1].name}`, async () => {
504
- await testE2E(
505
- tokens[pair[0].name],
506
- tokens[pair[1].name],
507
- holders[pair[0].name],
508
- pair[0].amount,
509
- side,
510
- dexKey,
511
- contractMethod,
512
- network,
513
- provider,
514
- );
515
- });
516
- it(`${pair[1].name} -> ${pair[0].name}`, async () => {
517
- await testE2E(
518
- tokens[pair[1].name],
519
- tokens[pair[0].name],
520
- holders[pair[1].name],
521
- pair[1].amount,
522
- side,
523
- dexKey,
524
- contractMethod,
525
- network,
526
- provider,
527
- );
528
- });
529
- });
530
- });
531
- });
532
- }),
533
- );
534
- });
535
-
536
472
  //daniel: BPT swaps are currently not supported, we've refactored to focus on mainToken paths
537
473
  /*it('MAIN TOKEN -> BPT, LinearPool', async () => {
538
474
  // Linear Pools allow swaps between main token (i.e. USDT) and pools BPT
@@ -785,36 +721,6 @@ describe('BalancerV2 E2E', () => {
785
721
  });
786
722
  }),
787
723
  );
788
-
789
- it('USDC -> USDT through Gyro3', async () => {
790
- await testE2E(
791
- tokens['USDC'],
792
- tokens['USDT'],
793
- holders['USDC'],
794
- '10000000', // 10 * 1e6
795
- SwapSide.SELL,
796
- dexKey,
797
- ContractMethod.multiSwap,
798
- network,
799
- provider,
800
- [`${dexKey}_0x17f1ef81707811ea15d9ee7c741179bbe2a63887`],
801
- );
802
- });
803
-
804
- it('USDC -> USDT through Gyro3 (BUY)', async () => {
805
- await testE2E(
806
- tokens['USDC'],
807
- tokens['USDT'],
808
- holders['USDC'],
809
- '10000000', // 10 * 1e6
810
- SwapSide.BUY,
811
- dexKey,
812
- ContractMethod.multiSwap,
813
- network,
814
- provider,
815
- [`${dexKey}_0x17f1ef81707811ea15d9ee7c741179bbe2a63887`],
816
- );
817
- });
818
724
  });
819
725
 
820
726
  describe('BalancerV2 ARBITRUM', () => {