@defisaver/positions-sdk 0.0.202 → 0.0.203

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.
@@ -7599,3 +7599,47 @@ export namespace EulerV2View {
7599
7599
  };
7600
7600
  export { networks_84 as networks };
7601
7601
  }
7602
+ export namespace LiquityV2StabilityPool {
7603
+ let abi_85: ({
7604
+ inputs: {
7605
+ internalType: string;
7606
+ name: string;
7607
+ type: string;
7608
+ }[];
7609
+ stateMutability: string;
7610
+ type: string;
7611
+ anonymous?: undefined;
7612
+ name?: undefined;
7613
+ outputs?: undefined;
7614
+ } | {
7615
+ anonymous: boolean;
7616
+ inputs: {
7617
+ indexed: boolean;
7618
+ internalType: string;
7619
+ name: string;
7620
+ type: string;
7621
+ }[];
7622
+ name: string;
7623
+ type: string;
7624
+ stateMutability?: undefined;
7625
+ outputs?: undefined;
7626
+ } | {
7627
+ inputs: {
7628
+ internalType: string;
7629
+ name: string;
7630
+ type: string;
7631
+ }[];
7632
+ name: string;
7633
+ outputs: {
7634
+ internalType: string;
7635
+ name: string;
7636
+ type: string;
7637
+ }[];
7638
+ stateMutability: string;
7639
+ type: string;
7640
+ anonymous?: undefined;
7641
+ })[];
7642
+ export { abi_85 as abi };
7643
+ let networks_85: {};
7644
+ export { networks_85 as networks };
7645
+ }
@@ -1105,5 +1105,9 @@ module.exports = {
1105
1105
  "networks": {
1106
1106
  "1": { "address": "0x8932E46Ecf96b5Fe033F5e27Ab6dC755Cb668967" }
1107
1107
  }
1108
+ },
1109
+ "LiquityV2StabilityPool": {
1110
+ "abi": [{ "inputs": [{ "internalType": "contract IAddressesRegistry", "name": "_addressesRegistry", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newActivePoolAddress", "type": "address" }], "name": "ActivePoolAddressChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_B", "type": "uint256" }, { "indexed": false, "internalType": "uint128", "name": "_epoch", "type": "uint128" }, { "indexed": false, "internalType": "uint128", "name": "_scale", "type": "uint128" }], "name": "B_Updated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newBoldTokenAddress", "type": "address" }], "name": "BoldTokenAddressChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newDefaultPoolAddress", "type": "address" }], "name": "DefaultPoolAddressChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "_depositor", "type": "address" }, { "indexed": false, "internalType": "enum IStabilityPoolEvents.Operation", "name": "_operation", "type": "uint8" }, { "indexed": false, "internalType": "uint256", "name": "_depositLossSinceLastOperation", "type": "uint256" }, { "indexed": false, "internalType": "int256", "name": "_depositChange", "type": "int256" }, { "indexed": false, "internalType": "uint256", "name": "_yieldGainSinceLastOperation", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_yieldGainClaimed", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_ethGainSinceLastOperation", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_ethGainClaimed", "type": "uint256" }], "name": "DepositOperation", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "_depositor", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_newDeposit", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_stashedColl", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotP", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotS", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotB", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotScale", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotEpoch", "type": "uint256" }], "name": "DepositUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint128", "name": "_currentEpoch", "type": "uint128" }], "name": "EpochUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_amount", "type": "uint256" }], "name": "EtherSent", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_P", "type": "uint256" }], "name": "P_Updated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newPriceFeedAddress", "type": "address" }], "name": "PriceFeedAddressChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_S", "type": "uint256" }, { "indexed": false, "internalType": "uint128", "name": "_epoch", "type": "uint128" }, { "indexed": false, "internalType": "uint128", "name": "_scale", "type": "uint128" }], "name": "S_Updated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint128", "name": "_currentScale", "type": "uint128" }], "name": "ScaleUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_newBalance", "type": "uint256" }], "name": "StabilityPoolBoldBalanceUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_newBalance", "type": "uint256" }], "name": "StabilityPoolCollBalanceUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newTroveManagerAddress", "type": "address" }], "name": "TroveManagerAddressChanged", "type": "event" }, { "inputs": [], "name": "NAME", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "P", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SCALE_FACTOR", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "activePool", "outputs": [{ "internalType": "contract IActivePool", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "boldToken", "outputs": [{ "internalType": "contract IBoldToken", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "claimAllCollGains", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "collToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "currentEpoch", "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "currentScale", "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "depositSnapshots", "outputs": [{ "internalType": "uint256", "name": "S", "type": "uint256" }, { "internalType": "uint256", "name": "P", "type": "uint256" }, { "internalType": "uint256", "name": "B", "type": "uint256" }, { "internalType": "uint128", "name": "scale", "type": "uint128" }, { "internalType": "uint128", "name": "epoch", "type": "uint128" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "deposits", "outputs": [{ "internalType": "uint256", "name": "initialValue", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }, { "internalType": "uint128", "name": "", "type": "uint128" }], "name": "epochToScaleToB", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }, { "internalType": "uint128", "name": "", "type": "uint128" }], "name": "epochToScaleToS", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getCollBalance", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getCompoundedBoldDeposit", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getDepositorCollGain", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getDepositorYieldGain", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getDepositorYieldGainWithPending", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getEntireSystemColl", "outputs": [{ "internalType": "uint256", "name": "entireSystemColl", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getEntireSystemDebt", "outputs": [{ "internalType": "uint256", "name": "entireSystemDebt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getTotalBoldDeposits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getYieldGainsOwed", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getYieldGainsPending", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastBoldLossError_Offset", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastBoldLossError_TotalDeposits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastCollError_Offset", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastYieldError", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_debtToOffset", "type": "uint256" }, { "internalType": "uint256", "name": "_collToAdd", "type": "uint256" }], "name": "offset", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_topUp", "type": "uint256" }, { "internalType": "bool", "name": "_doClaim", "type": "bool" }], "name": "provideToSP", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "stashedColl", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_boldYield", "type": "uint256" }], "name": "triggerBoldRewards", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "troveManager", "outputs": [{ "internalType": "contract ITroveManager", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_amount", "type": "uint256" }, { "internalType": "bool", "name": "_doClaim", "type": "bool" }], "name": "withdrawFromSP", "outputs": [], "stateMutability": "nonpayable", "type": "function" }],
1111
+ "networks": {}
1108
1112
  }
1109
1113
  };
@@ -1,6 +1,6 @@
1
1
  import Web3 from 'web3';
2
2
  import { EthAddress, NetworkNumber } from '../types/common';
3
- import { InnerLiquityV2MarketData, LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData } from '../types';
3
+ import { LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData, LiquityV2Versions } from '../types';
4
4
  export declare const getLiquityV2MarketData: (web3: Web3, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, mainnetWeb3: Web3) => Promise<LiquityV2MarketData>;
5
5
  export declare const getLiquityV2UserTroveIds: (web3: Web3, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, troveNFTAddress: EthAddress, limitBlocksForEventFetching: boolean, account: EthAddress) => Promise<{
6
6
  troves: {
@@ -8,11 +8,14 @@ export declare const getLiquityV2UserTroveIds: (web3: Web3, network: NetworkNumb
8
8
  }[];
9
9
  nextFreeTroveIndex: string;
10
10
  }>;
11
- export declare const getDebtInFrontLiquityV2: (viewContract: any, marketAddress: EthAddress, troveId: string, accumulatedSum?: string, iterations?: number) => Promise<string>;
12
- export declare const getLiquityV2TroveData: (web3: Web3, network: NetworkNumber, { selectedMarket, assetsData, marketData, troveId, }: {
11
+ export declare const getDebtInFrontForSingleMarketLiquityV2: (viewContract: any, marketAddress: EthAddress, troveId: string, accumulatedSum?: string, iterations?: number) => Promise<string>;
12
+ export declare const getDebtInFrontForInterestRateSingleMarketLiquityV2: (viewContract: any, marketAddress: EthAddress, interestRate: string, troveId?: string, accumulatedSum?: string, iterations?: number) => Promise<string>;
13
+ export declare const getDebtInFrontLiquityV2: (markets: Record<LiquityV2Versions, LiquityV2MarketData>, selectedMarket: LiquityV2Versions, web3: Web3, network: NetworkNumber, viewContract: any, troveId: string) => Promise<string>;
14
+ export declare const getDebtInFrontForInterestRateLiquityV2: (markets: Record<LiquityV2Versions, LiquityV2MarketData>, selectedMarket: LiquityV2Versions, web3: Web3, network: NetworkNumber, viewContract: any, interestRate: string) => Promise<string>;
15
+ export declare const getLiquityV2TroveData: (web3: Web3, network: NetworkNumber, { selectedMarket, assetsData, troveId, allMarketsData, }: {
13
16
  selectedMarket: LiquityV2MarketInfo;
14
17
  assetsData: LiquityV2AssetsData;
15
- marketData: InnerLiquityV2MarketData;
16
18
  troveId: string;
19
+ allMarketsData: Record<LiquityV2Versions, LiquityV2MarketData>;
17
20
  }) => Promise<LiquityV2TroveData>;
18
21
  export declare const getLiquityV2ClaimableCollateral: (collSurplusPoolAddress: EthAddress, account: EthAddress, web3: Web3, network: NetworkNumber) => Promise<string>;
@@ -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.getLiquityV2ClaimableCollateral = exports.getLiquityV2TroveData = exports.getDebtInFrontLiquityV2 = exports.getLiquityV2UserTroveIds = exports.getLiquityV2MarketData = void 0;
15
+ exports.getLiquityV2ClaimableCollateral = exports.getLiquityV2TroveData = exports.getDebtInFrontForInterestRateLiquityV2 = exports.getDebtInFrontLiquityV2 = exports.getDebtInFrontForInterestRateSingleMarketLiquityV2 = exports.getDebtInFrontForSingleMarketLiquityV2 = exports.getLiquityV2UserTroveIds = 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");
@@ -21,6 +21,7 @@ const staking_1 = require("../staking");
21
21
  const liquityV2Helpers_1 = require("../helpers/liquityV2Helpers");
22
22
  const utils_1 = require("../services/utils");
23
23
  const constants_1 = require("../constants");
24
+ const markets_1 = require("../markets");
24
25
  const getLiquityV2MarketData = (web3, network, selectedMarket, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
25
26
  const viewContract = (0, contracts_1.LiquityV2ViewContract)(web3, network);
26
27
  const { marketAddress, debtToken, collateralToken } = selectedMarket;
@@ -133,21 +134,65 @@ const getLiquityV2UserTroveIds = (web3, network, selectedMarket, troveNFTAddress
133
134
  return { troves: filteredTroves, nextFreeTroveIndex };
134
135
  });
135
136
  exports.getLiquityV2UserTroveIds = getLiquityV2UserTroveIds;
136
- 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(); });
137
- const getDebtInFrontLiquityV2 = (viewContract, marketAddress, troveId, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () {
138
- const { debt, next } = yield _getDebtInFront(viewContract, marketAddress, troveId, accumulatedSum, iterations);
137
+ const _getDebtInFrontForSingleMarket = (viewContract, marketAddress, troveId, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () { return viewContract.methods.getDebtInFront(marketAddress, troveId, accumulatedSum, iterations).call(); });
138
+ const getDebtInFrontForSingleMarketLiquityV2 = (viewContract, marketAddress, troveId, accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () {
139
+ const { debt, next } = yield _getDebtInFrontForSingleMarket(viewContract, marketAddress, troveId, accumulatedSum, iterations);
139
140
  if (next === '0')
140
141
  return (0, tokens_1.assetAmountInEth)(debt);
141
- return (0, exports.getDebtInFrontLiquityV2)(viewContract, marketAddress, next, debt, iterations);
142
+ return (0, exports.getDebtInFrontForSingleMarketLiquityV2)(viewContract, marketAddress, next, debt, iterations);
143
+ });
144
+ exports.getDebtInFrontForSingleMarketLiquityV2 = getDebtInFrontForSingleMarketLiquityV2;
145
+ const _getDebtInFrontForInterestRateSingleMarketLiquityV2 = (viewContract, marketAddress, troveId = '0', accumulatedSum = '0', iterations = 2000, interestRate) => __awaiter(void 0, void 0, void 0, function* () { return viewContract.methods.getDebtInFrontByInterestRate(marketAddress, troveId, accumulatedSum, iterations, interestRate).call(); });
146
+ const getDebtInFrontForInterestRateSingleMarketLiquityV2 = (viewContract, marketAddress, interestRate, troveId = '0', accumulatedSum = '0', iterations = 2000) => __awaiter(void 0, void 0, void 0, function* () {
147
+ if (+interestRate === 0 || !interestRate)
148
+ return '0';
149
+ const interestRateWei = new decimal_js_1.default(interestRate).times(1e16).toFixed(0).toString();
150
+ const res = yield _getDebtInFrontForInterestRateSingleMarketLiquityV2(viewContract, marketAddress, troveId, accumulatedSum, iterations, interestRateWei);
151
+ const { debt, next } = res;
152
+ if (next === '0')
153
+ return (0, tokens_1.assetAmountInEth)(debt);
154
+ return (0, exports.getDebtInFrontForInterestRateSingleMarketLiquityV2)(viewContract, marketAddress, interestRate, next, debt, iterations);
155
+ });
156
+ exports.getDebtInFrontForInterestRateSingleMarketLiquityV2 = getDebtInFrontForInterestRateSingleMarketLiquityV2;
157
+ const getUnbackedDebtForSingleMarket = (totalBorrowed, web3, network, stabilityPoolAddress) => __awaiter(void 0, void 0, void 0, function* () {
158
+ const stabilityPoolContract = (0, contracts_1.createContractWrapper)(web3, network, 'LiquityV2StabilityPool', stabilityPoolAddress);
159
+ const totalBoldDeposits = yield stabilityPoolContract.methods.getTotalBoldDeposits().call();
160
+ const totalBoldDepositsInEth = (0, tokens_1.assetAmountInEth)(totalBoldDeposits);
161
+ return new decimal_js_1.default(totalBorrowed).sub(totalBoldDepositsInEth).toString();
162
+ });
163
+ const getAllMarketsUnbackedDebts = (markets, web3, network) => __awaiter(void 0, void 0, void 0, function* () {
164
+ const allMarketsUnbackedDebt = yield Promise.all(Object.entries(markets).map(([version, market]) => __awaiter(void 0, void 0, void 0, function* () {
165
+ const { assetsData, marketData } = market;
166
+ const unbackedDebt = yield getUnbackedDebtForSingleMarket(assetsData.BOLD.totalBorrow, web3, network, marketData.stabilityPoolAddress);
167
+ return [version, unbackedDebt];
168
+ })));
169
+ return Object.fromEntries(allMarketsUnbackedDebt);
170
+ });
171
+ const getDebtInFrontLiquityV2 = (markets, selectedMarket, web3, network, viewContract, troveId) => __awaiter(void 0, void 0, void 0, function* () {
172
+ const allMarketsUnbackedDebts = yield getAllMarketsUnbackedDebts(markets, web3, network);
173
+ const sumOfAllMarketsUnbackedDebt = new decimal_js_1.default(Object.values(allMarketsUnbackedDebts).reduce((acc, debt) => acc.plus(debt), new decimal_js_1.default(0)));
174
+ const selectedMarketUnbackedDebt = new decimal_js_1.default(allMarketsUnbackedDebts[selectedMarket]);
175
+ const interestRateDebtInFront = new decimal_js_1.default(yield (0, exports.getDebtInFrontForSingleMarketLiquityV2)(viewContract, (0, markets_1.LiquityV2Markets)(network)[selectedMarket].marketAddress, troveId));
176
+ const res = interestRateDebtInFront.div((selectedMarketUnbackedDebt.div(sumOfAllMarketsUnbackedDebt)));
177
+ return res.toString();
142
178
  });
143
179
  exports.getDebtInFrontLiquityV2 = getDebtInFrontLiquityV2;
144
- const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsData, marketData, troveId, }) => __awaiter(void 0, void 0, void 0, function* () {
180
+ const getDebtInFrontForInterestRateLiquityV2 = (markets, selectedMarket, web3, network, viewContract, interestRate) => __awaiter(void 0, void 0, void 0, function* () {
181
+ const allMarketsUnbackedDebts = yield getAllMarketsUnbackedDebts(markets, web3, network);
182
+ const sumOfAllMarketsUnbackedDebt = new decimal_js_1.default(Object.values(allMarketsUnbackedDebts).reduce((acc, debt) => acc.plus(debt), new decimal_js_1.default(0)));
183
+ const selectedMarketUnbackedDebt = new decimal_js_1.default(allMarketsUnbackedDebts[selectedMarket]);
184
+ const interestRateDebtInFront = new decimal_js_1.default(yield (0, exports.getDebtInFrontForInterestRateSingleMarketLiquityV2)(viewContract, (0, markets_1.LiquityV2Markets)(network)[selectedMarket].marketAddress, interestRate));
185
+ const res = interestRateDebtInFront.div((selectedMarketUnbackedDebt.div(sumOfAllMarketsUnbackedDebt)));
186
+ return res.toString();
187
+ });
188
+ exports.getDebtInFrontForInterestRateLiquityV2 = getDebtInFrontForInterestRateLiquityV2;
189
+ const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsData, troveId, allMarketsData, }) => __awaiter(void 0, void 0, void 0, function* () {
145
190
  const viewContract = (0, contracts_1.LiquityV2ViewContract)(web3, network);
146
- const { minCollRatio } = marketData;
191
+ const { minCollRatio } = allMarketsData[selectedMarket.value].marketData;
147
192
  const { collateralToken, marketAddress, debtToken } = selectedMarket;
148
193
  const [data, debtInFront] = yield Promise.all([
149
194
  viewContract.methods.getTroveInfo(marketAddress, troveId).call(),
150
- (0, exports.getDebtInFrontLiquityV2)(viewContract, marketAddress, troveId),
195
+ (0, exports.getDebtInFrontLiquityV2)(allMarketsData, selectedMarket.value, web3, network, viewContract, troveId),
151
196
  ]);
152
197
  const usedAssets = {};
153
198
  const debtAssetData = assetsData[debtToken];
@@ -0,0 +1,223 @@
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 ActivePoolAddressChanged = ContractEventLog<{
13
+ _newActivePoolAddress: string;
14
+ 0: string;
15
+ }>;
16
+ export type B_Updated = ContractEventLog<{
17
+ _B: string;
18
+ _epoch: string;
19
+ _scale: string;
20
+ 0: string;
21
+ 1: string;
22
+ 2: string;
23
+ }>;
24
+ export type BoldTokenAddressChanged = ContractEventLog<{
25
+ _newBoldTokenAddress: string;
26
+ 0: string;
27
+ }>;
28
+ export type DefaultPoolAddressChanged = ContractEventLog<{
29
+ _newDefaultPoolAddress: string;
30
+ 0: string;
31
+ }>;
32
+ export type DepositOperation = ContractEventLog<{
33
+ _depositor: string;
34
+ _operation: string;
35
+ _depositLossSinceLastOperation: string;
36
+ _depositChange: string;
37
+ _yieldGainSinceLastOperation: string;
38
+ _yieldGainClaimed: string;
39
+ _ethGainSinceLastOperation: string;
40
+ _ethGainClaimed: string;
41
+ 0: string;
42
+ 1: string;
43
+ 2: string;
44
+ 3: string;
45
+ 4: string;
46
+ 5: string;
47
+ 6: string;
48
+ 7: string;
49
+ }>;
50
+ export type DepositUpdated = ContractEventLog<{
51
+ _depositor: string;
52
+ _newDeposit: string;
53
+ _stashedColl: string;
54
+ _snapshotP: string;
55
+ _snapshotS: string;
56
+ _snapshotB: string;
57
+ _snapshotScale: string;
58
+ _snapshotEpoch: string;
59
+ 0: string;
60
+ 1: string;
61
+ 2: string;
62
+ 3: string;
63
+ 4: string;
64
+ 5: string;
65
+ 6: string;
66
+ 7: string;
67
+ }>;
68
+ export type EpochUpdated = ContractEventLog<{
69
+ _currentEpoch: string;
70
+ 0: string;
71
+ }>;
72
+ export type EtherSent = ContractEventLog<{
73
+ _to: string;
74
+ _amount: string;
75
+ 0: string;
76
+ 1: string;
77
+ }>;
78
+ export type P_Updated = ContractEventLog<{
79
+ _P: string;
80
+ 0: string;
81
+ }>;
82
+ export type PriceFeedAddressChanged = ContractEventLog<{
83
+ _newPriceFeedAddress: string;
84
+ 0: string;
85
+ }>;
86
+ export type S_Updated = ContractEventLog<{
87
+ _S: string;
88
+ _epoch: string;
89
+ _scale: string;
90
+ 0: string;
91
+ 1: string;
92
+ 2: string;
93
+ }>;
94
+ export type ScaleUpdated = ContractEventLog<{
95
+ _currentScale: string;
96
+ 0: string;
97
+ }>;
98
+ export type StabilityPoolBoldBalanceUpdated = ContractEventLog<{
99
+ _newBalance: string;
100
+ 0: string;
101
+ }>;
102
+ export type StabilityPoolCollBalanceUpdated = ContractEventLog<{
103
+ _newBalance: string;
104
+ 0: string;
105
+ }>;
106
+ export type TroveManagerAddressChanged = ContractEventLog<{
107
+ _newTroveManagerAddress: string;
108
+ 0: string;
109
+ }>;
110
+ export interface LiquityV2StabilityPool extends BaseContract {
111
+ constructor(jsonInterface: any[], address?: string, options?: ContractOptions): LiquityV2StabilityPool;
112
+ clone(): LiquityV2StabilityPool;
113
+ methods: {
114
+ NAME(): NonPayableTransactionObject<string>;
115
+ P(): NonPayableTransactionObject<string>;
116
+ SCALE_FACTOR(): NonPayableTransactionObject<string>;
117
+ activePool(): NonPayableTransactionObject<string>;
118
+ boldToken(): NonPayableTransactionObject<string>;
119
+ claimAllCollGains(): NonPayableTransactionObject<void>;
120
+ collToken(): NonPayableTransactionObject<string>;
121
+ currentEpoch(): NonPayableTransactionObject<string>;
122
+ currentScale(): NonPayableTransactionObject<string>;
123
+ depositSnapshots(arg0: string): NonPayableTransactionObject<[
124
+ string,
125
+ string,
126
+ string,
127
+ string,
128
+ string
129
+ ] & {
130
+ S: string;
131
+ P: string;
132
+ B: string;
133
+ scale: string;
134
+ epoch: string;
135
+ }>;
136
+ deposits(arg0: string): NonPayableTransactionObject<string>;
137
+ epochToScaleToB(arg0: number | string | BN, arg1: number | string | BN): NonPayableTransactionObject<string>;
138
+ epochToScaleToS(arg0: number | string | BN, arg1: number | string | BN): NonPayableTransactionObject<string>;
139
+ getCollBalance(): NonPayableTransactionObject<string>;
140
+ getCompoundedBoldDeposit(_depositor: string): NonPayableTransactionObject<string>;
141
+ getDepositorCollGain(_depositor: string): NonPayableTransactionObject<string>;
142
+ getDepositorYieldGain(_depositor: string): NonPayableTransactionObject<string>;
143
+ getDepositorYieldGainWithPending(_depositor: string): NonPayableTransactionObject<string>;
144
+ getEntireSystemColl(): NonPayableTransactionObject<string>;
145
+ getEntireSystemDebt(): NonPayableTransactionObject<string>;
146
+ getTotalBoldDeposits(): NonPayableTransactionObject<string>;
147
+ getYieldGainsOwed(): NonPayableTransactionObject<string>;
148
+ getYieldGainsPending(): NonPayableTransactionObject<string>;
149
+ lastBoldLossError_Offset(): NonPayableTransactionObject<string>;
150
+ lastBoldLossError_TotalDeposits(): NonPayableTransactionObject<string>;
151
+ lastCollError_Offset(): NonPayableTransactionObject<string>;
152
+ lastYieldError(): NonPayableTransactionObject<string>;
153
+ offset(_debtToOffset: number | string | BN, _collToAdd: number | string | BN): NonPayableTransactionObject<void>;
154
+ provideToSP(_topUp: number | string | BN, _doClaim: boolean): NonPayableTransactionObject<void>;
155
+ stashedColl(arg0: string): NonPayableTransactionObject<string>;
156
+ triggerBoldRewards(_boldYield: number | string | BN): NonPayableTransactionObject<void>;
157
+ troveManager(): NonPayableTransactionObject<string>;
158
+ withdrawFromSP(_amount: number | string | BN, _doClaim: boolean): NonPayableTransactionObject<void>;
159
+ };
160
+ events: {
161
+ ActivePoolAddressChanged(cb?: Callback<ActivePoolAddressChanged>): EventEmitter;
162
+ ActivePoolAddressChanged(options?: EventOptions, cb?: Callback<ActivePoolAddressChanged>): EventEmitter;
163
+ B_Updated(cb?: Callback<B_Updated>): EventEmitter;
164
+ B_Updated(options?: EventOptions, cb?: Callback<B_Updated>): EventEmitter;
165
+ BoldTokenAddressChanged(cb?: Callback<BoldTokenAddressChanged>): EventEmitter;
166
+ BoldTokenAddressChanged(options?: EventOptions, cb?: Callback<BoldTokenAddressChanged>): EventEmitter;
167
+ DefaultPoolAddressChanged(cb?: Callback<DefaultPoolAddressChanged>): EventEmitter;
168
+ DefaultPoolAddressChanged(options?: EventOptions, cb?: Callback<DefaultPoolAddressChanged>): EventEmitter;
169
+ DepositOperation(cb?: Callback<DepositOperation>): EventEmitter;
170
+ DepositOperation(options?: EventOptions, cb?: Callback<DepositOperation>): EventEmitter;
171
+ DepositUpdated(cb?: Callback<DepositUpdated>): EventEmitter;
172
+ DepositUpdated(options?: EventOptions, cb?: Callback<DepositUpdated>): EventEmitter;
173
+ EpochUpdated(cb?: Callback<EpochUpdated>): EventEmitter;
174
+ EpochUpdated(options?: EventOptions, cb?: Callback<EpochUpdated>): EventEmitter;
175
+ EtherSent(cb?: Callback<EtherSent>): EventEmitter;
176
+ EtherSent(options?: EventOptions, cb?: Callback<EtherSent>): EventEmitter;
177
+ P_Updated(cb?: Callback<P_Updated>): EventEmitter;
178
+ P_Updated(options?: EventOptions, cb?: Callback<P_Updated>): EventEmitter;
179
+ PriceFeedAddressChanged(cb?: Callback<PriceFeedAddressChanged>): EventEmitter;
180
+ PriceFeedAddressChanged(options?: EventOptions, cb?: Callback<PriceFeedAddressChanged>): EventEmitter;
181
+ S_Updated(cb?: Callback<S_Updated>): EventEmitter;
182
+ S_Updated(options?: EventOptions, cb?: Callback<S_Updated>): EventEmitter;
183
+ ScaleUpdated(cb?: Callback<ScaleUpdated>): EventEmitter;
184
+ ScaleUpdated(options?: EventOptions, cb?: Callback<ScaleUpdated>): EventEmitter;
185
+ StabilityPoolBoldBalanceUpdated(cb?: Callback<StabilityPoolBoldBalanceUpdated>): EventEmitter;
186
+ StabilityPoolBoldBalanceUpdated(options?: EventOptions, cb?: Callback<StabilityPoolBoldBalanceUpdated>): EventEmitter;
187
+ StabilityPoolCollBalanceUpdated(cb?: Callback<StabilityPoolCollBalanceUpdated>): EventEmitter;
188
+ StabilityPoolCollBalanceUpdated(options?: EventOptions, cb?: Callback<StabilityPoolCollBalanceUpdated>): EventEmitter;
189
+ TroveManagerAddressChanged(cb?: Callback<TroveManagerAddressChanged>): EventEmitter;
190
+ TroveManagerAddressChanged(options?: EventOptions, cb?: Callback<TroveManagerAddressChanged>): EventEmitter;
191
+ allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
192
+ };
193
+ once(event: "ActivePoolAddressChanged", cb: Callback<ActivePoolAddressChanged>): void;
194
+ once(event: "ActivePoolAddressChanged", options: EventOptions, cb: Callback<ActivePoolAddressChanged>): void;
195
+ once(event: "B_Updated", cb: Callback<B_Updated>): void;
196
+ once(event: "B_Updated", options: EventOptions, cb: Callback<B_Updated>): void;
197
+ once(event: "BoldTokenAddressChanged", cb: Callback<BoldTokenAddressChanged>): void;
198
+ once(event: "BoldTokenAddressChanged", options: EventOptions, cb: Callback<BoldTokenAddressChanged>): void;
199
+ once(event: "DefaultPoolAddressChanged", cb: Callback<DefaultPoolAddressChanged>): void;
200
+ once(event: "DefaultPoolAddressChanged", options: EventOptions, cb: Callback<DefaultPoolAddressChanged>): void;
201
+ once(event: "DepositOperation", cb: Callback<DepositOperation>): void;
202
+ once(event: "DepositOperation", options: EventOptions, cb: Callback<DepositOperation>): void;
203
+ once(event: "DepositUpdated", cb: Callback<DepositUpdated>): void;
204
+ once(event: "DepositUpdated", options: EventOptions, cb: Callback<DepositUpdated>): void;
205
+ once(event: "EpochUpdated", cb: Callback<EpochUpdated>): void;
206
+ once(event: "EpochUpdated", options: EventOptions, cb: Callback<EpochUpdated>): void;
207
+ once(event: "EtherSent", cb: Callback<EtherSent>): void;
208
+ once(event: "EtherSent", options: EventOptions, cb: Callback<EtherSent>): void;
209
+ once(event: "P_Updated", cb: Callback<P_Updated>): void;
210
+ once(event: "P_Updated", options: EventOptions, cb: Callback<P_Updated>): void;
211
+ once(event: "PriceFeedAddressChanged", cb: Callback<PriceFeedAddressChanged>): void;
212
+ once(event: "PriceFeedAddressChanged", options: EventOptions, cb: Callback<PriceFeedAddressChanged>): void;
213
+ once(event: "S_Updated", cb: Callback<S_Updated>): void;
214
+ once(event: "S_Updated", options: EventOptions, cb: Callback<S_Updated>): void;
215
+ once(event: "ScaleUpdated", cb: Callback<ScaleUpdated>): void;
216
+ once(event: "ScaleUpdated", options: EventOptions, cb: Callback<ScaleUpdated>): void;
217
+ once(event: "StabilityPoolBoldBalanceUpdated", cb: Callback<StabilityPoolBoldBalanceUpdated>): void;
218
+ once(event: "StabilityPoolBoldBalanceUpdated", options: EventOptions, cb: Callback<StabilityPoolBoldBalanceUpdated>): void;
219
+ once(event: "StabilityPoolCollBalanceUpdated", cb: Callback<StabilityPoolCollBalanceUpdated>): void;
220
+ once(event: "StabilityPoolCollBalanceUpdated", options: EventOptions, cb: Callback<StabilityPoolCollBalanceUpdated>): void;
221
+ once(event: "TroveManagerAddressChanged", cb: Callback<TroveManagerAddressChanged>): void;
222
+ once(event: "TroveManagerAddressChanged", options: EventOptions, cb: Callback<TroveManagerAddressChanged>): void;
223
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /* Autogenerated file. Do not edit manually. */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -37,6 +37,7 @@ export type { LendingPoolAddressesProvider } from "./LendingPoolAddressesProvide
37
37
  export type { Lido } from "./Lido";
38
38
  export type { LiquityActivePool } from "./LiquityActivePool";
39
39
  export type { LiquityV2CollSurplusPool } from "./LiquityV2CollSurplusPool";
40
+ export type { LiquityV2StabilityPool } from "./LiquityV2StabilityPool";
40
41
  export type { LiquityV2TroveNFT } from "./LiquityV2TroveNFT";
41
42
  export type { LiquityV2View } from "./LiquityV2View";
42
43
  export type { LiquityView } from "./LiquityView";
@@ -7599,3 +7599,47 @@ export namespace EulerV2View {
7599
7599
  };
7600
7600
  export { networks_84 as networks };
7601
7601
  }
7602
+ export namespace LiquityV2StabilityPool {
7603
+ let abi_85: ({
7604
+ inputs: {
7605
+ internalType: string;
7606
+ name: string;
7607
+ type: string;
7608
+ }[];
7609
+ stateMutability: string;
7610
+ type: string;
7611
+ anonymous?: undefined;
7612
+ name?: undefined;
7613
+ outputs?: undefined;
7614
+ } | {
7615
+ anonymous: boolean;
7616
+ inputs: {
7617
+ indexed: boolean;
7618
+ internalType: string;
7619
+ name: string;
7620
+ type: string;
7621
+ }[];
7622
+ name: string;
7623
+ type: string;
7624
+ stateMutability?: undefined;
7625
+ outputs?: undefined;
7626
+ } | {
7627
+ inputs: {
7628
+ internalType: string;
7629
+ name: string;
7630
+ type: string;
7631
+ }[];
7632
+ name: string;
7633
+ outputs: {
7634
+ internalType: string;
7635
+ name: string;
7636
+ type: string;
7637
+ }[];
7638
+ stateMutability: string;
7639
+ type: string;
7640
+ anonymous?: undefined;
7641
+ })[];
7642
+ export { abi_85 as abi };
7643
+ let networks_85: {};
7644
+ export { networks_85 as networks };
7645
+ }
@@ -1104,5 +1104,9 @@ module.exports = {
1104
1104
  "networks": {
1105
1105
  "1": { "address": "0x8932E46Ecf96b5Fe033F5e27Ab6dC755Cb668967" }
1106
1106
  }
1107
+ },
1108
+ "LiquityV2StabilityPool": {
1109
+ "abi": [{ "inputs": [{ "internalType": "contract IAddressesRegistry", "name": "_addressesRegistry", "type": "address" }], "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newActivePoolAddress", "type": "address" }], "name": "ActivePoolAddressChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_B", "type": "uint256" }, { "indexed": false, "internalType": "uint128", "name": "_epoch", "type": "uint128" }, { "indexed": false, "internalType": "uint128", "name": "_scale", "type": "uint128" }], "name": "B_Updated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newBoldTokenAddress", "type": "address" }], "name": "BoldTokenAddressChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newDefaultPoolAddress", "type": "address" }], "name": "DefaultPoolAddressChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "_depositor", "type": "address" }, { "indexed": false, "internalType": "enum IStabilityPoolEvents.Operation", "name": "_operation", "type": "uint8" }, { "indexed": false, "internalType": "uint256", "name": "_depositLossSinceLastOperation", "type": "uint256" }, { "indexed": false, "internalType": "int256", "name": "_depositChange", "type": "int256" }, { "indexed": false, "internalType": "uint256", "name": "_yieldGainSinceLastOperation", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_yieldGainClaimed", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_ethGainSinceLastOperation", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_ethGainClaimed", "type": "uint256" }], "name": "DepositOperation", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "_depositor", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_newDeposit", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_stashedColl", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotP", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotS", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotB", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotScale", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_snapshotEpoch", "type": "uint256" }], "name": "DepositUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint128", "name": "_currentEpoch", "type": "uint128" }], "name": "EpochUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "_amount", "type": "uint256" }], "name": "EtherSent", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_P", "type": "uint256" }], "name": "P_Updated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newPriceFeedAddress", "type": "address" }], "name": "PriceFeedAddressChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_S", "type": "uint256" }, { "indexed": false, "internalType": "uint128", "name": "_epoch", "type": "uint128" }, { "indexed": false, "internalType": "uint128", "name": "_scale", "type": "uint128" }], "name": "S_Updated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint128", "name": "_currentScale", "type": "uint128" }], "name": "ScaleUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_newBalance", "type": "uint256" }], "name": "StabilityPoolBoldBalanceUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "_newBalance", "type": "uint256" }], "name": "StabilityPoolCollBalanceUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "address", "name": "_newTroveManagerAddress", "type": "address" }], "name": "TroveManagerAddressChanged", "type": "event" }, { "inputs": [], "name": "NAME", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "P", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SCALE_FACTOR", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "activePool", "outputs": [{ "internalType": "contract IActivePool", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "boldToken", "outputs": [{ "internalType": "contract IBoldToken", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "claimAllCollGains", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "collToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "currentEpoch", "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "currentScale", "outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "depositSnapshots", "outputs": [{ "internalType": "uint256", "name": "S", "type": "uint256" }, { "internalType": "uint256", "name": "P", "type": "uint256" }, { "internalType": "uint256", "name": "B", "type": "uint256" }, { "internalType": "uint128", "name": "scale", "type": "uint128" }, { "internalType": "uint128", "name": "epoch", "type": "uint128" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "deposits", "outputs": [{ "internalType": "uint256", "name": "initialValue", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }, { "internalType": "uint128", "name": "", "type": "uint128" }], "name": "epochToScaleToB", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }, { "internalType": "uint128", "name": "", "type": "uint128" }], "name": "epochToScaleToS", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getCollBalance", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getCompoundedBoldDeposit", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getDepositorCollGain", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getDepositorYieldGain", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_depositor", "type": "address" }], "name": "getDepositorYieldGainWithPending", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getEntireSystemColl", "outputs": [{ "internalType": "uint256", "name": "entireSystemColl", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getEntireSystemDebt", "outputs": [{ "internalType": "uint256", "name": "entireSystemDebt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getTotalBoldDeposits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getYieldGainsOwed", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getYieldGainsPending", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastBoldLossError_Offset", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastBoldLossError_TotalDeposits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastCollError_Offset", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastYieldError", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_debtToOffset", "type": "uint256" }, { "internalType": "uint256", "name": "_collToAdd", "type": "uint256" }], "name": "offset", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_topUp", "type": "uint256" }, { "internalType": "bool", "name": "_doClaim", "type": "bool" }], "name": "provideToSP", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "stashedColl", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_boldYield", "type": "uint256" }], "name": "triggerBoldRewards", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "troveManager", "outputs": [{ "internalType": "contract ITroveManager", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_amount", "type": "uint256" }, { "internalType": "bool", "name": "_doClaim", "type": "bool" }], "name": "withdrawFromSP", "outputs": [], "stateMutability": "nonpayable", "type": "function" }],
1110
+ "networks": {}
1107
1111
  }
1108
1112
  };
@@ -1,6 +1,6 @@
1
1
  import Web3 from 'web3';
2
2
  import { EthAddress, NetworkNumber } from '../types/common';
3
- import { InnerLiquityV2MarketData, LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData } from '../types';
3
+ import { LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData, LiquityV2Versions } from '../types';
4
4
  export declare const getLiquityV2MarketData: (web3: Web3, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, mainnetWeb3: Web3) => Promise<LiquityV2MarketData>;
5
5
  export declare const getLiquityV2UserTroveIds: (web3: Web3, network: NetworkNumber, selectedMarket: LiquityV2MarketInfo, troveNFTAddress: EthAddress, limitBlocksForEventFetching: boolean, account: EthAddress) => Promise<{
6
6
  troves: {
@@ -8,11 +8,14 @@ export declare const getLiquityV2UserTroveIds: (web3: Web3, network: NetworkNumb
8
8
  }[];
9
9
  nextFreeTroveIndex: string;
10
10
  }>;
11
- export declare const getDebtInFrontLiquityV2: (viewContract: any, marketAddress: EthAddress, troveId: string, accumulatedSum?: string, iterations?: number) => Promise<string>;
12
- export declare const getLiquityV2TroveData: (web3: Web3, network: NetworkNumber, { selectedMarket, assetsData, marketData, troveId, }: {
11
+ export declare const getDebtInFrontForSingleMarketLiquityV2: (viewContract: any, marketAddress: EthAddress, troveId: string, accumulatedSum?: string, iterations?: number) => Promise<string>;
12
+ export declare const getDebtInFrontForInterestRateSingleMarketLiquityV2: (viewContract: any, marketAddress: EthAddress, interestRate: string, troveId?: string, accumulatedSum?: string, iterations?: number) => Promise<string>;
13
+ export declare const getDebtInFrontLiquityV2: (markets: Record<LiquityV2Versions, LiquityV2MarketData>, selectedMarket: LiquityV2Versions, web3: Web3, network: NetworkNumber, viewContract: any, troveId: string) => Promise<string>;
14
+ export declare const getDebtInFrontForInterestRateLiquityV2: (markets: Record<LiquityV2Versions, LiquityV2MarketData>, selectedMarket: LiquityV2Versions, web3: Web3, network: NetworkNumber, viewContract: any, interestRate: string) => Promise<string>;
15
+ export declare const getLiquityV2TroveData: (web3: Web3, network: NetworkNumber, { selectedMarket, assetsData, troveId, allMarketsData, }: {
13
16
  selectedMarket: LiquityV2MarketInfo;
14
17
  assetsData: LiquityV2AssetsData;
15
- marketData: InnerLiquityV2MarketData;
16
18
  troveId: string;
19
+ allMarketsData: Record<LiquityV2Versions, LiquityV2MarketData>;
17
20
  }) => Promise<LiquityV2TroveData>;
18
21
  export declare const getLiquityV2ClaimableCollateral: (collSurplusPoolAddress: EthAddress, account: EthAddress, web3: Web3, network: NetworkNumber) => Promise<string>;