@gearbox-protocol/sdk 2.1.15 → 2.1.17
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/contracts/PriceFeedDataLive.sol +13 -3
- package/lib/oracles/priceFeeds.js +1 -0
- package/lib/oracles/priceFeeds.spec.js +2 -5
- package/lib/oracles/pricefeedType.d.ts +2 -0
- package/lib/tokens/tokens.spec.js +2 -5
- package/lib/utils/multicall.d.ts +1 -1
- package/lib/utils/multicall.js +2 -2
- package/package.json +1 -1
|
@@ -20,6 +20,12 @@ struct CurvePriceFeedData {
|
|
|
20
20
|
Contracts pool;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
struct CrvUsdPriceFeedData {
|
|
24
|
+
Tokens token;
|
|
25
|
+
Tokens underlying;
|
|
26
|
+
Contracts pool;
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
struct TheSamePriceFeedData {
|
|
24
30
|
Tokens token;
|
|
25
31
|
Tokens tokenHasSamePriceFeed;
|
|
@@ -70,7 +76,7 @@ contract PriceFeedDataLive {
|
|
|
70
76
|
mapping(uint256 => GenericLPPriceFeedData[]) wrappedAaveV2PriceFeedsByNetwork;
|
|
71
77
|
mapping(uint256 => GenericLPPriceFeedData[]) compoundV2PriceFeedsByNetwork;
|
|
72
78
|
mapping(uint256 => GenericLPPriceFeedData[]) erc4626PriceFeedsByNetwork;
|
|
73
|
-
mapping(uint256 =>
|
|
79
|
+
mapping(uint256 => CrvUsdPriceFeedData[]) crvUSDPriceFeedsByNetwork;
|
|
74
80
|
mapping(uint256 => RedStonePriceFeedData[]) redStonePriceFeedsByNetwork;
|
|
75
81
|
|
|
76
82
|
constructor() {
|
|
@@ -765,8 +771,12 @@ contract PriceFeedDataLive {
|
|
|
765
771
|
);
|
|
766
772
|
|
|
767
773
|
// ------------------------ crvUSD ------------------------
|
|
768
|
-
crvUSDPriceFeedsByNetwork[1].push(
|
|
769
|
-
|
|
774
|
+
crvUSDPriceFeedsByNetwork[1].push(
|
|
775
|
+
CrvUsdPriceFeedData({token: Tokens.crvUSD, pool: Contracts.CURVE_CRVUSD_USDC_POOL, underlying: Tokens.USDC})
|
|
776
|
+
);
|
|
777
|
+
crvUSDPriceFeedsByNetwork[42161].push(
|
|
778
|
+
CrvUsdPriceFeedData({token: Tokens.crvUSD, pool: Contracts.CURVE_CRVUSD_USDC_POOL, underlying: Tokens.USDC})
|
|
779
|
+
);
|
|
770
780
|
|
|
771
781
|
// ------------------------ crvUSDUSDC ------------------------
|
|
772
782
|
curvePriceFeedsByNetwork[1].push(
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
const chai_1 = require("chai");
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const chains_1 = require("../core/chains");
|
|
9
6
|
const types_1 = require("../types");
|
|
10
7
|
const formatter_1 = require("../utils/formatter");
|
|
11
|
-
const multicall_1 =
|
|
8
|
+
const multicall_1 = require("../utils/multicall");
|
|
12
9
|
const priceFeeds_1 = require("./priceFeeds");
|
|
13
10
|
const pricefeedType_1 = require("./pricefeedType");
|
|
14
11
|
const iFeed = types_1.AggregatorV3Interface__factory.createInterface();
|
|
@@ -27,7 +24,7 @@ class PriceFeedsSuite {
|
|
|
27
24
|
}
|
|
28
25
|
return new ethers_1.ethers.providers.StaticJsonRpcProvider(url, chains_1.CHAINS[c]);
|
|
29
26
|
});
|
|
30
|
-
const resps = await Promise.all(this.networkTypes.map((_, i) => (0, multicall_1.
|
|
27
|
+
const resps = await Promise.all(this.networkTypes.map((_, i) => (0, multicall_1.safeMulticall)(this.calls[i], providers[i])));
|
|
31
28
|
return resps.map((_, i) => this.buildDict(this.calls[i], resps[i]));
|
|
32
29
|
}
|
|
33
30
|
collectCalls(c) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CurvePoolContract } from "../contracts/contracts";
|
|
1
2
|
import { NetworkType } from "../core/chains";
|
|
2
3
|
import { AaveV2LPToken } from "../tokens/aave";
|
|
3
4
|
import { NormalToken } from "../tokens/normal";
|
|
@@ -89,5 +90,6 @@ export type PriceFeedData = {
|
|
|
89
90
|
feeds: Record<NetworkType, PriceFeedData>;
|
|
90
91
|
} | {
|
|
91
92
|
type: PriceFeedType.CURVE_USD_ORACLE;
|
|
93
|
+
pool: CurvePoolContract;
|
|
92
94
|
underlying: NormalToken;
|
|
93
95
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
/* eslint-disable max-nested-callbacks */
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const chains_1 = require("../core/chains");
|
|
9
6
|
const types_1 = require("../types");
|
|
10
|
-
const multicall_1 =
|
|
7
|
+
const multicall_1 = require("../utils/multicall");
|
|
11
8
|
const token_1 = require("./token");
|
|
12
9
|
const erc20 = types_1.IERC20Metadata__factory.createInterface();
|
|
13
10
|
const EXCEPTIONS_IN_SYMBOLS = {
|
|
@@ -67,7 +64,7 @@ class TokenSuite {
|
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
66
|
else {
|
|
70
|
-
const resps = await (0, multicall_1.
|
|
67
|
+
const resps = await (0, multicall_1.safeMulticall)(this.calls, this.provider);
|
|
71
68
|
for (let i = 0; i < resps.length; i++) {
|
|
72
69
|
const call = this.calls[i];
|
|
73
70
|
const resp = resps[i];
|
package/lib/utils/multicall.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function multicall<R extends Array<any>>(calls: Array<MCall<any>>
|
|
|
21
21
|
* @param overrides
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export declare function safeMulticall<V = any, T extends MCall<any> = MCall<any>>(calls: T[], p: Signer | ethers.providers.Provider, overrides?: CallOverrides): Promise<Array<{
|
|
25
25
|
error: boolean;
|
|
26
26
|
value?: V;
|
|
27
27
|
}>>;
|
package/lib/utils/multicall.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MultiCallContract = exports.multicall = void 0;
|
|
3
|
+
exports.MultiCallContract = exports.safeMulticall = exports.multicall = void 0;
|
|
4
4
|
const config_1 = require("../config");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
async function multicall(calls, p, overrides) {
|
|
@@ -37,7 +37,7 @@ async function safeMulticall(calls, p, overrides) {
|
|
|
37
37
|
: undefined,
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
40
|
-
exports.
|
|
40
|
+
exports.safeMulticall = safeMulticall;
|
|
41
41
|
function unwrapArray(data) {
|
|
42
42
|
if (!data) {
|
|
43
43
|
return data;
|