@defisaver/positions-sdk 0.0.48 → 0.0.49
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/llamaLend/index.js
CHANGED
|
@@ -86,6 +86,10 @@ const getLlamaLendGlobalData = (web3, network, selectedMarket) => __awaiter(void
|
|
|
86
86
|
console.log('here');
|
|
87
87
|
// all prices are in 18 decimals
|
|
88
88
|
const totalDebt = (0, tokens_1.assetAmountInEth)(data.totalDebt, debtAsset);
|
|
89
|
+
const totalDebtSupplied = (0, tokens_1.assetAmountInEth)(data.debtTokenTotalSupply, debtAsset);
|
|
90
|
+
const utilization = new decimal_js_1.default(totalDebtSupplied).gt(0)
|
|
91
|
+
? new decimal_js_1.default(totalDebt).div(totalDebtSupplied).mul(100)
|
|
92
|
+
: 0;
|
|
89
93
|
const ammPrice = (0, tokens_1.assetAmountInEth)(data.ammPrice, debtAsset);
|
|
90
94
|
const oraclePrice = (0, utils_1.getEthAmountForDecimals)(data.oraclePrice, 18);
|
|
91
95
|
const rate = (0, tokens_1.assetAmountInEth)(data.ammRate);
|
|
@@ -122,6 +126,8 @@ const getLlamaLendGlobalData = (web3, network, selectedMarket) => __awaiter(void
|
|
|
122
126
|
};
|
|
123
127
|
return Object.assign(Object.assign({}, data), { assetsData,
|
|
124
128
|
totalDebt,
|
|
129
|
+
totalDebtSupplied,
|
|
130
|
+
utilization,
|
|
125
131
|
ammPrice, oraclePrice: (0, tokens_1.assetAmountInEth)(data.oraclePrice, debtAsset), basePrice: (0, tokens_1.assetAmountInEth)(data.basePrice, debtAsset), minted: (0, tokens_1.assetAmountInEth)(data.minted, debtAsset), redeemed: (0, tokens_1.assetAmountInEth)(data.redeemed, debtAsset), borrowRate,
|
|
126
132
|
lendRate,
|
|
127
133
|
futureBorrowRate, bands: bandsData, leftToBorrow });
|
|
@@ -185,7 +191,7 @@ const getLlamaLendUserData = (web3, network, address, selectedMarket, marketData
|
|
|
185
191
|
const shares = (0, tokens_1.assetAmountInEth)(data.debtTokenSuppliedShares, debtAsset);
|
|
186
192
|
const usedAssets = {
|
|
187
193
|
[collAsset]: {
|
|
188
|
-
isSupplied:
|
|
194
|
+
isSupplied: new decimal_js_1.default(collSupplied).gt('0'),
|
|
189
195
|
supplied: collSupplied,
|
|
190
196
|
suppliedUsd: collSuppliedUsd,
|
|
191
197
|
borrowed: '0',
|
package/esm/llamaLend/index.js
CHANGED
|
@@ -80,6 +80,10 @@ export const getLlamaLendGlobalData = (web3, network, selectedMarket) => __await
|
|
|
80
80
|
console.log('here');
|
|
81
81
|
// all prices are in 18 decimals
|
|
82
82
|
const totalDebt = assetAmountInEth(data.totalDebt, debtAsset);
|
|
83
|
+
const totalDebtSupplied = assetAmountInEth(data.debtTokenTotalSupply, debtAsset);
|
|
84
|
+
const utilization = new Dec(totalDebtSupplied).gt(0)
|
|
85
|
+
? new Dec(totalDebt).div(totalDebtSupplied).mul(100)
|
|
86
|
+
: 0;
|
|
83
87
|
const ammPrice = assetAmountInEth(data.ammPrice, debtAsset);
|
|
84
88
|
const oraclePrice = getEthAmountForDecimals(data.oraclePrice, 18);
|
|
85
89
|
const rate = assetAmountInEth(data.ammRate);
|
|
@@ -116,6 +120,8 @@ export const getLlamaLendGlobalData = (web3, network, selectedMarket) => __await
|
|
|
116
120
|
};
|
|
117
121
|
return Object.assign(Object.assign({}, data), { assetsData,
|
|
118
122
|
totalDebt,
|
|
123
|
+
totalDebtSupplied,
|
|
124
|
+
utilization,
|
|
119
125
|
ammPrice, oraclePrice: assetAmountInEth(data.oraclePrice, debtAsset), basePrice: assetAmountInEth(data.basePrice, debtAsset), minted: assetAmountInEth(data.minted, debtAsset), redeemed: assetAmountInEth(data.redeemed, debtAsset), borrowRate,
|
|
120
126
|
lendRate,
|
|
121
127
|
futureBorrowRate, bands: bandsData, leftToBorrow });
|
|
@@ -177,7 +183,7 @@ export const getLlamaLendUserData = (web3, network, address, selectedMarket, mar
|
|
|
177
183
|
const shares = assetAmountInEth(data.debtTokenSuppliedShares, debtAsset);
|
|
178
184
|
const usedAssets = {
|
|
179
185
|
[collAsset]: {
|
|
180
|
-
isSupplied:
|
|
186
|
+
isSupplied: new Dec(collSupplied).gt('0'),
|
|
181
187
|
supplied: collSupplied,
|
|
182
188
|
suppliedUsd: collSuppliedUsd,
|
|
183
189
|
borrowed: '0',
|
package/package.json
CHANGED
package/src/llamaLend/index.ts
CHANGED
|
@@ -82,6 +82,10 @@ export const getLlamaLendGlobalData = async (web3: Web3, network: NetworkNumber,
|
|
|
82
82
|
console.log('here');
|
|
83
83
|
// all prices are in 18 decimals
|
|
84
84
|
const totalDebt = assetAmountInEth(data.totalDebt, debtAsset);
|
|
85
|
+
const totalDebtSupplied = assetAmountInEth(data.debtTokenTotalSupply, debtAsset);
|
|
86
|
+
const utilization = new Dec(totalDebtSupplied).gt(0)
|
|
87
|
+
? new Dec(totalDebt).div(totalDebtSupplied).mul(100)
|
|
88
|
+
: 0;
|
|
85
89
|
const ammPrice = assetAmountInEth(data.ammPrice, debtAsset);
|
|
86
90
|
const oraclePrice = getEthAmountForDecimals(data.oraclePrice, 18);
|
|
87
91
|
|
|
@@ -127,6 +131,8 @@ export const getLlamaLendGlobalData = async (web3: Web3, network: NetworkNumber,
|
|
|
127
131
|
...data,
|
|
128
132
|
assetsData,
|
|
129
133
|
totalDebt,
|
|
134
|
+
totalDebtSupplied,
|
|
135
|
+
utilization,
|
|
130
136
|
ammPrice,
|
|
131
137
|
oraclePrice: assetAmountInEth(data.oraclePrice, debtAsset),
|
|
132
138
|
basePrice: assetAmountInEth(data.basePrice, debtAsset),
|
|
@@ -208,7 +214,7 @@ export const getLlamaLendUserData = async (web3: Web3, network: NetworkNumber, a
|
|
|
208
214
|
|
|
209
215
|
const usedAssets: LlamaLendUsedAssets = {
|
|
210
216
|
[collAsset]: {
|
|
211
|
-
isSupplied:
|
|
217
|
+
isSupplied: new Dec(collSupplied).gt('0'),
|
|
212
218
|
supplied: collSupplied,
|
|
213
219
|
suppliedUsd: collSuppliedUsd,
|
|
214
220
|
borrowed: '0',
|