@defisaver/positions-sdk 1.0.11-fluid-dev12 → 1.0.11-fluid-dev13
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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +69 -69
- package/cjs/config/contracts.d.ts +113 -53
- package/cjs/config/contracts.js +10 -0
- package/cjs/contracts.d.ts +1 -0
- package/cjs/contracts.js +2 -1
- package/cjs/fluid/index.js +27 -0
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/markets/fluid/index.d.ts +0 -2
- package/cjs/markets/fluid/index.js +26 -24
- package/cjs/services/priceService.d.ts +2 -0
- package/cjs/services/priceService.js +13 -1
- package/cjs/types/contracts/generated/BTCPriceFeed.d.ts +135 -0
- package/cjs/types/contracts/generated/BTCPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +1 -0
- package/esm/config/contracts.d.ts +113 -53
- package/esm/config/contracts.js +10 -0
- package/esm/contracts.d.ts +1 -0
- package/esm/contracts.js +1 -0
- package/esm/fluid/index.js +28 -1
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/markets/fluid/index.d.ts +0 -2
- package/esm/markets/fluid/index.js +24 -21
- package/esm/services/priceService.d.ts +2 -0
- package/esm/services/priceService.js +11 -1
- package/esm/types/contracts/generated/BTCPriceFeed.d.ts +135 -0
- package/esm/types/contracts/generated/BTCPriceFeed.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +1 -0
- package/package.json +54 -54
- package/src/aaveV2/index.ts +227 -227
- package/src/aaveV3/index.ts +624 -624
- package/src/assets/index.ts +60 -60
- package/src/chickenBonds/index.ts +123 -123
- package/src/compoundV2/index.ts +220 -220
- package/src/compoundV3/index.ts +291 -291
- package/src/config/contracts.js +1165 -1155
- package/src/constants/index.ts +6 -6
- package/src/contracts.ts +136 -135
- package/src/curveUsd/index.ts +239 -239
- package/src/eulerV2/index.ts +303 -303
- package/src/exchange/index.ts +17 -17
- package/src/fluid/index.ts +1320 -1289
- package/src/helpers/aaveHelpers/index.ts +203 -203
- package/src/helpers/chickenBondsHelpers/index.ts +23 -23
- package/src/helpers/compoundHelpers/index.ts +248 -248
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +234 -234
- package/src/helpers/fluidHelpers/index.ts +325 -325
- package/src/helpers/index.ts +11 -11
- package/src/helpers/liquityV2Helpers/index.ts +80 -80
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +94 -94
- package/src/helpers/morphoBlueHelpers/index.ts +367 -367
- package/src/helpers/sparkHelpers/index.ts +154 -154
- package/src/index.ts +52 -52
- package/src/liquity/index.ts +116 -116
- package/src/liquityV2/index.ts +295 -295
- package/src/llamaLend/index.ts +275 -275
- package/src/maker/index.ts +117 -117
- package/src/markets/aave/index.ts +152 -152
- package/src/markets/aave/marketAssets.ts +46 -46
- package/src/markets/compound/index.ts +213 -213
- package/src/markets/compound/marketsAssets.ts +82 -82
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2456 -2454
- package/src/markets/index.ts +27 -27
- package/src/markets/liquityV2/index.ts +54 -54
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +895 -895
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +10 -10
- package/src/moneymarket/moneymarketCommonService.ts +80 -80
- package/src/morphoAaveV2/index.ts +256 -256
- package/src/morphoAaveV3/index.ts +630 -630
- package/src/morphoBlue/index.ts +202 -202
- package/src/multicall/index.ts +33 -33
- package/src/services/priceService.ts +143 -130
- package/src/services/utils.ts +59 -59
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +460 -460
- package/src/staking/staking.ts +217 -217
- package/src/types/aave.ts +275 -275
- package/src/types/chickenBonds.ts +45 -45
- package/src/types/common.ts +84 -84
- package/src/types/compound.ts +133 -133
- package/src/types/contracts/generated/BTCPriceFeed.ts +202 -0
- package/src/types/contracts/generated/index.ts +1 -0
- package/src/types/curveUsd.ts +119 -119
- package/src/types/euler.ts +173 -173
- package/src/types/fluid.ts +330 -330
- package/src/types/index.ts +11 -11
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +119 -119
- package/src/types/llamaLend.ts +155 -155
- package/src/types/maker.ts +50 -50
- package/src/types/morphoBlue.ts +194 -194
- package/src/types/spark.ts +135 -135
package/cjs/fluid/index.js
CHANGED
|
@@ -47,6 +47,9 @@ const parseVaultType = (vaultType) => {
|
|
|
47
47
|
const getChainLinkPricesForTokens = (tokens, network, web3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
48
|
const isMainnet = (0, utils_1.isMainnetNetwork)(network);
|
|
49
49
|
const noDuplicateTokens = new Array(...new Set(tokens));
|
|
50
|
+
// TODO: this needs to be refactored
|
|
51
|
+
const ethPriceChainlink = yield (0, priceService_1.getEthPriceForFluid)(web3, network);
|
|
52
|
+
const btcPriceChainlink = yield (0, priceService_1.getBTCPriceForFluid)(web3, network);
|
|
50
53
|
const calls = noDuplicateTokens.flatMap((address) => {
|
|
51
54
|
const assetInfo = (0, tokens_1.getAssetInfoByAddress)(address, network);
|
|
52
55
|
const isTokenUSDA = assetInfo.symbol === 'USDA';
|
|
@@ -86,6 +89,27 @@ const getChainLinkPricesForTokens = (tokens, network, web3) => __awaiter(void 0,
|
|
|
86
89
|
acc[token] = new decimal_js_1.default(ethPrice).mul(wstETHRate).toString();
|
|
87
90
|
break;
|
|
88
91
|
}
|
|
92
|
+
// TODO: These addresses do not have chainlink feeds, so we need to handle them separately, this is hotfix
|
|
93
|
+
case 'ezETH': {
|
|
94
|
+
acc[token] = new decimal_js_1.default(ethPriceChainlink).mul(1.049).toString();
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case 'rsETH': {
|
|
98
|
+
acc[token] = new decimal_js_1.default(ethPriceChainlink).mul(1.0454).toString();
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case 'weETHs': {
|
|
102
|
+
acc[token] = new decimal_js_1.default(ethPriceChainlink).mul(1.026).toString();
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case 'LBTC': {
|
|
106
|
+
acc[token] = new decimal_js_1.default(btcPriceChainlink).toString();
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
case 'sUSDS': {
|
|
110
|
+
acc[token] = new decimal_js_1.default('105276929').toString();
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
89
113
|
case 'weETH': {
|
|
90
114
|
const { ethPrice, weETHRate, } = (0, priceService_1.parseWeETHPriceCalls)(prices[i + offset][0], prices[i + offset + 1], prices[i + offset + 2][0]);
|
|
91
115
|
offset += 2;
|
|
@@ -100,6 +124,9 @@ const getChainLinkPricesForTokens = (tokens, network, web3) => __awaiter(void 0,
|
|
|
100
124
|
}, {});
|
|
101
125
|
});
|
|
102
126
|
const getTokenPriceFromChainlink = (asset, network, web3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
+
if (asset.symbol === 'sUSDS') {
|
|
128
|
+
return new decimal_js_1.default('105276929').div(1e8).toString();
|
|
129
|
+
}
|
|
103
130
|
const isTokenUSDA = asset.symbol === 'USDA';
|
|
104
131
|
const isMainnet = (0, utils_1.isMainnetNetwork)(network);
|
|
105
132
|
const loanTokenFeedAddress = (0, priceService_1.getChainlinkAssetAddress)(asset.symbol, network);
|
|
@@ -117,73 +117,73 @@ const getApyAfterValuesEstimation = (selectedMarket, actions, web3, network) =>
|
|
|
117
117
|
});
|
|
118
118
|
exports.getApyAfterValuesEstimation = getApyAfterValuesEstimation;
|
|
119
119
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
120
|
-
const MARKET_QUERY = `
|
|
121
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
122
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
123
|
-
reallocatableLiquidityAssets
|
|
124
|
-
targetBorrowUtilization
|
|
125
|
-
loanAsset {
|
|
126
|
-
address
|
|
127
|
-
decimals
|
|
128
|
-
priceUsd
|
|
129
|
-
}
|
|
130
|
-
state {
|
|
131
|
-
liquidityAssets
|
|
132
|
-
borrowAssets
|
|
133
|
-
supplyAssets
|
|
134
|
-
}
|
|
135
|
-
publicAllocatorSharedLiquidity {
|
|
136
|
-
assets
|
|
137
|
-
vault {
|
|
138
|
-
address
|
|
139
|
-
name
|
|
140
|
-
}
|
|
141
|
-
allocationMarket {
|
|
142
|
-
uniqueKey
|
|
143
|
-
loanAsset {
|
|
144
|
-
address
|
|
145
|
-
}
|
|
146
|
-
collateralAsset {
|
|
147
|
-
address
|
|
148
|
-
}
|
|
149
|
-
irmAddress
|
|
150
|
-
oracle {
|
|
151
|
-
address
|
|
152
|
-
}
|
|
153
|
-
lltv
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
loanAsset {
|
|
157
|
-
address
|
|
158
|
-
}
|
|
159
|
-
collateralAsset {
|
|
160
|
-
address
|
|
161
|
-
}
|
|
162
|
-
oracle {
|
|
163
|
-
address
|
|
164
|
-
}
|
|
165
|
-
irmAddress
|
|
166
|
-
lltv
|
|
167
|
-
}
|
|
168
|
-
}
|
|
120
|
+
const MARKET_QUERY = `
|
|
121
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
122
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
123
|
+
reallocatableLiquidityAssets
|
|
124
|
+
targetBorrowUtilization
|
|
125
|
+
loanAsset {
|
|
126
|
+
address
|
|
127
|
+
decimals
|
|
128
|
+
priceUsd
|
|
129
|
+
}
|
|
130
|
+
state {
|
|
131
|
+
liquidityAssets
|
|
132
|
+
borrowAssets
|
|
133
|
+
supplyAssets
|
|
134
|
+
}
|
|
135
|
+
publicAllocatorSharedLiquidity {
|
|
136
|
+
assets
|
|
137
|
+
vault {
|
|
138
|
+
address
|
|
139
|
+
name
|
|
140
|
+
}
|
|
141
|
+
allocationMarket {
|
|
142
|
+
uniqueKey
|
|
143
|
+
loanAsset {
|
|
144
|
+
address
|
|
145
|
+
}
|
|
146
|
+
collateralAsset {
|
|
147
|
+
address
|
|
148
|
+
}
|
|
149
|
+
irmAddress
|
|
150
|
+
oracle {
|
|
151
|
+
address
|
|
152
|
+
}
|
|
153
|
+
lltv
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
loanAsset {
|
|
157
|
+
address
|
|
158
|
+
}
|
|
159
|
+
collateralAsset {
|
|
160
|
+
address
|
|
161
|
+
}
|
|
162
|
+
oracle {
|
|
163
|
+
address
|
|
164
|
+
}
|
|
165
|
+
irmAddress
|
|
166
|
+
lltv
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
169
|
`;
|
|
170
|
-
const REWARDS_QUERY = `
|
|
171
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
172
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
173
|
-
uniqueKey
|
|
174
|
-
state {
|
|
175
|
-
rewards {
|
|
176
|
-
amountPerSuppliedToken
|
|
177
|
-
supplyApr
|
|
178
|
-
amountPerBorrowedToken
|
|
179
|
-
borrowApr
|
|
180
|
-
asset {
|
|
181
|
-
address
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
170
|
+
const REWARDS_QUERY = `
|
|
171
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
172
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
173
|
+
uniqueKey
|
|
174
|
+
state {
|
|
175
|
+
rewards {
|
|
176
|
+
amountPerSuppliedToken
|
|
177
|
+
supplyApr
|
|
178
|
+
amountPerBorrowedToken
|
|
179
|
+
borrowApr
|
|
180
|
+
asset {
|
|
181
|
+
address
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
187
|
`;
|
|
188
188
|
/**
|
|
189
189
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
|
@@ -95,7 +95,6 @@ export declare const FLUID_ETH_USDC_USDT_23_ARB: (networkId?: NetworkNumber) =>
|
|
|
95
95
|
export declare const FLUID_WSTETH_USDC_USDT_24_ARB: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
96
96
|
export declare const FLUID_WEETH_USDC_USDT_25_ARB: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
97
97
|
export declare const FLUID_WBTC_USDC_USDT_26_ARB: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
98
|
-
export declare const FLUID_SUSDS_USDC_USDT_30_ARB: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
99
98
|
export declare const FLUID_ETH_USDC_1_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
100
99
|
export declare const FLUID_WSTETH_USDC_2_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
101
100
|
export declare const FLUID_WSTETH_ETH_3_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
@@ -213,7 +212,6 @@ export declare const FluidMarkets: (networkId: NetworkNumber) => {
|
|
|
213
212
|
FLUID_WSTETH_USDC_USDT_24_ARB: FluidMarketInfo;
|
|
214
213
|
FLUID_WEETH_USDC_USDT_25_ARB: FluidMarketInfo;
|
|
215
214
|
FLUID_WBTC_USDC_USDT_26_ARB: FluidMarketInfo;
|
|
216
|
-
FLUID_SUSDS_USDC_USDT_30_ARB: FluidMarketInfo;
|
|
217
215
|
FLUID_ETH_USDC_1_BASE: FluidMarketInfo;
|
|
218
216
|
FLUID_WSTETH_USDC_2_BASE: FluidMarketInfo;
|
|
219
217
|
FLUID_WSTETH_ETH_3_BASE: FluidMarketInfo;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FLUID_CBBTC_GHO_60 = exports.FLUID_WBTC_GHO_59 = exports.FLUID_SUSDS_GHO_58 = exports.FLUID_WEETH_GHO_57 = exports.FLUID_SUSDE_GHO_56 = exports.FLUID_WSTETH_GHO_55 = exports.FLUID_ETH_GHO_54 = exports.FLUID_WBTC_CBBTC_USDT_53 = exports.FLUID_WBTC_CBBTC_USDC_52 = exports.FLUID_WBTC_CBBTC_WBTC_CBBTC_51 = exports.FLUID_SUSDE_USDC_USDT_50 = exports.FLUID_CBBTC_USDC_USDT_49 = exports.FLUID_WBTC_USDC_USDT_48 = exports.FLUID_WEETH_USDC_USDT_47 = exports.FLUID_WSTETH_USDC_USDT_46 = exports.FLUID_ETH_USDC_USDT_45 = exports.FLUID_WSTETH_ETH_WSTETH_ETH_44 = exports.FLUID_WEETH_CBBTC_32 = exports.FLUID_WSTETH_CBBTC_33 = exports.FLUID_ETH_CBBTC_31 = exports.FLUID_CBBTC_USDT_30 = exports.FLUID_CBBTC_USDC_29 = exports.FLUID_CBBTC_ETH_28 = exports.FLUID_WEETHS_WSTETH_27 = exports.FLUID_WEETH_WBTC_26 = exports.FLUID_WSTETH_WBTC_25 = exports.FLUID_ETH_WBTC_24 = exports.FLUID_WBTC_ETH_23 = exports.FLUID_WBTC_USDT_22 = exports.FLUID_WBTC_USDC_21 = exports.FLUID_WEETH_USDT_20 = exports.FLUID_WEETH_USDC_19 = exports.FLUID_SUSDE_USDT_18 = exports.FLUID_SUSDE_USDC_17 = exports.FLUID_WEETH_WSTETH_16 = exports.FLUID_WSTETH_USDT_15 = exports.FLUID_WSTETH_USDC_14 = exports.FLUID_WSTETH_ETH_13 = exports.FLUID_ETH_USDT_12 = exports.FLUID_ETH_USDC_11 = exports.FLUID_WEETH_USDT_10 = exports.FLUID_WEETH_USDC_9 = exports.FLUID_SUSDE_USDT_8 = exports.FLUID_SUSDE_USDC_7 = exports.FLUID_WEETH_WSTETH_6 = exports.FLUID_WSTETH_USDT_5 = exports.FLUID_WSTETH_USDC_4 = exports.FLUID_WSTETH_ETH_3 = exports.FLUID_ETH_USDT_2 = exports.FLUID_ETH_USDC_1 = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.getFTokenAddress = exports.FluidFTokens = exports.getFluidMarketInfoByAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.FLUID_LBTC_SUSDS_22_BASE = exports.FLUID_LBTC_USDC_21_BASE = exports.FLUID_CBBTC_SUSDS_19_BASE = exports.FLUID_WSTETH_SUSDS_18_BASE = exports.FLUID_ETH_SUSDS_17_BASE = exports.FLUID_WSTETH_CBBTC_16_BASE = exports.FLUID_WEETH_CBBTC_15_BASE = exports.FLUID_ETH_CBBTC_14_BASE = exports.FLUID_CBBTC_ETH_13_BASE = exports.FLUID_WSTETH_EURC_12_BASE = exports.FLUID_WEETH_EURC_11_BASE = exports.FLUID_ETH_EURC_10_BASE = exports.FLUID_CBETH_EURC_9_BASE = exports.FLUID_CBBTC_EURC_8_BASE = exports.FLUID_CBBTC_USDC_7_BASE = exports.FLUID_CBETH_USDC_6_BASE =
|
|
4
|
+
exports.FLUID_WEETH_USDC_5_BASE = exports.FLUID_WEETH_WSTETH_4_BASE = exports.FLUID_WSTETH_ETH_3_BASE = exports.FLUID_WSTETH_USDC_2_BASE = exports.FLUID_ETH_USDC_1_BASE = exports.FLUID_WBTC_USDC_USDT_26_ARB = exports.FLUID_WEETH_USDC_USDT_25_ARB = exports.FLUID_WSTETH_USDC_USDT_24_ARB = exports.FLUID_ETH_USDC_USDT_23_ARB = exports.FLUID_USDC_ETH_USDC_ETH_22_ARB = exports.FLUID_WEETH_WBTC_21_ARB = exports.FLUID_WSTETH_WBTC_20_ARB = exports.FLUID_ETH_WBTC_19_ARB = exports.FLUID_WBTC_ETH_18_ARB = exports.FLUID_WEETH_ETH_WSTETH_17_ARB = exports.FLUID_WSTETH_ETH_WSTETH_ETH_16_ARB = exports.FLUID_WBTC_USDT_13_ARB = exports.FLUID_WBTC_USDC_12_ARB = exports.FLUID_ARB_USDT_11_ARB = exports.FLUID_ARB_USDC_10_ARB = exports.FLUID_ETH_ARB_9_ARB = exports.FLUID_WEETH_USDT_8_ARB = exports.FLUID_WEETH_USDC_7_ARB = exports.FLUID_WEETH_WSTETH_6_ARB = exports.FLUID_WSTETH_ETH_5_ARB = exports.FLUID_WSTETH_USDT_4_ARB = exports.FLUID_WSTETH_USDC_3_ARB = exports.FLUID_ETH_USDT_2_ARB = exports.FLUID_ETH_USDC_1_ARB = exports.FLUID_WBTC_LBTC_WBTC_115 = exports.FLUID_LBTC_CBBTC_CBBTC_114 = exports.FLUID_LBTC_GHO_109 = exports.FLUID_LBTC_USDT_108 = exports.FLUID_LBTC_USDC_107 = exports.FLUID_EZETH_ETH_WSTETH_104 = exports.FLUID_EZETH_WSTETH_103 = exports.FLUID_USDC_CBBTC_102 = exports.FLUID_USDC_WBTC_101 = exports.FLUID_USDC_ETH_100 = exports.FLUID_USDE_USDT_USDC_USDT_99 = exports.FLUID_SUSDE_USDT_USDC_USDT_98 = exports.FLUID_LBTC_CBBTC_WBTC_97 = exports.FLUID_USDE_USDT_USDT_93 = exports.FLUID_SUSDE_USDT_USDT_92 = exports.FLUID_WEETHS_ETH_WSTETH_80 = exports.FLUID_RSETH_WSTETH_79 = exports.FLUID_RSETH_ETH_WSTETH_78 = exports.FLUID_USDC_ETH_USDC_ETH_77 = exports.FLUID_WEETH_ETH_WSTETH_74 = exports.FLUID_GHO_USDC_GHO_USDC_61 = void 0;
|
|
5
|
+
exports.getFTokenAddress = exports.FluidFTokens = exports.getFluidMarketInfoByAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.FLUID_LBTC_SUSDS_22_BASE = exports.FLUID_LBTC_USDC_21_BASE = exports.FLUID_CBBTC_SUSDS_19_BASE = exports.FLUID_WSTETH_SUSDS_18_BASE = exports.FLUID_ETH_SUSDS_17_BASE = exports.FLUID_WSTETH_CBBTC_16_BASE = exports.FLUID_WEETH_CBBTC_15_BASE = exports.FLUID_ETH_CBBTC_14_BASE = exports.FLUID_CBBTC_ETH_13_BASE = exports.FLUID_WSTETH_EURC_12_BASE = exports.FLUID_WEETH_EURC_11_BASE = exports.FLUID_ETH_EURC_10_BASE = exports.FLUID_CBETH_EURC_9_BASE = exports.FLUID_CBBTC_EURC_8_BASE = exports.FLUID_CBBTC_USDC_7_BASE = exports.FLUID_CBETH_USDC_6_BASE = void 0;
|
|
6
6
|
const common_1 = require("../../types/common");
|
|
7
7
|
const types_1 = require("../../types");
|
|
8
8
|
const utils_1 = require("../../services/utils");
|
|
@@ -1859,26 +1859,28 @@ const FLUID_WBTC_USDC_USDT_26_ARB = (networkId = common_1.NetworkNumber.Eth) =>
|
|
|
1859
1859
|
debtAsset1: 'USDT',
|
|
1860
1860
|
});
|
|
1861
1861
|
exports.FLUID_WBTC_USDC_USDT_26_ARB = FLUID_WBTC_USDC_USDT_26_ARB;
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1862
|
+
// TODO: This issue is due to sUSDS price fetching via multicall on arbi fails and it's not handled correctly
|
|
1863
|
+
/*
|
|
1864
|
+
export const FLUID_SUSDS_USDC_USDT_30_ARB = (networkId: NetworkNumber = NetworkNumber.Eth): FluidMarketInfo => ({
|
|
1865
|
+
stableBased: true,
|
|
1866
|
+
btcBased: false,
|
|
1867
|
+
wstETHBased: false,
|
|
1868
|
+
ethBased: false,
|
|
1869
|
+
type: FluidVaultType.T3,
|
|
1870
|
+
id: 30,
|
|
1871
|
+
chainIds: [NetworkNumber.Arb],
|
|
1872
|
+
label: '#30 (sUSDS / USDC-USDT)',
|
|
1873
|
+
shortLabel: 'sUSDS/USDC-USDT',
|
|
1874
|
+
value: FluidArbitrumVersion.FLUID_SUSDS_USDC_USDT_30_ARB,
|
|
1875
|
+
url: 'susds_usdc_usdt_30_arb',
|
|
1876
|
+
marketAddress: '0xE6b5D1CdC4935295c84772C4700932b4BFC93274',
|
|
1877
|
+
hasSmartCollateral: false,
|
|
1878
|
+
hasSmartDebt: true,
|
|
1879
|
+
collateralAsset0: 'sUSDS',
|
|
1880
|
+
debtAsset0: 'USDC',
|
|
1881
|
+
debtAsset1: 'USDT',
|
|
1882
|
+
});
|
|
1883
|
+
*/
|
|
1882
1884
|
const FLUID_ETH_USDC_1_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
1883
1885
|
stableBased: true,
|
|
1884
1886
|
btcBased: false,
|
|
@@ -2199,7 +2201,7 @@ const FLUID_ETH_SUSDS_17_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
2199
2201
|
hasSmartCollateral: false,
|
|
2200
2202
|
hasSmartDebt: false,
|
|
2201
2203
|
collateralAsset0: 'ETH',
|
|
2202
|
-
debtAsset0: '
|
|
2204
|
+
debtAsset0: 'sUSDS',
|
|
2203
2205
|
});
|
|
2204
2206
|
exports.FLUID_ETH_SUSDS_17_BASE = FLUID_ETH_SUSDS_17_BASE;
|
|
2205
2207
|
const FLUID_WSTETH_SUSDS_18_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
@@ -2375,7 +2377,7 @@ const FluidMarkets = (networkId) => ({
|
|
|
2375
2377
|
[types_1.FluidArbitrumVersion.FLUID_WSTETH_USDC_USDT_24_ARB]: (0, exports.FLUID_WSTETH_USDC_USDT_24_ARB)(networkId),
|
|
2376
2378
|
[types_1.FluidArbitrumVersion.FLUID_WEETH_USDC_USDT_25_ARB]: (0, exports.FLUID_WEETH_USDC_USDT_25_ARB)(networkId),
|
|
2377
2379
|
[types_1.FluidArbitrumVersion.FLUID_WBTC_USDC_USDT_26_ARB]: (0, exports.FLUID_WBTC_USDC_USDT_26_ARB)(networkId),
|
|
2378
|
-
[
|
|
2380
|
+
// [FluidArbitrumVersion.FLUID_SUSDS_USDC_USDT_30_ARB]: FLUID_SUSDS_USDC_USDT_30_ARB(networkId),
|
|
2379
2381
|
// base
|
|
2380
2382
|
[types_1.FluidBaseVersions.FLUID_ETH_USDC_1_BASE]: (0, exports.FLUID_ETH_USDC_1_BASE)(networkId),
|
|
2381
2383
|
[types_1.FluidBaseVersions.FLUID_WSTETH_USDC_2_BASE]: (0, exports.FLUID_WSTETH_USDC_2_BASE)(networkId),
|
|
@@ -28,4 +28,6 @@ export declare const parseWeETHPriceCalls: (_ethPrice: string, weETHrate: {
|
|
|
28
28
|
weETHRate: string;
|
|
29
29
|
};
|
|
30
30
|
export declare const getWstETHPriceFluid: (web3: Web3, network: NetworkNumber) => Promise<string>;
|
|
31
|
+
export declare const getBTCPriceForFluid: (web3: Web3, network: NetworkNumber) => Promise<string>;
|
|
32
|
+
export declare const getEthPriceForFluid: (web3: Web3, network: NetworkNumber) => Promise<string>;
|
|
31
33
|
export declare const getChainlinkAssetAddress: (symbol: string, network: NetworkNumber) => string;
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getChainlinkAssetAddress = exports.getWstETHPriceFluid = exports.parseWeETHPriceCalls = exports.parseWstETHPriceCalls = exports.getWeETHChainLinkPriceCalls = exports.getWstETHChainLinkPriceCalls = exports.getWstETHPrice = exports.getCompPrice = exports.getUSDCPrice = exports.getEthPrice = void 0;
|
|
15
|
+
exports.getChainlinkAssetAddress = exports.getEthPriceForFluid = exports.getBTCPriceForFluid = exports.getWstETHPriceFluid = exports.parseWeETHPriceCalls = exports.parseWstETHPriceCalls = exports.getWeETHChainLinkPriceCalls = exports.getWstETHChainLinkPriceCalls = exports.getWstETHPrice = exports.getCompPrice = exports.getUSDCPrice = exports.getEthPrice = void 0;
|
|
16
16
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
17
17
|
const tokens_1 = require("@defisaver/tokens");
|
|
18
18
|
const contracts_1 = require("../contracts");
|
|
@@ -124,6 +124,18 @@ const getWstETHPriceFluid = (web3, network) => __awaiter(void 0, void 0, void 0,
|
|
|
124
124
|
return new decimal_js_1.default(ethPrice).mul(wstETHRate).toString();
|
|
125
125
|
});
|
|
126
126
|
exports.getWstETHPriceFluid = getWstETHPriceFluid;
|
|
127
|
+
const getBTCPriceForFluid = (web3, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
+
const contract = (0, contracts_1.BTCPriceFeedContract)(web3, network);
|
|
129
|
+
const price = yield contract.methods.latestAnswer().call();
|
|
130
|
+
return new decimal_js_1.default(price).div(1e8).toString();
|
|
131
|
+
});
|
|
132
|
+
exports.getBTCPriceForFluid = getBTCPriceForFluid;
|
|
133
|
+
const getEthPriceForFluid = (web3, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
134
|
+
const contract = (0, contracts_1.ETHPriceFeedContract)(web3, network);
|
|
135
|
+
const price = yield contract.methods.latestAnswer().call();
|
|
136
|
+
return new decimal_js_1.default(price).div(1e8).toString();
|
|
137
|
+
});
|
|
138
|
+
exports.getEthPriceForFluid = getEthPriceForFluid;
|
|
127
139
|
// chainlink price feed available only on mainnet
|
|
128
140
|
const getChainlinkAssetAddress = (symbol, network) => {
|
|
129
141
|
// Chainlink only has BTC/USD feed so we use that for BTC derivatives
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type BN from "bn.js";
|
|
3
|
+
import type { ContractOptions } from "web3-eth-contract";
|
|
4
|
+
import type { EventLog } from "web3-core";
|
|
5
|
+
import type { EventEmitter } from "events";
|
|
6
|
+
import type { Callback, NonPayableTransactionObject, BlockType, ContractEventLog, BaseContract } from "./types";
|
|
7
|
+
export interface EventOptions {
|
|
8
|
+
filter?: object;
|
|
9
|
+
fromBlock?: BlockType;
|
|
10
|
+
topics?: string[];
|
|
11
|
+
}
|
|
12
|
+
export type AnswerUpdated = ContractEventLog<{
|
|
13
|
+
current: string;
|
|
14
|
+
roundId: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
0: string;
|
|
17
|
+
1: string;
|
|
18
|
+
2: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type NewRound = ContractEventLog<{
|
|
21
|
+
roundId: string;
|
|
22
|
+
startedBy: string;
|
|
23
|
+
startedAt: string;
|
|
24
|
+
0: string;
|
|
25
|
+
1: string;
|
|
26
|
+
2: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type OwnershipTransferRequested = ContractEventLog<{
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
0: string;
|
|
32
|
+
1: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type OwnershipTransferred = ContractEventLog<{
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
0: string;
|
|
38
|
+
1: string;
|
|
39
|
+
}>;
|
|
40
|
+
export interface BTCPriceFeed extends BaseContract {
|
|
41
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): BTCPriceFeed;
|
|
42
|
+
clone(): BTCPriceFeed;
|
|
43
|
+
methods: {
|
|
44
|
+
acceptOwnership(): NonPayableTransactionObject<void>;
|
|
45
|
+
accessController(): NonPayableTransactionObject<string>;
|
|
46
|
+
aggregator(): NonPayableTransactionObject<string>;
|
|
47
|
+
confirmAggregator(_aggregator: string): NonPayableTransactionObject<void>;
|
|
48
|
+
decimals(): NonPayableTransactionObject<string>;
|
|
49
|
+
description(): NonPayableTransactionObject<string>;
|
|
50
|
+
getAnswer(_roundId: number | string | BN): NonPayableTransactionObject<string>;
|
|
51
|
+
getRoundData(_roundId: number | string | BN): NonPayableTransactionObject<[
|
|
52
|
+
string,
|
|
53
|
+
string,
|
|
54
|
+
string,
|
|
55
|
+
string,
|
|
56
|
+
string
|
|
57
|
+
] & {
|
|
58
|
+
roundId: string;
|
|
59
|
+
answer: string;
|
|
60
|
+
startedAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
answeredInRound: string;
|
|
63
|
+
}>;
|
|
64
|
+
getTimestamp(_roundId: number | string | BN): NonPayableTransactionObject<string>;
|
|
65
|
+
latestAnswer(): NonPayableTransactionObject<string>;
|
|
66
|
+
latestRound(): NonPayableTransactionObject<string>;
|
|
67
|
+
latestRoundData(): NonPayableTransactionObject<[
|
|
68
|
+
string,
|
|
69
|
+
string,
|
|
70
|
+
string,
|
|
71
|
+
string,
|
|
72
|
+
string
|
|
73
|
+
] & {
|
|
74
|
+
roundId: string;
|
|
75
|
+
answer: string;
|
|
76
|
+
startedAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
answeredInRound: string;
|
|
79
|
+
}>;
|
|
80
|
+
latestTimestamp(): NonPayableTransactionObject<string>;
|
|
81
|
+
owner(): NonPayableTransactionObject<string>;
|
|
82
|
+
phaseAggregators(arg0: number | string | BN): NonPayableTransactionObject<string>;
|
|
83
|
+
phaseId(): NonPayableTransactionObject<string>;
|
|
84
|
+
proposeAggregator(_aggregator: string): NonPayableTransactionObject<void>;
|
|
85
|
+
proposedAggregator(): NonPayableTransactionObject<string>;
|
|
86
|
+
proposedGetRoundData(_roundId: number | string | BN): NonPayableTransactionObject<[
|
|
87
|
+
string,
|
|
88
|
+
string,
|
|
89
|
+
string,
|
|
90
|
+
string,
|
|
91
|
+
string
|
|
92
|
+
] & {
|
|
93
|
+
roundId: string;
|
|
94
|
+
answer: string;
|
|
95
|
+
startedAt: string;
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
answeredInRound: string;
|
|
98
|
+
}>;
|
|
99
|
+
proposedLatestRoundData(): NonPayableTransactionObject<[
|
|
100
|
+
string,
|
|
101
|
+
string,
|
|
102
|
+
string,
|
|
103
|
+
string,
|
|
104
|
+
string
|
|
105
|
+
] & {
|
|
106
|
+
roundId: string;
|
|
107
|
+
answer: string;
|
|
108
|
+
startedAt: string;
|
|
109
|
+
updatedAt: string;
|
|
110
|
+
answeredInRound: string;
|
|
111
|
+
}>;
|
|
112
|
+
setController(_accessController: string): NonPayableTransactionObject<void>;
|
|
113
|
+
transferOwnership(_to: string): NonPayableTransactionObject<void>;
|
|
114
|
+
version(): NonPayableTransactionObject<string>;
|
|
115
|
+
};
|
|
116
|
+
events: {
|
|
117
|
+
AnswerUpdated(cb?: Callback<AnswerUpdated>): EventEmitter;
|
|
118
|
+
AnswerUpdated(options?: EventOptions, cb?: Callback<AnswerUpdated>): EventEmitter;
|
|
119
|
+
NewRound(cb?: Callback<NewRound>): EventEmitter;
|
|
120
|
+
NewRound(options?: EventOptions, cb?: Callback<NewRound>): EventEmitter;
|
|
121
|
+
OwnershipTransferRequested(cb?: Callback<OwnershipTransferRequested>): EventEmitter;
|
|
122
|
+
OwnershipTransferRequested(options?: EventOptions, cb?: Callback<OwnershipTransferRequested>): EventEmitter;
|
|
123
|
+
OwnershipTransferred(cb?: Callback<OwnershipTransferred>): EventEmitter;
|
|
124
|
+
OwnershipTransferred(options?: EventOptions, cb?: Callback<OwnershipTransferred>): EventEmitter;
|
|
125
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
126
|
+
};
|
|
127
|
+
once(event: "AnswerUpdated", cb: Callback<AnswerUpdated>): void;
|
|
128
|
+
once(event: "AnswerUpdated", options: EventOptions, cb: Callback<AnswerUpdated>): void;
|
|
129
|
+
once(event: "NewRound", cb: Callback<NewRound>): void;
|
|
130
|
+
once(event: "NewRound", options: EventOptions, cb: Callback<NewRound>): void;
|
|
131
|
+
once(event: "OwnershipTransferRequested", cb: Callback<OwnershipTransferRequested>): void;
|
|
132
|
+
once(event: "OwnershipTransferRequested", options: EventOptions, cb: Callback<OwnershipTransferRequested>): void;
|
|
133
|
+
once(event: "OwnershipTransferred", cb: Callback<OwnershipTransferred>): void;
|
|
134
|
+
once(event: "OwnershipTransferred", options: EventOptions, cb: Callback<OwnershipTransferred>): void;
|
|
135
|
+
}
|
|
@@ -12,6 +12,7 @@ export type { AaveV3LidoProtocolDataProvider } from "./AaveV3LidoProtocolDataPro
|
|
|
12
12
|
export type { AaveV3PoolAddressesProvider } from "./AaveV3PoolAddressesProvider";
|
|
13
13
|
export type { AaveV3ProtocolDataProvider } from "./AaveV3ProtocolDataProvider";
|
|
14
14
|
export type { AaveV3View } from "./AaveV3View";
|
|
15
|
+
export type { BTCPriceFeed } from "./BTCPriceFeed";
|
|
15
16
|
export type { BalanceScanner } from "./BalanceScanner";
|
|
16
17
|
export type { COMPPriceFeed } from "./COMPPriceFeed";
|
|
17
18
|
export type { CbEth } from "./CbEth";
|