@defisaver/positions-sdk 0.0.46 → 0.0.48
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/aaveV2/index.js +1 -1
- package/cjs/config/contracts.d.ts +236 -0
- package/cjs/config/contracts.js +25 -1
- 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/llamaLendHelpers/index.d.ts +9 -0
- package/cjs/helpers/llamaLendHelpers/index.js +53 -0
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +4 -1
- package/cjs/llamaLend/index.d.ts +7 -0
- package/cjs/llamaLend/index.js +232 -0
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/markets/llamaLend/index.d.ts +12 -0
- package/cjs/markets/llamaLend/index.js +53 -0
- package/cjs/morphoAaveV2/index.js +1 -1
- package/cjs/services/utils.d.ts +1 -0
- package/cjs/services/utils.js +3 -1
- package/cjs/setup.d.ts +1 -0
- package/cjs/setup.js +12 -0
- package/cjs/types/contracts/generated/LlamaLendCRVCrvUSDController.d.ts +209 -0
- package/cjs/types/contracts/generated/LlamaLendCRVCrvUSDController.js +5 -0
- package/cjs/types/contracts/generated/LlamaLendCrvUSDCRVDController.d.ts +209 -0
- package/cjs/types/contracts/generated/LlamaLendCrvUSDCRVDController.js +5 -0
- package/cjs/types/contracts/generated/LlamaLendView.d.ts +260 -0
- package/cjs/types/contracts/generated/LlamaLendView.js +5 -0
- package/cjs/types/contracts/generated/LlamaLendWstETHCrvUSDController.d.ts +209 -0
- package/cjs/types/contracts/generated/LlamaLendWstETHCrvUSDController.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +4 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/llamaLend.d.ts +110 -0
- package/cjs/types/llamaLend.js +17 -0
- package/esm/aaveV2/index.js +1 -1
- package/esm/config/contracts.d.ts +236 -0
- package/esm/config/contracts.js +25 -1
- 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/llamaLendHelpers/index.d.ts +9 -0
- package/esm/helpers/llamaLendHelpers/index.js +46 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/llamaLend/index.d.ts +7 -0
- package/esm/llamaLend/index.js +222 -0
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/markets/llamaLend/index.d.ts +12 -0
- package/esm/markets/llamaLend/index.js +45 -0
- package/esm/morphoAaveV2/index.js +1 -1
- package/esm/services/utils.d.ts +1 -0
- package/esm/services/utils.js +1 -0
- package/esm/setup.d.ts +1 -0
- package/esm/setup.js +7 -0
- package/esm/types/contracts/generated/LlamaLendCRVCrvUSDController.d.ts +209 -0
- package/esm/types/contracts/generated/LlamaLendCRVCrvUSDController.js +4 -0
- package/esm/types/contracts/generated/LlamaLendCrvUSDCRVDController.d.ts +209 -0
- package/esm/types/contracts/generated/LlamaLendCrvUSDCRVDController.js +4 -0
- package/esm/types/contracts/generated/LlamaLendView.d.ts +260 -0
- package/esm/types/contracts/generated/LlamaLendView.js +4 -0
- package/esm/types/contracts/generated/LlamaLendWstETHCrvUSDController.d.ts +209 -0
- package/esm/types/contracts/generated/LlamaLendWstETHCrvUSDController.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +4 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/llamaLend.d.ts +110 -0
- package/esm/types/llamaLend.js +14 -0
- package/package.json +1 -1
- package/src/aaveV2/index.ts +2 -2
- package/src/config/contracts.js +25 -1
- package/src/contracts.ts +3 -1
- package/src/helpers/index.ts +2 -1
- package/src/helpers/llamaLendHelpers/index.ts +45 -0
- package/src/index.ts +4 -0
- package/src/llamaLend/index.ts +272 -0
- package/src/markets/index.ts +2 -1
- package/src/markets/llamaLend/index.ts +51 -0
- package/src/morphoAaveV2/index.ts +2 -2
- package/src/services/utils.ts +4 -1
- package/src/setup.ts +8 -0
- package/src/types/contracts/generated/LlamaLendCRVCrvUSDController.ts +416 -0
- package/src/types/contracts/generated/LlamaLendCrvUSDCRVDController.ts +416 -0
- package/src/types/contracts/generated/LlamaLendView.ts +335 -0
- package/src/types/contracts/generated/LlamaLendWstETHCrvUSDController.ts +416 -0
- package/src/types/contracts/generated/index.ts +4 -0
- package/src/types/index.ts +2 -1
- package/src/types/llamaLend.ts +118 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getLlamaLendFullPositionData = exports.getLlamaLendUserData = exports.getLlamaLendAccountBalances = exports.getLlamaLendGlobalData = void 0;
|
|
16
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
17
|
+
const tokens_1 = require("@defisaver/tokens");
|
|
18
|
+
const types_1 = require("../types");
|
|
19
|
+
const multicall_1 = require("../multicall");
|
|
20
|
+
const common_1 = require("../types/common");
|
|
21
|
+
const contracts_1 = require("../contracts");
|
|
22
|
+
const llamaLendHelpers_1 = require("../helpers/llamaLendHelpers");
|
|
23
|
+
const utils_1 = require("../services/utils");
|
|
24
|
+
const llamaLend_1 = require("../markets/llamaLend");
|
|
25
|
+
const constants_1 = require("../constants");
|
|
26
|
+
const getAndFormatBands = (web3, network, selectedMarket, _minBand, _maxBand) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
const contract = (0, contracts_1.LlamaLendViewContract)(web3, network);
|
|
28
|
+
const minBand = parseInt(_minBand, 10);
|
|
29
|
+
const maxBand = parseInt(_maxBand, 10);
|
|
30
|
+
const pivots = [];
|
|
31
|
+
// getBandsData uses a lot of gas to get all of the bands at once, so we use pagination and fetch 200 bands at a time
|
|
32
|
+
let i = minBand;
|
|
33
|
+
while (i < maxBand) {
|
|
34
|
+
i += 200;
|
|
35
|
+
if (i > maxBand) {
|
|
36
|
+
pivots.push(maxBand);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
pivots.push(i);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const bandsData = (yield Promise.all(pivots.map((pivot, index) => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
let start = 0;
|
|
44
|
+
if (index === 0) {
|
|
45
|
+
start = minBand;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
start = pivots[index - 1] + 1;
|
|
49
|
+
}
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
const pivotedBandsData = yield contract.methods.getBandsData(selectedMarket.controllerAddress, start, pivot).call();
|
|
52
|
+
return pivotedBandsData;
|
|
53
|
+
})))).flat();
|
|
54
|
+
return bandsData.map((band) => ({
|
|
55
|
+
id: band.id,
|
|
56
|
+
collAmount: (0, tokens_1.assetAmountInEth)(band.collAmount),
|
|
57
|
+
debtAmount: (0, tokens_1.assetAmountInEth)(band.debtAmount),
|
|
58
|
+
lowPrice: (0, tokens_1.assetAmountInEth)(band.lowPrice),
|
|
59
|
+
highPrice: (0, tokens_1.assetAmountInEth)(band.highPrice),
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
const getLlamaLendGlobalData = (web3, network, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const contract = (0, contracts_1.LlamaLendViewContract)(web3, network);
|
|
64
|
+
const FeedRegistryAddress = (0, contracts_1.getConfigContractAddress)('FeedRegistry', network);
|
|
65
|
+
const FeedRegistryAbi = (0, contracts_1.getConfigContractAbi)('FeedRegistry');
|
|
66
|
+
const collAsset = selectedMarket.collAsset;
|
|
67
|
+
const debtAsset = selectedMarket.baseAsset;
|
|
68
|
+
console.log(selectedMarket.controllerAddress);
|
|
69
|
+
// if something else is needed
|
|
70
|
+
const multicallData = [
|
|
71
|
+
{
|
|
72
|
+
target: FeedRegistryAddress,
|
|
73
|
+
abiItem: (0, utils_1.getAbiItem)(FeedRegistryAbi, 'latestAnswer'),
|
|
74
|
+
params: [(0, tokens_1.getAssetInfo)(debtAsset).address, constants_1.USD_QUOTE],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
target: contract.options.address,
|
|
78
|
+
abiItem: contract.options.jsonInterface.find(({ name }) => name === 'globalData'),
|
|
79
|
+
params: [selectedMarket.controllerAddress],
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
const multiRes = yield (0, multicall_1.multicall)(multicallData, web3, network);
|
|
83
|
+
console.log(multiRes);
|
|
84
|
+
const data = multiRes[1][0];
|
|
85
|
+
const debtUsdPrice = (0, utils_1.getEthAmountForDecimals)(multiRes[0][0], 8);
|
|
86
|
+
console.log('here');
|
|
87
|
+
// all prices are in 18 decimals
|
|
88
|
+
const totalDebt = (0, tokens_1.assetAmountInEth)(data.totalDebt, debtAsset);
|
|
89
|
+
const ammPrice = (0, tokens_1.assetAmountInEth)(data.ammPrice, debtAsset);
|
|
90
|
+
const oraclePrice = (0, utils_1.getEthAmountForDecimals)(data.oraclePrice, 18);
|
|
91
|
+
const rate = (0, tokens_1.assetAmountInEth)(data.ammRate);
|
|
92
|
+
const futureRate = (0, tokens_1.assetAmountInEth)(data.monetaryPolicyRate);
|
|
93
|
+
const exponentRate = new decimal_js_1.default(rate).mul(365).mul(86400);
|
|
94
|
+
const exponentFutureRate = new decimal_js_1.default(futureRate).mul(365).mul(86400);
|
|
95
|
+
const borrowRate = new decimal_js_1.default(new decimal_js_1.default(2.718281828459).pow(exponentRate).minus(1)).mul(100)
|
|
96
|
+
.toString();
|
|
97
|
+
const futureBorrowRate = new decimal_js_1.default(new decimal_js_1.default(2.718281828459).pow(exponentFutureRate).minus(1)).mul(100)
|
|
98
|
+
.toString();
|
|
99
|
+
const bandsData = yield getAndFormatBands(web3, network, selectedMarket, data.minBand, data.maxBand);
|
|
100
|
+
const cap = (0, tokens_1.assetAmountInEth)(data.debtTokenTotalSupply, debtAsset);
|
|
101
|
+
const leftToBorrow = (0, utils_1.getEthAmountForDecimals)(data.debtTokenLeftToBorrow, 18);
|
|
102
|
+
const debtInAYearBN = new decimal_js_1.default(totalDebt).mul(new decimal_js_1.default(2.718281828459).pow(exponentRate).toNumber());
|
|
103
|
+
const lendRate = debtInAYearBN.minus(totalDebt).div(cap).mul(100).toString();
|
|
104
|
+
const assetsData = {};
|
|
105
|
+
assetsData[debtAsset] = {
|
|
106
|
+
symbol: debtAsset,
|
|
107
|
+
address: data.debtToken,
|
|
108
|
+
price: debtUsdPrice,
|
|
109
|
+
supplyRate: lendRate,
|
|
110
|
+
borrowRate,
|
|
111
|
+
canBeSupplied: true,
|
|
112
|
+
canBeBorrowed: true,
|
|
113
|
+
};
|
|
114
|
+
assetsData[collAsset] = {
|
|
115
|
+
symbol: collAsset,
|
|
116
|
+
address: data.collateralToken,
|
|
117
|
+
price: new decimal_js_1.default(debtUsdPrice).mul(oraclePrice).toString(),
|
|
118
|
+
supplyRate: '0',
|
|
119
|
+
borrowRate: '0',
|
|
120
|
+
canBeSupplied: true,
|
|
121
|
+
canBeBorrowed: false,
|
|
122
|
+
};
|
|
123
|
+
return Object.assign(Object.assign({}, data), { assetsData,
|
|
124
|
+
totalDebt,
|
|
125
|
+
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
|
+
lendRate,
|
|
127
|
+
futureBorrowRate, bands: bandsData, leftToBorrow });
|
|
128
|
+
});
|
|
129
|
+
exports.getLlamaLendGlobalData = getLlamaLendGlobalData;
|
|
130
|
+
const getStatusForUser = (bandRange, activeBand, debtSupplied, collSupplied) => {
|
|
131
|
+
// if bands are equal, that can only be [0,0] which means user doesn't have loan (min number of bands is 4)
|
|
132
|
+
if (new decimal_js_1.default(bandRange[0]).eq(bandRange[1]))
|
|
133
|
+
return types_1.LlamaLendStatus.Nonexistant;
|
|
134
|
+
// if user doesn't have debtAsset as collateral, then his position is not in soft liquidation
|
|
135
|
+
if (new decimal_js_1.default(debtSupplied).lte(0)) {
|
|
136
|
+
if (new decimal_js_1.default(bandRange[0]).minus(activeBand).lte(3))
|
|
137
|
+
return types_1.LlamaLendStatus.Risk; // if user band is less than 3 bands away from active band, his position is at risk
|
|
138
|
+
return types_1.LlamaLendStatus.Safe;
|
|
139
|
+
}
|
|
140
|
+
if (new decimal_js_1.default(bandRange[0]).lte(activeBand) && new decimal_js_1.default(bandRange[1]).gte(activeBand))
|
|
141
|
+
return types_1.LlamaLendStatus.SoftLiquidating; // user has debtAsset as coll so he is in soft liquidation
|
|
142
|
+
if (new decimal_js_1.default(collSupplied).lte(0) || new decimal_js_1.default(bandRange[1]).lte(activeBand))
|
|
143
|
+
return types_1.LlamaLendStatus.SoftLiquidated; // or is fully soft liquidated
|
|
144
|
+
return types_1.LlamaLendStatus.Nonexistant;
|
|
145
|
+
};
|
|
146
|
+
const getLlamaLendAccountBalances = (web3, network, block, addressMapping, address, controllerAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
147
|
+
let balances = {
|
|
148
|
+
collateral: {},
|
|
149
|
+
debt: {},
|
|
150
|
+
};
|
|
151
|
+
if (!address) {
|
|
152
|
+
return balances;
|
|
153
|
+
}
|
|
154
|
+
const contract = (0, contracts_1.LlamaLendViewContract)(web3, network, block);
|
|
155
|
+
const selectedMarket = Object.values((0, llamaLend_1.LlamaLendMarkets)(network)).find(i => i.controllerAddress.toLowerCase() === controllerAddress.toLowerCase());
|
|
156
|
+
const data = yield contract.methods.userData(selectedMarket.controllerAddress, address).call({}, block);
|
|
157
|
+
balances = {
|
|
158
|
+
collateral: {
|
|
159
|
+
[addressMapping ? (0, tokens_1.getAssetInfo)((0, utils_1.wethToEth)(selectedMarket.collAsset), network).address.toLowerCase() : (0, utils_1.wethToEth)(selectedMarket.collAsset)]: data.marketCollateralAmount,
|
|
160
|
+
},
|
|
161
|
+
debt: {
|
|
162
|
+
[addressMapping ? (0, tokens_1.getAssetInfo)((0, utils_1.wethToEth)(selectedMarket.baseAsset), network).address.toLowerCase() : (0, utils_1.wethToEth)(selectedMarket.baseAsset)]: data.debtAmount,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
return balances;
|
|
166
|
+
});
|
|
167
|
+
exports.getLlamaLendAccountBalances = getLlamaLendAccountBalances;
|
|
168
|
+
const getLlamaLendUserData = (web3, network, address, selectedMarket, marketData) => __awaiter(void 0, void 0, void 0, function* () {
|
|
169
|
+
const contract = (0, contracts_1.LlamaLendViewContract)(web3, network);
|
|
170
|
+
const { assetsData } = marketData;
|
|
171
|
+
const data = yield contract.methods.userData(selectedMarket.controllerAddress, address).call();
|
|
172
|
+
const collAsset = selectedMarket.collAsset;
|
|
173
|
+
const debtAsset = selectedMarket.baseAsset;
|
|
174
|
+
const collPrice = assetsData[collAsset].price;
|
|
175
|
+
const debtPrice = assetsData[debtAsset].price;
|
|
176
|
+
const health = (0, tokens_1.assetAmountInEth)(data.health);
|
|
177
|
+
const healthPercent = new decimal_js_1.default(health).mul(100).toString();
|
|
178
|
+
const collSupplied = (0, tokens_1.assetAmountInEth)(data.marketCollateralAmount, collAsset);
|
|
179
|
+
const collSuppliedUsd = new decimal_js_1.default(collSupplied).mul(collPrice).toString();
|
|
180
|
+
const debtSupplied = (0, tokens_1.assetAmountInEth)(data.debtTokenCollateralAmount, debtAsset);
|
|
181
|
+
const debtSuppliedUsd = new decimal_js_1.default(debtSupplied).mul(debtPrice).toString();
|
|
182
|
+
const debtSuppliedForYield = (0, tokens_1.assetAmountInEth)(data.debtTokenSuppliedAssets, debtAsset);
|
|
183
|
+
const debtSuppliedForYieldUsd = new decimal_js_1.default(debtSupplied).mul(debtPrice).toString();
|
|
184
|
+
const debtBorrowed = (0, tokens_1.assetAmountInEth)(data.debtAmount, debtAsset);
|
|
185
|
+
const shares = (0, tokens_1.assetAmountInEth)(data.debtTokenSuppliedShares, debtAsset);
|
|
186
|
+
const usedAssets = {
|
|
187
|
+
[collAsset]: {
|
|
188
|
+
isSupplied: true,
|
|
189
|
+
supplied: collSupplied,
|
|
190
|
+
suppliedUsd: collSuppliedUsd,
|
|
191
|
+
borrowed: '0',
|
|
192
|
+
borrowedUsd: '0',
|
|
193
|
+
isBorrowed: false,
|
|
194
|
+
symbol: collAsset,
|
|
195
|
+
collateral: true,
|
|
196
|
+
price: collPrice,
|
|
197
|
+
},
|
|
198
|
+
[debtAsset]: {
|
|
199
|
+
isSupplied: new decimal_js_1.default(debtSupplied).gt('0') || new decimal_js_1.default(debtSuppliedForYield).gt('0'),
|
|
200
|
+
collateral: new decimal_js_1.default(debtSupplied).gt('0'),
|
|
201
|
+
supplied: debtSupplied,
|
|
202
|
+
suppliedUsd: debtSuppliedUsd,
|
|
203
|
+
suppliedForYield: debtSuppliedForYield,
|
|
204
|
+
suppliedForYieldUsd: debtSuppliedForYieldUsd,
|
|
205
|
+
borrowed: debtBorrowed,
|
|
206
|
+
borrowedUsd: debtBorrowed,
|
|
207
|
+
isBorrowed: new decimal_js_1.default(debtBorrowed).gt('0'),
|
|
208
|
+
symbol: debtAsset,
|
|
209
|
+
price: debtPrice,
|
|
210
|
+
shares,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
const priceHigh = (0, tokens_1.assetAmountInEth)(data.priceHigh);
|
|
214
|
+
const priceLow = (0, tokens_1.assetAmountInEth)(data.priceLow);
|
|
215
|
+
const _userBands = data.loanExists ? (yield getAndFormatBands(web3, network, selectedMarket, data.bandRange[0], data.bandRange[1])) : [];
|
|
216
|
+
const status = data.loanExists ? getStatusForUser(data.bandRange, marketData.activeBand, debtSupplied, collSupplied) : types_1.LlamaLendStatus.Nonexistant;
|
|
217
|
+
const userBands = _userBands.map((band, index) => (Object.assign(Object.assign({}, band), { userDebtAmount: (0, tokens_1.assetAmountInEth)(data.usersBands[0][index], debtAsset), userCollAmount: (0, tokens_1.assetAmountInEth)(data.usersBands[1][index], collAsset) }))).sort((a, b) => parseInt(b.id, 10) - parseInt(a.id, 10));
|
|
218
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, data), { debtAmount: (0, tokens_1.assetAmountInEth)(data.debtAmount, debtAsset), health,
|
|
219
|
+
healthPercent,
|
|
220
|
+
priceHigh,
|
|
221
|
+
priceLow, liquidationDiscount: (0, tokens_1.assetAmountInEth)(data.liquidationDiscount), numOfBands: data.N, usedAssets,
|
|
222
|
+
status }), (0, llamaLendHelpers_1.getLlamaLendAggregatedData)({
|
|
223
|
+
loanExists: data.loanExists, usedAssets, network: common_1.NetworkNumber.Eth, selectedMarket, numOfBands: data.N,
|
|
224
|
+
})), { userBands });
|
|
225
|
+
});
|
|
226
|
+
exports.getLlamaLendUserData = getLlamaLendUserData;
|
|
227
|
+
const getLlamaLendFullPositionData = (web3, network, address, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
|
|
228
|
+
const marketData = yield (0, exports.getLlamaLendGlobalData)(web3, network, selectedMarket);
|
|
229
|
+
const positionData = yield (0, exports.getLlamaLendUserData)(web3, network, address, selectedMarket, marketData);
|
|
230
|
+
return positionData;
|
|
231
|
+
});
|
|
232
|
+
exports.getLlamaLendFullPositionData = getLlamaLendFullPositionData;
|
package/cjs/markets/index.d.ts
CHANGED
package/cjs/markets/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.CompoundMarkets = exports.AaveMarkets = void 0;
|
|
3
|
+
exports.LlamaLendMarkets = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.CompoundMarkets = exports.AaveMarkets = void 0;
|
|
4
4
|
var aave_1 = require("./aave");
|
|
5
5
|
Object.defineProperty(exports, "AaveMarkets", { enumerable: true, get: function () { return aave_1.AaveMarkets; } });
|
|
6
6
|
var compound_1 = require("./compound");
|
|
@@ -11,3 +11,5 @@ var curveUsd_1 = require("./curveUsd");
|
|
|
11
11
|
Object.defineProperty(exports, "CrvUsdMarkets", { enumerable: true, get: function () { return curveUsd_1.CrvUsdMarkets; } });
|
|
12
12
|
var morphoBlue_1 = require("./morphoBlue");
|
|
13
13
|
Object.defineProperty(exports, "MorphoBlueMarkets", { enumerable: true, get: function () { return morphoBlue_1.MorphoBlueMarkets; } });
|
|
14
|
+
var llamaLend_1 = require("./llamaLend");
|
|
15
|
+
Object.defineProperty(exports, "LlamaLendMarkets", { enumerable: true, get: function () { return llamaLend_1.LlamaLendMarkets; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LlamaLendMarketData, LlamaLendVersions } from '../../types';
|
|
2
|
+
import { NetworkNumber } from '../../types/common';
|
|
3
|
+
export declare const LLAMALEND_WSTETH_CRVUSD_MARKET: (networkId: NetworkNumber) => LlamaLendMarketData;
|
|
4
|
+
export declare const LLAMALEND_CRVUSD_CRV_MARKET: (networkId: NetworkNumber) => LlamaLendMarketData;
|
|
5
|
+
export declare const LLAMALEND_CRV_CRVUSD_MARKET: (networkId: NetworkNumber) => LlamaLendMarketData;
|
|
6
|
+
export declare const LlamaLendMarkets: (networkId: NetworkNumber) => {
|
|
7
|
+
readonly llamaLendwstETHcrvUSD: LlamaLendMarketData;
|
|
8
|
+
readonly llamaLendcrvUSDCRV: LlamaLendMarketData;
|
|
9
|
+
readonly llamaLendCRVcrvUSD: LlamaLendMarketData;
|
|
10
|
+
};
|
|
11
|
+
export declare const LLAMALEND_ALL_VERSIONS: LlamaLendVersions[];
|
|
12
|
+
export declare const getLlamaLendMarketData: (market: LlamaLendVersions, network?: NetworkNumber) => LlamaLendMarketData;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLlamaLendMarketData = exports.LLAMALEND_ALL_VERSIONS = exports.LlamaLendMarkets = exports.LLAMALEND_CRV_CRVUSD_MARKET = exports.LLAMALEND_CRVUSD_CRV_MARKET = exports.LLAMALEND_WSTETH_CRVUSD_MARKET = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const LLAMALEND_WSTETH_CRVUSD_MARKET = (networkId) => ({
|
|
6
|
+
chainIds: [1],
|
|
7
|
+
label: 'LlamaLend - wstETH/crvUSD',
|
|
8
|
+
shortLabel: 'wstETH/crvUSD',
|
|
9
|
+
value: types_1.LlamaLendVersions.LlamaLendwstETHcrvUSD,
|
|
10
|
+
collAsset: 'wstETH',
|
|
11
|
+
baseAsset: 'crvUSD',
|
|
12
|
+
controllerAddress: '0x5E657c5227A596a860621C5551c9735d8f4A8BE3',
|
|
13
|
+
vaultAddress: '0xE21C518a09b26Bf65B16767B97249385f12780d9',
|
|
14
|
+
url: 'wstethcrvusd',
|
|
15
|
+
});
|
|
16
|
+
exports.LLAMALEND_WSTETH_CRVUSD_MARKET = LLAMALEND_WSTETH_CRVUSD_MARKET;
|
|
17
|
+
const LLAMALEND_CRVUSD_CRV_MARKET = (networkId) => ({
|
|
18
|
+
chainIds: [1],
|
|
19
|
+
label: 'LlamaLend - crvUSD/CRV',
|
|
20
|
+
shortLabel: 'crvUSD/CRV',
|
|
21
|
+
value: types_1.LlamaLendVersions.LlamaLendcrvUSDCRV,
|
|
22
|
+
collAsset: 'crvUSD',
|
|
23
|
+
baseAsset: 'CRV',
|
|
24
|
+
controllerAddress: '0x43fc0f246F952ff12B757341A91cF4040711dDE9',
|
|
25
|
+
vaultAddress: '0x044aC5160e5A04E09EBAE06D786fc151F2BA5ceD',
|
|
26
|
+
url: 'crvusdcrv',
|
|
27
|
+
});
|
|
28
|
+
exports.LLAMALEND_CRVUSD_CRV_MARKET = LLAMALEND_CRVUSD_CRV_MARKET;
|
|
29
|
+
const LLAMALEND_CRV_CRVUSD_MARKET = (networkId) => ({
|
|
30
|
+
chainIds: [1],
|
|
31
|
+
label: 'LlamaLend - CRV/crvUSD',
|
|
32
|
+
shortLabel: 'CRV/crvUSD',
|
|
33
|
+
value: types_1.LlamaLendVersions.LlamaLendCRVcrvUSD,
|
|
34
|
+
collAsset: 'CRV',
|
|
35
|
+
baseAsset: 'crvUSD',
|
|
36
|
+
controllerAddress: '0x7443944962D04720f8c220C0D25f56F869d6EfD4',
|
|
37
|
+
vaultAddress: '0x67A18c18709C09D48000B321c6E1cb09F7181211',
|
|
38
|
+
url: 'crvcrvusd',
|
|
39
|
+
});
|
|
40
|
+
exports.LLAMALEND_CRV_CRVUSD_MARKET = LLAMALEND_CRV_CRVUSD_MARKET;
|
|
41
|
+
const LlamaLendMarkets = (networkId) => ({
|
|
42
|
+
[types_1.LlamaLendVersions.LlamaLendwstETHcrvUSD]: (0, exports.LLAMALEND_WSTETH_CRVUSD_MARKET)(networkId),
|
|
43
|
+
[types_1.LlamaLendVersions.LlamaLendcrvUSDCRV]: (0, exports.LLAMALEND_CRVUSD_CRV_MARKET)(networkId),
|
|
44
|
+
[types_1.LlamaLendVersions.LlamaLendCRVcrvUSD]: (0, exports.LLAMALEND_CRV_CRVUSD_MARKET)(networkId),
|
|
45
|
+
});
|
|
46
|
+
exports.LlamaLendMarkets = LlamaLendMarkets;
|
|
47
|
+
exports.LLAMALEND_ALL_VERSIONS = [
|
|
48
|
+
types_1.LlamaLendVersions.LlamaLendwstETHcrvUSD,
|
|
49
|
+
types_1.LlamaLendVersions.LlamaLendcrvUSDCRV,
|
|
50
|
+
types_1.LlamaLendVersions.LlamaLendCRVcrvUSD,
|
|
51
|
+
];
|
|
52
|
+
const getLlamaLendMarketData = (market, network = 1) => (0, exports.LlamaLendMarkets)(network)[market];
|
|
53
|
+
exports.getLlamaLendMarketData = getLlamaLendMarketData;
|
|
@@ -24,7 +24,7 @@ const aaveV3_1 = require("../aaveV3");
|
|
|
24
24
|
const aaveHelpers_1 = require("../helpers/aaveHelpers");
|
|
25
25
|
const priceService_1 = require("../services/priceService");
|
|
26
26
|
const getMorphoAaveV2MarketsData = (web3, network, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
const ethPrice = yield (0, priceService_1.getEthPrice)(
|
|
27
|
+
const ethPrice = yield (0, priceService_1.getEthPrice)(web3);
|
|
28
28
|
const morphoAaveV2ViewContract = (0, contracts_1.MorphoAaveV2ViewContract)(web3, network);
|
|
29
29
|
const [contractData, morphoRewardsRes] = yield Promise.allSettled([
|
|
30
30
|
morphoAaveV2ViewContract.methods.getAllMarketsInfo().call(),
|
package/cjs/services/utils.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const getAbiItem: (abi: any, methodName: string) => any;
|
|
|
9
9
|
export declare const ADDRESS_REGEX: RegExp;
|
|
10
10
|
export declare const isAddress: (address: string) => boolean;
|
|
11
11
|
export declare const compareAddresses: (addr1?: string, addr2?: string) => boolean;
|
|
12
|
+
export declare const getWeiAmountForDecimals: (amount: string | number, decimals: number) => string;
|
|
12
13
|
export declare const getEthAmountForDecimals: (amount: string | number, decimals: string | number) => string;
|
|
13
14
|
export declare const handleWbtcLegacy: (asset: string) => string;
|
|
14
15
|
export declare const wethToEthByAddress: (maybeWethAddr: string, chainId?: NetworkNumber) => string;
|
package/cjs/services/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.mapRange = exports.bytesToString = exports.ethToWethByAddress = exports.wethToEthByAddress = exports.handleWbtcLegacy = exports.getEthAmountForDecimals = exports.compareAddresses = exports.isAddress = exports.ADDRESS_REGEX = exports.getAbiItem = exports.wstEthToStEth = exports.stEthToWstEth = exports.wethToEth = exports.ethToWeth = exports.addToObjectIf = exports.isLayer2Network = void 0;
|
|
6
|
+
exports.mapRange = exports.bytesToString = exports.ethToWethByAddress = exports.wethToEthByAddress = exports.handleWbtcLegacy = exports.getEthAmountForDecimals = exports.getWeiAmountForDecimals = exports.compareAddresses = exports.isAddress = exports.ADDRESS_REGEX = exports.getAbiItem = exports.wstEthToStEth = exports.stEthToWstEth = exports.wethToEth = exports.ethToWeth = exports.addToObjectIf = exports.isLayer2Network = void 0;
|
|
7
7
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
8
8
|
const tokens_1 = require("@defisaver/tokens");
|
|
9
9
|
const common_1 = require("../types/common");
|
|
@@ -26,6 +26,8 @@ const isAddress = (address) => typeof address === 'string' && (new RegExp(export
|
|
|
26
26
|
exports.isAddress = isAddress;
|
|
27
27
|
const compareAddresses = (addr1 = '', addr2 = '') => addr1.toLowerCase() === addr2.toLowerCase();
|
|
28
28
|
exports.compareAddresses = compareAddresses;
|
|
29
|
+
const getWeiAmountForDecimals = (amount, decimals) => new decimal_js_1.default(amount).mul(Math.pow(10, decimals)).floor().toString();
|
|
30
|
+
exports.getWeiAmountForDecimals = getWeiAmountForDecimals;
|
|
29
31
|
const getEthAmountForDecimals = (amount, decimals) => new decimal_js_1.default(amount).div(Math.pow(10, +decimals)).toString();
|
|
30
32
|
exports.getEthAmountForDecimals = getEthAmountForDecimals;
|
|
31
33
|
const handleWbtcLegacy = (asset) => (asset === 'WBTC Legacy' ? 'WBTC' : asset);
|
package/cjs/setup.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/cjs/setup.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
7
|
+
decimal_js_1.default.set({
|
|
8
|
+
rounding: decimal_js_1.default.ROUND_DOWN,
|
|
9
|
+
toExpPos: 9e15,
|
|
10
|
+
toExpNeg: -9e15,
|
|
11
|
+
precision: 50,
|
|
12
|
+
});
|
|
@@ -0,0 +1,209 @@
|
|
|
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 UserState = ContractEventLog<{
|
|
13
|
+
user: string;
|
|
14
|
+
collateral: string;
|
|
15
|
+
debt: string;
|
|
16
|
+
n1: string;
|
|
17
|
+
n2: string;
|
|
18
|
+
liquidation_discount: string;
|
|
19
|
+
0: string;
|
|
20
|
+
1: string;
|
|
21
|
+
2: string;
|
|
22
|
+
3: string;
|
|
23
|
+
4: string;
|
|
24
|
+
5: string;
|
|
25
|
+
}>;
|
|
26
|
+
export type Borrow = ContractEventLog<{
|
|
27
|
+
user: string;
|
|
28
|
+
collateral_increase: string;
|
|
29
|
+
loan_increase: string;
|
|
30
|
+
0: string;
|
|
31
|
+
1: string;
|
|
32
|
+
2: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type Repay = ContractEventLog<{
|
|
35
|
+
user: string;
|
|
36
|
+
collateral_decrease: string;
|
|
37
|
+
loan_decrease: string;
|
|
38
|
+
0: string;
|
|
39
|
+
1: string;
|
|
40
|
+
2: string;
|
|
41
|
+
}>;
|
|
42
|
+
export type RemoveCollateral = ContractEventLog<{
|
|
43
|
+
user: string;
|
|
44
|
+
collateral_decrease: string;
|
|
45
|
+
0: string;
|
|
46
|
+
1: string;
|
|
47
|
+
}>;
|
|
48
|
+
export type Liquidate = ContractEventLog<{
|
|
49
|
+
liquidator: string;
|
|
50
|
+
user: string;
|
|
51
|
+
collateral_received: string;
|
|
52
|
+
stablecoin_received: string;
|
|
53
|
+
debt: string;
|
|
54
|
+
0: string;
|
|
55
|
+
1: string;
|
|
56
|
+
2: string;
|
|
57
|
+
3: string;
|
|
58
|
+
4: string;
|
|
59
|
+
}>;
|
|
60
|
+
export type SetMonetaryPolicy = ContractEventLog<{
|
|
61
|
+
monetary_policy: string;
|
|
62
|
+
0: string;
|
|
63
|
+
}>;
|
|
64
|
+
export type SetBorrowingDiscounts = ContractEventLog<{
|
|
65
|
+
loan_discount: string;
|
|
66
|
+
liquidation_discount: string;
|
|
67
|
+
0: string;
|
|
68
|
+
1: string;
|
|
69
|
+
}>;
|
|
70
|
+
export type CollectFees = ContractEventLog<{
|
|
71
|
+
amount: string;
|
|
72
|
+
new_supply: string;
|
|
73
|
+
0: string;
|
|
74
|
+
1: string;
|
|
75
|
+
}>;
|
|
76
|
+
export interface LlamaLendCRVCrvUSDController extends BaseContract {
|
|
77
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): LlamaLendCRVCrvUSDController;
|
|
78
|
+
clone(): LlamaLendCRVCrvUSDController;
|
|
79
|
+
methods: {
|
|
80
|
+
factory(): NonPayableTransactionObject<string>;
|
|
81
|
+
amm(): NonPayableTransactionObject<string>;
|
|
82
|
+
collateral_token(): NonPayableTransactionObject<string>;
|
|
83
|
+
borrowed_token(): NonPayableTransactionObject<string>;
|
|
84
|
+
save_rate(): NonPayableTransactionObject<void>;
|
|
85
|
+
debt(user: string): NonPayableTransactionObject<string>;
|
|
86
|
+
loan_exists(user: string): NonPayableTransactionObject<boolean>;
|
|
87
|
+
total_debt(): NonPayableTransactionObject<string>;
|
|
88
|
+
"max_borrowable(uint256,uint256)"(collateral: number | string | BN, N: number | string | BN): NonPayableTransactionObject<string>;
|
|
89
|
+
"max_borrowable(uint256,uint256,uint256)"(collateral: number | string | BN, N: number | string | BN, current_debt: number | string | BN): NonPayableTransactionObject<string>;
|
|
90
|
+
min_collateral(debt: number | string | BN, N: number | string | BN): NonPayableTransactionObject<string>;
|
|
91
|
+
calculate_debt_n1(collateral: number | string | BN, debt: number | string | BN, N: number | string | BN): NonPayableTransactionObject<string>;
|
|
92
|
+
create_loan(collateral: number | string | BN, debt: number | string | BN, N: number | string | BN): NonPayableTransactionObject<void>;
|
|
93
|
+
create_loan_extended(collateral: number | string | BN, debt: number | string | BN, N: number | string | BN, callbacker: string, callback_args: number | string | BN[]): NonPayableTransactionObject<void>;
|
|
94
|
+
"add_collateral(uint256)"(collateral: number | string | BN): NonPayableTransactionObject<void>;
|
|
95
|
+
"add_collateral(uint256,address)"(collateral: number | string | BN, _for: string): NonPayableTransactionObject<void>;
|
|
96
|
+
"remove_collateral(uint256)"(collateral: number | string | BN): NonPayableTransactionObject<void>;
|
|
97
|
+
"remove_collateral(uint256,bool)"(collateral: number | string | BN, use_eth: boolean): NonPayableTransactionObject<void>;
|
|
98
|
+
borrow_more(collateral: number | string | BN, debt: number | string | BN): NonPayableTransactionObject<void>;
|
|
99
|
+
borrow_more_extended(collateral: number | string | BN, debt: number | string | BN, callbacker: string, callback_args: number | string | BN[]): NonPayableTransactionObject<void>;
|
|
100
|
+
"repay(uint256)"(_d_debt: number | string | BN): NonPayableTransactionObject<void>;
|
|
101
|
+
"repay(uint256,address)"(_d_debt: number | string | BN, _for: string): NonPayableTransactionObject<void>;
|
|
102
|
+
"repay(uint256,address,int256)"(_d_debt: number | string | BN, _for: string, max_active_band: number | string | BN): NonPayableTransactionObject<void>;
|
|
103
|
+
"repay(uint256,address,int256,bool)"(_d_debt: number | string | BN, _for: string, max_active_band: number | string | BN, use_eth: boolean): NonPayableTransactionObject<void>;
|
|
104
|
+
repay_extended(callbacker: string, callback_args: number | string | BN[]): NonPayableTransactionObject<void>;
|
|
105
|
+
"health_calculator(address,int256,int256,bool)"(user: string, d_collateral: number | string | BN, d_debt: number | string | BN, full: boolean): NonPayableTransactionObject<string>;
|
|
106
|
+
"health_calculator(address,int256,int256,bool,uint256)"(user: string, d_collateral: number | string | BN, d_debt: number | string | BN, full: boolean, N: number | string | BN): NonPayableTransactionObject<string>;
|
|
107
|
+
"liquidate(address,uint256)"(user: string, min_x: number | string | BN): NonPayableTransactionObject<void>;
|
|
108
|
+
"liquidate(address,uint256,bool)"(user: string, min_x: number | string | BN, use_eth: boolean): NonPayableTransactionObject<void>;
|
|
109
|
+
liquidate_extended(user: string, min_x: number | string | BN, frac: number | string | BN, use_eth: boolean, callbacker: string, callback_args: number | string | BN[]): NonPayableTransactionObject<void>;
|
|
110
|
+
"tokens_to_liquidate(address)"(user: string): NonPayableTransactionObject<string>;
|
|
111
|
+
"tokens_to_liquidate(address,uint256)"(user: string, frac: number | string | BN): NonPayableTransactionObject<string>;
|
|
112
|
+
"health(address)"(user: string): NonPayableTransactionObject<string>;
|
|
113
|
+
"health(address,bool)"(user: string, full: boolean): NonPayableTransactionObject<string>;
|
|
114
|
+
"users_to_liquidate()"(): NonPayableTransactionObject<[
|
|
115
|
+
string,
|
|
116
|
+
string,
|
|
117
|
+
string,
|
|
118
|
+
string,
|
|
119
|
+
string
|
|
120
|
+
] & {
|
|
121
|
+
user: string;
|
|
122
|
+
x: string;
|
|
123
|
+
y: string;
|
|
124
|
+
debt: string;
|
|
125
|
+
health: string;
|
|
126
|
+
}[]>;
|
|
127
|
+
"users_to_liquidate(uint256)"(_from: number | string | BN): NonPayableTransactionObject<[
|
|
128
|
+
string,
|
|
129
|
+
string,
|
|
130
|
+
string,
|
|
131
|
+
string,
|
|
132
|
+
string
|
|
133
|
+
] & {
|
|
134
|
+
user: string;
|
|
135
|
+
x: string;
|
|
136
|
+
y: string;
|
|
137
|
+
debt: string;
|
|
138
|
+
health: string;
|
|
139
|
+
}[]>;
|
|
140
|
+
"users_to_liquidate(uint256,uint256)"(_from: number | string | BN, _limit: number | string | BN): NonPayableTransactionObject<[
|
|
141
|
+
string,
|
|
142
|
+
string,
|
|
143
|
+
string,
|
|
144
|
+
string,
|
|
145
|
+
string
|
|
146
|
+
] & {
|
|
147
|
+
user: string;
|
|
148
|
+
x: string;
|
|
149
|
+
y: string;
|
|
150
|
+
debt: string;
|
|
151
|
+
health: string;
|
|
152
|
+
}[]>;
|
|
153
|
+
amm_price(): NonPayableTransactionObject<string>;
|
|
154
|
+
user_prices(user: string): NonPayableTransactionObject<[string, string]>;
|
|
155
|
+
user_state(user: string): NonPayableTransactionObject<[string, string, string, string]>;
|
|
156
|
+
set_amm_fee(fee: number | string | BN): NonPayableTransactionObject<void>;
|
|
157
|
+
set_amm_admin_fee(fee: number | string | BN): NonPayableTransactionObject<void>;
|
|
158
|
+
set_monetary_policy(monetary_policy: string): NonPayableTransactionObject<void>;
|
|
159
|
+
set_borrowing_discounts(loan_discount: number | string | BN, liquidation_discount: number | string | BN): NonPayableTransactionObject<void>;
|
|
160
|
+
set_callback(cb: string): NonPayableTransactionObject<void>;
|
|
161
|
+
admin_fees(): NonPayableTransactionObject<string>;
|
|
162
|
+
collect_fees(): NonPayableTransactionObject<string>;
|
|
163
|
+
check_lock(): NonPayableTransactionObject<boolean>;
|
|
164
|
+
liquidation_discounts(arg0: string): NonPayableTransactionObject<string>;
|
|
165
|
+
loans(arg0: number | string | BN): NonPayableTransactionObject<string>;
|
|
166
|
+
loan_ix(arg0: string): NonPayableTransactionObject<string>;
|
|
167
|
+
n_loans(): NonPayableTransactionObject<string>;
|
|
168
|
+
minted(): NonPayableTransactionObject<string>;
|
|
169
|
+
redeemed(): NonPayableTransactionObject<string>;
|
|
170
|
+
monetary_policy(): NonPayableTransactionObject<string>;
|
|
171
|
+
liquidation_discount(): NonPayableTransactionObject<string>;
|
|
172
|
+
loan_discount(): NonPayableTransactionObject<string>;
|
|
173
|
+
};
|
|
174
|
+
events: {
|
|
175
|
+
UserState(cb?: Callback<UserState>): EventEmitter;
|
|
176
|
+
UserState(options?: EventOptions, cb?: Callback<UserState>): EventEmitter;
|
|
177
|
+
Borrow(cb?: Callback<Borrow>): EventEmitter;
|
|
178
|
+
Borrow(options?: EventOptions, cb?: Callback<Borrow>): EventEmitter;
|
|
179
|
+
Repay(cb?: Callback<Repay>): EventEmitter;
|
|
180
|
+
Repay(options?: EventOptions, cb?: Callback<Repay>): EventEmitter;
|
|
181
|
+
RemoveCollateral(cb?: Callback<RemoveCollateral>): EventEmitter;
|
|
182
|
+
RemoveCollateral(options?: EventOptions, cb?: Callback<RemoveCollateral>): EventEmitter;
|
|
183
|
+
Liquidate(cb?: Callback<Liquidate>): EventEmitter;
|
|
184
|
+
Liquidate(options?: EventOptions, cb?: Callback<Liquidate>): EventEmitter;
|
|
185
|
+
SetMonetaryPolicy(cb?: Callback<SetMonetaryPolicy>): EventEmitter;
|
|
186
|
+
SetMonetaryPolicy(options?: EventOptions, cb?: Callback<SetMonetaryPolicy>): EventEmitter;
|
|
187
|
+
SetBorrowingDiscounts(cb?: Callback<SetBorrowingDiscounts>): EventEmitter;
|
|
188
|
+
SetBorrowingDiscounts(options?: EventOptions, cb?: Callback<SetBorrowingDiscounts>): EventEmitter;
|
|
189
|
+
CollectFees(cb?: Callback<CollectFees>): EventEmitter;
|
|
190
|
+
CollectFees(options?: EventOptions, cb?: Callback<CollectFees>): EventEmitter;
|
|
191
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
192
|
+
};
|
|
193
|
+
once(event: "UserState", cb: Callback<UserState>): void;
|
|
194
|
+
once(event: "UserState", options: EventOptions, cb: Callback<UserState>): void;
|
|
195
|
+
once(event: "Borrow", cb: Callback<Borrow>): void;
|
|
196
|
+
once(event: "Borrow", options: EventOptions, cb: Callback<Borrow>): void;
|
|
197
|
+
once(event: "Repay", cb: Callback<Repay>): void;
|
|
198
|
+
once(event: "Repay", options: EventOptions, cb: Callback<Repay>): void;
|
|
199
|
+
once(event: "RemoveCollateral", cb: Callback<RemoveCollateral>): void;
|
|
200
|
+
once(event: "RemoveCollateral", options: EventOptions, cb: Callback<RemoveCollateral>): void;
|
|
201
|
+
once(event: "Liquidate", cb: Callback<Liquidate>): void;
|
|
202
|
+
once(event: "Liquidate", options: EventOptions, cb: Callback<Liquidate>): void;
|
|
203
|
+
once(event: "SetMonetaryPolicy", cb: Callback<SetMonetaryPolicy>): void;
|
|
204
|
+
once(event: "SetMonetaryPolicy", options: EventOptions, cb: Callback<SetMonetaryPolicy>): void;
|
|
205
|
+
once(event: "SetBorrowingDiscounts", cb: Callback<SetBorrowingDiscounts>): void;
|
|
206
|
+
once(event: "SetBorrowingDiscounts", options: EventOptions, cb: Callback<SetBorrowingDiscounts>): void;
|
|
207
|
+
once(event: "CollectFees", cb: Callback<CollectFees>): void;
|
|
208
|
+
once(event: "CollectFees", options: EventOptions, cb: Callback<CollectFees>): void;
|
|
209
|
+
}
|