@defisaver/positions-sdk 2.1.13-dev-plasma-fluid3 → 2.1.14
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/cjs/config/contracts.d.ts +0 -12
- package/cjs/config/contracts.js +3 -7
- package/cjs/fluid/index.js +38 -71
- package/cjs/markets/fluid/index.d.ts +0 -46
- package/cjs/markets/fluid/index.js +1 -436
- package/cjs/moneymarket/moneymarketCommonService.js +5 -1
- package/cjs/portfolio/index.js +1 -4
- package/cjs/services/priceService.js +1 -1
- package/cjs/types/fluid.d.ts +1 -30
- package/cjs/types/fluid.js +1 -31
- package/esm/config/contracts.d.ts +0 -12
- package/esm/config/contracts.js +3 -7
- package/esm/fluid/index.js +39 -72
- package/esm/markets/fluid/index.d.ts +0 -46
- package/esm/markets/fluid/index.js +1 -415
- package/esm/moneymarket/moneymarketCommonService.js +5 -1
- package/esm/portfolio/index.js +1 -4
- package/esm/services/priceService.js +2 -2
- package/esm/types/fluid.d.ts +1 -30
- package/esm/types/fluid.js +0 -30
- package/package.json +1 -1
- package/src/config/contracts.ts +3 -7
- package/src/fluid/index.ts +47 -85
- package/src/markets/fluid/index.ts +2 -442
- package/src/moneymarket/moneymarketCommonService.ts +5 -1
- package/src/portfolio/index.ts +1 -3
- package/src/services/priceService.ts +3 -3
- package/src/types/fluid.ts +1 -32
- package/CLAUDE.md +0 -32
|
@@ -71006,9 +71006,6 @@ export declare const ETHPriceFeed: {
|
|
|
71006
71006
|
readonly "42161": {
|
|
71007
71007
|
readonly address: "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612";
|
|
71008
71008
|
};
|
|
71009
|
-
readonly "9745": {
|
|
71010
|
-
readonly address: "0x43A7dd2125266c5c4c26EB86cd61241132426Fe7";
|
|
71011
|
-
};
|
|
71012
71009
|
};
|
|
71013
71010
|
};
|
|
71014
71011
|
export declare const BTCPriceFeed: {
|
|
@@ -71418,9 +71415,6 @@ export declare const BTCPriceFeed: {
|
|
|
71418
71415
|
readonly "42161": {
|
|
71419
71416
|
readonly address: "0x6ce185860a4963106506C203335A2910413708e9";
|
|
71420
71417
|
};
|
|
71421
|
-
readonly "9745": {
|
|
71422
|
-
readonly address: "0x3Bc5434dd1Fc6a1B68625e0269B9818cDd9E21B5";
|
|
71423
|
-
};
|
|
71424
71418
|
};
|
|
71425
71419
|
};
|
|
71426
71420
|
export declare const USDCPriceFeed: {
|
|
@@ -75043,9 +75037,6 @@ export declare const DFSFeedRegistry: {
|
|
|
75043
75037
|
readonly "42161": {
|
|
75044
75038
|
readonly address: "0x158E27De8B5E5bC3FA1C6D5b365a291c54f6b0Fd";
|
|
75045
75039
|
};
|
|
75046
|
-
readonly "9745": {
|
|
75047
|
-
readonly address: "0x2226836ec16FF5974dFD8DF740CD461B42FAffD5";
|
|
75048
|
-
};
|
|
75049
75040
|
};
|
|
75050
75041
|
};
|
|
75051
75042
|
export declare const LlamaLendView: {
|
|
@@ -82004,9 +81995,6 @@ export declare const FluidView: {
|
|
|
82004
81995
|
readonly "8453": {
|
|
82005
81996
|
readonly address: "0x6cd4D6af4F292817eA2A2311F099dF26cd015028";
|
|
82006
81997
|
};
|
|
82007
|
-
readonly "9745": {
|
|
82008
|
-
readonly address: "0x27C0BAe2338cE28097122393faF90375B9395dd1";
|
|
82009
|
-
};
|
|
82010
81998
|
readonly "42161": {
|
|
82011
81999
|
readonly address: "0xf9e6d5568887ac8eC6fA33B7eefD2A176A958e71";
|
|
82012
82000
|
};
|
package/cjs/config/contracts.js
CHANGED
|
@@ -989,8 +989,7 @@ exports.ETHPriceFeed = {
|
|
|
989
989
|
"1": { "address": "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" },
|
|
990
990
|
"10": { "address": "0x13e3Ee699D1909E989722E753853AE30b17e08c5" },
|
|
991
991
|
"8453": { "address": "0x71041dddad3595F9CEd3DcCFBe3D1F4b0a16Bb70" },
|
|
992
|
-
"42161": { "address": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612" }
|
|
993
|
-
"9745": { "address": "0x43A7dd2125266c5c4c26EB86cd61241132426Fe7" },
|
|
992
|
+
"42161": { "address": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612" }
|
|
994
993
|
},
|
|
995
994
|
};
|
|
996
995
|
exports.BTCPriceFeed = {
|
|
@@ -999,8 +998,7 @@ exports.BTCPriceFeed = {
|
|
|
999
998
|
"1": { "address": "0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c" },
|
|
1000
999
|
"10": { "address": "0xD702DD976Fb76Fffc2D3963D037dfDae5b04E593" },
|
|
1001
1000
|
"8453": { "address": "0x64c911996D3c6aC71f9b455B1E8E7266BcbD848F" },
|
|
1002
|
-
"42161": { "address": "0x6ce185860a4963106506C203335A2910413708e9" }
|
|
1003
|
-
"9745": { "address": "0x3Bc5434dd1Fc6a1B68625e0269B9818cDd9E21B5" }
|
|
1001
|
+
"42161": { "address": "0x6ce185860a4963106506C203335A2910413708e9" }
|
|
1004
1002
|
},
|
|
1005
1003
|
};
|
|
1006
1004
|
exports.USDCPriceFeed = {
|
|
@@ -1068,8 +1066,7 @@ exports.DFSFeedRegistry = {
|
|
|
1068
1066
|
"abi": [{ "inputs": [], "name": "NonContractCall", "type": "error" }, { "inputs": [], "name": "SenderNotAdmin", "type": "error" }, { "inputs": [], "name": "SenderNotOwner", "type": "error" }, { "inputs": [], "name": "adminVault", "outputs": [{ "internalType": "contract AdminVault", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "address", "name": "", "type": "address" }], "name": "aggregators", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "base", "type": "address" }, { "internalType": "address", "name": "quote", "type": "address" }], "name": "getFeed", "outputs": [{ "internalType": "address", "name": "aggregator", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "kill", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "base", "type": "address" }, { "internalType": "address", "name": "quote", "type": "address" }], "name": "latestRoundData", "outputs": [{ "internalType": "uint80", "name": "roundId", "type": "uint80" }, { "internalType": "int256", "name": "answer", "type": "int256" }, { "internalType": "uint256", "name": "startedAt", "type": "uint256" }, { "internalType": "uint256", "name": "updatedAt", "type": "uint256" }, { "internalType": "uint80", "name": "answeredInRound", "type": "uint80" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "base", "type": "address" }, { "internalType": "address", "name": "quote", "type": "address" }, { "internalType": "address", "name": "aggregator", "type": "address" }], "name": "setFeed", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address[]", "name": "bases", "type": "address[]" }, { "internalType": "address[]", "name": "quotes", "type": "address[]" }, { "internalType": "address[]", "name": "aggregator", "type": "address[]" }], "name": "setFeeds", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_token", "type": "address" }, { "internalType": "address", "name": "_receiver", "type": "address" }, { "internalType": "uint256", "name": "_amount", "type": "uint256" }], "name": "withdrawStuckFunds", "outputs": [], "stateMutability": "nonpayable", "type": "function" }],
|
|
1069
1067
|
"networks": {
|
|
1070
1068
|
"8453": { "address": "0x7dFF34190d0307fC234fc7E8C152C9715083eB02" },
|
|
1071
|
-
"42161": { "address": "0x158E27De8B5E5bC3FA1C6D5b365a291c54f6b0Fd" }
|
|
1072
|
-
"9745": { "address": "0x2226836ec16FF5974dFD8DF740CD461B42FAffD5" }
|
|
1069
|
+
"42161": { "address": "0x158E27De8B5E5bC3FA1C6D5b365a291c54f6b0Fd" }
|
|
1073
1070
|
}
|
|
1074
1071
|
};
|
|
1075
1072
|
exports.LlamaLendView = {
|
|
@@ -1129,7 +1126,6 @@ exports.FluidView = {
|
|
|
1129
1126
|
"networks": {
|
|
1130
1127
|
"1": { "address": "0xc8df052bD7A8d76a34c09e758Dff3c6298C0115c" },
|
|
1131
1128
|
"8453": { "address": "0x6cd4D6af4F292817eA2A2311F099dF26cd015028" },
|
|
1132
|
-
"9745": { "address": "0x27C0BAe2338cE28097122393faF90375B9395dd1" },
|
|
1133
1129
|
"42161": { "address": "0xf9e6d5568887ac8eC6fA33B7eefD2A176A958e71" }
|
|
1134
1130
|
}
|
|
1135
1131
|
};
|
package/cjs/fluid/index.js
CHANGED
|
@@ -72,7 +72,7 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
|
|
|
72
72
|
const chainLinkFeedAddress = (0, priceService_1.getChainlinkAssetAddress)(assetInfo.symbol, network);
|
|
73
73
|
if (assetInfo.symbol === 'wstETH')
|
|
74
74
|
return (0, priceService_1.getWstETHChainLinkPriceCalls)(client, network);
|
|
75
|
-
if (assetInfo.symbol === 'weETH'
|
|
75
|
+
if (assetInfo.symbol === 'weETH')
|
|
76
76
|
return (0, priceService_1.getWeETHChainLinkPriceCalls)(client, network);
|
|
77
77
|
if (isMainnet) {
|
|
78
78
|
const feedRegistryContract = (0, contracts_1.FeedRegistryContractViem)(client, common_1.NetworkNumber.Eth);
|
|
@@ -98,7 +98,7 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
|
|
|
98
98
|
const btcPriceChainlink = new decimal_js_1.default(results[1].result).div(1e8).toString();
|
|
99
99
|
let offset = 2; // wstETH and weETH has 3 calls, while others have only 1, so we need to keep track. First 2 are static calls for eth and btc prices
|
|
100
100
|
return noDuplicateTokens.reduce((acc, token, i) => {
|
|
101
|
-
var _a
|
|
101
|
+
var _a;
|
|
102
102
|
const assetInfo = (0, tokens_1.getAssetInfoByAddress)(token, network);
|
|
103
103
|
switch (assetInfo.symbol) {
|
|
104
104
|
case 'USDA':
|
|
@@ -134,31 +134,16 @@ const getChainLinkPricesForTokens = (tokens, network, client) => __awaiter(void
|
|
|
134
134
|
break;
|
|
135
135
|
}
|
|
136
136
|
case 'weETH': {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
acc[token] = new decimal_js_1.default(ethPrice).mul(weETHRate).toString();
|
|
143
|
-
// @ts-ignore
|
|
144
|
-
}
|
|
145
|
-
else if ((_a = results[i + offset].result) === null || _a === void 0 ? void 0 : _a[1]) {
|
|
146
|
-
// For Plasma, use default chainlink feed (latestRoundData format)
|
|
147
|
-
// @ts-ignore
|
|
148
|
-
acc[token] = new decimal_js_1.default(results[i + offset].result[1].toString()).div(1e8).toString();
|
|
149
|
-
}
|
|
150
|
-
else if (results[i + offset].result) {
|
|
151
|
-
// For Plasma, use default chainlink feed (latestAnswer format)
|
|
152
|
-
acc[token] = new decimal_js_1.default(results[i + offset].result.toString()).div(1e8).toString();
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
acc[token] = '0';
|
|
156
|
-
}
|
|
137
|
+
const { ethPrice, weETHRate, } = (0, priceService_1.parseWeETHPriceCalls)(results[i + offset].result.toString(),
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
results[i + offset + 1].result[1].toString(), results[i + offset + 2].result.toString());
|
|
140
|
+
offset += 2;
|
|
141
|
+
acc[token] = new decimal_js_1.default(ethPrice).mul(weETHRate).toString();
|
|
157
142
|
break;
|
|
158
143
|
}
|
|
159
144
|
default:
|
|
160
145
|
// @ts-ignore
|
|
161
|
-
if ((
|
|
146
|
+
if ((_a = results[i + offset].result) === null || _a === void 0 ? void 0 : _a[1]) {
|
|
162
147
|
// @ts-ignore
|
|
163
148
|
acc[token] = new decimal_js_1.default(results[i + offset].result[1].toString()).div(1e8).toString();
|
|
164
149
|
}
|
|
@@ -191,14 +176,8 @@ const getTokenPriceFromChainlink = (asset, network, provider) => __awaiter(void
|
|
|
191
176
|
else {
|
|
192
177
|
// Currently only base network is supported
|
|
193
178
|
const feedRegistryContract = (0, contracts_1.DFSFeedRegistryContractViem)(provider, network);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
loanTokenPrice = roundPriceData[1].toString();
|
|
197
|
-
}
|
|
198
|
-
catch (err) {
|
|
199
|
-
console.error(`Error fetching price for ${asset.symbol} on ${network}: ${err}`);
|
|
200
|
-
loanTokenPrice = '0';
|
|
201
|
-
}
|
|
179
|
+
const roundPriceData = isTokenUSDA ? [0, '100000000'] : yield feedRegistryContract.read.latestRoundData([loanTokenFeedAddress, constants_1.USD_QUOTE]);
|
|
180
|
+
loanTokenPrice = roundPriceData[1].toString();
|
|
202
181
|
}
|
|
203
182
|
return new decimal_js_1.default(loanTokenPrice).div(1e8).toString();
|
|
204
183
|
});
|
|
@@ -235,10 +214,8 @@ const getTradingApy = (poolAddress) => __awaiter(void 0, void 0, void 0, functio
|
|
|
235
214
|
});
|
|
236
215
|
const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
237
216
|
var _a, _b;
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
const debtAssetContract = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
241
|
-
const debtAsset = (0, tokens_1.getAssetInfo)((0, utils_1.getNativeAssetFromWrapped)(debtAssetContract.symbol), network);
|
|
217
|
+
const collAsset = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
|
|
218
|
+
const debtAsset = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
242
219
|
const supplyRate = new decimal_js_1.default(data.supplyRateVault).div(100).toString();
|
|
243
220
|
const borrowRate = new decimal_js_1.default(data.borrowRateVault).div(100).toString();
|
|
244
221
|
const oracleScaleFactor = new decimal_js_1.default(27).add(debtAsset.decimals).sub(collAsset.decimals).toString();
|
|
@@ -249,7 +226,7 @@ const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
249
226
|
debtPriceParsed = tokenPrices[debtAsset.symbol] || '0';
|
|
250
227
|
}
|
|
251
228
|
else {
|
|
252
|
-
debtPriceParsed = yield getTokenPriceFromChainlink(
|
|
229
|
+
debtPriceParsed = yield getTokenPriceFromChainlink(debtAsset, network, provider);
|
|
253
230
|
}
|
|
254
231
|
const collAssetData = {
|
|
255
232
|
symbol: collAsset.symbol,
|
|
@@ -347,12 +324,9 @@ const parseT1MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
347
324
|
});
|
|
348
325
|
const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
349
326
|
var _a, _b, _c;
|
|
350
|
-
const
|
|
351
|
-
const
|
|
352
|
-
const
|
|
353
|
-
const collAsset1 = (0, tokens_1.getAssetInfo)((0, utils_1.getNativeAssetFromWrapped)(collAsset1Contract.symbol), network);
|
|
354
|
-
const debtAssetContract = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
355
|
-
const debtAsset = (0, tokens_1.getAssetInfo)((0, utils_1.getNativeAssetFromWrapped)(debtAssetContract.symbol), network);
|
|
327
|
+
const collAsset0 = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
|
|
328
|
+
const collAsset1 = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken1, network);
|
|
329
|
+
const debtAsset = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
356
330
|
// 18 because collateral is represented in shares for which they use 18 decimals
|
|
357
331
|
const oracleScaleFactor = new decimal_js_1.default(27).add(debtAsset.decimals).sub(18).toString();
|
|
358
332
|
const oracleScale = new decimal_js_1.default(10).pow(oracleScaleFactor).toString();
|
|
@@ -362,13 +336,13 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
362
336
|
prices = tokenPrices;
|
|
363
337
|
}
|
|
364
338
|
else {
|
|
365
|
-
prices = yield getChainLinkPricesForTokens([
|
|
339
|
+
prices = yield getChainLinkPricesForTokens([collAsset0.address, collAsset1.address, debtAsset.address], network, provider);
|
|
366
340
|
}
|
|
367
341
|
const { supplyDexFee, totalSupplyShares, supplyRate1, totalSupplyToken1, token0PerSupplyShare, token1PerSupplyShare, totalSupplyToken0, maxSupplyShares, withdrawableToken0, withdrawable0, withdrawableToken1, withdrawable1, supplyRate0, utilizationSupply0, utilizationSupply1, withdrawableShares, reservesSupplyToken0, reservesSupplyToken1, } = (0, fluidHelpers_1.parseDexSupplyData)(data.dexSupplyData, collAsset0.symbol, collAsset1.symbol);
|
|
368
342
|
const collFirstAssetData = {
|
|
369
343
|
symbol: collAsset0.symbol,
|
|
370
344
|
address: collAsset0.address,
|
|
371
|
-
price: prices[tokenPrices ? collAsset0.symbol :
|
|
345
|
+
price: prices[tokenPrices ? collAsset0.symbol : collAsset0.address],
|
|
372
346
|
totalSupply: new decimal_js_1.default(totalSupplyShares).mul(token0PerSupplyShare).toString(),
|
|
373
347
|
canBeSupplied: true,
|
|
374
348
|
supplyRate: supplyRate0,
|
|
@@ -390,7 +364,7 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
390
364
|
const collSecondAssetData = {
|
|
391
365
|
symbol: collAsset1.symbol,
|
|
392
366
|
address: collAsset1.address,
|
|
393
|
-
price: prices[tokenPrices ? collAsset1.symbol :
|
|
367
|
+
price: prices[tokenPrices ? collAsset1.symbol : collAsset1.address],
|
|
394
368
|
totalSupply: new decimal_js_1.default(totalSupplyShares).mul(token1PerSupplyShare).toString(),
|
|
395
369
|
canBeSupplied: true,
|
|
396
370
|
supplyRate: supplyRate1,
|
|
@@ -415,7 +389,7 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
415
389
|
const borrowRate = new decimal_js_1.default(data.borrowRateVault).div(100).toString();
|
|
416
390
|
const debtAssetData = {
|
|
417
391
|
symbol: debtAsset.symbol,
|
|
418
|
-
price: prices[tokenPrices ? debtAsset.symbol :
|
|
392
|
+
price: prices[tokenPrices ? debtAsset.symbol : debtAsset.address],
|
|
419
393
|
address: debtAsset.address,
|
|
420
394
|
totalBorrow: data.totalBorrowVault.toString(),
|
|
421
395
|
canBeBorrowed: true,
|
|
@@ -444,7 +418,7 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
444
418
|
const liquidationMaxLimit = new decimal_js_1.default(data.liquidationMaxLimit).div(100).toString();
|
|
445
419
|
const liqFactor = new decimal_js_1.default(data.liquidationThreshold).div(10000).toString();
|
|
446
420
|
const totalSupplySharesInVault = (0, tokens_1.assetAmountInEth)(data.totalSupplyVault.toString());
|
|
447
|
-
const collSharePrice = new decimal_js_1.default(oraclePrice).mul(prices[tokenPrices ? debtAsset.symbol :
|
|
421
|
+
const collSharePrice = new decimal_js_1.default(oraclePrice).mul(prices[tokenPrices ? debtAsset.symbol : debtAsset.address]).toString();
|
|
448
422
|
const totalSupplyVaultUsd = new decimal_js_1.default(totalSupplySharesInVault).mul(collSharePrice).toString();
|
|
449
423
|
const maxSupplySharesUsd = new decimal_js_1.default(maxSupplyShares).mul(collSharePrice).toString();
|
|
450
424
|
const withdrawableUSD = new decimal_js_1.default(withdrawableShares).mul(collSharePrice).toString();
|
|
@@ -503,12 +477,9 @@ const parseT2MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
503
477
|
});
|
|
504
478
|
const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
505
479
|
var _a, _b, _c, _d;
|
|
506
|
-
const
|
|
507
|
-
const
|
|
508
|
-
const
|
|
509
|
-
const debtAsset0 = (0, tokens_1.getAssetInfo)((0, utils_1.getNativeAssetFromWrapped)(debtAsset0Contract.symbol), network);
|
|
510
|
-
const debtAsset1Contract = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken1, network);
|
|
511
|
-
const debtAsset1 = (0, tokens_1.getAssetInfo)((0, utils_1.getNativeAssetFromWrapped)(debtAsset1Contract.symbol), network);
|
|
480
|
+
const collAsset = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
|
|
481
|
+
const debtAsset0 = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
482
|
+
const debtAsset1 = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken1, network);
|
|
512
483
|
const { borrowableShares, maxBorrowShares, borrowDexFee, utilizationBorrow0, utilizationBorrow1, borrowable0, borrowable1, borrowRate0, borrowRate1, totalBorrowShares, token0PerBorrowShare, token1PerBorrowShare, borrowableToken0, borrowableToken1, totalBorrowToken0, totalBorrowToken1, reservesBorrowToken0, reservesBorrowToken1, } = (0, fluidHelpers_1.parseDexBorrowData)(data.dexBorrowData, debtAsset0.symbol, debtAsset1.symbol);
|
|
513
484
|
// 18 because debt is represented in shares for which they use 18 decimals
|
|
514
485
|
const oracleScaleFactor = new decimal_js_1.default(27).add(18).sub(collAsset.decimals).toString();
|
|
@@ -519,13 +490,13 @@ const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
519
490
|
prices = tokenPrices;
|
|
520
491
|
}
|
|
521
492
|
else {
|
|
522
|
-
prices = yield getChainLinkPricesForTokens([
|
|
493
|
+
prices = yield getChainLinkPricesForTokens([collAsset.address, debtAsset0.address, debtAsset1.address], network, provider);
|
|
523
494
|
}
|
|
524
495
|
const supplyRate = new decimal_js_1.default(data.supplyRateVault).div(100).toString();
|
|
525
496
|
const collAssetData = {
|
|
526
497
|
symbol: collAsset.symbol,
|
|
527
498
|
address: collAsset.address,
|
|
528
|
-
price: prices[tokenPrices ? collAsset.symbol :
|
|
499
|
+
price: prices[tokenPrices ? collAsset.symbol : collAsset.address],
|
|
529
500
|
totalSupply: data.totalSupplyVault.toString(),
|
|
530
501
|
canBeSupplied: true,
|
|
531
502
|
supplyRate,
|
|
@@ -544,7 +515,7 @@ const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
544
515
|
const debtAsset0Data = {
|
|
545
516
|
symbol: debtAsset0.symbol,
|
|
546
517
|
address: debtAsset0.address,
|
|
547
|
-
price: prices[tokenPrices ? debtAsset0.symbol :
|
|
518
|
+
price: prices[tokenPrices ? debtAsset0.symbol : debtAsset0.address],
|
|
548
519
|
totalBorrow: new decimal_js_1.default(totalBorrowShares).mul(token0PerBorrowShare).toString(),
|
|
549
520
|
canBeBorrowed: true,
|
|
550
521
|
borrowRate: borrowRate0,
|
|
@@ -566,7 +537,7 @@ const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
566
537
|
const debtAsset1Data = {
|
|
567
538
|
symbol: debtAsset1.symbol,
|
|
568
539
|
address: debtAsset1.address,
|
|
569
|
-
price: prices[tokenPrices ? debtAsset1.symbol :
|
|
540
|
+
price: prices[tokenPrices ? debtAsset1.symbol : debtAsset1.address],
|
|
570
541
|
totalBorrow: new decimal_js_1.default(totalBorrowShares).mul(token1PerBorrowShare).toString(),
|
|
571
542
|
canBeBorrowed: true,
|
|
572
543
|
borrowRate: borrowRate1,
|
|
@@ -655,14 +626,10 @@ const parseT3MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
655
626
|
});
|
|
656
627
|
const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaiter(void 0, [provider_1, data_1, network_1, ...args_1], void 0, function* (provider, data, network, tokenPrices = null) {
|
|
657
628
|
var _a, _b, _c, _d;
|
|
658
|
-
const
|
|
659
|
-
const
|
|
660
|
-
const
|
|
661
|
-
const
|
|
662
|
-
const debtAsset0Contract = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
663
|
-
const debtAsset0 = (0, tokens_1.getAssetInfo)((0, utils_1.getNativeAssetFromWrapped)(debtAsset0Contract.symbol), network);
|
|
664
|
-
const debtAsset1Contract = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken1, network);
|
|
665
|
-
const debtAsset1 = (0, tokens_1.getAssetInfo)((0, utils_1.getNativeAssetFromWrapped)(debtAsset1Contract.symbol), network);
|
|
629
|
+
const collAsset0 = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken0, network);
|
|
630
|
+
const collAsset1 = (0, tokens_1.getAssetInfoByAddress)(data.supplyToken1, network);
|
|
631
|
+
const debtAsset0 = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken0, network);
|
|
632
|
+
const debtAsset1 = (0, tokens_1.getAssetInfoByAddress)(data.borrowToken1, network);
|
|
666
633
|
const quoteToken = (0, tokens_1.getAssetInfoByAddress)(data.dexBorrowData.quoteToken, network);
|
|
667
634
|
// 27 - 18 + 18
|
|
668
635
|
const oracleScaleFactor = new decimal_js_1.default(27).toString();
|
|
@@ -673,14 +640,14 @@ const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
673
640
|
prices = tokenPrices;
|
|
674
641
|
}
|
|
675
642
|
else {
|
|
676
|
-
prices = yield getChainLinkPricesForTokens([
|
|
643
|
+
prices = yield getChainLinkPricesForTokens([collAsset0.address, collAsset1.address, debtAsset0.address, debtAsset1.address], network, provider);
|
|
677
644
|
}
|
|
678
645
|
const { supplyDexFee, totalSupplyShares, supplyRate1, token0PerSupplyShare, token1PerSupplyShare, totalSupplyToken0, totalSupplyToken1, maxSupplyShares, withdrawableToken0, withdrawable0, withdrawableToken1, withdrawable1, supplyRate0, utilizationSupply0, utilizationSupply1, withdrawableShares, reservesSupplyToken0, reservesSupplyToken1, } = (0, fluidHelpers_1.parseDexSupplyData)(data.dexSupplyData, collAsset0.symbol, collAsset1.symbol);
|
|
679
646
|
const { borrowableShares, maxBorrowShares, borrowDexFee, utilizationBorrow0, utilizationBorrow1, borrowable0, borrowable1, borrowRate0, borrowRate1, totalBorrowShares, token0PerBorrowShare, token1PerBorrowShare, borrowableToken0, borrowableToken1, totalBorrowToken0, totalBorrowToken1, quoteTokensPerShare, reservesBorrowToken0, reservesBorrowToken1, } = (0, fluidHelpers_1.parseDexBorrowData)(data.dexBorrowData, debtAsset0.symbol, debtAsset1.symbol);
|
|
680
647
|
const collAsset0Data = {
|
|
681
648
|
symbol: collAsset0.symbol,
|
|
682
649
|
address: collAsset0.address,
|
|
683
|
-
price: prices[tokenPrices ? collAsset0.symbol :
|
|
650
|
+
price: prices[tokenPrices ? collAsset0.symbol : collAsset0.address],
|
|
684
651
|
totalSupply: new decimal_js_1.default(totalSupplyShares).mul(token0PerSupplyShare).toString(),
|
|
685
652
|
canBeSupplied: true,
|
|
686
653
|
supplyRate: supplyRate0,
|
|
@@ -702,7 +669,7 @@ const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
702
669
|
const collAsset1Data = {
|
|
703
670
|
symbol: collAsset1.symbol,
|
|
704
671
|
address: collAsset1.address,
|
|
705
|
-
price: prices[tokenPrices ? collAsset1.symbol :
|
|
672
|
+
price: prices[tokenPrices ? collAsset1.symbol : collAsset1.address],
|
|
706
673
|
totalSupply: new decimal_js_1.default(totalSupplyShares).mul(token1PerSupplyShare).toString(),
|
|
707
674
|
canBeSupplied: true,
|
|
708
675
|
supplyRate: supplyRate1,
|
|
@@ -724,7 +691,7 @@ const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
724
691
|
const debtAsset0Data = {
|
|
725
692
|
symbol: debtAsset0.symbol,
|
|
726
693
|
address: debtAsset0.address,
|
|
727
|
-
price: prices[tokenPrices ? debtAsset0.symbol :
|
|
694
|
+
price: prices[tokenPrices ? debtAsset0.symbol : debtAsset0.address],
|
|
728
695
|
totalBorrow: new decimal_js_1.default(totalBorrowShares).mul(token0PerBorrowShare).toString(),
|
|
729
696
|
canBeBorrowed: true,
|
|
730
697
|
borrowRate: borrowRate0,
|
|
@@ -746,7 +713,7 @@ const parseT4MarketData = (provider_1, data_1, network_1, ...args_1) => __awaite
|
|
|
746
713
|
const debtAsset1Data = {
|
|
747
714
|
symbol: debtAsset1.symbol,
|
|
748
715
|
address: debtAsset1.address,
|
|
749
|
-
price: prices[tokenPrices ? debtAsset1.symbol :
|
|
716
|
+
price: prices[tokenPrices ? debtAsset1.symbol : debtAsset1.address],
|
|
750
717
|
totalBorrow: new decimal_js_1.default(totalBorrowShares).mul(token1PerBorrowShare).toString(),
|
|
751
718
|
canBeBorrowed: true,
|
|
752
719
|
borrowRate: borrowRate1,
|
|
@@ -1227,7 +1194,7 @@ const getTokenPricePortfolio = (token, provider, network) => __awaiter(void 0, v
|
|
|
1227
1194
|
if (token === 'wstETH') {
|
|
1228
1195
|
return (0, priceService_1.getWstETHPrice)(provider, network);
|
|
1229
1196
|
}
|
|
1230
|
-
if (token === 'weETH'
|
|
1197
|
+
if (token === 'weETH') {
|
|
1231
1198
|
return (0, priceService_1.getWeETHPrice)(provider, network);
|
|
1232
1199
|
}
|
|
1233
1200
|
const isMainnet = (0, utils_1.isMainnetNetwork)(network);
|
|
@@ -116,27 +116,6 @@ export declare const FLUID_WSTETH_SUSDS_18_BASE: (networkId?: NetworkNumber) =>
|
|
|
116
116
|
export declare const FLUID_CBBTC_SUSDS_19_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
117
117
|
export declare const FLUID_LBTC_USDC_21_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
118
118
|
export declare const FLUID_LBTC_SUSDS_22_BASE: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
119
|
-
export declare const FLUID_ETH_USDT_1_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
120
|
-
export declare const FLUID_ETH_USDE_2_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
121
|
-
export declare const FLUID_WEETH_ETH_3_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
122
|
-
export declare const FLUID_SUSDE_USDT_4_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
123
|
-
export declare const FLUID_WEETH_USDT_5_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
124
|
-
export declare const FLUID_WEETH_USDE_6_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
125
|
-
export declare const FLUID_XAUT_USDT_7_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
126
|
-
export declare const FLUID_XAUT_USDE_8_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
127
|
-
export declare const FLUID_USDE_USDT_9_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
128
|
-
export declare const FLUID_USDAI_USDT_10_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
129
|
-
export declare const FLUID_WEETH_ETH_ETH_11_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
130
|
-
export declare const FLUID_SUSDE_USDT_USDT_12_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
131
|
-
export declare const FLUID_USDE_USDT_USDT_13_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
132
|
-
export declare const FLUID_USDAI_USDT_USDT_14_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
133
|
-
export declare const FLUID_USDT_SYRUPUSDT_USDT_15_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
134
|
-
export declare const FLUID_XPL_USDT_16_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
135
|
-
export declare const FLUID_XPL_USDE_17_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
136
|
-
export declare const FLUID_WSTUSR_USDT_18_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
137
|
-
export declare const FLUID_WSTUSR_USDT_USDT_19_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
138
|
-
export declare const FLUID_SYRUPUSDT_USDT_20_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
139
|
-
export declare const FLUID_ETH_WRSETH_ETH_21_PLASMA: (networkId?: NetworkNumber) => FluidMarketInfo;
|
|
140
119
|
export declare const FluidMarkets: (networkId: NetworkNumber) => {
|
|
141
120
|
FLUID_ETH_USDC_1: FluidMarketInfo;
|
|
142
121
|
FLUID_ETH_USDT_2: FluidMarketInfo;
|
|
@@ -254,27 +233,6 @@ export declare const FluidMarkets: (networkId: NetworkNumber) => {
|
|
|
254
233
|
FLUID_CBBTC_SUSDS_19_BASE: FluidMarketInfo;
|
|
255
234
|
FLUID_LBTC_USDC_21_BASE: FluidMarketInfo;
|
|
256
235
|
FLUID_LBTC_SUSDS_22_BASE: FluidMarketInfo;
|
|
257
|
-
FLUID_ETH_USDT_1_PLASMA: FluidMarketInfo;
|
|
258
|
-
FLUID_ETH_USDE_2_PLASMA: FluidMarketInfo;
|
|
259
|
-
FLUID_WEETH_ETH_3_PLASMA: FluidMarketInfo;
|
|
260
|
-
FLUID_SUSDE_USDT_4_PLASMA: FluidMarketInfo;
|
|
261
|
-
FLUID_WEETH_USDT_5_PLASMA: FluidMarketInfo;
|
|
262
|
-
FLUID_WEETH_USDE_6_PLASMA: FluidMarketInfo;
|
|
263
|
-
FLUID_XAUT_USDT_7_PLASMA: FluidMarketInfo;
|
|
264
|
-
FLUID_XAUT_USDE_8_PLASMA: FluidMarketInfo;
|
|
265
|
-
FLUID_USDE_USDT_9_PLASMA: FluidMarketInfo;
|
|
266
|
-
FLUID_USDAI_USDT_10_PLASMA: FluidMarketInfo;
|
|
267
|
-
FLUID_WEETH_ETH_ETH_11_PLASMA: FluidMarketInfo;
|
|
268
|
-
FLUID_SUSDE_USDT_USDT_12_PLASMA: FluidMarketInfo;
|
|
269
|
-
FLUID_USDE_USDT_USDT_13_PLASMA: FluidMarketInfo;
|
|
270
|
-
FLUID_USDAI_USDT_USDT_14_PLASMA: FluidMarketInfo;
|
|
271
|
-
FLUID_USDT_SYRUPUSDT_USDT_15_PLASMA: FluidMarketInfo;
|
|
272
|
-
FLUID_XPL_USDT_16_PLASMA: FluidMarketInfo;
|
|
273
|
-
FLUID_XPL_USDE_17_PLASMA: FluidMarketInfo;
|
|
274
|
-
FLUID_WSTUSR_USDT_18_PLASMA: FluidMarketInfo;
|
|
275
|
-
FLUID_WSTUSR_USDT_USDT_19_PLASMA: FluidMarketInfo;
|
|
276
|
-
FLUID_SYRUPUSDT_USDT_20_PLASMA: FluidMarketInfo;
|
|
277
|
-
FLUID_ETH_WRSETH_ETH_21_PLASMA: FluidMarketInfo;
|
|
278
236
|
};
|
|
279
237
|
export declare const getFluidVersionsDataForNetwork: (network: NetworkNumber) => FluidMarketInfo[];
|
|
280
238
|
export declare const getFluidMarketInfoById: (vaultId: number, network?: NetworkNumber) => FluidMarketInfo | undefined;
|
|
@@ -302,9 +260,5 @@ export declare const FluidFTokens: (networkId: NetworkNumber) => {
|
|
|
302
260
|
wstETH: string;
|
|
303
261
|
sUSDS: string;
|
|
304
262
|
GHO: string;
|
|
305
|
-
} | {
|
|
306
|
-
ETH: string;
|
|
307
|
-
USDT: string;
|
|
308
|
-
USDe: string;
|
|
309
263
|
};
|
|
310
264
|
export declare const getFTokenAddress: (token: string, networkId: NetworkNumber) => any;
|