@paraswap/dex-lib 2.36.0 → 2.36.2-curve-v1-disable-pool
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/api3-proxy.json +7 -0
- package/build/abi/dexalot/DexalotMainnetRFQ.json +887 -0
- package/build/dex/balancer-v2/config.js +1 -1
- package/build/dex/curve-v1/config.js +20 -19
- package/build/dex/curve-v1/config.js.map +1 -1
- package/build/dex/dexalot/config.d.ts +4 -0
- package/build/dex/dexalot/config.js +18 -0
- package/build/dex/dexalot/config.js.map +1 -0
- package/build/dex/dexalot/constants.d.ts +15 -0
- package/build/dex/dexalot/constants.js +22 -0
- package/build/dex/dexalot/constants.js.map +1 -0
- package/build/dex/dexalot/dexalot.d.ts +69 -0
- package/build/dex/dexalot/dexalot.js +614 -0
- package/build/dex/dexalot/dexalot.js.map +1 -0
- package/build/dex/dexalot/rate-fetcher.d.ts +28 -0
- package/build/dex/dexalot/rate-fetcher.js +100 -0
- package/build/dex/dexalot/rate-fetcher.js.map +1 -0
- package/build/dex/dexalot/types.d.ts +114 -0
- package/build/dex/dexalot/types.js +12 -0
- package/build/dex/dexalot/types.js.map +1 -0
- package/build/dex/dexalot/validators.d.ts +5 -0
- package/build/dex/dexalot/validators.js +45 -0
- package/build/dex/dexalot/validators.js.map +1 -0
- package/build/dex/quick-perps/pool.js +21 -6
- package/build/dex/quick-perps/pool.js.map +1 -1
- package/build/dex/quick-perps/quick-perps.js +34 -28
- package/build/dex/quick-perps/quick-perps.js.map +1 -1
- package/build/dex/solidly/config.js +1 -1
- package/build/dex/solidly/forks-override/aerodrome.js.map +1 -1
- package/build/dex/uniswap-v3/config.js.map +1 -1
- package/build/lib/api3-feed.d.ts +4 -0
- package/build/lib/api3-feed.js +18 -0
- package/build/lib/api3-feed.js.map +1 -1
- package/package.json +1 -1
- package/src/abi/api3-proxy.json +7 -0
- package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +6 -8
- package/src/dex/balancer-v2/config.ts +1 -1
- package/src/dex/curve-v1/config.ts +20 -19
- package/src/dex/maverick-v1/maverick-v1-e2e.test.ts +1 -7
- package/src/dex/pancakeswap-v3/pancakeswap-v3-e2e.test.ts +1 -7
- package/src/dex/quick-perps/pool.ts +42 -7
- package/src/dex/quick-perps/quick-perps-events.test.ts +0 -1
- package/src/dex/quick-perps/quick-perps.ts +45 -35
- package/src/dex/solidly/config.ts +1 -1
- package/src/dex/solidly/forks-override/aerodrome.ts +1 -5
- package/src/dex/uniswap-v3/config.ts +1 -2
- package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +1 -7
- package/src/dex/uniswap-v3/uniswap-v3-integration.test.ts +0 -2
- package/src/lib/api3-feed.ts +35 -0
package/build/lib/api3-feed.js
CHANGED
|
@@ -20,12 +20,30 @@ class Api3FeedSubscriber extends composed_event_subscriber_1.PartialEventSubscri
|
|
|
20
20
|
callData: Api3FeedSubscriber.proxyInterface.encodeFunctionData('api3ServerV1'),
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
+
static getDapiNameHashMultiCallInput(proxy) {
|
|
24
|
+
return {
|
|
25
|
+
target: proxy,
|
|
26
|
+
callData: Api3FeedSubscriber.proxyInterface.encodeFunctionData('dapiNameHash'),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
23
29
|
static getDataFeedId(proxy) {
|
|
24
30
|
return {
|
|
25
31
|
target: proxy,
|
|
26
32
|
callData: Api3FeedSubscriber.proxyInterface.encodeFunctionData('dataFeedId'),
|
|
27
33
|
};
|
|
28
34
|
}
|
|
35
|
+
static getFeedIdFromDapiNameHash(api3Server, dapiNameHash) {
|
|
36
|
+
return {
|
|
37
|
+
target: api3Server,
|
|
38
|
+
callData: Api3FeedSubscriber.api3ServerV1Iface.encodeFunctionData('dapiNameHashToDataFeedId', [dapiNameHash]),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
static decodeFeedIdFromDapiNameHash(multicallOutput) {
|
|
42
|
+
return Api3FeedSubscriber.api3ServerV1Iface.decodeFunctionResult('dapiNameHashToDataFeedId', multicallOutput)[0];
|
|
43
|
+
}
|
|
44
|
+
static decodeDapiNameHash(multicallOutput) {
|
|
45
|
+
return Api3FeedSubscriber.proxyInterface.decodeFunctionResult('dapiNameHash', multicallOutput)[0];
|
|
46
|
+
}
|
|
29
47
|
static decodeDataFeedId(multicallOutput) {
|
|
30
48
|
return Api3FeedSubscriber.proxyInterface.decodeFunctionResult('dataFeedId', multicallOutput)[0];
|
|
31
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api3-feed.js","sourceRoot":"","sources":["../../src/lib/api3-feed.ts"],"names":[],"mappings":";;;;;;AACA,4EAAsE;AAUtE,4CAA+C;AAC/C,6EAA8C;AAC9C,qFAAyD;AAOzD,MAAa,kBAA0B,SAAQ,kDAG9C;IAYC,YACU,KAAc,EACtB,UAAmB,EACX,UAAkB,EAC1B,IAAsE,EACtE,MAAc;QAEd,KAAK,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAN1B,UAAK,GAAL,KAAK,CAAS;QAEd,eAAU,GAAV,UAAU,CAAQ;IAK5B,CAAC;IAED,MAAM,CAAC,6BAA6B,CAAC,KAAc;QACjD,OAAO;YACL,MAAM,EAAE,KAAK;YACb,QAAQ,EACN,kBAAkB,CAAC,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC;SACvE,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,KAAc;QACjC,OAAO;YACL,MAAM,EAAE,KAAK;YACb,QAAQ,EACN,kBAAkB,CAAC,cAAc,CAAC,kBAAkB,CAAC,YAAY,CAAC;SACrE,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,eAAgC;QACtD,OAAO,kBAAkB,CAAC,cAAc,CAAC,oBAAoB,CAC3D,YAAY,EACZ,eAAe,CAChB,CAAC,CAAC,CAAC,CAAC;IACP,CAAC;IAED,M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EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACvC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;SAChD,CAAC;IACJ,CAAC;IAEM,aAAa,CAAC,KAA0B;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;IACtC,CAAC;;AAzJH,gDA0JC;AAtJiB,iCAAc,GAAG,IAAI,eAAS,CAAC,yBAAQ,CAAC,CAAC;AACzC,oCAAiB,GAAG,IAAI,eAAS,CAAC,6BAAe,CAAC,CAAC;AACnD,6CAA0B,GACxC,kBAAkB,CAAC,iBAAiB,CAAC,aAAa,CAChD,6BAA6B,CAC9B,CAAC;AACY,iDAA8B,GAC5C,kBAAkB,CAAC,iBAAiB,CAAC,aAAa,CAChD,6BAA6B,CAC9B,CAAC"}
|
package/package.json
CHANGED
package/src/abi/api3-proxy.json
CHANGED
|
@@ -42,5 +42,12 @@
|
|
|
42
42
|
],
|
|
43
43
|
"stateMutability": "view",
|
|
44
44
|
"type": "function"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"inputs": [],
|
|
48
|
+
"name": "dapiNameHash",
|
|
49
|
+
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
|
|
50
|
+
"stateMutability": "view",
|
|
51
|
+
"type": "function"
|
|
45
52
|
}
|
|
46
53
|
]
|
|
@@ -2,7 +2,11 @@ import dotenv from 'dotenv';
|
|
|
2
2
|
dotenv.config();
|
|
3
3
|
|
|
4
4
|
import { testE2E } from '../../../tests/utils-e2e';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Holders,
|
|
7
|
+
NativeTokenSymbols,
|
|
8
|
+
Tokens,
|
|
9
|
+
} from '../../../tests/constants-e2e';
|
|
6
10
|
import { ContractMethod, Network, SwapSide } from '../../constants';
|
|
7
11
|
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
8
12
|
|
|
@@ -37,13 +41,7 @@ function testForNetwork(
|
|
|
37
41
|
ContractMethod.megaSwap,
|
|
38
42
|
],
|
|
39
43
|
],
|
|
40
|
-
[
|
|
41
|
-
SwapSide.BUY,
|
|
42
|
-
[
|
|
43
|
-
ContractMethod.simpleBuy,
|
|
44
|
-
ContractMethod.buy,
|
|
45
|
-
],
|
|
46
|
-
],
|
|
44
|
+
[SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
|
|
47
45
|
]);
|
|
48
46
|
|
|
49
47
|
describe(`${network}`, () => {
|
|
@@ -958,25 +958,26 @@ export const CurveV1Config: DexConfigMap<DexParams> = {
|
|
|
958
958
|
isMetapool: false,
|
|
959
959
|
baseToken: '0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E',
|
|
960
960
|
},
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
961
|
+
// Disabled pool
|
|
962
|
+
// main_iDAI_iUSDC_iFUSDT: {
|
|
963
|
+
// underlying: [
|
|
964
|
+
// '0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E', // DAI
|
|
965
|
+
// '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', // USDC
|
|
966
|
+
// '0x049d68029688eAbF473097a2fC38ef61633A3C7A', // fUSDT
|
|
967
|
+
// ],
|
|
968
|
+
// coins: [
|
|
969
|
+
// '0x04c762a5dF2Fa02FE868F25359E0C259fB811CfE', // iDAI
|
|
970
|
+
// '0x328A7b4d538A2b3942653a9983fdA3C12c571141', // iUSDC
|
|
971
|
+
// '0x70faC71debfD67394D1278D98A29dea79DC6E57A', // iFUSDT
|
|
972
|
+
// ],
|
|
973
|
+
// address: '0x4FC8D635c3cB1d0aa123859e2B2587d0FF2707b1',
|
|
974
|
+
// name: 'main_iDAI_iUSDC_iFUSDT',
|
|
975
|
+
// type: 2,
|
|
976
|
+
// version: 3,
|
|
977
|
+
// isLending: true,
|
|
978
|
+
// isMetapool: false,
|
|
979
|
+
// baseToken: '0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E',
|
|
980
|
+
// },
|
|
980
981
|
},
|
|
981
982
|
},
|
|
982
983
|
[Network.AVALANCHE]: {
|
|
@@ -38,13 +38,7 @@ function testForNetwork(
|
|
|
38
38
|
ContractMethod.megaSwap,
|
|
39
39
|
],
|
|
40
40
|
],
|
|
41
|
-
[
|
|
42
|
-
SwapSide.BUY,
|
|
43
|
-
[
|
|
44
|
-
ContractMethod.simpleBuy,
|
|
45
|
-
ContractMethod.buy,
|
|
46
|
-
],
|
|
47
|
-
],
|
|
41
|
+
[SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
|
|
48
42
|
]);
|
|
49
43
|
|
|
50
44
|
describe(`${network}`, () => {
|
|
@@ -38,13 +38,7 @@ function testForNetwork(
|
|
|
38
38
|
ContractMethod.megaSwap,
|
|
39
39
|
],
|
|
40
40
|
],
|
|
41
|
-
[
|
|
42
|
-
SwapSide.BUY,
|
|
43
|
-
[
|
|
44
|
-
ContractMethod.simpleBuy,
|
|
45
|
-
ContractMethod.buy,
|
|
46
|
-
],
|
|
47
|
-
],
|
|
41
|
+
[SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
|
|
48
42
|
]);
|
|
49
43
|
|
|
50
44
|
describe(`${network}`, () => {
|
|
@@ -104,6 +104,7 @@ export class QuickPerpsEventPool extends ComposedEventSubscriber<PoolState> {
|
|
|
104
104
|
const evenState = this.getState(blockNumber);
|
|
105
105
|
if (evenState) return evenState;
|
|
106
106
|
const onChainState = await this.generateState(blockNumber);
|
|
107
|
+
this.logger.warn(`State is generated in RPC fallback call`);
|
|
107
108
|
this.setState(onChainState, blockNumber);
|
|
108
109
|
return onChainState;
|
|
109
110
|
}
|
|
@@ -283,7 +284,8 @@ export class QuickPerpsEventPool extends ComposedEventSubscriber<PoolState> {
|
|
|
283
284
|
for (let priceFeed of priceFeeds) {
|
|
284
285
|
const api3ServerAddressCallData =
|
|
285
286
|
Api3FeedSubscriber.getApi3ServerV1MultiCallInput(priceFeed);
|
|
286
|
-
const dataFeedIdCallData =
|
|
287
|
+
const dataFeedIdCallData =
|
|
288
|
+
Api3FeedSubscriber.getDapiNameHashMultiCallInput(priceFeed);
|
|
287
289
|
multiCallData.push(...[api3ServerAddressCallData, dataFeedIdCallData]);
|
|
288
290
|
multicallSlices.push([i, i + 2]);
|
|
289
291
|
i += 2;
|
|
@@ -315,24 +317,31 @@ export class QuickPerpsEventPool extends ComposedEventSubscriber<PoolState> {
|
|
|
315
317
|
await multiContract.methods.aggregate(multiCallData).call({}, blockNumber)
|
|
316
318
|
).returnData;
|
|
317
319
|
|
|
318
|
-
const
|
|
320
|
+
const api3ServerV1Prep: {
|
|
319
321
|
[address: string]: {
|
|
320
322
|
proxy: Address;
|
|
321
323
|
api3ServerV1: Address;
|
|
322
|
-
dataFeedId: string;
|
|
323
324
|
};
|
|
324
325
|
} = {};
|
|
326
|
+
const getFeedIdRequests: MultiCallInput[] = [];
|
|
327
|
+
|
|
325
328
|
for (let token of tokens) {
|
|
326
|
-
const [api3ServerAddressRes,
|
|
329
|
+
const [api3ServerAddressRes, dapiNameHashRes] = configResults.slice(
|
|
327
330
|
...multicallSlices.shift()!,
|
|
328
331
|
);
|
|
329
332
|
const serverV1Address =
|
|
330
333
|
Api3FeedSubscriber.decodeApi3ServerV1Result(api3ServerAddressRes);
|
|
331
|
-
const
|
|
332
|
-
|
|
334
|
+
const dapiNameHash =
|
|
335
|
+
Api3FeedSubscriber.decodeDapiNameHash(dapiNameHashRes);
|
|
336
|
+
getFeedIdRequests.push(
|
|
337
|
+
Api3FeedSubscriber.getFeedIdFromDapiNameHash(
|
|
338
|
+
serverV1Address,
|
|
339
|
+
dapiNameHash,
|
|
340
|
+
),
|
|
341
|
+
);
|
|
342
|
+
api3ServerV1Prep[token] = {
|
|
333
343
|
proxy: priceFeeds.shift(),
|
|
334
344
|
api3ServerV1: serverV1Address,
|
|
335
|
-
dataFeedId,
|
|
336
345
|
};
|
|
337
346
|
}
|
|
338
347
|
|
|
@@ -355,6 +364,32 @@ export class QuickPerpsEventPool extends ComposedEventSubscriber<PoolState> {
|
|
|
355
364
|
const vaultConfigResults = configResults.slice(...multicallSlices.shift()!);
|
|
356
365
|
const vaultConfig = Vault.getConfig(vaultConfigResults, tokens);
|
|
357
366
|
|
|
367
|
+
const feedIdResults = (
|
|
368
|
+
await multiContract.methods
|
|
369
|
+
.aggregate(getFeedIdRequests)
|
|
370
|
+
.call({}, blockNumber)
|
|
371
|
+
).returnData;
|
|
372
|
+
|
|
373
|
+
const api3ServerV1: {
|
|
374
|
+
[address: string]: {
|
|
375
|
+
proxy: Address;
|
|
376
|
+
api3ServerV1: Address;
|
|
377
|
+
dataFeedId: string;
|
|
378
|
+
};
|
|
379
|
+
} = {};
|
|
380
|
+
for (let [i, token] of tokens.entries()) {
|
|
381
|
+
const { proxy, api3ServerV1: api3ServerAddress } =
|
|
382
|
+
api3ServerV1Prep[token];
|
|
383
|
+
const dataFeedId = Api3FeedSubscriber.decodeFeedIdFromDapiNameHash(
|
|
384
|
+
feedIdResults[i],
|
|
385
|
+
);
|
|
386
|
+
api3ServerV1[token] = {
|
|
387
|
+
proxy,
|
|
388
|
+
api3ServerV1: api3ServerAddress,
|
|
389
|
+
dataFeedId,
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
358
393
|
return {
|
|
359
394
|
vaultAddress: dexParams.vault,
|
|
360
395
|
readerAddress: dexParams.reader,
|
|
@@ -117,45 +117,55 @@ export class QuickPerps extends SimpleExchange implements IDex<QuickPerpsData> {
|
|
|
117
117
|
limitPools?: string[],
|
|
118
118
|
): Promise<null | ExchangePrices<QuickPerpsData>> {
|
|
119
119
|
if (side === SwapSide.BUY || !this.pool) return null;
|
|
120
|
-
|
|
121
|
-
.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
try {
|
|
121
|
+
const srcAddress = this.dexHelper.config
|
|
122
|
+
.wrapETH(srcToken)
|
|
123
|
+
.address.toLowerCase();
|
|
124
|
+
const destAddress = this.dexHelper.config
|
|
125
|
+
.wrapETH(destToken)
|
|
126
|
+
.address.toLowerCase();
|
|
127
|
+
if (
|
|
128
|
+
srcAddress === destAddress ||
|
|
129
|
+
!(
|
|
130
|
+
this.supportedTokensMap[srcAddress] &&
|
|
131
|
+
this.supportedTokensMap[destAddress]
|
|
132
|
+
)
|
|
131
133
|
)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (limitPools && pools.some(p => !limitPools.includes(p))) return null;
|
|
134
|
+
return null;
|
|
135
|
+
const srcPoolIdentifier = `${this.dexKey}_${srcAddress}`;
|
|
136
|
+
const destPoolIdentifier = `${this.dexKey}_${destAddress}`;
|
|
137
|
+
const pools = [srcPoolIdentifier, destPoolIdentifier];
|
|
138
|
+
if (limitPools && pools.some(p => !limitPools.includes(p))) return null;
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
const unitVolume = getBigIntPow(srcToken.decimals);
|
|
141
|
+
const prices = await this.pool.getAmountOut(
|
|
142
|
+
srcAddress,
|
|
143
|
+
destAddress,
|
|
144
|
+
[unitVolume, ...amounts],
|
|
145
|
+
blockNumber,
|
|
146
|
+
);
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
if (!prices) return null;
|
|
148
149
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
return [
|
|
151
|
+
{
|
|
152
|
+
prices: prices.slice(1),
|
|
153
|
+
unit: prices[0],
|
|
154
|
+
gasCost: QuickPerpsGasCost,
|
|
155
|
+
exchange: this.dexKey,
|
|
156
|
+
data: {},
|
|
157
|
+
poolAddresses: [this.params.vault],
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
} catch (e) {
|
|
161
|
+
this.logger.error(
|
|
162
|
+
`Error_getPrices ${srcToken.symbol || srcToken.address}, ${
|
|
163
|
+
destToken.symbol || destToken.address
|
|
164
|
+
}, ${side}: `,
|
|
165
|
+
e,
|
|
166
|
+
);
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
159
169
|
}
|
|
160
170
|
|
|
161
171
|
// Returns estimated gas cost of calldata for this DEX in multiSwap
|
|
@@ -16,11 +16,7 @@ export class Aerodrome extends VelodromeV2 {
|
|
|
16
16
|
dexKey: string,
|
|
17
17
|
protected dexHelper: IDexHelper,
|
|
18
18
|
) {
|
|
19
|
-
super(
|
|
20
|
-
network,
|
|
21
|
-
dexKey,
|
|
22
|
-
dexHelper,
|
|
23
|
-
);
|
|
19
|
+
super(network, dexKey, dexHelper);
|
|
24
20
|
|
|
25
21
|
this.factory = new dexHelper.web3Provider.eth.Contract(
|
|
26
22
|
AerodromeFactoryABI as any,
|
|
@@ -220,8 +220,7 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
|
|
|
220
220
|
chunksCount: 10,
|
|
221
221
|
initRetryFrequency: 10,
|
|
222
222
|
initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
|
|
223
|
-
subgraphURL:
|
|
224
|
-
'https://api.studio.thegraph.com/query/32073/v3-base/v0.0.1',
|
|
223
|
+
subgraphURL: 'https://api.studio.thegraph.com/query/32073/v3-base/v0.0.1',
|
|
225
224
|
},
|
|
226
225
|
},
|
|
227
226
|
ChronosV3: {
|
|
@@ -429,13 +429,7 @@ describe('UniswapV3 E2E', () => {
|
|
|
429
429
|
ContractMethod.megaSwap,
|
|
430
430
|
],
|
|
431
431
|
],
|
|
432
|
-
[
|
|
433
|
-
SwapSide.BUY,
|
|
434
|
-
[
|
|
435
|
-
ContractMethod.simpleBuy,
|
|
436
|
-
ContractMethod.buy
|
|
437
|
-
],
|
|
438
|
-
],
|
|
432
|
+
[SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
|
|
439
433
|
]);
|
|
440
434
|
|
|
441
435
|
sideToContractMethods.forEach((contractMethods, side) =>
|
package/src/lib/api3-feed.ts
CHANGED
|
@@ -51,6 +51,14 @@ export class Api3FeedSubscriber<State> extends PartialEventSubscriber<
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
static getDapiNameHashMultiCallInput(proxy: Address): MultiCallInput {
|
|
55
|
+
return {
|
|
56
|
+
target: proxy,
|
|
57
|
+
callData:
|
|
58
|
+
Api3FeedSubscriber.proxyInterface.encodeFunctionData('dapiNameHash'),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
54
62
|
static getDataFeedId(proxy: Address): MultiCallInput {
|
|
55
63
|
return {
|
|
56
64
|
target: proxy,
|
|
@@ -59,6 +67,33 @@ export class Api3FeedSubscriber<State> extends PartialEventSubscriber<
|
|
|
59
67
|
};
|
|
60
68
|
}
|
|
61
69
|
|
|
70
|
+
static getFeedIdFromDapiNameHash(
|
|
71
|
+
api3Server: Address,
|
|
72
|
+
dapiNameHash: string,
|
|
73
|
+
): MultiCallInput {
|
|
74
|
+
return {
|
|
75
|
+
target: api3Server,
|
|
76
|
+
callData: Api3FeedSubscriber.api3ServerV1Iface.encodeFunctionData(
|
|
77
|
+
'dapiNameHashToDataFeedId',
|
|
78
|
+
[dapiNameHash],
|
|
79
|
+
),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static decodeFeedIdFromDapiNameHash(multicallOutput: MultiCallOutput) {
|
|
84
|
+
return Api3FeedSubscriber.api3ServerV1Iface.decodeFunctionResult(
|
|
85
|
+
'dapiNameHashToDataFeedId',
|
|
86
|
+
multicallOutput,
|
|
87
|
+
)[0];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static decodeDapiNameHash(multicallOutput: MultiCallOutput) {
|
|
91
|
+
return Api3FeedSubscriber.proxyInterface.decodeFunctionResult(
|
|
92
|
+
'dapiNameHash',
|
|
93
|
+
multicallOutput,
|
|
94
|
+
)[0];
|
|
95
|
+
}
|
|
96
|
+
|
|
62
97
|
static decodeDataFeedId(multicallOutput: MultiCallOutput) {
|
|
63
98
|
return Api3FeedSubscriber.proxyInterface.decodeFunctionResult(
|
|
64
99
|
'dataFeedId',
|