@defisaver/positions-sdk 0.0.198 → 0.0.199-dev-1
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 +126 -4
- package/cjs/config/contracts.js +14 -0
- package/cjs/contracts.d.ts +1 -0
- package/cjs/contracts.js +2 -1
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/helpers/liquityV2Helpers/index.d.ts +12 -0
- package/cjs/helpers/liquityV2Helpers/index.js +63 -0
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/liquityV2/index.d.ts +18 -0
- package/cjs/liquityV2/index.js +186 -0
- package/cjs/markets/aave/marketAssets.js +2 -4
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/markets/liquityV2/index.d.ts +10 -0
- package/cjs/markets/liquityV2/index.js +47 -0
- package/cjs/moneymarket/moneymarketCommonService.js +1 -1
- package/cjs/types/contracts/generated/LiquityV2CollSurplusPool.d.ts +64 -0
- package/cjs/types/contracts/generated/LiquityV2CollSurplusPool.js +5 -0
- package/cjs/types/contracts/generated/LiquityV2TroveNFT.d.ts +73 -0
- package/cjs/types/contracts/generated/LiquityV2TroveNFT.js +5 -0
- package/cjs/types/contracts/generated/LiquityV2View.d.ts +244 -0
- package/cjs/types/contracts/generated/LiquityV2View.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +3 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/liquityV2.d.ts +111 -0
- package/cjs/types/liquityV2.js +24 -0
- package/esm/config/contracts.d.ts +126 -4
- package/esm/config/contracts.js +14 -0
- package/esm/contracts.d.ts +1 -0
- package/esm/contracts.js +1 -0
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/liquityV2Helpers/index.d.ts +12 -0
- package/esm/helpers/liquityV2Helpers/index.js +55 -0
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/liquityV2/index.d.ts +18 -0
- package/esm/liquityV2/index.js +175 -0
- package/esm/markets/aave/marketAssets.js +2 -4
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/markets/liquityV2/index.d.ts +10 -0
- package/esm/markets/liquityV2/index.js +40 -0
- package/esm/moneymarket/moneymarketCommonService.js +1 -1
- package/esm/types/contracts/generated/LiquityV2CollSurplusPool.d.ts +64 -0
- package/esm/types/contracts/generated/LiquityV2CollSurplusPool.js +4 -0
- package/esm/types/contracts/generated/LiquityV2TroveNFT.d.ts +73 -0
- package/esm/types/contracts/generated/LiquityV2TroveNFT.js +4 -0
- package/esm/types/contracts/generated/LiquityV2View.d.ts +244 -0
- package/esm/types/contracts/generated/LiquityV2View.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +3 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/liquityV2.d.ts +111 -0
- package/esm/types/liquityV2.js +21 -0
- package/package.json +49 -49
- package/src/aaveV2/index.ts +227 -227
- package/src/aaveV3/index.ts +625 -625
- 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 +1109 -1095
- package/src/constants/index.ts +6 -6
- package/src/contracts.ts +133 -132
- package/src/curveUsd/index.ts +229 -229
- package/src/eulerV2/index.ts +303 -303
- package/src/exchange/index.ts +17 -17
- package/src/helpers/aaveHelpers/index.ts +198 -198
- package/src/helpers/chickenBondsHelpers/index.ts +23 -23
- package/src/helpers/compoundHelpers/index.ts +246 -246
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +232 -232
- package/src/helpers/index.ts +10 -9
- package/src/helpers/liquityV2Helpers/index.ts +80 -0
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +94 -94
- package/src/helpers/morphoBlueHelpers/index.ts +365 -365
- package/src/helpers/sparkHelpers/index.ts +150 -150
- package/src/index.ts +50 -48
- package/src/liquity/index.ts +116 -116
- package/src/liquityV2/index.ts +219 -0
- 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 +44 -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/index.ts +24 -24
- package/src/markets/liquityV2/index.ts +44 -0
- 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 +631 -631
- package/src/morphoBlue/index.ts +204 -204
- package/src/multicall/index.ts +22 -22
- package/src/services/dsrService.ts +15 -15
- package/src/services/priceService.ts +62 -62
- package/src/services/utils.ts +56 -56
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +461 -461
- package/src/staking/staking.ts +220 -220
- package/src/types/aave.ts +271 -271
- package/src/types/chickenBonds.ts +45 -45
- package/src/types/common.ts +84 -84
- package/src/types/compound.ts +131 -131
- package/src/types/contracts/generated/LiquityV2CollSurplusPool.ts +130 -0
- package/src/types/contracts/generated/LiquityV2TroveNFT.ts +150 -0
- package/src/types/contracts/generated/LiquityV2View.ts +315 -0
- package/src/types/contracts/generated/index.ts +3 -0
- package/src/types/curveUsd.ts +118 -118
- package/src/types/euler.ts +171 -171
- package/src/types/index.ts +10 -9
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +119 -0
- package/src/types/llamaLend.ts +155 -155
- package/src/types/maker.ts +50 -50
- package/src/types/morphoBlue.ts +192 -192
- package/src/types/spark.ts +131 -131
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import Dec from 'decimal.js';
|
|
11
|
+
import { assetAmountInEth, getAssetInfo } from '@defisaver/tokens';
|
|
12
|
+
import { createContractWrapper, LiquityV2ViewContract } from '../contracts';
|
|
13
|
+
import { LIQUITY_V2_TROVE_STATUS_ENUM, } from '../types';
|
|
14
|
+
import { getStakingApy, STAKING_ASSETS } from '../staking';
|
|
15
|
+
import { getLiquityV2AggregatedPositionData } from '../helpers/liquityV2Helpers';
|
|
16
|
+
import { compareAddresses, ethToWeth } from '../services/utils';
|
|
17
|
+
import { ZERO_ADDRESS } from '../constants';
|
|
18
|
+
export const getLiquityV2MarketData = (web3, network, selectedMarket, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
const viewContract = LiquityV2ViewContract(web3, network);
|
|
20
|
+
const { marketAddress, debtToken, collateralToken } = selectedMarket;
|
|
21
|
+
const data = yield viewContract.methods.getMarketData(marketAddress).call();
|
|
22
|
+
const hintHelperAddress = data.hintHelpers;
|
|
23
|
+
const troveNFTAddress = data.troveNFT;
|
|
24
|
+
const borrowerOperationsAddress = data.borrowerOperations;
|
|
25
|
+
const troveManagerAddress = data.troveManager;
|
|
26
|
+
const stabilityPoolAddress = data.stabilityPool;
|
|
27
|
+
const collSurplusPoolAddress = data.collSurplusPool;
|
|
28
|
+
const activePoolAddress = data.activePool;
|
|
29
|
+
const minCollRatio = new Dec(data.MCR).div(1e16).toString();
|
|
30
|
+
const criticalCollRatio = new Dec(data.CCR).div(1e18).toString();
|
|
31
|
+
const totalMarketBorrow = assetAmountInEth(data.entireSystemDebt);
|
|
32
|
+
const totalMarketSupply = assetAmountInEth(data.entireSystemColl);
|
|
33
|
+
const collPrice = assetAmountInEth(data.collPrice);
|
|
34
|
+
const totalCollRatio = new Dec(totalMarketSupply).mul(collPrice).div(totalMarketBorrow).toString();
|
|
35
|
+
const leftToBorrowGlobal = new Dec(totalMarketSupply).mul(collPrice).div(criticalCollRatio).sub(totalMarketBorrow)
|
|
36
|
+
.toString();
|
|
37
|
+
const minCollAmountForCurrentBorrow = new Dec(totalMarketBorrow).mul(criticalCollRatio).div(collPrice).toString();
|
|
38
|
+
const leftToWithdrawGlobal = new Dec(totalMarketSupply).sub(minCollAmountForCurrentBorrow).toString();
|
|
39
|
+
const assetsData = {};
|
|
40
|
+
assetsData[debtToken] = {
|
|
41
|
+
symbol: debtToken,
|
|
42
|
+
address: getAssetInfo(debtToken, network).address,
|
|
43
|
+
price: '1',
|
|
44
|
+
totalSupply: '0',
|
|
45
|
+
totalBorrow: totalMarketBorrow,
|
|
46
|
+
canBeSupplied: false,
|
|
47
|
+
canBeBorrowed: true,
|
|
48
|
+
leftToBorrowGlobal,
|
|
49
|
+
leftToWithdrawGlobal: '0',
|
|
50
|
+
};
|
|
51
|
+
assetsData[collateralToken] = {
|
|
52
|
+
symbol: collateralToken,
|
|
53
|
+
address: getAssetInfo(ethToWeth(collateralToken), network).address,
|
|
54
|
+
price: collPrice,
|
|
55
|
+
totalSupply: totalMarketSupply,
|
|
56
|
+
totalBorrow: '0',
|
|
57
|
+
canBeSupplied: true,
|
|
58
|
+
canBeBorrowed: false,
|
|
59
|
+
leftToBorrowGlobal: '0',
|
|
60
|
+
leftToWithdrawGlobal,
|
|
61
|
+
};
|
|
62
|
+
if (STAKING_ASSETS.includes(collateralToken)) {
|
|
63
|
+
assetsData[collateralToken].incentiveSupplyApy = yield getStakingApy(collateralToken, mainnetWeb3);
|
|
64
|
+
assetsData[collateralToken].incentiveSupplyToken = collateralToken;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
assetsData,
|
|
68
|
+
marketData: {
|
|
69
|
+
minCollRatio,
|
|
70
|
+
totalCollRatio: new Dec(totalCollRatio).mul(100).toString(),
|
|
71
|
+
criticalCollRatio: new Dec(criticalCollRatio).mul(100).toString(),
|
|
72
|
+
isUnderCollateralized: new Dec(totalCollRatio).lt(criticalCollRatio),
|
|
73
|
+
hintHelperAddress,
|
|
74
|
+
troveNFTAddress,
|
|
75
|
+
borrowerOperationsAddress,
|
|
76
|
+
troveManagerAddress,
|
|
77
|
+
stabilityPoolAddress,
|
|
78
|
+
collSurplusPoolAddress,
|
|
79
|
+
activePoolAddress,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
const _getUserTroves = (viewContract, account, marketAddress, startIndex = 0, endIndex = 100) => __awaiter(void 0, void 0, void 0, function* () { return viewContract.methods.getUserTroves(account, marketAddress, startIndex, endIndex).call(); });
|
|
84
|
+
const getUserTroves = (viewContract, account, marketAddress, startIndex = 0, endIndex = 100, troves = []) => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
+
const result = yield _getUserTroves(viewContract, account, marketAddress, startIndex, endIndex);
|
|
86
|
+
const newStartIndex = endIndex + 1;
|
|
87
|
+
const nextFreeTroveIndex = result.nextFreeTroveIndex;
|
|
88
|
+
const existingTroves = [...troves, ...result.troves];
|
|
89
|
+
if (nextFreeTroveIndex !== '-1')
|
|
90
|
+
return { troves: existingTroves.filter((trove) => trove.ownedByUser), nextFreeTroveIndex };
|
|
91
|
+
return getUserTroves(viewContract, account, marketAddress, newStartIndex, newStartIndex + 100, existingTroves);
|
|
92
|
+
});
|
|
93
|
+
const TransferEventSig = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef';
|
|
94
|
+
const getTransferredTroves = (web3, network, troveNFTAddress, account) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
+
const nftContract = createContractWrapper(web3, network, 'LiquityV2TroveNFT', troveNFTAddress);
|
|
96
|
+
const currentBlock = yield web3.eth.getBlockNumber();
|
|
97
|
+
const events = yield nftContract.getPastEvents(TransferEventSig, {
|
|
98
|
+
fromBlock: currentBlock - 1000,
|
|
99
|
+
});
|
|
100
|
+
const userTransferredTroves = events.filter((event) => !compareAddresses(event.returnValues.from, ZERO_ADDRESS) && compareAddresses(event.returnValues.to, account));
|
|
101
|
+
// check if the last know transfer address is the user
|
|
102
|
+
userTransferredTroves.forEach((event, index) => {
|
|
103
|
+
const otherTransfers = events.filter((e) => event.blockNumber < e.blockNumber && e.returnValues.tokenId === event.returnValues.tokenId);
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
userTransferredTroves[index].invalid = !!otherTransfers.length;
|
|
106
|
+
});
|
|
107
|
+
// @ts-ignore
|
|
108
|
+
return userTransferredTroves.filter((event) => !event.invalid).map((event) => ({ troveId: event.returnValues.tokenId }));
|
|
109
|
+
});
|
|
110
|
+
export const getLiquityV2UserTroveIds = (web3, network, selectedMarket, troveNFTAddress, account) => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
|
+
const viewContract = LiquityV2ViewContract(web3, network);
|
|
112
|
+
const [{ troves: userTroves, nextFreeTroveIndex }, userTransferredTroves] = yield Promise.all([
|
|
113
|
+
getUserTroves(viewContract, account, selectedMarket.marketAddress),
|
|
114
|
+
getTransferredTroves(web3, network, troveNFTAddress, account),
|
|
115
|
+
]);
|
|
116
|
+
const troves = [...userTroves.map(({ troveId }) => ({ troveId })), ...userTransferredTroves];
|
|
117
|
+
const filteredTroves = troves.filter((value, index, self) => index === self.findIndex((t) => (t.troveId === value.troveId)));
|
|
118
|
+
return { troves: filteredTroves, nextFreeTroveIndex };
|
|
119
|
+
});
|
|
120
|
+
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(); });
|
|
121
|
+
export const getDebtInFrontLiquityV2 = (viewContract, marketAddress, troveId, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () {
|
|
122
|
+
const { debt, next } = yield _getDebtInFront(viewContract, marketAddress, troveId, accumulatedSum, iterations);
|
|
123
|
+
if (next === '0')
|
|
124
|
+
return assetAmountInEth(debt);
|
|
125
|
+
return getDebtInFrontLiquityV2(viewContract, marketAddress, next, debt, iterations);
|
|
126
|
+
});
|
|
127
|
+
export const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsData, marketData, troveId, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
128
|
+
const viewContract = LiquityV2ViewContract(web3, network);
|
|
129
|
+
const { minCollRatio } = marketData;
|
|
130
|
+
const { collateralToken, marketAddress, debtToken } = selectedMarket;
|
|
131
|
+
const [data, debtInFront] = yield Promise.all([
|
|
132
|
+
viewContract.methods.getTroveInfo(marketAddress, troveId).call(),
|
|
133
|
+
getDebtInFrontLiquityV2(viewContract, marketAddress, troveId),
|
|
134
|
+
]);
|
|
135
|
+
const usedAssets = {};
|
|
136
|
+
const debtAssetData = assetsData[debtToken];
|
|
137
|
+
const borrowed = assetAmountInEth(data.debtAmount);
|
|
138
|
+
usedAssets[debtToken] = {
|
|
139
|
+
symbol: debtToken,
|
|
140
|
+
supplied: '0',
|
|
141
|
+
suppliedUsd: '0',
|
|
142
|
+
borrowed,
|
|
143
|
+
borrowedUsd: new Dec(borrowed).mul(debtAssetData.price).toString(),
|
|
144
|
+
isBorrowed: true,
|
|
145
|
+
isSupplied: false,
|
|
146
|
+
};
|
|
147
|
+
const collAssetData = assetsData[collateralToken];
|
|
148
|
+
const suppliedColl = assetAmountInEth(data.collAmount);
|
|
149
|
+
usedAssets[collateralToken] = {
|
|
150
|
+
symbol: collateralToken,
|
|
151
|
+
supplied: suppliedColl,
|
|
152
|
+
suppliedUsd: new Dec(suppliedColl).mul(collAssetData.price).toString(),
|
|
153
|
+
borrowed: '0',
|
|
154
|
+
borrowedUsd: '0',
|
|
155
|
+
isBorrowed: false,
|
|
156
|
+
isSupplied: true,
|
|
157
|
+
collateral: true,
|
|
158
|
+
};
|
|
159
|
+
const collRatio = new Dec(data.TCRatio).div(1e16).toString();
|
|
160
|
+
const interestRate = new Dec(data.annualInterestRate).div(1e16).toString();
|
|
161
|
+
const interestBatchManager = data.interestBatchManager;
|
|
162
|
+
const payload = Object.assign(Object.assign({ usedAssets,
|
|
163
|
+
troveId,
|
|
164
|
+
interestRate,
|
|
165
|
+
interestBatchManager,
|
|
166
|
+
debtInFront, troveStatus: LIQUITY_V2_TROVE_STATUS_ENUM[parseInt(data.status, 10)] }, getLiquityV2AggregatedPositionData({
|
|
167
|
+
usedAssets, assetsData, minCollRatio, interestRate,
|
|
168
|
+
})), { collRatio });
|
|
169
|
+
return payload;
|
|
170
|
+
});
|
|
171
|
+
export const getLiquityV2ClaimableCollateral = (collSurplusPoolAddress, account, web3, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
172
|
+
const collSurplusPoolContract = createContractWrapper(web3, network, 'LiquityV2CollSurplusPool', collSurplusPoolAddress);
|
|
173
|
+
const claimableCollateral = yield collSurplusPoolContract.methods.getCollateral(account).call();
|
|
174
|
+
return claimableCollateral;
|
|
175
|
+
});
|
|
@@ -11,10 +11,8 @@ export const aaveV3AssetsDefaultMarketEth = ['ETH', 'wstETH', 'WBTC', 'USDC', 'D
|
|
|
11
11
|
export const aaveV3AssetsDefaultMarketOpt = [
|
|
12
12
|
'DAI', 'USDC.e', 'USDT', 'SUSD', 'AAVE', 'LINK', 'WBTC', 'ETH', 'OP', 'wstETH', 'LUSD', 'MAI', 'rETH', 'USDC',
|
|
13
13
|
];
|
|
14
|
-
export const aaveV3AssetsDefaultMarketArb = [
|
|
15
|
-
|
|
16
|
-
];
|
|
17
|
-
export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC'];
|
|
14
|
+
export const aaveV3AssetsDefaultMarketArb = ['DAI', 'LINK', 'USDC.e', 'WBTC', 'ETH', 'USDT', 'AAVE', 'EURS', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC', 'FRAX', 'ARB', 'weETH', 'GHO', 'ezETH'];
|
|
15
|
+
export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC', 'ezETH'];
|
|
18
16
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
19
17
|
export const aaveV3AssetsDefaultMarket = {
|
|
20
18
|
[NetworkNumber.Eth]: aaveV3AssetsDefaultMarketEth,
|
package/esm/markets/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { SparkMarkets } from './spark';
|
|
|
4
4
|
export { CrvUsdMarkets } from './curveUsd';
|
|
5
5
|
export { MorphoBlueMarkets, findMorphoBlueMarket } from './morphoBlue';
|
|
6
6
|
export { LlamaLendMarkets } from './llamaLend';
|
|
7
|
+
export { LiquityV2Markets } from './liquityV2';
|
|
7
8
|
export { EulerV2Markets } from './euler';
|
package/esm/markets/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { SparkMarkets } from './spark';
|
|
|
4
4
|
export { CrvUsdMarkets } from './curveUsd';
|
|
5
5
|
export { MorphoBlueMarkets, findMorphoBlueMarket } from './morphoBlue';
|
|
6
6
|
export { LlamaLendMarkets } from './llamaLend';
|
|
7
|
+
export { LiquityV2Markets } from './liquityV2';
|
|
7
8
|
export { EulerV2Markets } from './euler';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NetworkNumber } from '../../types/common';
|
|
2
|
+
import { LiquityV2MarketInfo } from '../../types/liquityV2';
|
|
3
|
+
export declare const LIQUITY_V2_ETH_MARKET: (networkId?: NetworkNumber) => LiquityV2MarketInfo;
|
|
4
|
+
export declare const LIQUITY_V2_WSTETH_MARKET: (networkId?: NetworkNumber) => LiquityV2MarketInfo;
|
|
5
|
+
export declare const LIQUITY_V2_RETH_MARKET: (networkId?: NetworkNumber) => LiquityV2MarketInfo;
|
|
6
|
+
export declare const LiquityV2Markets: (networkId: NetworkNumber) => {
|
|
7
|
+
readonly liquityv2eth: LiquityV2MarketInfo;
|
|
8
|
+
readonly liquityv2wsteth: LiquityV2MarketInfo;
|
|
9
|
+
readonly liquityv2reth: LiquityV2MarketInfo;
|
|
10
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NetworkNumber } from '../../types/common';
|
|
2
|
+
import { LiquityV2Versions } from '../../types/liquityV2';
|
|
3
|
+
export const LIQUITY_V2_ETH_MARKET = (networkId = NetworkNumber.Eth) => ({
|
|
4
|
+
chainIds: [NetworkNumber.Eth],
|
|
5
|
+
label: 'Liquity V2 ETH',
|
|
6
|
+
shortLabel: 'ETH',
|
|
7
|
+
value: LiquityV2Versions.LiquityV2Eth,
|
|
8
|
+
url: 'eth',
|
|
9
|
+
debtToken: 'BOLD',
|
|
10
|
+
collateralToken: 'ETH',
|
|
11
|
+
marketAddress: '0xc3fe668b43439525f70fe860f89882f0be312504',
|
|
12
|
+
protocolName: 'liquity-v2',
|
|
13
|
+
});
|
|
14
|
+
export const LIQUITY_V2_WSTETH_MARKET = (networkId = NetworkNumber.Eth) => ({
|
|
15
|
+
chainIds: [NetworkNumber.Eth],
|
|
16
|
+
label: 'Liquity V2 wstETH',
|
|
17
|
+
shortLabel: 'wstETH',
|
|
18
|
+
value: LiquityV2Versions.LiquityV2WstEth,
|
|
19
|
+
url: 'wsteth',
|
|
20
|
+
debtToken: 'BOLD',
|
|
21
|
+
collateralToken: 'wstETH',
|
|
22
|
+
marketAddress: '0x9b27787ff66aa3cea8dbc47772328459a1fa05ac',
|
|
23
|
+
protocolName: 'liquity-v2',
|
|
24
|
+
});
|
|
25
|
+
export const LIQUITY_V2_RETH_MARKET = (networkId = NetworkNumber.Eth) => ({
|
|
26
|
+
chainIds: [NetworkNumber.Eth],
|
|
27
|
+
label: 'Liquity V2 rETH',
|
|
28
|
+
shortLabel: 'rETH',
|
|
29
|
+
value: LiquityV2Versions.LiquityV2REth,
|
|
30
|
+
url: 'reth',
|
|
31
|
+
debtToken: 'BOLD',
|
|
32
|
+
collateralToken: 'rETH',
|
|
33
|
+
marketAddress: '0xde524be191de806011e98c8d36d50d7a88391a3e',
|
|
34
|
+
protocolName: 'liquity-v2',
|
|
35
|
+
});
|
|
36
|
+
export const LiquityV2Markets = (networkId) => ({
|
|
37
|
+
[LiquityV2Versions.LiquityV2Eth]: LIQUITY_V2_ETH_MARKET(networkId),
|
|
38
|
+
[LiquityV2Versions.LiquityV2WstEth]: LIQUITY_V2_WSTETH_MARKET(networkId),
|
|
39
|
+
[LiquityV2Versions.LiquityV2REth]: LIQUITY_V2_RETH_MARKET(networkId),
|
|
40
|
+
});
|
|
@@ -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;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 BorrowerOperationsAddressChanged = ContractEventLog<{
|
|
13
|
+
_newBorrowerOperationsAddress: string;
|
|
14
|
+
0: string;
|
|
15
|
+
}>;
|
|
16
|
+
export type CollBalanceUpdated = ContractEventLog<{
|
|
17
|
+
_account: string;
|
|
18
|
+
_newBalance: string;
|
|
19
|
+
0: string;
|
|
20
|
+
1: string;
|
|
21
|
+
}>;
|
|
22
|
+
export type CollSent = ContractEventLog<{
|
|
23
|
+
_to: string;
|
|
24
|
+
_amount: string;
|
|
25
|
+
0: string;
|
|
26
|
+
1: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type TroveManagerAddressChanged = ContractEventLog<{
|
|
29
|
+
_newTroveManagerAddress: string;
|
|
30
|
+
0: string;
|
|
31
|
+
}>;
|
|
32
|
+
export interface LiquityV2CollSurplusPool extends BaseContract {
|
|
33
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): LiquityV2CollSurplusPool;
|
|
34
|
+
clone(): LiquityV2CollSurplusPool;
|
|
35
|
+
methods: {
|
|
36
|
+
NAME(): NonPayableTransactionObject<string>;
|
|
37
|
+
accountSurplus(_account: string, _amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
38
|
+
borrowerOperationsAddress(): NonPayableTransactionObject<string>;
|
|
39
|
+
claimColl(_account: string): NonPayableTransactionObject<void>;
|
|
40
|
+
collToken(): NonPayableTransactionObject<string>;
|
|
41
|
+
getCollBalance(): NonPayableTransactionObject<string>;
|
|
42
|
+
getCollateral(_account: string): NonPayableTransactionObject<string>;
|
|
43
|
+
troveManagerAddress(): NonPayableTransactionObject<string>;
|
|
44
|
+
};
|
|
45
|
+
events: {
|
|
46
|
+
BorrowerOperationsAddressChanged(cb?: Callback<BorrowerOperationsAddressChanged>): EventEmitter;
|
|
47
|
+
BorrowerOperationsAddressChanged(options?: EventOptions, cb?: Callback<BorrowerOperationsAddressChanged>): EventEmitter;
|
|
48
|
+
CollBalanceUpdated(cb?: Callback<CollBalanceUpdated>): EventEmitter;
|
|
49
|
+
CollBalanceUpdated(options?: EventOptions, cb?: Callback<CollBalanceUpdated>): EventEmitter;
|
|
50
|
+
CollSent(cb?: Callback<CollSent>): EventEmitter;
|
|
51
|
+
CollSent(options?: EventOptions, cb?: Callback<CollSent>): EventEmitter;
|
|
52
|
+
TroveManagerAddressChanged(cb?: Callback<TroveManagerAddressChanged>): EventEmitter;
|
|
53
|
+
TroveManagerAddressChanged(options?: EventOptions, cb?: Callback<TroveManagerAddressChanged>): EventEmitter;
|
|
54
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
55
|
+
};
|
|
56
|
+
once(event: "BorrowerOperationsAddressChanged", cb: Callback<BorrowerOperationsAddressChanged>): void;
|
|
57
|
+
once(event: "BorrowerOperationsAddressChanged", options: EventOptions, cb: Callback<BorrowerOperationsAddressChanged>): void;
|
|
58
|
+
once(event: "CollBalanceUpdated", cb: Callback<CollBalanceUpdated>): void;
|
|
59
|
+
once(event: "CollBalanceUpdated", options: EventOptions, cb: Callback<CollBalanceUpdated>): void;
|
|
60
|
+
once(event: "CollSent", cb: Callback<CollSent>): void;
|
|
61
|
+
once(event: "CollSent", options: EventOptions, cb: Callback<CollSent>): void;
|
|
62
|
+
once(event: "TroveManagerAddressChanged", cb: Callback<TroveManagerAddressChanged>): void;
|
|
63
|
+
once(event: "TroveManagerAddressChanged", options: EventOptions, cb: Callback<TroveManagerAddressChanged>): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 Approval = ContractEventLog<{
|
|
13
|
+
owner: string;
|
|
14
|
+
approved: string;
|
|
15
|
+
tokenId: string;
|
|
16
|
+
0: string;
|
|
17
|
+
1: string;
|
|
18
|
+
2: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type ApprovalForAll = ContractEventLog<{
|
|
21
|
+
owner: string;
|
|
22
|
+
operator: string;
|
|
23
|
+
approved: boolean;
|
|
24
|
+
0: string;
|
|
25
|
+
1: string;
|
|
26
|
+
2: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
export type Transfer = ContractEventLog<{
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
tokenId: string;
|
|
32
|
+
0: string;
|
|
33
|
+
1: string;
|
|
34
|
+
2: string;
|
|
35
|
+
}>;
|
|
36
|
+
export interface LiquityV2TroveNFT extends BaseContract {
|
|
37
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): LiquityV2TroveNFT;
|
|
38
|
+
clone(): LiquityV2TroveNFT;
|
|
39
|
+
methods: {
|
|
40
|
+
approve(to: string, tokenId: number | string | BN): NonPayableTransactionObject<void>;
|
|
41
|
+
balanceOf(owner: string): NonPayableTransactionObject<string>;
|
|
42
|
+
burn(_troveId: number | string | BN): NonPayableTransactionObject<void>;
|
|
43
|
+
getApproved(tokenId: number | string | BN): NonPayableTransactionObject<string>;
|
|
44
|
+
isApprovedForAll(owner: string, operator: string): NonPayableTransactionObject<boolean>;
|
|
45
|
+
metadataNFT(): NonPayableTransactionObject<string>;
|
|
46
|
+
mint(_owner: string, _troveId: number | string | BN): NonPayableTransactionObject<void>;
|
|
47
|
+
name(): NonPayableTransactionObject<string>;
|
|
48
|
+
ownerOf(tokenId: number | string | BN): NonPayableTransactionObject<string>;
|
|
49
|
+
"safeTransferFrom(address,address,uint256)"(from: string, to: string, tokenId: number | string | BN): NonPayableTransactionObject<void>;
|
|
50
|
+
"safeTransferFrom(address,address,uint256,bytes)"(from: string, to: string, tokenId: number | string | BN, data: string | number[]): NonPayableTransactionObject<void>;
|
|
51
|
+
setApprovalForAll(operator: string, approved: boolean): NonPayableTransactionObject<void>;
|
|
52
|
+
supportsInterface(interfaceId: string | number[]): NonPayableTransactionObject<boolean>;
|
|
53
|
+
symbol(): NonPayableTransactionObject<string>;
|
|
54
|
+
tokenURI(_tokenId: number | string | BN): NonPayableTransactionObject<string>;
|
|
55
|
+
transferFrom(from: string, to: string, tokenId: number | string | BN): NonPayableTransactionObject<void>;
|
|
56
|
+
troveManager(): NonPayableTransactionObject<string>;
|
|
57
|
+
};
|
|
58
|
+
events: {
|
|
59
|
+
Approval(cb?: Callback<Approval>): EventEmitter;
|
|
60
|
+
Approval(options?: EventOptions, cb?: Callback<Approval>): EventEmitter;
|
|
61
|
+
ApprovalForAll(cb?: Callback<ApprovalForAll>): EventEmitter;
|
|
62
|
+
ApprovalForAll(options?: EventOptions, cb?: Callback<ApprovalForAll>): EventEmitter;
|
|
63
|
+
Transfer(cb?: Callback<Transfer>): EventEmitter;
|
|
64
|
+
Transfer(options?: EventOptions, cb?: Callback<Transfer>): EventEmitter;
|
|
65
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
66
|
+
};
|
|
67
|
+
once(event: "Approval", cb: Callback<Approval>): void;
|
|
68
|
+
once(event: "Approval", options: EventOptions, cb: Callback<Approval>): void;
|
|
69
|
+
once(event: "ApprovalForAll", cb: Callback<ApprovalForAll>): void;
|
|
70
|
+
once(event: "ApprovalForAll", options: EventOptions, cb: Callback<ApprovalForAll>): void;
|
|
71
|
+
once(event: "Transfer", cb: Callback<Transfer>): void;
|
|
72
|
+
once(event: "Transfer", options: EventOptions, cb: Callback<Transfer>): void;
|
|
73
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
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, BaseContract } from "./types";
|
|
7
|
+
export interface EventOptions {
|
|
8
|
+
filter?: object;
|
|
9
|
+
fromBlock?: BlockType;
|
|
10
|
+
topics?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare namespace LiquityV2View {
|
|
13
|
+
type MarketDataStruct = [
|
|
14
|
+
string,
|
|
15
|
+
number | string | BN,
|
|
16
|
+
number | string | BN,
|
|
17
|
+
number | string | BN,
|
|
18
|
+
number | string | BN,
|
|
19
|
+
number | string | BN,
|
|
20
|
+
number | string | BN,
|
|
21
|
+
number | string | BN,
|
|
22
|
+
string,
|
|
23
|
+
string,
|
|
24
|
+
string,
|
|
25
|
+
string,
|
|
26
|
+
string,
|
|
27
|
+
string,
|
|
28
|
+
string,
|
|
29
|
+
string,
|
|
30
|
+
string,
|
|
31
|
+
string,
|
|
32
|
+
number | string | BN,
|
|
33
|
+
boolean
|
|
34
|
+
] | {
|
|
35
|
+
market: string;
|
|
36
|
+
CCR: number | string | BN;
|
|
37
|
+
MCR: number | string | BN;
|
|
38
|
+
SCR: number | string | BN;
|
|
39
|
+
LIQUIDATION_PENALTY_SP: number | string | BN;
|
|
40
|
+
LIQUIDATION_PENALTY_REDISTRIBUTION: number | string | BN;
|
|
41
|
+
entireSystemColl: number | string | BN;
|
|
42
|
+
entireSystemDebt: number | string | BN;
|
|
43
|
+
collToken: string;
|
|
44
|
+
troveNFT: string;
|
|
45
|
+
borrowerOperations: string;
|
|
46
|
+
troveManager: string;
|
|
47
|
+
stabilityPool: string;
|
|
48
|
+
sortedTroves: string;
|
|
49
|
+
collSurplusPool: string;
|
|
50
|
+
activePool: string;
|
|
51
|
+
hintHelpers: string;
|
|
52
|
+
priceFeed: string;
|
|
53
|
+
collPrice: number | string | BN;
|
|
54
|
+
isShutDown: boolean;
|
|
55
|
+
};
|
|
56
|
+
type MarketDataStructOutputArray = [
|
|
57
|
+
string,
|
|
58
|
+
string,
|
|
59
|
+
string,
|
|
60
|
+
string,
|
|
61
|
+
string,
|
|
62
|
+
string,
|
|
63
|
+
string,
|
|
64
|
+
string,
|
|
65
|
+
string,
|
|
66
|
+
string,
|
|
67
|
+
string,
|
|
68
|
+
string,
|
|
69
|
+
string,
|
|
70
|
+
string,
|
|
71
|
+
string,
|
|
72
|
+
string,
|
|
73
|
+
string,
|
|
74
|
+
string,
|
|
75
|
+
string,
|
|
76
|
+
boolean
|
|
77
|
+
];
|
|
78
|
+
type MarketDataStructOutputStruct = {
|
|
79
|
+
market: string;
|
|
80
|
+
CCR: string;
|
|
81
|
+
MCR: string;
|
|
82
|
+
SCR: string;
|
|
83
|
+
LIQUIDATION_PENALTY_SP: string;
|
|
84
|
+
LIQUIDATION_PENALTY_REDISTRIBUTION: string;
|
|
85
|
+
entireSystemColl: string;
|
|
86
|
+
entireSystemDebt: string;
|
|
87
|
+
collToken: string;
|
|
88
|
+
troveNFT: string;
|
|
89
|
+
borrowerOperations: string;
|
|
90
|
+
troveManager: string;
|
|
91
|
+
stabilityPool: string;
|
|
92
|
+
sortedTroves: string;
|
|
93
|
+
collSurplusPool: string;
|
|
94
|
+
activePool: string;
|
|
95
|
+
hintHelpers: string;
|
|
96
|
+
priceFeed: string;
|
|
97
|
+
collPrice: string;
|
|
98
|
+
isShutDown: boolean;
|
|
99
|
+
};
|
|
100
|
+
type MarketDataStructOutput = MarketDataStructOutputArray & MarketDataStructOutputStruct;
|
|
101
|
+
type TroveDataStruct = [
|
|
102
|
+
number | string | BN,
|
|
103
|
+
string,
|
|
104
|
+
string,
|
|
105
|
+
number | string | BN,
|
|
106
|
+
number | string | BN,
|
|
107
|
+
number | string | BN,
|
|
108
|
+
number | string | BN,
|
|
109
|
+
number | string | BN,
|
|
110
|
+
number | string | BN,
|
|
111
|
+
string,
|
|
112
|
+
number | string | BN
|
|
113
|
+
] | {
|
|
114
|
+
troveId: number | string | BN;
|
|
115
|
+
owner: string;
|
|
116
|
+
collToken: string;
|
|
117
|
+
status: number | string | BN;
|
|
118
|
+
collAmount: number | string | BN;
|
|
119
|
+
debtAmount: number | string | BN;
|
|
120
|
+
collPrice: number | string | BN;
|
|
121
|
+
TCRatio: number | string | BN;
|
|
122
|
+
annualInterestRate: number | string | BN;
|
|
123
|
+
interestBatchManager: string;
|
|
124
|
+
batchDebtShares: number | string | BN;
|
|
125
|
+
};
|
|
126
|
+
type TroveDataStructOutputArray = [
|
|
127
|
+
string,
|
|
128
|
+
string,
|
|
129
|
+
string,
|
|
130
|
+
string,
|
|
131
|
+
string,
|
|
132
|
+
string,
|
|
133
|
+
string,
|
|
134
|
+
string,
|
|
135
|
+
string,
|
|
136
|
+
string,
|
|
137
|
+
string
|
|
138
|
+
];
|
|
139
|
+
type TroveDataStructOutputStruct = {
|
|
140
|
+
troveId: string;
|
|
141
|
+
owner: string;
|
|
142
|
+
collToken: string;
|
|
143
|
+
status: string;
|
|
144
|
+
collAmount: string;
|
|
145
|
+
debtAmount: string;
|
|
146
|
+
collPrice: string;
|
|
147
|
+
TCRatio: string;
|
|
148
|
+
annualInterestRate: string;
|
|
149
|
+
interestBatchManager: string;
|
|
150
|
+
batchDebtShares: string;
|
|
151
|
+
};
|
|
152
|
+
type TroveDataStructOutput = TroveDataStructOutputArray & TroveDataStructOutputStruct;
|
|
153
|
+
type ExistingTroveStruct = [number | string | BN, boolean] | {
|
|
154
|
+
troveId: number | string | BN;
|
|
155
|
+
ownedByUser: boolean;
|
|
156
|
+
};
|
|
157
|
+
type ExistingTroveStructOutputArray = [string, boolean];
|
|
158
|
+
type ExistingTroveStructOutputStruct = {
|
|
159
|
+
troveId: string;
|
|
160
|
+
ownedByUser: boolean;
|
|
161
|
+
};
|
|
162
|
+
type ExistingTroveStructOutput = ExistingTroveStructOutputArray & ExistingTroveStructOutputStruct;
|
|
163
|
+
}
|
|
164
|
+
export interface LiquityV2View extends BaseContract {
|
|
165
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): LiquityV2View;
|
|
166
|
+
clone(): LiquityV2View;
|
|
167
|
+
methods: {
|
|
168
|
+
findInsertPosition(_market: string, _interestRate: number | string | BN, _prevId: number | string | BN, _nextId: number | string | BN): NonPayableTransactionObject<[
|
|
169
|
+
string,
|
|
170
|
+
string
|
|
171
|
+
] & {
|
|
172
|
+
prevId: string;
|
|
173
|
+
nextId: string;
|
|
174
|
+
}>;
|
|
175
|
+
getApproxHint(_market: string, _collIndex: number | string | BN, _interestRate: number | string | BN, _numTrials: number | string | BN, _inputRandomSeed: number | string | BN): NonPayableTransactionObject<[
|
|
176
|
+
string,
|
|
177
|
+
string,
|
|
178
|
+
string
|
|
179
|
+
] & {
|
|
180
|
+
hintId: string;
|
|
181
|
+
diff: string;
|
|
182
|
+
latestRandomSeed: string;
|
|
183
|
+
}>;
|
|
184
|
+
getDebtInFront(_market: string, _troveId: number | string | BN, _acc: number | string | BN, _iterations: number | string | BN): NonPayableTransactionObject<[
|
|
185
|
+
string,
|
|
186
|
+
string
|
|
187
|
+
] & {
|
|
188
|
+
next: string;
|
|
189
|
+
debt: string;
|
|
190
|
+
}>;
|
|
191
|
+
getDebtInFrontByInterestRate(_market: string, _troveId: number | string | BN, _acc: number | string | BN, _iterations: number | string | BN, _targetIR: number | string | BN): NonPayableTransactionObject<[
|
|
192
|
+
string,
|
|
193
|
+
string
|
|
194
|
+
] & {
|
|
195
|
+
next: string;
|
|
196
|
+
debt: string;
|
|
197
|
+
}>;
|
|
198
|
+
getDebtInFrontByTroveNum(_market: string, _numTroves: number | string | BN): NonPayableTransactionObject<string>;
|
|
199
|
+
getDepositorInfo(_market: string, _depositor: string): NonPayableTransactionObject<[
|
|
200
|
+
string,
|
|
201
|
+
string,
|
|
202
|
+
string
|
|
203
|
+
] & {
|
|
204
|
+
compoundedBOLD: string;
|
|
205
|
+
collGain: string;
|
|
206
|
+
boldGain: string;
|
|
207
|
+
}>;
|
|
208
|
+
getInsertPosition(_market: string, _collIndex: number | string | BN, _interestRate: number | string | BN, _numTrials: number | string | BN, _inputRandomSeed: number | string | BN): NonPayableTransactionObject<[
|
|
209
|
+
string,
|
|
210
|
+
string
|
|
211
|
+
] & {
|
|
212
|
+
prevId: string;
|
|
213
|
+
nextId: string;
|
|
214
|
+
}>;
|
|
215
|
+
getMarketData(_market: string): NonPayableTransactionObject<LiquityV2View.MarketDataStructOutput>;
|
|
216
|
+
getNumOfTrovesInFrontOfTrove(_market: string, _troveId: number | string | BN, _iterations: number | string | BN): NonPayableTransactionObject<[
|
|
217
|
+
string,
|
|
218
|
+
string
|
|
219
|
+
] & {
|
|
220
|
+
next: string;
|
|
221
|
+
numTroves: string;
|
|
222
|
+
}>;
|
|
223
|
+
getTroveInfo(_market: string, _troveId: number | string | BN): NonPayableTransactionObject<LiquityV2View.TroveDataStructOutput>;
|
|
224
|
+
getTrovePosition(_market: string, _collIndex: number | string | BN, _troveId: number | string | BN, _numTrials: number | string | BN, _inputRandomSeed: number | string | BN): NonPayableTransactionObject<[
|
|
225
|
+
string,
|
|
226
|
+
string
|
|
227
|
+
] & {
|
|
228
|
+
prevId: string;
|
|
229
|
+
nextId: string;
|
|
230
|
+
}>;
|
|
231
|
+
getUserTroves(_user: string, _market: string, _startIndex: number | string | BN, _endIndex: number | string | BN): NonPayableTransactionObject<[
|
|
232
|
+
LiquityV2View.ExistingTroveStructOutput[],
|
|
233
|
+
string
|
|
234
|
+
] & {
|
|
235
|
+
troves: LiquityV2View.ExistingTroveStructOutput[];
|
|
236
|
+
nextFreeTroveIndex: string;
|
|
237
|
+
}>;
|
|
238
|
+
isShutDown(_market: string): NonPayableTransactionObject<boolean>;
|
|
239
|
+
predictAdjustTroveUpfrontFee(_market: string, _collIndex: number | string | BN, _troveId: number | string | BN, _debtIncrease: number | string | BN): NonPayableTransactionObject<string>;
|
|
240
|
+
};
|
|
241
|
+
events: {
|
|
242
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
243
|
+
};
|
|
244
|
+
}
|