@paraswap/dex-lib 3.8.32-inception → 3.8.32-inception.3
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/inception/inception-ratio-feed.json +239 -3
- package/build/dex/inception/inception-event-pool.d.ts +4 -4
- package/build/dex/inception/inception-event-pool.js +9 -6
- package/build/dex/inception/inception-event-pool.js.map +1 -1
- package/build/dex/inception/inception.d.ts +6 -6
- package/build/dex/inception/inception.js +31 -15
- package/build/dex/inception/inception.js.map +1 -1
- package/build/dex/inception/tokens.d.ts +1 -1
- package/package.json +1 -1
- package/src/abi/inception/inception-ratio-feed.json +239 -3
- package/src/dex/inception/inception-event-pool.ts +10 -6
- package/src/dex/inception/inception-events.test.ts +3 -5
- package/src/dex/inception/inception.ts +52 -19
- package/src/dex/inception/tokens.ts +1 -1
- package/src/abi/inception/inception-ineth.json +0 -609
|
@@ -1,4 +1,109 @@
|
|
|
1
1
|
[
|
|
2
|
+
{ "inputs": [], "name": "EnforcedPause", "type": "error" },
|
|
3
|
+
{ "inputs": [], "name": "ExpectedPause", "type": "error" },
|
|
4
|
+
{ "inputs": [], "name": "InconsistentInputData", "type": "error" },
|
|
5
|
+
{
|
|
6
|
+
"inputs": [{ "internalType": "uint256", "name": "day", "type": "uint256" }],
|
|
7
|
+
"name": "IncorrectDay",
|
|
8
|
+
"type": "error"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"inputs": [
|
|
12
|
+
{ "internalType": "address", "name": "token", "type": "address" }
|
|
13
|
+
],
|
|
14
|
+
"name": "IncorrectToken",
|
|
15
|
+
"type": "error"
|
|
16
|
+
},
|
|
17
|
+
{ "inputs": [], "name": "InvalidInitialization", "type": "error" },
|
|
18
|
+
{ "inputs": [], "name": "NewRatioThresholdInvalid", "type": "error" },
|
|
19
|
+
{ "inputs": [], "name": "NotInitializing", "type": "error" },
|
|
20
|
+
{ "inputs": [], "name": "NullParams", "type": "error" },
|
|
21
|
+
{
|
|
22
|
+
"inputs": [
|
|
23
|
+
{ "internalType": "address", "name": "account", "type": "address" }
|
|
24
|
+
],
|
|
25
|
+
"name": "OperatorUnauthorizedAccount",
|
|
26
|
+
"type": "error"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"inputs": [
|
|
30
|
+
{ "internalType": "address", "name": "owner", "type": "address" }
|
|
31
|
+
],
|
|
32
|
+
"name": "OwnableInvalidOwner",
|
|
33
|
+
"type": "error"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"inputs": [
|
|
37
|
+
{ "internalType": "address", "name": "account", "type": "address" }
|
|
38
|
+
],
|
|
39
|
+
"name": "OwnableUnauthorizedAccount",
|
|
40
|
+
"type": "error"
|
|
41
|
+
},
|
|
42
|
+
{ "inputs": [], "name": "RatioThresholdNotSet", "type": "error" },
|
|
43
|
+
{
|
|
44
|
+
"anonymous": false,
|
|
45
|
+
"inputs": [
|
|
46
|
+
{
|
|
47
|
+
"indexed": false,
|
|
48
|
+
"internalType": "uint64",
|
|
49
|
+
"name": "version",
|
|
50
|
+
"type": "uint64"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"name": "Initialized",
|
|
54
|
+
"type": "event"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"anonymous": false,
|
|
58
|
+
"inputs": [
|
|
59
|
+
{
|
|
60
|
+
"indexed": false,
|
|
61
|
+
"internalType": "address",
|
|
62
|
+
"name": "prevValue",
|
|
63
|
+
"type": "address"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"indexed": false,
|
|
67
|
+
"internalType": "address",
|
|
68
|
+
"name": "newValue",
|
|
69
|
+
"type": "address"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"name": "OperatorUpdated",
|
|
73
|
+
"type": "event"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"anonymous": false,
|
|
77
|
+
"inputs": [
|
|
78
|
+
{
|
|
79
|
+
"indexed": true,
|
|
80
|
+
"internalType": "address",
|
|
81
|
+
"name": "previousOwner",
|
|
82
|
+
"type": "address"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"indexed": true,
|
|
86
|
+
"internalType": "address",
|
|
87
|
+
"name": "newOwner",
|
|
88
|
+
"type": "address"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"name": "OwnershipTransferred",
|
|
92
|
+
"type": "event"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"anonymous": false,
|
|
96
|
+
"inputs": [
|
|
97
|
+
{
|
|
98
|
+
"indexed": false,
|
|
99
|
+
"internalType": "address",
|
|
100
|
+
"name": "account",
|
|
101
|
+
"type": "address"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"name": "Paused",
|
|
105
|
+
"type": "event"
|
|
106
|
+
},
|
|
2
107
|
{
|
|
3
108
|
"anonymous": false,
|
|
4
109
|
"inputs": [
|
|
@@ -11,19 +116,76 @@
|
|
|
11
116
|
{
|
|
12
117
|
"indexed": false,
|
|
13
118
|
"internalType": "uint256",
|
|
14
|
-
"name": "
|
|
119
|
+
"name": "failedRatio",
|
|
120
|
+
"type": "uint256"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"indexed": false,
|
|
124
|
+
"internalType": "string",
|
|
125
|
+
"name": "reason",
|
|
126
|
+
"type": "string"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"name": "RatioNotUpdated",
|
|
130
|
+
"type": "event"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"anonymous": false,
|
|
134
|
+
"inputs": [
|
|
135
|
+
{
|
|
136
|
+
"indexed": false,
|
|
137
|
+
"internalType": "uint256",
|
|
138
|
+
"name": "prevValue",
|
|
15
139
|
"type": "uint256"
|
|
16
140
|
},
|
|
17
141
|
{
|
|
18
142
|
"indexed": false,
|
|
19
143
|
"internalType": "uint256",
|
|
20
|
-
"name": "
|
|
144
|
+
"name": "newValue",
|
|
145
|
+
"type": "uint256"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"name": "RatioThresholdChanged",
|
|
149
|
+
"type": "event"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"anonymous": false,
|
|
153
|
+
"inputs": [
|
|
154
|
+
{
|
|
155
|
+
"indexed": true,
|
|
156
|
+
"internalType": "address",
|
|
157
|
+
"name": "tokenAddress",
|
|
158
|
+
"type": "address"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"indexed": false,
|
|
162
|
+
"internalType": "uint256",
|
|
163
|
+
"name": "prevValue",
|
|
164
|
+
"type": "uint256"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"indexed": false,
|
|
168
|
+
"internalType": "uint256",
|
|
169
|
+
"name": "newValue",
|
|
21
170
|
"type": "uint256"
|
|
22
171
|
}
|
|
23
172
|
],
|
|
24
173
|
"name": "RatioUpdated",
|
|
25
174
|
"type": "event"
|
|
26
175
|
},
|
|
176
|
+
{
|
|
177
|
+
"anonymous": false,
|
|
178
|
+
"inputs": [
|
|
179
|
+
{
|
|
180
|
+
"indexed": false,
|
|
181
|
+
"internalType": "address",
|
|
182
|
+
"name": "account",
|
|
183
|
+
"type": "address"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"name": "Unpaused",
|
|
187
|
+
"type": "event"
|
|
188
|
+
},
|
|
27
189
|
{
|
|
28
190
|
"inputs": [],
|
|
29
191
|
"name": "MAX_THRESHOLD",
|
|
@@ -67,12 +229,35 @@
|
|
|
67
229
|
"type": "function"
|
|
68
230
|
},
|
|
69
231
|
{
|
|
70
|
-
"inputs": [
|
|
232
|
+
"inputs": [
|
|
233
|
+
{ "internalType": "address", "name": "operator", "type": "address" }
|
|
234
|
+
],
|
|
71
235
|
"name": "initialize",
|
|
72
236
|
"outputs": [],
|
|
73
237
|
"stateMutability": "nonpayable",
|
|
74
238
|
"type": "function"
|
|
75
239
|
},
|
|
240
|
+
{
|
|
241
|
+
"inputs": [],
|
|
242
|
+
"name": "owner",
|
|
243
|
+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
|
244
|
+
"stateMutability": "view",
|
|
245
|
+
"type": "function"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"inputs": [],
|
|
249
|
+
"name": "pause",
|
|
250
|
+
"outputs": [],
|
|
251
|
+
"stateMutability": "nonpayable",
|
|
252
|
+
"type": "function"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"inputs": [],
|
|
256
|
+
"name": "paused",
|
|
257
|
+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
|
258
|
+
"stateMutability": "view",
|
|
259
|
+
"type": "function"
|
|
260
|
+
},
|
|
76
261
|
{
|
|
77
262
|
"inputs": [],
|
|
78
263
|
"name": "ratioThreshold",
|
|
@@ -80,6 +265,57 @@
|
|
|
80
265
|
"stateMutability": "view",
|
|
81
266
|
"type": "function"
|
|
82
267
|
},
|
|
268
|
+
{
|
|
269
|
+
"inputs": [],
|
|
270
|
+
"name": "renounceOwnership",
|
|
271
|
+
"outputs": [],
|
|
272
|
+
"stateMutability": "nonpayable",
|
|
273
|
+
"type": "function"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"inputs": [
|
|
277
|
+
{ "internalType": "address", "name": "token", "type": "address" },
|
|
278
|
+
{ "internalType": "uint256", "name": "ratio", "type": "uint256" }
|
|
279
|
+
],
|
|
280
|
+
"name": "repairRatioFor",
|
|
281
|
+
"outputs": [],
|
|
282
|
+
"stateMutability": "nonpayable",
|
|
283
|
+
"type": "function"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"inputs": [
|
|
287
|
+
{ "internalType": "address", "name": "newOperator", "type": "address" }
|
|
288
|
+
],
|
|
289
|
+
"name": "setInceptionOperator",
|
|
290
|
+
"outputs": [],
|
|
291
|
+
"stateMutability": "nonpayable",
|
|
292
|
+
"type": "function"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"inputs": [
|
|
296
|
+
{ "internalType": "uint256", "name": "newValue", "type": "uint256" }
|
|
297
|
+
],
|
|
298
|
+
"name": "setRatioThreshold",
|
|
299
|
+
"outputs": [],
|
|
300
|
+
"stateMutability": "nonpayable",
|
|
301
|
+
"type": "function"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"inputs": [
|
|
305
|
+
{ "internalType": "address", "name": "newOwner", "type": "address" }
|
|
306
|
+
],
|
|
307
|
+
"name": "transferOwnership",
|
|
308
|
+
"outputs": [],
|
|
309
|
+
"stateMutability": "nonpayable",
|
|
310
|
+
"type": "function"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"inputs": [],
|
|
314
|
+
"name": "unpause",
|
|
315
|
+
"outputs": [],
|
|
316
|
+
"stateMutability": "nonpayable",
|
|
317
|
+
"type": "function"
|
|
318
|
+
},
|
|
83
319
|
{
|
|
84
320
|
"inputs": [
|
|
85
321
|
{ "internalType": "address[]", "name": "addresses", "type": "address[]" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { AsyncOrSync, DeepReadonly } from 'ts-essentials';
|
|
3
|
-
import { BlockHeader, Log, Logger } from '../../types';
|
|
3
|
+
import { Address, BlockHeader, Log, Logger } from '../../types';
|
|
4
4
|
import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
|
|
5
5
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
6
6
|
import { PoolConfig, PoolState } from './types';
|
|
@@ -16,10 +16,12 @@ export class InceptionEventPool extends StatefulEventSubscriber<PoolState> {
|
|
|
16
16
|
protected network: number,
|
|
17
17
|
protected dexHelper: IDexHelper,
|
|
18
18
|
logger: Logger,
|
|
19
|
-
|
|
19
|
+
protected ratioFeedAddress: Address,
|
|
20
20
|
public poolInterface: Interface,
|
|
21
21
|
) {
|
|
22
|
-
super(parentName,
|
|
22
|
+
super(parentName, ratioFeedAddress, dexHelper, logger);
|
|
23
|
+
|
|
24
|
+
this.addressesSubscribed = [ratioFeedAddress];
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
protected processLog(
|
|
@@ -33,9 +35,11 @@ export class InceptionEventPool extends StatefulEventSubscriber<PoolState> {
|
|
|
33
35
|
switch (parsed.name) {
|
|
34
36
|
case 'RatioUpdated': {
|
|
35
37
|
const tokenInfo = getTokenFromAddress(this.network, parsed.args[0]);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
if (tokenInfo) {
|
|
39
|
+
_state[tokenInfo.symbol.toLowerCase()] = {
|
|
40
|
+
ratio: BigInt(parsed.args[2].toString()),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
39
43
|
return _state;
|
|
40
44
|
}
|
|
41
45
|
default:
|
|
@@ -26,7 +26,8 @@ async function fetchPoolState(
|
|
|
26
26
|
|
|
27
27
|
describe('Inception Event', function () {
|
|
28
28
|
const blockNumbers: { [eventName: string]: number[] } = {
|
|
29
|
-
RatioUpdated: [20438963, 20431766, 20424602],
|
|
29
|
+
// RatioUpdated: [20438963, 20431766, 20424602],
|
|
30
|
+
RatioUpdated: [20438962, 20431765, 20424601, 20703959, 20711125],
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
describe('InceptionEventPool', function () {
|
|
@@ -40,10 +41,7 @@ describe('Inception Event', function () {
|
|
|
40
41
|
network,
|
|
41
42
|
dexHelper,
|
|
42
43
|
logger,
|
|
43
|
-
|
|
44
|
-
ratioFeedAddress: ratioFeedAddress,
|
|
45
|
-
initState: {},
|
|
46
|
-
},
|
|
44
|
+
ratioFeedAddress,
|
|
47
45
|
poolInterface,
|
|
48
46
|
);
|
|
49
47
|
|
|
@@ -10,20 +10,28 @@ import {
|
|
|
10
10
|
PoolLiquidity,
|
|
11
11
|
PoolPrices,
|
|
12
12
|
Token,
|
|
13
|
+
TransferFeeParams,
|
|
13
14
|
} from '../../types';
|
|
14
15
|
import INCEPTION_ABI from '../../abi/inception/inception-vault.json';
|
|
15
16
|
import INCEPTION_POOL_ABI from '../../abi/inception/inception-ineth-pool.json';
|
|
16
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
DEST_TOKEN_PARASWAP_TRANSFERS,
|
|
19
|
+
Network,
|
|
20
|
+
NULL_ADDRESS,
|
|
21
|
+
SRC_TOKEN_PARASWAP_TRANSFERS,
|
|
22
|
+
} from '../../constants';
|
|
17
23
|
import * as CALLDATA_GAS_COST from '../../calldata-gas-cost';
|
|
18
|
-
import { getDexKeysWithNetwork
|
|
24
|
+
import { getDexKeysWithNetwork } from '../../utils';
|
|
19
25
|
import { IDex } from '../../dex/idex';
|
|
20
26
|
import { IDexHelper } from '../../dex-helper/idex-helper';
|
|
21
|
-
import {
|
|
27
|
+
import { InceptionDexData, PoolState } from './types';
|
|
22
28
|
import { SimpleExchange } from '../simple-exchange';
|
|
23
29
|
import { InceptionConfig, InceptionPricePoolConfig } from './config';
|
|
24
|
-
import { getTokenFromAddress, setTokensOnNetwork
|
|
30
|
+
import { getTokenFromAddress, setTokensOnNetwork } from './tokens';
|
|
25
31
|
import { getOnChainState, getTokenList } from './utils';
|
|
26
32
|
import { InceptionEventPool } from './inception-event-pool';
|
|
33
|
+
import { applyTransferFee } from '../../lib/token-transfer-fee';
|
|
34
|
+
import { RETURN_AMOUNT_POS_0 } from '../../executor/constants';
|
|
27
35
|
|
|
28
36
|
const DECIMALS = BigInt(1e18);
|
|
29
37
|
|
|
@@ -36,7 +44,7 @@ export class Inception
|
|
|
36
44
|
|
|
37
45
|
readonly hasConstantPriceLargeAmounts = false;
|
|
38
46
|
readonly needWrapNative = false;
|
|
39
|
-
readonly isFeeOnTransferSupported =
|
|
47
|
+
readonly isFeeOnTransferSupported = true;
|
|
40
48
|
|
|
41
49
|
public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
|
|
42
50
|
getDexKeysWithNetwork(InceptionConfig);
|
|
@@ -60,10 +68,7 @@ export class Inception
|
|
|
60
68
|
network,
|
|
61
69
|
dexHelper,
|
|
62
70
|
this.logger,
|
|
63
|
-
|
|
64
|
-
ratioFeedAddress: InceptionPricePoolConfig[dexKey][network].ratioFeed,
|
|
65
|
-
initState: {},
|
|
66
|
-
},
|
|
71
|
+
InceptionPricePoolConfig[dexKey][network].ratioFeed,
|
|
67
72
|
this.poolInterface,
|
|
68
73
|
);
|
|
69
74
|
}
|
|
@@ -125,6 +130,12 @@ export class Inception
|
|
|
125
130
|
side: SwapSide,
|
|
126
131
|
blockNumber: number,
|
|
127
132
|
limitPools?: string[],
|
|
133
|
+
transferFees: TransferFeeParams = {
|
|
134
|
+
srcFee: 0,
|
|
135
|
+
destFee: 0,
|
|
136
|
+
srcDexFee: 0,
|
|
137
|
+
destDexFee: 0,
|
|
138
|
+
},
|
|
128
139
|
): Promise<null | ExchangePrices<InceptionDexData>> {
|
|
129
140
|
if (side === SwapSide.BUY) {
|
|
130
141
|
return null;
|
|
@@ -133,26 +144,38 @@ export class Inception
|
|
|
133
144
|
const src = getTokenFromAddress(this.network, srcToken.address);
|
|
134
145
|
const dest = getTokenFromAddress(this.network, destToken.address);
|
|
135
146
|
|
|
136
|
-
if (src !== dest) {
|
|
147
|
+
if (!src || !dest || src !== dest) {
|
|
137
148
|
return null;
|
|
138
149
|
}
|
|
139
150
|
|
|
140
151
|
const poolState = await this.getPoolState(this.eventPool, blockNumber);
|
|
141
152
|
if (!poolState) return null;
|
|
142
153
|
|
|
154
|
+
const unitPrice = DECIMALS;
|
|
155
|
+
const prices = amounts.map(amount => {
|
|
156
|
+
const ratio = poolState[src.symbol.toLowerCase()].ratio;
|
|
157
|
+
return (ratio * amount) / DECIMALS;
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const [unitPriceWithFee, ...pricesWithFee] = applyTransferFee(
|
|
161
|
+
[unitPrice, ...prices],
|
|
162
|
+
side,
|
|
163
|
+
side === SwapSide.SELL ? transferFees.srcFee : transferFees.destFee,
|
|
164
|
+
side === SwapSide.SELL
|
|
165
|
+
? SRC_TOKEN_PARASWAP_TRANSFERS
|
|
166
|
+
: DEST_TOKEN_PARASWAP_TRANSFERS,
|
|
167
|
+
);
|
|
168
|
+
|
|
143
169
|
return [
|
|
144
170
|
{
|
|
145
|
-
prices:
|
|
146
|
-
|
|
147
|
-
return (ratio * amount) / DECIMALS;
|
|
148
|
-
}),
|
|
149
|
-
unit: DECIMALS,
|
|
171
|
+
prices: pricesWithFee,
|
|
172
|
+
unit: unitPriceWithFee,
|
|
150
173
|
gasCost: 120_000,
|
|
151
174
|
exchange: this.dexKey,
|
|
152
175
|
data: {
|
|
153
176
|
exchange: dest.vault,
|
|
154
177
|
},
|
|
155
|
-
poolAddresses: [
|
|
178
|
+
poolAddresses: [dest.vault],
|
|
156
179
|
},
|
|
157
180
|
];
|
|
158
181
|
}
|
|
@@ -182,18 +205,25 @@ export class Inception
|
|
|
182
205
|
): DexExchangeParam {
|
|
183
206
|
const dexParams = getTokenFromAddress(this.network, srcToken);
|
|
184
207
|
|
|
208
|
+
if (!dexParams) {
|
|
209
|
+
throw new Error('Unknown token');
|
|
210
|
+
}
|
|
211
|
+
|
|
185
212
|
const isNative = dexParams.baseTokenSlug === 'ETH';
|
|
186
213
|
let swapData;
|
|
187
214
|
let dexFuncHasRecipient;
|
|
215
|
+
let swappedAmountNotPresentInExchangeData;
|
|
188
216
|
if (isNative) {
|
|
189
217
|
swapData = this.poolInterface.encodeFunctionData('stake()', []);
|
|
190
218
|
dexFuncHasRecipient = false;
|
|
219
|
+
swappedAmountNotPresentInExchangeData = true;
|
|
191
220
|
} else {
|
|
192
221
|
swapData = this.vaultInterface.encodeFunctionData('deposit', [
|
|
193
222
|
srcAmount,
|
|
194
223
|
recipient,
|
|
195
224
|
]);
|
|
196
225
|
dexFuncHasRecipient = true;
|
|
226
|
+
swappedAmountNotPresentInExchangeData = false;
|
|
197
227
|
}
|
|
198
228
|
|
|
199
229
|
return {
|
|
@@ -201,7 +231,7 @@ export class Inception
|
|
|
201
231
|
dexFuncHasRecipient,
|
|
202
232
|
exchangeData: swapData,
|
|
203
233
|
targetExchange: dexParams.vault,
|
|
204
|
-
swappedAmountNotPresentInExchangeData
|
|
234
|
+
swappedAmountNotPresentInExchangeData,
|
|
205
235
|
returnAmountPos: undefined,
|
|
206
236
|
};
|
|
207
237
|
}
|
|
@@ -214,7 +244,7 @@ export class Inception
|
|
|
214
244
|
): Promise<PoolLiquidity[]> {
|
|
215
245
|
await this.initializeTokens();
|
|
216
246
|
|
|
217
|
-
const token
|
|
247
|
+
const token = getTokenFromAddress(this.network, tokenAddress);
|
|
218
248
|
|
|
219
249
|
if (token) {
|
|
220
250
|
return [
|
|
@@ -224,7 +254,10 @@ export class Inception
|
|
|
224
254
|
address: token.vault,
|
|
225
255
|
connectorTokens: [
|
|
226
256
|
{
|
|
227
|
-
address:
|
|
257
|
+
address:
|
|
258
|
+
tokenAddress.toLowerCase() === token.token.toLowerCase()
|
|
259
|
+
? token.baseToken
|
|
260
|
+
: token.token,
|
|
228
261
|
decimals: 1e18,
|
|
229
262
|
},
|
|
230
263
|
],
|
|
@@ -32,6 +32,6 @@ export function setTokensOnNetwork(network: Network, tokens: DexParams[]) {
|
|
|
32
32
|
export function getTokenFromAddress(
|
|
33
33
|
network: Network,
|
|
34
34
|
address: string,
|
|
35
|
-
): DexParams {
|
|
35
|
+
): DexParams | undefined {
|
|
36
36
|
return TokensByAddress[network]?.[address.toLowerCase()];
|
|
37
37
|
}
|