@defisaver/positions-sdk 0.0.166-dev3-liquity-v2 → 0.0.166-dev5-liquity-v2
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.js +1 -1
- package/cjs/liquityV2/index.d.ts +2 -1
- package/cjs/liquityV2/index.js +16 -7
- package/cjs/moneymarket/moneymarketCommonService.js +1 -1
- package/cjs/types/liquityV2.d.ts +2 -2
- package/esm/config/contracts.js +1 -1
- package/esm/liquityV2/index.d.ts +2 -1
- package/esm/liquityV2/index.js +14 -6
- package/esm/moneymarket/moneymarketCommonService.js +1 -1
- package/esm/types/liquityV2.d.ts +2 -2
- package/package.json +1 -1
- package/src/config/contracts.js +1 -1
- package/src/liquityV2/index.ts +16 -6
- package/src/moneymarket/moneymarketCommonService.ts +1 -1
- package/src/types/liquityV2.ts +2 -2
package/cjs/config/contracts.js
CHANGED
|
@@ -1034,7 +1034,7 @@ module.exports = {
|
|
|
1034
1034
|
"LiquityV2View": {
|
|
1035
1035
|
"abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_interestRate", "type": "uint256" }, { "internalType": "uint256", "name": "_prevId", "type": "uint256" }, { "internalType": "uint256", "name": "_nextId", "type": "uint256" }], "name": "findInsertPosition", "outputs": [{ "internalType": "uint256", "name": "prevId", "type": "uint256" }, { "internalType": "uint256", "name": "nextId", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_collIndex", "type": "uint256" }, { "internalType": "uint256", "name": "_interestRate", "type": "uint256" }, { "internalType": "uint256", "name": "_numTrials", "type": "uint256" }, { "internalType": "uint256", "name": "_inputRandomSeed", "type": "uint256" }], "name": "getApproxHint", "outputs": [{ "internalType": "uint256", "name": "hintId", "type": "uint256" }, { "internalType": "uint256", "name": "diff", "type": "uint256" }, { "internalType": "uint256", "name": "latestRandomSeed", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_acc", "type": "uint256" }, { "internalType": "uint256", "name": "_iterations", "type": "uint256" }], "name": "getDebtInFront", "outputs": [{ "internalType": "uint256", "name": "next", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_acc", "type": "uint256" }, { "internalType": "uint256", "name": "_iterations", "type": "uint256" }, { "internalType": "uint256", "name": "_targetIR", "type": "uint256" }], "name": "getDebtInFrontByInterestRate", "outputs": [{ "internalType": "uint256", "name": "next", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_numTroves", "type": "uint256" }], "name": "getDebtInFrontByTroveNum", "outputs": [{ "internalType": "uint256", "name": "debt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getDepositorInfo", "outputs": [{ "internalType": "uint256", "name": "compoundedBOLD", "type": "uint256" }, { "internalType": "uint256", "name": "collGain", "type": "uint256" }, { "internalType": "uint256", "name": "boldGain", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_collIndex", "type": "uint256" }, { "internalType": "uint256", "name": "_interestRate", "type": "uint256" }, { "internalType": "uint256", "name": "_numTrials", "type": "uint256" }, { "internalType": "uint256", "name": "_inputRandomSeed", "type": "uint256" }], "name": "getInsertPosition", "outputs": [{ "internalType": "uint256", "name": "prevId", "type": "uint256" }, { "internalType": "uint256", "name": "nextId", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }], "name": "getMarketData", "outputs": [{ "components": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "CCR", "type": "uint256" }, { "internalType": "uint256", "name": "MCR", "type": "uint256" }, { "internalType": "uint256", "name": "SCR", "type": "uint256" }, { "internalType": "uint256", "name": "LIQUIDATION_PENALTY_SP", "type": "uint256" }, { "internalType": "uint256", "name": "LIQUIDATION_PENALTY_REDISTRIBUTION", "type": "uint256" }, { "internalType": "uint256", "name": "entireSystemColl", "type": "uint256" }, { "internalType": "uint256", "name": "entireSystemDebt", "type": "uint256" }, { "internalType": "address", "name": "collToken", "type": "address" }, { "internalType": "address", "name": "troveNFT", "type": "address" }, { "internalType": "address", "name": "borrowerOperations", "type": "address" }, { "internalType": "address", "name": "troveManager", "type": "address" }, { "internalType": "address", "name": "stabilityPool", "type": "address" }, { "internalType": "address", "name": "sortedTroves", "type": "address" }, { "internalType": "address", "name": "collSurplusPool", "type": "address" }, { "internalType": "address", "name": "hintHelpers", "type": "address" }, { "internalType": "address", "name": "priceFeed", "type": "address" }, { "internalType": "uint256", "name": "collPrice", "type": "uint256" }, { "internalType": "bool", "name": "isShutDown", "type": "bool" }], "internalType": "struct LiquityV2View.MarketData", "name": "data", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_iterations", "type": "uint256" }], "name": "getNumOfTrovesInFrontOfTrove", "outputs": [{ "internalType": "uint256", "name": "next", "type": "uint256" }, { "internalType": "uint256", "name": "numTroves", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }], "name": "getTroveInfo", "outputs": [{ "components": [{ "internalType": "uint256", "name": "troveId", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "collToken", "type": "address" }, { "internalType": "enum ITroveManager.Status", "name": "status", "type": "uint8" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }, { "internalType": "uint256", "name": "collPrice", "type": "uint256" }, { "internalType": "uint256", "name": "TCRatio", "type": "uint256" }, { "internalType": "uint256", "name": "annualInterestRate", "type": "uint256" }, { "internalType": "address", "name": "interestBatchManager", "type": "address" }, { "internalType": "uint256", "name": "batchDebtShares", "type": "uint256" }], "internalType": "struct LiquityV2View.TroveData", "name": "trove", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_collIndex", "type": "uint256" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_numTrials", "type": "uint256" }, { "internalType": "uint256", "name": "_inputRandomSeed", "type": "uint256" }], "name": "getTrovePosition", "outputs": [{ "internalType": "uint256", "name": "prevId", "type": "uint256" }, { "internalType": "uint256", "name": "nextId", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }], "name": "isShutDown", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }],
|
|
1036
1036
|
"networks": {
|
|
1037
|
-
"1": { "address": "
|
|
1037
|
+
"1": { "address": "0xD484E43F56e2A83D8D4476b803dAEc99c557b4a8" },
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
1040
|
};
|
package/cjs/liquityV2/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
|
-
import { NetworkNumber } from '../types/common';
|
|
2
|
+
import { EthAddress, NetworkNumber } from '../types/common';
|
|
3
3
|
import { InnerLiquityV2MarketData, LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData } from '../types';
|
|
4
4
|
export declare const getLiquityV2MarketData: (web3: Web3, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, mainnetWeb3: Web3) => Promise<LiquityV2MarketData>;
|
|
5
|
+
export declare const getDebtInFrontLiquityV2: (viewContract: any, marketAddress: EthAddress, troveId: string, accumulatedSum?: string, iterations?: number) => Promise<string>;
|
|
5
6
|
export declare const getLiquityV2TroveData: (web3: Web3, network: NetworkNumber, { selectedMarket, assetsData, marketData, troveId, }: {
|
|
6
7
|
selectedMarket: LiquityV2MarketInfo;
|
|
7
8
|
assetsData: LiquityV2AssetsData;
|
package/cjs/liquityV2/index.js
CHANGED
|
@@ -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.getLiquityV2TroveData = exports.getLiquityV2MarketData = void 0;
|
|
15
|
+
exports.getLiquityV2TroveData = exports.getDebtInFrontLiquityV2 = exports.getLiquityV2MarketData = 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");
|
|
@@ -51,18 +51,27 @@ const getLiquityV2MarketData = (web3, network, selectedMarket, mainnetWeb3) => _
|
|
|
51
51
|
return { assetsData, marketData: { minCollRatio } };
|
|
52
52
|
});
|
|
53
53
|
exports.getLiquityV2MarketData = getLiquityV2MarketData;
|
|
54
|
+
const _getDebtInFront = (viewContract, marketAddress, troveId, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () { return viewContract.methods.getDebtInFront(marketAddress, troveId, accumulatedSum, iterations).call(); });
|
|
55
|
+
const getDebtInFrontLiquityV2 = (viewContract, marketAddress, troveId, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
const { debt, next } = yield _getDebtInFront(viewContract, marketAddress, troveId, accumulatedSum, iterations);
|
|
57
|
+
if (next === '0')
|
|
58
|
+
return (0, tokens_1.assetAmountInEth)(debt);
|
|
59
|
+
return (0, exports.getDebtInFrontLiquityV2)(viewContract, marketAddress, next, debt, iterations);
|
|
60
|
+
});
|
|
61
|
+
exports.getDebtInFrontLiquityV2 = getDebtInFrontLiquityV2;
|
|
54
62
|
const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsData, marketData, troveId, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
63
|
const viewContract = (0, contracts_1.LiquityV2ViewContract)(web3, network);
|
|
56
64
|
const { minCollRatio } = marketData;
|
|
57
65
|
const { collateralToken, marketAddress, debtToken } = selectedMarket;
|
|
58
|
-
const data = yield
|
|
66
|
+
const [data, debtInFront] = yield Promise.all([
|
|
67
|
+
viewContract.methods.getTroveInfo(marketAddress, troveId).call(),
|
|
68
|
+
(0, exports.getDebtInFrontLiquityV2)(viewContract, marketAddress, troveId),
|
|
69
|
+
]);
|
|
59
70
|
const usedAssets = {};
|
|
60
71
|
const debtAssetData = assetsData[debtToken];
|
|
61
72
|
const borrowed = (0, tokens_1.assetAmountInEth)(data.debtAmount);
|
|
62
73
|
usedAssets[debtToken] = {
|
|
63
74
|
symbol: debtToken,
|
|
64
|
-
address: debtAssetData.address,
|
|
65
|
-
price: debtAssetData.price,
|
|
66
75
|
supplied: '0',
|
|
67
76
|
suppliedUsd: '0',
|
|
68
77
|
borrowed,
|
|
@@ -74,14 +83,13 @@ const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsData, mark
|
|
|
74
83
|
const suppliedColl = (0, tokens_1.assetAmountInEth)(data.collAmount);
|
|
75
84
|
usedAssets[collateralToken] = {
|
|
76
85
|
symbol: collateralToken,
|
|
77
|
-
address: collAssetData.address,
|
|
78
|
-
price: collAssetData.price,
|
|
79
86
|
supplied: suppliedColl,
|
|
80
87
|
suppliedUsd: new decimal_js_1.default(suppliedColl).mul(collAssetData.price).toString(),
|
|
81
88
|
borrowed: '0',
|
|
82
89
|
borrowedUsd: '0',
|
|
83
90
|
isBorrowed: false,
|
|
84
91
|
isSupplied: true,
|
|
92
|
+
collateral: true,
|
|
85
93
|
};
|
|
86
94
|
const collRatio = new decimal_js_1.default(data.TCRatio).div(1e16).toString();
|
|
87
95
|
const interestRate = new decimal_js_1.default(data.annualInterestRate).div(1e16).toString();
|
|
@@ -90,7 +98,8 @@ const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsData, mark
|
|
|
90
98
|
troveId,
|
|
91
99
|
collRatio,
|
|
92
100
|
interestRate,
|
|
93
|
-
interestBatchManager,
|
|
101
|
+
interestBatchManager,
|
|
102
|
+
debtInFront, troveStatus: types_1.LIQUITY_TROVE_STATUS_ENUM[parseInt(data.status, 10)] }, (0, liquityV2Helpers_1.getLiquityV2AggregatedPositionData)({
|
|
94
103
|
usedAssets, assetsData, minCollRatio, interestRate,
|
|
95
104
|
}));
|
|
96
105
|
return payload;
|
|
@@ -27,7 +27,7 @@ const calcLeverageLiqPrice = (leverageType, assetPrice, borrowedUsd, borrowLimit
|
|
|
27
27
|
exports.calcLeverageLiqPrice = calcLeverageLiqPrice;
|
|
28
28
|
const calculateBorrowingAssetLimit = (assetBorrowedUsd, borrowLimitUsd) => new decimal_js_1.default(assetBorrowedUsd).div(borrowLimitUsd).times(100).toString();
|
|
29
29
|
exports.calculateBorrowingAssetLimit = calculateBorrowingAssetLimit;
|
|
30
|
-
exports.STABLE_ASSETS = ['DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI', 'crvUSD'];
|
|
30
|
+
exports.STABLE_ASSETS = ['DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI', 'crvUSD', 'BOLD'];
|
|
31
31
|
const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
32
32
|
let borrowUnstable = 0;
|
|
33
33
|
let supplyStable = 0;
|
package/cjs/types/liquityV2.d.ts
CHANGED
|
@@ -37,8 +37,7 @@ export interface LiquityV2MarketData {
|
|
|
37
37
|
}
|
|
38
38
|
export interface LiquityV2UsedAsset {
|
|
39
39
|
symbol: string;
|
|
40
|
-
|
|
41
|
-
price: string;
|
|
40
|
+
collateral?: boolean;
|
|
42
41
|
supplied: string;
|
|
43
42
|
suppliedUsd: string;
|
|
44
43
|
borrowed: string;
|
|
@@ -80,4 +79,5 @@ export interface LiquityV2TroveData {
|
|
|
80
79
|
leveragedType: string;
|
|
81
80
|
leveragedAsset: string;
|
|
82
81
|
liquidationPrice: string;
|
|
82
|
+
debtInFront: string;
|
|
83
83
|
}
|
package/esm/config/contracts.js
CHANGED
|
@@ -1033,7 +1033,7 @@ module.exports = {
|
|
|
1033
1033
|
"LiquityV2View": {
|
|
1034
1034
|
"abi": [{ "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_interestRate", "type": "uint256" }, { "internalType": "uint256", "name": "_prevId", "type": "uint256" }, { "internalType": "uint256", "name": "_nextId", "type": "uint256" }], "name": "findInsertPosition", "outputs": [{ "internalType": "uint256", "name": "prevId", "type": "uint256" }, { "internalType": "uint256", "name": "nextId", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_collIndex", "type": "uint256" }, { "internalType": "uint256", "name": "_interestRate", "type": "uint256" }, { "internalType": "uint256", "name": "_numTrials", "type": "uint256" }, { "internalType": "uint256", "name": "_inputRandomSeed", "type": "uint256" }], "name": "getApproxHint", "outputs": [{ "internalType": "uint256", "name": "hintId", "type": "uint256" }, { "internalType": "uint256", "name": "diff", "type": "uint256" }, { "internalType": "uint256", "name": "latestRandomSeed", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_acc", "type": "uint256" }, { "internalType": "uint256", "name": "_iterations", "type": "uint256" }], "name": "getDebtInFront", "outputs": [{ "internalType": "uint256", "name": "next", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_acc", "type": "uint256" }, { "internalType": "uint256", "name": "_iterations", "type": "uint256" }, { "internalType": "uint256", "name": "_targetIR", "type": "uint256" }], "name": "getDebtInFrontByInterestRate", "outputs": [{ "internalType": "uint256", "name": "next", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_numTroves", "type": "uint256" }], "name": "getDebtInFrontByTroveNum", "outputs": [{ "internalType": "uint256", "name": "debt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getDepositorInfo", "outputs": [{ "internalType": "uint256", "name": "compoundedBOLD", "type": "uint256" }, { "internalType": "uint256", "name": "collGain", "type": "uint256" }, { "internalType": "uint256", "name": "boldGain", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_collIndex", "type": "uint256" }, { "internalType": "uint256", "name": "_interestRate", "type": "uint256" }, { "internalType": "uint256", "name": "_numTrials", "type": "uint256" }, { "internalType": "uint256", "name": "_inputRandomSeed", "type": "uint256" }], "name": "getInsertPosition", "outputs": [{ "internalType": "uint256", "name": "prevId", "type": "uint256" }, { "internalType": "uint256", "name": "nextId", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }], "name": "getMarketData", "outputs": [{ "components": [{ "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "CCR", "type": "uint256" }, { "internalType": "uint256", "name": "MCR", "type": "uint256" }, { "internalType": "uint256", "name": "SCR", "type": "uint256" }, { "internalType": "uint256", "name": "LIQUIDATION_PENALTY_SP", "type": "uint256" }, { "internalType": "uint256", "name": "LIQUIDATION_PENALTY_REDISTRIBUTION", "type": "uint256" }, { "internalType": "uint256", "name": "entireSystemColl", "type": "uint256" }, { "internalType": "uint256", "name": "entireSystemDebt", "type": "uint256" }, { "internalType": "address", "name": "collToken", "type": "address" }, { "internalType": "address", "name": "troveNFT", "type": "address" }, { "internalType": "address", "name": "borrowerOperations", "type": "address" }, { "internalType": "address", "name": "troveManager", "type": "address" }, { "internalType": "address", "name": "stabilityPool", "type": "address" }, { "internalType": "address", "name": "sortedTroves", "type": "address" }, { "internalType": "address", "name": "collSurplusPool", "type": "address" }, { "internalType": "address", "name": "hintHelpers", "type": "address" }, { "internalType": "address", "name": "priceFeed", "type": "address" }, { "internalType": "uint256", "name": "collPrice", "type": "uint256" }, { "internalType": "bool", "name": "isShutDown", "type": "bool" }], "internalType": "struct LiquityV2View.MarketData", "name": "data", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_iterations", "type": "uint256" }], "name": "getNumOfTrovesInFrontOfTrove", "outputs": [{ "internalType": "uint256", "name": "next", "type": "uint256" }, { "internalType": "uint256", "name": "numTroves", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }], "name": "getTroveInfo", "outputs": [{ "components": [{ "internalType": "uint256", "name": "troveId", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "collToken", "type": "address" }, { "internalType": "enum ITroveManager.Status", "name": "status", "type": "uint8" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }, { "internalType": "uint256", "name": "collPrice", "type": "uint256" }, { "internalType": "uint256", "name": "TCRatio", "type": "uint256" }, { "internalType": "uint256", "name": "annualInterestRate", "type": "uint256" }, { "internalType": "address", "name": "interestBatchManager", "type": "address" }, { "internalType": "uint256", "name": "batchDebtShares", "type": "uint256" }], "internalType": "struct LiquityV2View.TroveData", "name": "trove", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_collIndex", "type": "uint256" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_numTrials", "type": "uint256" }, { "internalType": "uint256", "name": "_inputRandomSeed", "type": "uint256" }], "name": "getTrovePosition", "outputs": [{ "internalType": "uint256", "name": "prevId", "type": "uint256" }, { "internalType": "uint256", "name": "nextId", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_market", "type": "address" }], "name": "isShutDown", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }],
|
|
1035
1035
|
"networks": {
|
|
1036
|
-
"1": { "address": "
|
|
1036
|
+
"1": { "address": "0xD484E43F56e2A83D8D4476b803dAEc99c557b4a8" },
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
1039
|
};
|
package/esm/liquityV2/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
|
-
import { NetworkNumber } from '../types/common';
|
|
2
|
+
import { EthAddress, NetworkNumber } from '../types/common';
|
|
3
3
|
import { InnerLiquityV2MarketData, LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData } from '../types';
|
|
4
4
|
export declare const getLiquityV2MarketData: (web3: Web3, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, mainnetWeb3: Web3) => Promise<LiquityV2MarketData>;
|
|
5
|
+
export declare const getDebtInFrontLiquityV2: (viewContract: any, marketAddress: EthAddress, troveId: string, accumulatedSum?: string, iterations?: number) => Promise<string>;
|
|
5
6
|
export declare const getLiquityV2TroveData: (web3: Web3, network: NetworkNumber, { selectedMarket, assetsData, marketData, troveId, }: {
|
|
6
7
|
selectedMarket: LiquityV2MarketInfo;
|
|
7
8
|
assetsData: LiquityV2AssetsData;
|
package/esm/liquityV2/index.js
CHANGED
|
@@ -44,18 +44,26 @@ export const getLiquityV2MarketData = (web3, network, selectedMarket, mainnetWeb
|
|
|
44
44
|
const minCollRatio = new Dec(data.MCR).div(1e16).toString();
|
|
45
45
|
return { assetsData, marketData: { minCollRatio } };
|
|
46
46
|
});
|
|
47
|
+
const _getDebtInFront = (viewContract, marketAddress, troveId, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () { return viewContract.methods.getDebtInFront(marketAddress, troveId, accumulatedSum, iterations).call(); });
|
|
48
|
+
export const getDebtInFrontLiquityV2 = (viewContract, marketAddress, troveId, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
const { debt, next } = yield _getDebtInFront(viewContract, marketAddress, troveId, accumulatedSum, iterations);
|
|
50
|
+
if (next === '0')
|
|
51
|
+
return assetAmountInEth(debt);
|
|
52
|
+
return getDebtInFrontLiquityV2(viewContract, marketAddress, next, debt, iterations);
|
|
53
|
+
});
|
|
47
54
|
export const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsData, marketData, troveId, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
55
|
const viewContract = LiquityV2ViewContract(web3, network);
|
|
49
56
|
const { minCollRatio } = marketData;
|
|
50
57
|
const { collateralToken, marketAddress, debtToken } = selectedMarket;
|
|
51
|
-
const data = yield
|
|
58
|
+
const [data, debtInFront] = yield Promise.all([
|
|
59
|
+
viewContract.methods.getTroveInfo(marketAddress, troveId).call(),
|
|
60
|
+
getDebtInFrontLiquityV2(viewContract, marketAddress, troveId),
|
|
61
|
+
]);
|
|
52
62
|
const usedAssets = {};
|
|
53
63
|
const debtAssetData = assetsData[debtToken];
|
|
54
64
|
const borrowed = assetAmountInEth(data.debtAmount);
|
|
55
65
|
usedAssets[debtToken] = {
|
|
56
66
|
symbol: debtToken,
|
|
57
|
-
address: debtAssetData.address,
|
|
58
|
-
price: debtAssetData.price,
|
|
59
67
|
supplied: '0',
|
|
60
68
|
suppliedUsd: '0',
|
|
61
69
|
borrowed,
|
|
@@ -67,14 +75,13 @@ export const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsDat
|
|
|
67
75
|
const suppliedColl = assetAmountInEth(data.collAmount);
|
|
68
76
|
usedAssets[collateralToken] = {
|
|
69
77
|
symbol: collateralToken,
|
|
70
|
-
address: collAssetData.address,
|
|
71
|
-
price: collAssetData.price,
|
|
72
78
|
supplied: suppliedColl,
|
|
73
79
|
suppliedUsd: new Dec(suppliedColl).mul(collAssetData.price).toString(),
|
|
74
80
|
borrowed: '0',
|
|
75
81
|
borrowedUsd: '0',
|
|
76
82
|
isBorrowed: false,
|
|
77
83
|
isSupplied: true,
|
|
84
|
+
collateral: true,
|
|
78
85
|
};
|
|
79
86
|
const collRatio = new Dec(data.TCRatio).div(1e16).toString();
|
|
80
87
|
const interestRate = new Dec(data.annualInterestRate).div(1e16).toString();
|
|
@@ -83,7 +90,8 @@ export const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsDat
|
|
|
83
90
|
troveId,
|
|
84
91
|
collRatio,
|
|
85
92
|
interestRate,
|
|
86
|
-
interestBatchManager,
|
|
93
|
+
interestBatchManager,
|
|
94
|
+
debtInFront, troveStatus: LIQUITY_TROVE_STATUS_ENUM[parseInt(data.status, 10)] }, getLiquityV2AggregatedPositionData({
|
|
87
95
|
usedAssets, assetsData, minCollRatio, interestRate,
|
|
88
96
|
}));
|
|
89
97
|
return payload;
|
|
@@ -16,7 +16,7 @@ export const calcLeverageLiqPrice = (leverageType, assetPrice, borrowedUsd, borr
|
|
|
16
16
|
return '0';
|
|
17
17
|
};
|
|
18
18
|
export const calculateBorrowingAssetLimit = (assetBorrowedUsd, borrowLimitUsd) => new Dec(assetBorrowedUsd).div(borrowLimitUsd).times(100).toString();
|
|
19
|
-
export const STABLE_ASSETS = ['DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI', 'crvUSD'];
|
|
19
|
+
export const STABLE_ASSETS = ['DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI', 'crvUSD', 'BOLD'];
|
|
20
20
|
export const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
21
21
|
let borrowUnstable = 0;
|
|
22
22
|
let supplyStable = 0;
|
package/esm/types/liquityV2.d.ts
CHANGED
|
@@ -37,8 +37,7 @@ export interface LiquityV2MarketData {
|
|
|
37
37
|
}
|
|
38
38
|
export interface LiquityV2UsedAsset {
|
|
39
39
|
symbol: string;
|
|
40
|
-
|
|
41
|
-
price: string;
|
|
40
|
+
collateral?: boolean;
|
|
42
41
|
supplied: string;
|
|
43
42
|
suppliedUsd: string;
|
|
44
43
|
borrowed: string;
|
|
@@ -80,4 +79,5 @@ export interface LiquityV2TroveData {
|
|
|
80
79
|
leveragedType: string;
|
|
81
80
|
leveragedAsset: string;
|
|
82
81
|
liquidationPrice: string;
|
|
82
|
+
debtInFront: string;
|
|
83
83
|
}
|
package/package.json
CHANGED
package/src/config/contracts.js
CHANGED
|
@@ -1034,7 +1034,7 @@ module.exports = {
|
|
|
1034
1034
|
"LiquityV2View":{
|
|
1035
1035
|
"abi": [ { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_interestRate", "type": "uint256" }, { "internalType": "uint256", "name": "_prevId", "type": "uint256" }, { "internalType": "uint256", "name": "_nextId", "type": "uint256" } ], "name": "findInsertPosition", "outputs": [ { "internalType": "uint256", "name": "prevId", "type": "uint256" }, { "internalType": "uint256", "name": "nextId", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_collIndex", "type": "uint256" }, { "internalType": "uint256", "name": "_interestRate", "type": "uint256" }, { "internalType": "uint256", "name": "_numTrials", "type": "uint256" }, { "internalType": "uint256", "name": "_inputRandomSeed", "type": "uint256" } ], "name": "getApproxHint", "outputs": [ { "internalType": "uint256", "name": "hintId", "type": "uint256" }, { "internalType": "uint256", "name": "diff", "type": "uint256" }, { "internalType": "uint256", "name": "latestRandomSeed", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_acc", "type": "uint256" }, { "internalType": "uint256", "name": "_iterations", "type": "uint256" } ], "name": "getDebtInFront", "outputs": [ { "internalType": "uint256", "name": "next", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_acc", "type": "uint256" }, { "internalType": "uint256", "name": "_iterations", "type": "uint256" }, { "internalType": "uint256", "name": "_targetIR", "type": "uint256" } ], "name": "getDebtInFrontByInterestRate", "outputs": [ { "internalType": "uint256", "name": "next", "type": "uint256" }, { "internalType": "uint256", "name": "debt", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_numTroves", "type": "uint256" } ], "name": "getDebtInFrontByTroveNum", "outputs": [ { "internalType": "uint256", "name": "debt", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "address", "name": "_depositor", "type": "address" } ], "name": "getDepositorInfo", "outputs": [ { "internalType": "uint256", "name": "compoundedBOLD", "type": "uint256" }, { "internalType": "uint256", "name": "collGain", "type": "uint256" }, { "internalType": "uint256", "name": "boldGain", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_collIndex", "type": "uint256" }, { "internalType": "uint256", "name": "_interestRate", "type": "uint256" }, { "internalType": "uint256", "name": "_numTrials", "type": "uint256" }, { "internalType": "uint256", "name": "_inputRandomSeed", "type": "uint256" } ], "name": "getInsertPosition", "outputs": [ { "internalType": "uint256", "name": "prevId", "type": "uint256" }, { "internalType": "uint256", "name": "nextId", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" } ], "name": "getMarketData", "outputs": [ { "components": [ { "internalType": "address", "name": "market", "type": "address" }, { "internalType": "uint256", "name": "CCR", "type": "uint256" }, { "internalType": "uint256", "name": "MCR", "type": "uint256" }, { "internalType": "uint256", "name": "SCR", "type": "uint256" }, { "internalType": "uint256", "name": "LIQUIDATION_PENALTY_SP", "type": "uint256" }, { "internalType": "uint256", "name": "LIQUIDATION_PENALTY_REDISTRIBUTION", "type": "uint256" }, { "internalType": "uint256", "name": "entireSystemColl", "type": "uint256" }, { "internalType": "uint256", "name": "entireSystemDebt", "type": "uint256" }, { "internalType": "address", "name": "collToken", "type": "address" }, { "internalType": "address", "name": "troveNFT", "type": "address" }, { "internalType": "address", "name": "borrowerOperations", "type": "address" }, { "internalType": "address", "name": "troveManager", "type": "address" }, { "internalType": "address", "name": "stabilityPool", "type": "address" }, { "internalType": "address", "name": "sortedTroves", "type": "address" }, { "internalType": "address", "name": "collSurplusPool", "type": "address" }, { "internalType": "address", "name": "hintHelpers", "type": "address" }, { "internalType": "address", "name": "priceFeed", "type": "address" }, { "internalType": "uint256", "name": "collPrice", "type": "uint256" }, { "internalType": "bool", "name": "isShutDown", "type": "bool" } ], "internalType": "struct LiquityV2View.MarketData", "name": "data", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_iterations", "type": "uint256" } ], "name": "getNumOfTrovesInFrontOfTrove", "outputs": [ { "internalType": "uint256", "name": "next", "type": "uint256" }, { "internalType": "uint256", "name": "numTroves", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" } ], "name": "getTroveInfo", "outputs": [ { "components": [ { "internalType": "uint256", "name": "troveId", "type": "uint256" }, { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "collToken", "type": "address" }, { "internalType": "enum ITroveManager.Status", "name": "status", "type": "uint8" }, { "internalType": "uint256", "name": "collAmount", "type": "uint256" }, { "internalType": "uint256", "name": "debtAmount", "type": "uint256" }, { "internalType": "uint256", "name": "collPrice", "type": "uint256" }, { "internalType": "uint256", "name": "TCRatio", "type": "uint256" }, { "internalType": "uint256", "name": "annualInterestRate", "type": "uint256" }, { "internalType": "address", "name": "interestBatchManager", "type": "address" }, { "internalType": "uint256", "name": "batchDebtShares", "type": "uint256" } ], "internalType": "struct LiquityV2View.TroveData", "name": "trove", "type": "tuple" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" }, { "internalType": "uint256", "name": "_collIndex", "type": "uint256" }, { "internalType": "uint256", "name": "_troveId", "type": "uint256" }, { "internalType": "uint256", "name": "_numTrials", "type": "uint256" }, { "internalType": "uint256", "name": "_inputRandomSeed", "type": "uint256" } ], "name": "getTrovePosition", "outputs": [ { "internalType": "uint256", "name": "prevId", "type": "uint256" }, { "internalType": "uint256", "name": "nextId", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_market", "type": "address" } ], "name": "isShutDown", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" } ],
|
|
1036
1036
|
"networks": {
|
|
1037
|
-
"1": { "address": "
|
|
1037
|
+
"1": { "address": "0xD484E43F56e2A83D8D4476b803dAEc99c557b4a8" },
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
package/src/liquityV2/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Web3 from 'web3';
|
|
|
2
2
|
import Dec from 'decimal.js';
|
|
3
3
|
import { assetAmountInEth, getAssetInfo } from '@defisaver/tokens';
|
|
4
4
|
import { LiquityV2ViewContract } from '../contracts';
|
|
5
|
-
import { NetworkNumber } from '../types/common';
|
|
5
|
+
import { EthAddress, NetworkNumber } from '../types/common';
|
|
6
6
|
import {
|
|
7
7
|
InnerLiquityV2MarketData,
|
|
8
8
|
LIQUITY_TROVE_STATUS_ENUM,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { getStakingApy, STAKING_ASSETS } from '../staking';
|
|
12
12
|
import { getLiquityV2AggregatedPositionData } from '../helpers/liquityV2Helpers';
|
|
13
13
|
import { ethToWeth } from '../services/utils';
|
|
14
|
+
import { ZERO_ADDRESS } from '../constants';
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
export const getLiquityV2MarketData = async (web3: Web3, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, mainnetWeb3: Web3): Promise<LiquityV2MarketData> => {
|
|
@@ -45,6 +46,14 @@ export const getLiquityV2MarketData = async (web3: Web3, network: NetworkNumber,
|
|
|
45
46
|
return { assetsData, marketData: { minCollRatio } };
|
|
46
47
|
};
|
|
47
48
|
|
|
49
|
+
const _getDebtInFront = async (viewContract: any, marketAddress: EthAddress, troveId: string, accumulatedSum = '0', iterations = 2000) => viewContract.methods.getDebtInFront(marketAddress, troveId, accumulatedSum, iterations).call();
|
|
50
|
+
|
|
51
|
+
export const getDebtInFrontLiquityV2 = async (viewContract: any, marketAddress: EthAddress, troveId: string, accumulatedSum = '0', iterations = 2000): Promise<string> => {
|
|
52
|
+
const { debt, next } = await _getDebtInFront(viewContract, marketAddress, troveId, accumulatedSum, iterations);
|
|
53
|
+
if (next === '0') return assetAmountInEth(debt);
|
|
54
|
+
return getDebtInFrontLiquityV2(viewContract, marketAddress, next, debt, iterations);
|
|
55
|
+
};
|
|
56
|
+
|
|
48
57
|
export const getLiquityV2TroveData = async (
|
|
49
58
|
web3: Web3,
|
|
50
59
|
network: NetworkNumber,
|
|
@@ -64,15 +73,16 @@ export const getLiquityV2TroveData = async (
|
|
|
64
73
|
const viewContract = LiquityV2ViewContract(web3, network);
|
|
65
74
|
const { minCollRatio } = marketData;
|
|
66
75
|
const { collateralToken, marketAddress, debtToken } = selectedMarket;
|
|
67
|
-
const data = await
|
|
76
|
+
const [data, debtInFront] = await Promise.all([
|
|
77
|
+
viewContract.methods.getTroveInfo(marketAddress, troveId).call(),
|
|
78
|
+
getDebtInFrontLiquityV2(viewContract, marketAddress, troveId),
|
|
79
|
+
]);
|
|
68
80
|
const usedAssets: LiquityV2UsedAssets = {};
|
|
69
81
|
|
|
70
82
|
const debtAssetData = assetsData[debtToken];
|
|
71
83
|
const borrowed = assetAmountInEth(data.debtAmount);
|
|
72
84
|
usedAssets[debtToken] = {
|
|
73
85
|
symbol: debtToken,
|
|
74
|
-
address: debtAssetData.address,
|
|
75
|
-
price: debtAssetData.price,
|
|
76
86
|
supplied: '0',
|
|
77
87
|
suppliedUsd: '0',
|
|
78
88
|
borrowed,
|
|
@@ -85,14 +95,13 @@ export const getLiquityV2TroveData = async (
|
|
|
85
95
|
const suppliedColl = assetAmountInEth(data.collAmount);
|
|
86
96
|
usedAssets[collateralToken] = {
|
|
87
97
|
symbol: collateralToken,
|
|
88
|
-
address: collAssetData.address,
|
|
89
|
-
price: collAssetData.price,
|
|
90
98
|
supplied: suppliedColl,
|
|
91
99
|
suppliedUsd: new Dec(suppliedColl).mul(collAssetData.price).toString(),
|
|
92
100
|
borrowed: '0',
|
|
93
101
|
borrowedUsd: '0',
|
|
94
102
|
isBorrowed: false,
|
|
95
103
|
isSupplied: true,
|
|
104
|
+
collateral: true,
|
|
96
105
|
};
|
|
97
106
|
|
|
98
107
|
const collRatio = new Dec(data.TCRatio).div(1e16).toString();
|
|
@@ -105,6 +114,7 @@ export const getLiquityV2TroveData = async (
|
|
|
105
114
|
collRatio,
|
|
106
115
|
interestRate,
|
|
107
116
|
interestBatchManager,
|
|
117
|
+
debtInFront,
|
|
108
118
|
troveStatus: LIQUITY_TROVE_STATUS_ENUM[parseInt(data.status, 10)],
|
|
109
119
|
...getLiquityV2AggregatedPositionData({
|
|
110
120
|
usedAssets, assetsData, minCollRatio, interestRate,
|
|
@@ -20,7 +20,7 @@ export const calcLeverageLiqPrice = (leverageType: string, assetPrice: string, b
|
|
|
20
20
|
|
|
21
21
|
export const calculateBorrowingAssetLimit = (assetBorrowedUsd: string, borrowLimitUsd: string) => new Dec(assetBorrowedUsd).div(borrowLimitUsd).times(100).toString();
|
|
22
22
|
|
|
23
|
-
export const STABLE_ASSETS = ['DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI', 'crvUSD'];
|
|
23
|
+
export const STABLE_ASSETS = ['DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI', 'crvUSD', 'BOLD'];
|
|
24
24
|
|
|
25
25
|
export const isLeveragedPos = (usedAssets: MMUsedAssets, dustLimit = 5) => {
|
|
26
26
|
let borrowUnstable = 0;
|
package/src/types/liquityV2.ts
CHANGED
|
@@ -42,8 +42,7 @@ export interface LiquityV2MarketData {
|
|
|
42
42
|
|
|
43
43
|
export interface LiquityV2UsedAsset {
|
|
44
44
|
symbol: string,
|
|
45
|
-
|
|
46
|
-
price: string,
|
|
45
|
+
collateral?: boolean,
|
|
47
46
|
supplied: string,
|
|
48
47
|
suppliedUsd: string,
|
|
49
48
|
borrowed: string,
|
|
@@ -86,4 +85,5 @@ export interface LiquityV2TroveData {
|
|
|
86
85
|
leveragedType: string,
|
|
87
86
|
leveragedAsset: string,
|
|
88
87
|
liquidationPrice: string,
|
|
88
|
+
debtInFront: string,
|
|
89
89
|
}
|