@gearbox-protocol/sdk 1.26.1 → 1.27.0
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/AdapterData.sol +76 -239
- package/contracts/AdapterType.sol +23 -23
- package/contracts/PriceFeedDataLive.sol +369 -284
- package/contracts/PriceFeedType.sol +19 -18
- package/contracts/SupportedContracts.sol +110 -262
- package/contracts/Tokens.sol +106 -90
- package/contracts/TokensData.sol +197 -664
- package/lib/apy/curveAPY.js +1 -1
- package/lib/apy/yearnAPY.js +1 -1
- package/lib/contracts/contracts.d.ts +21 -2
- package/lib/contracts/contracts.js +102 -2
- package/lib/contracts/contractsRegister.js +1 -1
- package/lib/contracts/protocols.d.ts +3 -1
- package/lib/contracts/protocols.js +10 -0
- package/lib/core/creditSession.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -5
- package/lib/oracles/oracles.d.ts +20 -6
- package/lib/oracles/oracles.js +4 -3
- package/lib/oracles/priceFeeds.js +106 -52
- package/lib/oracles/priceFeeds.spec.d.ts +1 -0
- package/lib/oracles/priceFeeds.spec.js +135 -0
- package/lib/parsers/txParser.js +2 -2
- package/lib/pathfinder/tradeTypes.d.ts +25 -2
- package/lib/pathfinder/tradeTypes.js +5 -0
- package/lib/tokens/aave.d.ts +23 -0
- package/lib/tokens/aave.js +119 -0
- package/lib/tokens/compound.d.ts +13 -0
- package/lib/tokens/compound.js +61 -0
- package/lib/tokens/decimals.js +13 -0
- package/lib/tokens/normal.d.ts +1 -1
- package/lib/tokens/normal.js +16 -0
- package/lib/tokens/token.d.ts +4 -2
- package/lib/tokens/token.js +43 -4
- package/lib/tokens/tokenType.d.ts +4 -2
- package/lib/tokens/tokenType.js +3 -1
- package/lib/tokens/tokens.spec.d.ts +1 -0
- package/lib/tokens/tokens.spec.js +110 -0
- package/lib/utils/mappers.d.ts +6 -5
- package/lib/utils/mappers.js +11 -12
- package/lib/utils/multicall.d.ts +14 -0
- package/lib/utils/multicall.js +34 -1
- package/package.json +3 -2
package/lib/apy/curveAPY.js
CHANGED
|
@@ -52,7 +52,7 @@ async function getCurveAPY() {
|
|
|
52
52
|
...cryptoPoolData.map(p => [p.id, p]),
|
|
53
53
|
...factoryTricryptoPoolData.map(p => [p.id, p]),
|
|
54
54
|
]);
|
|
55
|
-
const curveAPY =
|
|
55
|
+
const curveAPY = mappers_1.TypedObjectUtils.entries(APY_DICTIONARY).reduce((acc, [curveSymbol, poolId]) => {
|
|
56
56
|
const { baseApy, crvApy } = apys[poolId] || {};
|
|
57
57
|
if (baseApy === undefined)
|
|
58
58
|
console.warn(`No base apy for: ${curveSymbol}, ${poolId}`);
|
package/lib/apy/yearnAPY.js
CHANGED
|
@@ -19,7 +19,7 @@ async function getYearnAPY() {
|
|
|
19
19
|
acc[d.symbol.toLowerCase()] = d;
|
|
20
20
|
return acc;
|
|
21
21
|
}, {});
|
|
22
|
-
const yearnAPY =
|
|
22
|
+
const yearnAPY = mappers_1.TypedObjectUtils.entries(yearn_1.yearnTokens).reduce((acc, [yearnSymbol]) => {
|
|
23
23
|
const { apy } = dataBySymbol[transformSymbol(yearnSymbol)] || {};
|
|
24
24
|
const { net_apy: netApy } = apy || {};
|
|
25
25
|
acc[yearnSymbol] = (0, formatter_1.toBN)((netApy / RESPONSE_DECIMALS).toString(), constants_1.WAD_DECIMALS_POW);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NetworkType } from "../core/chains";
|
|
2
|
+
import { AaveV2LPToken } from "../tokens/aave";
|
|
2
3
|
import { ConvexStakedPhantomToken } from "../tokens/convex";
|
|
3
4
|
import type { CurveLPToken } from "../tokens/curveLP";
|
|
4
5
|
import { NormalToken } from "../tokens/normal";
|
|
@@ -9,7 +10,10 @@ export type UniswapV2Contract = "UNISWAP_V2_ROUTER" | "SUSHISWAP_ROUTER";
|
|
|
9
10
|
export type CurvePoolContract = "CURVE_3CRV_POOL" | "CURVE_FRAX_USDC_POOL" | "CURVE_STETH_GATEWAY" | "CURVE_FRAX_POOL" | "CURVE_LUSD_POOL" | "CURVE_GUSD_POOL" | "CURVE_SUSD_POOL" | "CURVE_SUSD_DEPOSIT" | "CURVE_OHMFRAXBP_POOL" | "CURVE_CRVETH_POOL" | "CURVE_CVXETH_POOL" | "CURVE_3CRYPTO_POOL" | "CURVE_MIM_POOL" | "CURVE_LDOETH_POOL";
|
|
10
11
|
export type YearnVaultContract = "YEARN_DAI_VAULT" | "YEARN_USDC_VAULT" | "YEARN_WETH_VAULT" | "YEARN_WBTC_VAULT" | "YEARN_CURVE_FRAX_VAULT" | "YEARN_CURVE_STETH_VAULT";
|
|
11
12
|
export type ConvexPoolContract = "CONVEX_3CRV_POOL" | "CONVEX_FRAX_USDC_POOL" | "CONVEX_GUSD_POOL" | "CONVEX_SUSD_POOL" | "CONVEX_STECRV_POOL" | "CONVEX_FRAX3CRV_POOL" | "CONVEX_LUSD3CRV_POOL" | "CONVEX_OHMFRAXBP_POOL" | "CONVEX_MIM3CRV_POOL" | "CONVEX_CRVETH_POOL" | "CONVEX_CVXETH_POOL" | "CONVEX_3CRYPTO_POOL" | "CONVEX_LDOETH_POOL";
|
|
12
|
-
export type
|
|
13
|
+
export type AaveV2PoolContract = "AAVE_V2_DAI_POOL" | "AAVE_V2_USDC_POOL" | "AAVE_V2_USDT_POOL" | "AAVE_V2_WETH_POOL";
|
|
14
|
+
export type AaveV2TokenWrapperContract = "AAVE_V2_DAI_TOKEN_WRAPPER" | "AAVE_V2_USDC_TOKEN_WRAPPER" | "AAVE_V2_USDT_TOKEN_WRAPPER" | "AAVE_V2_WETH_TOKEN_WRAPPER";
|
|
15
|
+
export type CompoundV2PoolContract = "COMPOUND_V2_DAI_POOL" | "COMPOUND_V2_USDC_POOL" | "COMPOUND_V2_USDT_POOL" | "COMPOUND_V2_WETH_POOL";
|
|
16
|
+
export type SupportedContract = UniswapV2Contract | "UNISWAP_V3_ROUTER" | CurvePoolContract | "CURVE_GEAR_POOL" | YearnVaultContract | "CONVEX_BOOSTER" | ConvexPoolContract | "CONVEX_CLAIM_ZAP" | "LIDO_STETH_GATEWAY" | "LIDO_WSTETH" | "UNIVERSAL_ADAPTER" | "BALANCER_VAULT" | AaveV2PoolContract | AaveV2TokenWrapperContract | CompoundV2PoolContract;
|
|
13
17
|
export declare const contractsByNetwork: Record<NetworkType, Record<SupportedContract, string>>;
|
|
14
18
|
export declare const UNISWAP_V3_QUOTER = "NOT DEPLOYED";
|
|
15
19
|
export interface BaseContractParams {
|
|
@@ -83,7 +87,22 @@ export type BalancerParams = {
|
|
|
83
87
|
protocol: Protocols.Balancer;
|
|
84
88
|
type: AdapterInterface.BALANCER_VAULT;
|
|
85
89
|
} & BaseContractParams;
|
|
86
|
-
export type
|
|
90
|
+
export type AaveV2Params = {
|
|
91
|
+
protocol: Protocols.AaveV2;
|
|
92
|
+
type: AdapterInterface.AAVE_V2_LENDING_POOL;
|
|
93
|
+
underlying: NormalToken;
|
|
94
|
+
} & BaseContractParams;
|
|
95
|
+
export type WrapperAaveV2Params = {
|
|
96
|
+
protocol: Protocols.AaveV2;
|
|
97
|
+
type: AdapterInterface.AAVE_V2_WRAPPED_ATOKEN;
|
|
98
|
+
underlying: AaveV2LPToken;
|
|
99
|
+
} & BaseContractParams;
|
|
100
|
+
export type CompoundV2Params = {
|
|
101
|
+
protocol: Protocols.CompoundV2;
|
|
102
|
+
type: AdapterInterface.COMPOUND_V2_CERC20 | AdapterInterface.COMPOUND_V2_CETHER;
|
|
103
|
+
underlying: NormalToken;
|
|
104
|
+
} & BaseContractParams;
|
|
105
|
+
export type ContractParams = UniswapV2Params | UniswapV3Params | CurveParams | CurveSteCRVPoolParams | CurveGEARPoolParams | YearnParams | ConvexParams | ConvexPoolParams | LidoParams | LidoWsthETHParams | UniversalParams | BalancerParams | AaveV2Params | WrapperAaveV2Params | CompoundV2Params;
|
|
87
106
|
export declare const contractParams: Record<SupportedContract, ContractParams>;
|
|
88
107
|
export declare const contractsByAddress: Record<string, SupportedContract>;
|
|
89
108
|
export declare const isSupportedContract: (t: unknown) => t is SupportedContract;
|
|
@@ -57,6 +57,19 @@ exports.contractsByNetwork = {
|
|
|
57
57
|
BALANCER_VAULT: "0xBA12222222228d8Ba445958a75a0704d566BF2C8",
|
|
58
58
|
// GEARBOX
|
|
59
59
|
UNIVERSAL_ADAPTER: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
|
|
60
|
+
// AAVE
|
|
61
|
+
AAVE_V2_DAI_POOL: constants_1.NOT_DEPLOYED,
|
|
62
|
+
AAVE_V2_USDC_POOL: constants_1.NOT_DEPLOYED,
|
|
63
|
+
AAVE_V2_USDT_POOL: constants_1.NOT_DEPLOYED,
|
|
64
|
+
AAVE_V2_WETH_POOL: constants_1.NOT_DEPLOYED,
|
|
65
|
+
AAVE_V2_DAI_TOKEN_WRAPPER: token_1.tokenDataByNetwork.Mainnet.waDAI,
|
|
66
|
+
AAVE_V2_USDC_TOKEN_WRAPPER: token_1.tokenDataByNetwork.Mainnet.waUSDC,
|
|
67
|
+
AAVE_V2_USDT_TOKEN_WRAPPER: token_1.tokenDataByNetwork.Mainnet.waUSDT,
|
|
68
|
+
AAVE_V2_WETH_TOKEN_WRAPPER: token_1.tokenDataByNetwork.Mainnet.waWETH,
|
|
69
|
+
COMPOUND_V2_DAI_POOL: token_1.tokenDataByNetwork.Mainnet.cDAI,
|
|
70
|
+
COMPOUND_V2_USDC_POOL: token_1.tokenDataByNetwork.Mainnet.cUSDC,
|
|
71
|
+
COMPOUND_V2_USDT_POOL: token_1.tokenDataByNetwork.Mainnet.cUSDT,
|
|
72
|
+
COMPOUND_V2_WETH_POOL: token_1.tokenDataByNetwork.Mainnet.cWETH,
|
|
60
73
|
},
|
|
61
74
|
//
|
|
62
75
|
//
|
|
@@ -117,6 +130,19 @@ exports.contractsByNetwork = {
|
|
|
117
130
|
BALANCER_VAULT: constants_1.NOT_DEPLOYED,
|
|
118
131
|
// GEARBOX
|
|
119
132
|
UNIVERSAL_ADAPTER: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
|
|
133
|
+
// AAVE
|
|
134
|
+
AAVE_V2_DAI_POOL: constants_1.NOT_DEPLOYED,
|
|
135
|
+
AAVE_V2_USDC_POOL: constants_1.NOT_DEPLOYED,
|
|
136
|
+
AAVE_V2_USDT_POOL: constants_1.NOT_DEPLOYED,
|
|
137
|
+
AAVE_V2_WETH_POOL: constants_1.NOT_DEPLOYED,
|
|
138
|
+
AAVE_V2_DAI_TOKEN_WRAPPER: token_1.tokenDataByNetwork.Arbitrum.waDAI,
|
|
139
|
+
AAVE_V2_USDC_TOKEN_WRAPPER: token_1.tokenDataByNetwork.Arbitrum.waUSDC,
|
|
140
|
+
AAVE_V2_USDT_TOKEN_WRAPPER: token_1.tokenDataByNetwork.Arbitrum.waUSDT,
|
|
141
|
+
AAVE_V2_WETH_TOKEN_WRAPPER: token_1.tokenDataByNetwork.Arbitrum.waWETH,
|
|
142
|
+
COMPOUND_V2_DAI_POOL: token_1.tokenDataByNetwork.Arbitrum.cDAI,
|
|
143
|
+
COMPOUND_V2_USDC_POOL: token_1.tokenDataByNetwork.Arbitrum.cUSDC,
|
|
144
|
+
COMPOUND_V2_USDT_POOL: token_1.tokenDataByNetwork.Arbitrum.cUSDT,
|
|
145
|
+
COMPOUND_V2_WETH_POOL: token_1.tokenDataByNetwork.Arbitrum.cWETH,
|
|
120
146
|
},
|
|
121
147
|
};
|
|
122
148
|
exports.UNISWAP_V3_QUOTER = constants_1.NOT_DEPLOYED;
|
|
@@ -482,10 +508,84 @@ exports.contractParams = {
|
|
|
482
508
|
protocol: protocols_1.Protocols.Balancer,
|
|
483
509
|
type: adapters_1.AdapterInterface.BALANCER_VAULT,
|
|
484
510
|
},
|
|
511
|
+
AAVE_V2_DAI_POOL: {
|
|
512
|
+
name: "Aave V2 DAI",
|
|
513
|
+
protocol: protocols_1.Protocols.AaveV2,
|
|
514
|
+
type: adapters_1.AdapterInterface.AAVE_V2_LENDING_POOL,
|
|
515
|
+
underlying: "DAI",
|
|
516
|
+
},
|
|
517
|
+
AAVE_V2_USDC_POOL: {
|
|
518
|
+
name: "Aave V2 USDC",
|
|
519
|
+
protocol: protocols_1.Protocols.AaveV2,
|
|
520
|
+
type: adapters_1.AdapterInterface.AAVE_V2_LENDING_POOL,
|
|
521
|
+
underlying: "USDC",
|
|
522
|
+
},
|
|
523
|
+
AAVE_V2_USDT_POOL: {
|
|
524
|
+
name: "Aave V2 USDT",
|
|
525
|
+
protocol: protocols_1.Protocols.AaveV2,
|
|
526
|
+
type: adapters_1.AdapterInterface.AAVE_V2_LENDING_POOL,
|
|
527
|
+
underlying: "USDT",
|
|
528
|
+
},
|
|
529
|
+
AAVE_V2_WETH_POOL: {
|
|
530
|
+
name: "Aave V2 WETH",
|
|
531
|
+
protocol: protocols_1.Protocols.AaveV2,
|
|
532
|
+
type: adapters_1.AdapterInterface.AAVE_V2_LENDING_POOL,
|
|
533
|
+
underlying: "WETH",
|
|
534
|
+
},
|
|
535
|
+
AAVE_V2_DAI_TOKEN_WRAPPER: {
|
|
536
|
+
name: "Aave V2 DAI Token Wrapper",
|
|
537
|
+
protocol: protocols_1.Protocols.AaveV2,
|
|
538
|
+
type: adapters_1.AdapterInterface.AAVE_V2_WRAPPED_ATOKEN,
|
|
539
|
+
underlying: "aDAI",
|
|
540
|
+
},
|
|
541
|
+
AAVE_V2_USDC_TOKEN_WRAPPER: {
|
|
542
|
+
name: "Aave V2 USDC Token Wrapper",
|
|
543
|
+
protocol: protocols_1.Protocols.AaveV2,
|
|
544
|
+
type: adapters_1.AdapterInterface.AAVE_V2_WRAPPED_ATOKEN,
|
|
545
|
+
underlying: "aUSDC",
|
|
546
|
+
},
|
|
547
|
+
AAVE_V2_USDT_TOKEN_WRAPPER: {
|
|
548
|
+
name: "Aave V2 USDT Token Wrapper",
|
|
549
|
+
protocol: protocols_1.Protocols.AaveV2,
|
|
550
|
+
type: adapters_1.AdapterInterface.AAVE_V2_WRAPPED_ATOKEN,
|
|
551
|
+
underlying: "aUSDT",
|
|
552
|
+
},
|
|
553
|
+
AAVE_V2_WETH_TOKEN_WRAPPER: {
|
|
554
|
+
name: "Aave V2 WETH Token Wrapper",
|
|
555
|
+
protocol: protocols_1.Protocols.AaveV2,
|
|
556
|
+
type: adapters_1.AdapterInterface.AAVE_V2_WRAPPED_ATOKEN,
|
|
557
|
+
underlying: "aWETH",
|
|
558
|
+
},
|
|
559
|
+
COMPOUND_V2_DAI_POOL: {
|
|
560
|
+
name: "Compound V2 DAI",
|
|
561
|
+
protocol: protocols_1.Protocols.CompoundV2,
|
|
562
|
+
type: adapters_1.AdapterInterface.COMPOUND_V2_CERC20,
|
|
563
|
+
underlying: "DAI",
|
|
564
|
+
},
|
|
565
|
+
COMPOUND_V2_USDC_POOL: {
|
|
566
|
+
name: "Compound V2 DAI",
|
|
567
|
+
protocol: protocols_1.Protocols.CompoundV2,
|
|
568
|
+
type: adapters_1.AdapterInterface.COMPOUND_V2_CERC20,
|
|
569
|
+
underlying: "USDT",
|
|
570
|
+
},
|
|
571
|
+
COMPOUND_V2_USDT_POOL: {
|
|
572
|
+
name: "Compound V2 DAI",
|
|
573
|
+
protocol: protocols_1.Protocols.CompoundV2,
|
|
574
|
+
type: adapters_1.AdapterInterface.COMPOUND_V2_CERC20,
|
|
575
|
+
underlying: "USDT",
|
|
576
|
+
},
|
|
577
|
+
COMPOUND_V2_WETH_POOL: {
|
|
578
|
+
name: "Compound V2 DAI",
|
|
579
|
+
protocol: protocols_1.Protocols.CompoundV2,
|
|
580
|
+
type: adapters_1.AdapterInterface.COMPOUND_V2_CETHER,
|
|
581
|
+
underlying: "WETH",
|
|
582
|
+
},
|
|
485
583
|
};
|
|
486
|
-
exports.contractsByAddress =
|
|
584
|
+
exports.contractsByAddress = mappers_1.TypedObjectUtils.entries(exports.contractsByNetwork).reduce((acc, [, contracts]) => ({
|
|
487
585
|
...acc,
|
|
488
|
-
...
|
|
586
|
+
...mappers_1.TypedObjectUtils.fromEntries(mappers_1.TypedObjectUtils.entries(contracts)
|
|
587
|
+
.map(([k, v]) => [v.toLowerCase(), k])
|
|
588
|
+
.filter(k => !!k)),
|
|
489
589
|
}), {});
|
|
490
590
|
const isSupportedContract = (t) => typeof t === "string" && !!exports.contractParams[t];
|
|
491
591
|
exports.isSupportedContract = isSupportedContract;
|
|
@@ -59,7 +59,7 @@ const contractNames = Object.entries(contracts_1.contractsByAddress).reduce((acc
|
|
|
59
59
|
return { ...acc, [addr]: params.name };
|
|
60
60
|
}, {});
|
|
61
61
|
const contractsFullList = {
|
|
62
|
-
...
|
|
62
|
+
...mappers_1.TypedObjectUtils.keyToLowercase(exports.deployedContracts),
|
|
63
63
|
...contractNames,
|
|
64
64
|
};
|
|
65
65
|
function getContractName(address) {
|
|
@@ -11,6 +11,8 @@ var Protocols;
|
|
|
11
11
|
Protocols[Protocols["Lido"] = 5] = "Lido";
|
|
12
12
|
Protocols[Protocols["Gearbox"] = 6] = "Gearbox";
|
|
13
13
|
Protocols[Protocols["Balancer"] = 7] = "Balancer";
|
|
14
|
+
Protocols[Protocols["AaveV2"] = 8] = "AaveV2";
|
|
15
|
+
Protocols[Protocols["CompoundV2"] = 9] = "CompoundV2";
|
|
14
16
|
})(Protocols = exports.Protocols || (exports.Protocols = {}));
|
|
15
17
|
exports.protocolData = {
|
|
16
18
|
[Protocols.Uniswap]: {
|
|
@@ -45,4 +47,12 @@ exports.protocolData = {
|
|
|
45
47
|
name: "Balancer",
|
|
46
48
|
icon: "",
|
|
47
49
|
},
|
|
50
|
+
[Protocols.AaveV2]: {
|
|
51
|
+
name: "AaveV2",
|
|
52
|
+
icon: "",
|
|
53
|
+
},
|
|
54
|
+
[Protocols.CompoundV2]: {
|
|
55
|
+
name: "CompoundV2",
|
|
56
|
+
icon: "",
|
|
57
|
+
},
|
|
48
58
|
};
|
|
@@ -16,7 +16,7 @@ exports.CREDIT_SESSION_STATUS_BY_ID = {
|
|
|
16
16
|
4: "liquidateExpired",
|
|
17
17
|
5: "liquidatePaused",
|
|
18
18
|
};
|
|
19
|
-
exports.CREDIT_SESSION_ID_BY_STATUS =
|
|
19
|
+
exports.CREDIT_SESSION_ID_BY_STATUS = mappers_1.TypedObjectUtils.swapKeyValue(exports.CREDIT_SESSION_STATUS_BY_ID);
|
|
20
20
|
class CreditSession {
|
|
21
21
|
id;
|
|
22
22
|
status;
|
package/lib/index.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export { TokenType } from "./tokens/tokenType";
|
|
|
56
56
|
export * from "./tokens/yearn";
|
|
57
57
|
export * from "./utils/errors";
|
|
58
58
|
export { getPoolTokens, getUnderlyingToken } from "./utils/extracter";
|
|
59
|
-
export
|
|
59
|
+
export * from "./utils/mappers";
|
|
60
60
|
export * from "./utils/multicall";
|
|
61
61
|
export * from "./utils/price";
|
|
62
62
|
export { callRepeater } from "./utils/repeater";
|
package/lib/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.callRepeater = exports.
|
|
17
|
+
exports.callRepeater = exports.getUnderlyingToken = exports.getPoolTokens = exports.TokenType = exports.AdapterInterface = void 0;
|
|
18
18
|
__exportStar(require("./contracts/contracts"), exports);
|
|
19
19
|
__exportStar(require("./contracts/protocols"), exports);
|
|
20
20
|
__exportStar(require("./core/adapter"), exports);
|
|
@@ -78,10 +78,7 @@ __exportStar(require("./utils/errors"), exports);
|
|
|
78
78
|
var extracter_1 = require("./utils/extracter");
|
|
79
79
|
Object.defineProperty(exports, "getPoolTokens", { enumerable: true, get: function () { return extracter_1.getPoolTokens; } });
|
|
80
80
|
Object.defineProperty(exports, "getUnderlyingToken", { enumerable: true, get: function () { return extracter_1.getUnderlyingToken; } });
|
|
81
|
-
|
|
82
|
-
Object.defineProperty(exports, "keyToLowercase", { enumerable: true, get: function () { return mappers_1.keyToLowercase; } });
|
|
83
|
-
Object.defineProperty(exports, "objectEntries", { enumerable: true, get: function () { return mappers_1.objectEntries; } });
|
|
84
|
-
Object.defineProperty(exports, "swapKeyValue", { enumerable: true, get: function () { return mappers_1.swapKeyValue; } });
|
|
81
|
+
__exportStar(require("./utils/mappers"), exports);
|
|
85
82
|
__exportStar(require("./utils/multicall"), exports);
|
|
86
83
|
__exportStar(require("./utils/price"), exports);
|
|
87
84
|
var repeater_1 = require("./utils/repeater");
|
package/lib/oracles/oracles.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { NetworkType } from "../core/chains";
|
|
2
|
+
import { AaveV2LPToken } from "../tokens/aave";
|
|
3
|
+
import { NormalToken } from "../tokens/normal";
|
|
2
4
|
import { SupportedToken } from "../tokens/token";
|
|
3
5
|
export interface PriceFeed {
|
|
4
6
|
token: string;
|
|
@@ -14,14 +16,15 @@ export declare enum OracleType {
|
|
|
14
16
|
WSTETH_ORACLE = 6,
|
|
15
17
|
BOUNDED_ORACLE = 7,
|
|
16
18
|
COMPOSITE_ORACLE = 8,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
WRAPPED_AAVE_V2_ORACLE = 9,
|
|
20
|
+
COMPOUND_V2_ORACLE = 10,
|
|
19
21
|
BALANCER_STABLE_LP_ORACLE = 11,
|
|
20
22
|
BALANCER_WEIGHTED_LP_ORACLE = 12,
|
|
21
23
|
CURVE_CRYPTO_ORACLE = 13,
|
|
22
|
-
|
|
24
|
+
THE_SAME_AS = 14,
|
|
23
25
|
REDSTONE_ORACLE = 15,
|
|
24
|
-
ERC4626_VAULT_ORACLE = 16
|
|
26
|
+
ERC4626_VAULT_ORACLE = 16,
|
|
27
|
+
NETWORK_DIFFERENT = 17
|
|
25
28
|
}
|
|
26
29
|
export type PriceFeedData = {
|
|
27
30
|
type: OracleType.CHAINLINK_ORACLE;
|
|
@@ -58,6 +61,17 @@ export type PriceFeedData = {
|
|
|
58
61
|
type: OracleType.BALANCER_WEIGHTED_LP_ORACLE;
|
|
59
62
|
assets: Array<SupportedToken>;
|
|
60
63
|
} | {
|
|
61
|
-
type: OracleType.
|
|
62
|
-
|
|
64
|
+
type: OracleType.THE_SAME_AS;
|
|
65
|
+
token: SupportedToken;
|
|
66
|
+
} | {
|
|
67
|
+
type: OracleType.WRAPPED_AAVE_V2_ORACLE;
|
|
68
|
+
underlying: AaveV2LPToken;
|
|
69
|
+
} | {
|
|
70
|
+
type: OracleType.COMPOUND_V2_ORACLE;
|
|
71
|
+
underlying: NormalToken;
|
|
72
|
+
} | {
|
|
73
|
+
type: OracleType.REDSTONE_ORACLE;
|
|
74
|
+
dataId: string;
|
|
75
|
+
signers: Array<string>;
|
|
76
|
+
signersThreshold: number;
|
|
63
77
|
};
|
package/lib/oracles/oracles.js
CHANGED
|
@@ -12,12 +12,13 @@ var OracleType;
|
|
|
12
12
|
OracleType[OracleType["WSTETH_ORACLE"] = 6] = "WSTETH_ORACLE";
|
|
13
13
|
OracleType[OracleType["BOUNDED_ORACLE"] = 7] = "BOUNDED_ORACLE";
|
|
14
14
|
OracleType[OracleType["COMPOSITE_ORACLE"] = 8] = "COMPOSITE_ORACLE";
|
|
15
|
-
OracleType[OracleType["
|
|
16
|
-
OracleType[OracleType["
|
|
15
|
+
OracleType[OracleType["WRAPPED_AAVE_V2_ORACLE"] = 9] = "WRAPPED_AAVE_V2_ORACLE";
|
|
16
|
+
OracleType[OracleType["COMPOUND_V2_ORACLE"] = 10] = "COMPOUND_V2_ORACLE";
|
|
17
17
|
OracleType[OracleType["BALANCER_STABLE_LP_ORACLE"] = 11] = "BALANCER_STABLE_LP_ORACLE";
|
|
18
18
|
OracleType[OracleType["BALANCER_WEIGHTED_LP_ORACLE"] = 12] = "BALANCER_WEIGHTED_LP_ORACLE";
|
|
19
19
|
OracleType[OracleType["CURVE_CRYPTO_ORACLE"] = 13] = "CURVE_CRYPTO_ORACLE";
|
|
20
|
-
OracleType[OracleType["
|
|
20
|
+
OracleType[OracleType["THE_SAME_AS"] = 14] = "THE_SAME_AS";
|
|
21
21
|
OracleType[OracleType["REDSTONE_ORACLE"] = 15] = "REDSTONE_ORACLE";
|
|
22
22
|
OracleType[OracleType["ERC4626_VAULT_ORACLE"] = 16] = "ERC4626_VAULT_ORACLE";
|
|
23
|
+
OracleType[OracleType["NETWORK_DIFFERENT"] = 17] = "NETWORK_DIFFERENT";
|
|
23
24
|
})(OracleType = exports.OracleType || (exports.OracleType = {}));
|
|
@@ -227,6 +227,12 @@ exports.priceFeedsByNetwork = {
|
|
|
227
227
|
Arbitrum: "0xb2a824043730fe05f3da2efafa1cbbe83fa548d6",
|
|
228
228
|
},
|
|
229
229
|
},
|
|
230
|
+
SHIB: {
|
|
231
|
+
type: oracles_1.OracleType.REDSTONE_ORACLE,
|
|
232
|
+
dataId: "redstone-main-demo",
|
|
233
|
+
signers: ["0x0C39486f770B26F5527BBBf942726537986Cd7eb"],
|
|
234
|
+
signersThreshold: 1,
|
|
235
|
+
},
|
|
230
236
|
RDNT: {
|
|
231
237
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
232
238
|
address: {
|
|
@@ -321,109 +327,109 @@ exports.priceFeedsByNetwork = {
|
|
|
321
327
|
},
|
|
322
328
|
// CVX tokens
|
|
323
329
|
cvx3Crv: {
|
|
324
|
-
type: oracles_1.OracleType.
|
|
325
|
-
|
|
330
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
331
|
+
token: "3Crv",
|
|
326
332
|
},
|
|
327
333
|
cvxcrvFRAX: {
|
|
328
|
-
type: oracles_1.OracleType.
|
|
329
|
-
|
|
334
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
335
|
+
token: "crvFRAX",
|
|
330
336
|
},
|
|
331
337
|
cvxsteCRV: {
|
|
332
|
-
type: oracles_1.OracleType.
|
|
333
|
-
|
|
338
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
339
|
+
token: "steCRV",
|
|
334
340
|
},
|
|
335
341
|
cvxFRAX3CRV: {
|
|
336
|
-
type: oracles_1.OracleType.
|
|
337
|
-
|
|
342
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
343
|
+
token: "FRAX3CRV",
|
|
338
344
|
},
|
|
339
345
|
cvxLUSD3CRV: {
|
|
340
|
-
type: oracles_1.OracleType.
|
|
341
|
-
|
|
346
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
347
|
+
token: "LUSD3CRV",
|
|
342
348
|
},
|
|
343
349
|
cvxcrvPlain3andSUSD: {
|
|
344
|
-
type: oracles_1.OracleType.
|
|
345
|
-
|
|
350
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
351
|
+
token: "crvPlain3andSUSD",
|
|
346
352
|
},
|
|
347
353
|
cvxgusd3CRV: {
|
|
348
|
-
type: oracles_1.OracleType.
|
|
349
|
-
|
|
354
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
355
|
+
token: "gusd3CRV",
|
|
350
356
|
},
|
|
351
357
|
cvxOHMFRAXBP: {
|
|
352
|
-
type: oracles_1.OracleType.
|
|
353
|
-
|
|
358
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
359
|
+
token: "OHMFRAXBP",
|
|
354
360
|
},
|
|
355
361
|
cvxMIM_3LP3CRV: {
|
|
356
|
-
type: oracles_1.OracleType.
|
|
357
|
-
|
|
362
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
363
|
+
token: "MIM_3LP3CRV",
|
|
358
364
|
},
|
|
359
365
|
cvxcrvCRVETH: {
|
|
360
|
-
type: oracles_1.OracleType.
|
|
361
|
-
|
|
366
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
367
|
+
token: "crvCRVETH",
|
|
362
368
|
},
|
|
363
369
|
cvxcrvCVXETH: {
|
|
364
|
-
type: oracles_1.OracleType.
|
|
365
|
-
|
|
370
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
371
|
+
token: "crvCVXETH",
|
|
366
372
|
},
|
|
367
373
|
cvxcrvUSDTWBTCWETH: {
|
|
368
|
-
type: oracles_1.OracleType.
|
|
369
|
-
|
|
374
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
375
|
+
token: "crvUSDTWBTCWETH",
|
|
370
376
|
},
|
|
371
377
|
cvxLDOETH: {
|
|
372
|
-
type: oracles_1.OracleType.
|
|
373
|
-
|
|
378
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
379
|
+
token: "LDOETH",
|
|
374
380
|
},
|
|
375
381
|
// CVX tokens
|
|
376
382
|
stkcvx3Crv: {
|
|
377
|
-
type: oracles_1.OracleType.
|
|
378
|
-
|
|
383
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
384
|
+
token: "3Crv",
|
|
379
385
|
},
|
|
380
386
|
stkcvxcrvFRAX: {
|
|
381
|
-
type: oracles_1.OracleType.
|
|
382
|
-
|
|
387
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
388
|
+
token: "crvFRAX",
|
|
383
389
|
},
|
|
384
390
|
stkcvxsteCRV: {
|
|
385
|
-
type: oracles_1.OracleType.
|
|
386
|
-
|
|
391
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
392
|
+
token: "steCRV",
|
|
387
393
|
},
|
|
388
394
|
stkcvxFRAX3CRV: {
|
|
389
|
-
type: oracles_1.OracleType.
|
|
390
|
-
|
|
395
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
396
|
+
token: "FRAX3CRV",
|
|
391
397
|
},
|
|
392
398
|
stkcvxLUSD3CRV: {
|
|
393
|
-
type: oracles_1.OracleType.
|
|
394
|
-
|
|
399
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
400
|
+
token: "LUSD3CRV",
|
|
395
401
|
},
|
|
396
402
|
stkcvxcrvPlain3andSUSD: {
|
|
397
|
-
type: oracles_1.OracleType.
|
|
398
|
-
|
|
403
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
404
|
+
token: "crvPlain3andSUSD",
|
|
399
405
|
},
|
|
400
406
|
stkcvxgusd3CRV: {
|
|
401
|
-
type: oracles_1.OracleType.
|
|
402
|
-
|
|
407
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
408
|
+
token: "gusd3CRV",
|
|
403
409
|
},
|
|
404
410
|
stkcvxOHMFRAXBP: {
|
|
405
|
-
type: oracles_1.OracleType.
|
|
406
|
-
|
|
411
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
412
|
+
token: "OHMFRAXBP",
|
|
407
413
|
},
|
|
408
414
|
stkcvxMIM_3LP3CRV: {
|
|
409
|
-
type: oracles_1.OracleType.
|
|
410
|
-
|
|
415
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
416
|
+
token: "MIM_3LP3CRV",
|
|
411
417
|
},
|
|
412
418
|
stkcvxcrvCRVETH: {
|
|
413
|
-
type: oracles_1.OracleType.
|
|
414
|
-
|
|
419
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
420
|
+
token: "crvCRVETH",
|
|
415
421
|
},
|
|
416
422
|
stkcvxcrvCVXETH: {
|
|
417
|
-
type: oracles_1.OracleType.
|
|
418
|
-
|
|
423
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
424
|
+
token: "crvCVXETH",
|
|
419
425
|
},
|
|
420
426
|
stkcvxcrvUSDTWBTCWETH: {
|
|
421
|
-
type: oracles_1.OracleType.
|
|
422
|
-
|
|
427
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
428
|
+
token: "crvUSDTWBTCWETH",
|
|
423
429
|
},
|
|
424
430
|
stkcvxLDOETH: {
|
|
425
|
-
type: oracles_1.OracleType.
|
|
426
|
-
|
|
431
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
432
|
+
token: "LDOETH",
|
|
427
433
|
},
|
|
428
434
|
"50OHM_50DAI": {
|
|
429
435
|
type: oracles_1.OracleType.BALANCER_WEIGHTED_LP_ORACLE,
|
|
@@ -466,4 +472,52 @@ exports.priceFeedsByNetwork = {
|
|
|
466
472
|
type: oracles_1.OracleType.CHAINLINK_ORACLE,
|
|
467
473
|
address: { Mainnet: "", Arbitrum: "" },
|
|
468
474
|
},
|
|
475
|
+
aDAI: {
|
|
476
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
477
|
+
token: "DAI",
|
|
478
|
+
},
|
|
479
|
+
aUSDC: {
|
|
480
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
481
|
+
token: "USDC",
|
|
482
|
+
},
|
|
483
|
+
aUSDT: {
|
|
484
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
485
|
+
token: "USDT",
|
|
486
|
+
},
|
|
487
|
+
aWETH: {
|
|
488
|
+
type: oracles_1.OracleType.THE_SAME_AS,
|
|
489
|
+
token: "WETH",
|
|
490
|
+
},
|
|
491
|
+
waDAI: {
|
|
492
|
+
type: oracles_1.OracleType.WRAPPED_AAVE_V2_ORACLE,
|
|
493
|
+
underlying: "aDAI",
|
|
494
|
+
},
|
|
495
|
+
waUSDC: {
|
|
496
|
+
type: oracles_1.OracleType.WRAPPED_AAVE_V2_ORACLE,
|
|
497
|
+
underlying: "aUSDC",
|
|
498
|
+
},
|
|
499
|
+
waUSDT: {
|
|
500
|
+
type: oracles_1.OracleType.WRAPPED_AAVE_V2_ORACLE,
|
|
501
|
+
underlying: "aUSDT",
|
|
502
|
+
},
|
|
503
|
+
waWETH: {
|
|
504
|
+
type: oracles_1.OracleType.WRAPPED_AAVE_V2_ORACLE,
|
|
505
|
+
underlying: "aWETH",
|
|
506
|
+
},
|
|
507
|
+
cDAI: {
|
|
508
|
+
type: oracles_1.OracleType.COMPOUND_V2_ORACLE,
|
|
509
|
+
underlying: "DAI",
|
|
510
|
+
},
|
|
511
|
+
cUSDC: {
|
|
512
|
+
type: oracles_1.OracleType.COMPOUND_V2_ORACLE,
|
|
513
|
+
underlying: "USDC",
|
|
514
|
+
},
|
|
515
|
+
cUSDT: {
|
|
516
|
+
type: oracles_1.OracleType.COMPOUND_V2_ORACLE,
|
|
517
|
+
underlying: "USDT",
|
|
518
|
+
},
|
|
519
|
+
cWETH: {
|
|
520
|
+
type: oracles_1.OracleType.COMPOUND_V2_ORACLE,
|
|
521
|
+
underlying: "WETH",
|
|
522
|
+
},
|
|
469
523
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|