@defisaver/positions-sdk 0.0.166-dev2 → 0.0.166-dev2-liquity-v2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/.mocharc.json +4 -4
  2. package/.nvmrc +1 -1
  3. package/README.md +69 -69
  4. package/cjs/config/contracts.d.ts +3 -32
  5. package/cjs/config/contracts.js +3 -3
  6. package/cjs/contracts.d.ts +1 -1
  7. package/cjs/contracts.js +2 -2
  8. package/cjs/helpers/index.d.ts +1 -1
  9. package/cjs/helpers/index.js +2 -2
  10. package/cjs/helpers/liquityV2Helpers/index.d.ts +12 -0
  11. package/cjs/helpers/liquityV2Helpers/index.js +61 -0
  12. package/cjs/index.d.ts +2 -2
  13. package/cjs/index.js +3 -3
  14. package/cjs/liquityV2/index.d.ts +10 -0
  15. package/cjs/liquityV2/index.js +98 -0
  16. package/cjs/markets/index.d.ts +1 -1
  17. package/cjs/markets/index.js +3 -3
  18. package/cjs/markets/liquityV2/index.d.ts +8 -0
  19. package/cjs/markets/liquityV2/index.js +34 -0
  20. package/cjs/services/utils.d.ts +0 -2
  21. package/cjs/services/utils.js +1 -4
  22. package/cjs/types/contracts/generated/LiquityV2View.d.ts +222 -0
  23. package/cjs/types/contracts/generated/index.d.ts +1 -1
  24. package/cjs/types/index.d.ts +1 -1
  25. package/cjs/types/index.js +1 -1
  26. package/cjs/types/liquityV2.d.ts +81 -0
  27. package/cjs/types/liquityV2.js +8 -0
  28. package/esm/config/contracts.d.ts +3 -32
  29. package/esm/config/contracts.js +3 -3
  30. package/esm/contracts.d.ts +1 -1
  31. package/esm/contracts.js +1 -1
  32. package/esm/helpers/index.d.ts +1 -1
  33. package/esm/helpers/index.js +1 -1
  34. package/esm/helpers/liquityV2Helpers/index.d.ts +12 -0
  35. package/esm/helpers/liquityV2Helpers/index.js +53 -0
  36. package/esm/index.d.ts +2 -2
  37. package/esm/index.js +2 -2
  38. package/esm/liquityV2/index.d.ts +10 -0
  39. package/esm/liquityV2/index.js +90 -0
  40. package/esm/markets/index.d.ts +1 -1
  41. package/esm/markets/index.js +1 -1
  42. package/esm/markets/liquityV2/index.d.ts +8 -0
  43. package/esm/markets/liquityV2/index.js +28 -0
  44. package/esm/services/utils.d.ts +0 -2
  45. package/esm/services/utils.js +0 -2
  46. package/esm/types/contracts/generated/LiquityV2View.d.ts +222 -0
  47. package/esm/types/contracts/generated/index.d.ts +1 -1
  48. package/esm/types/index.d.ts +1 -1
  49. package/esm/types/index.js +1 -1
  50. package/esm/types/liquityV2.d.ts +81 -0
  51. package/esm/types/liquityV2.js +5 -0
  52. package/package.json +49 -49
  53. package/src/aaveV2/index.ts +227 -227
  54. package/src/aaveV3/index.ts +590 -590
  55. package/src/assets/index.ts +60 -60
  56. package/src/chickenBonds/index.ts +123 -123
  57. package/src/compoundV2/index.ts +219 -219
  58. package/src/compoundV3/index.ts +281 -281
  59. package/src/config/contracts.js +1040 -1040
  60. package/src/constants/index.ts +6 -6
  61. package/src/contracts.ts +130 -130
  62. package/src/curveUsd/index.ts +229 -229
  63. package/src/exchange/index.ts +17 -17
  64. package/src/helpers/aaveHelpers/index.ts +194 -194
  65. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  66. package/src/helpers/compoundHelpers/index.ts +246 -246
  67. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  68. package/src/helpers/index.ts +9 -9
  69. package/src/helpers/liquityV2Helpers/index.ts +78 -0
  70. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  71. package/src/helpers/makerHelpers/index.ts +94 -94
  72. package/src/helpers/morphoBlueHelpers/index.ts +115 -115
  73. package/src/helpers/sparkHelpers/index.ts +150 -150
  74. package/src/index.ts +48 -48
  75. package/src/liquity/index.ts +116 -116
  76. package/src/liquityV2/index.ts +115 -0
  77. package/src/llamaLend/index.ts +275 -275
  78. package/src/maker/index.ts +117 -117
  79. package/src/markets/aave/index.ts +152 -152
  80. package/src/markets/aave/marketAssets.ts +46 -46
  81. package/src/markets/compound/index.ts +173 -173
  82. package/src/markets/compound/marketsAssets.ts +64 -64
  83. package/src/markets/curveUsd/index.ts +69 -69
  84. package/src/markets/index.ts +23 -24
  85. package/src/markets/liquityV2/index.ts +31 -0
  86. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  87. package/src/markets/llamaLend/index.ts +235 -235
  88. package/src/markets/morphoBlue/index.ts +728 -728
  89. package/src/markets/spark/index.ts +29 -29
  90. package/src/markets/spark/marketAssets.ts +10 -10
  91. package/src/moneymarket/moneymarketCommonService.ts +80 -80
  92. package/src/morphoAaveV2/index.ts +256 -256
  93. package/src/morphoAaveV3/index.ts +630 -630
  94. package/src/morphoBlue/index.ts +171 -171
  95. package/src/multicall/index.ts +22 -22
  96. package/src/services/dsrService.ts +15 -15
  97. package/src/services/priceService.ts +21 -21
  98. package/src/services/utils.ts +54 -57
  99. package/src/setup.ts +8 -8
  100. package/src/spark/index.ts +424 -424
  101. package/src/staking/staking.ts +218 -218
  102. package/src/types/aave.ts +262 -262
  103. package/src/types/chickenBonds.ts +45 -45
  104. package/src/types/common.ts +84 -84
  105. package/src/types/compound.ts +129 -129
  106. package/src/types/contracts/generated/LiquityV2View.ts +280 -0
  107. package/src/types/contracts/generated/index.ts +1 -1
  108. package/src/types/curveUsd.ts +118 -118
  109. package/src/types/index.ts +10 -10
  110. package/src/types/liquity.ts +30 -30
  111. package/src/types/liquityV2.ts +87 -0
  112. package/src/types/llamaLend.ts +155 -155
  113. package/src/types/maker.ts +50 -50
  114. package/src/types/morphoBlue.ts +146 -146
  115. package/src/types/spark.ts +127 -127
  116. package/cjs/eulerV2/index.d.ts +0 -40
  117. package/cjs/eulerV2/index.js +0 -207
  118. package/cjs/helpers/eulerHelpers/index.d.ts +0 -27
  119. package/cjs/helpers/eulerHelpers/index.js +0 -232
  120. package/cjs/markets/euler/index.d.ts +0 -10
  121. package/cjs/markets/euler/index.js +0 -41
  122. package/cjs/types/contracts/generated/EulerV2View.d.ts +0 -333
  123. package/cjs/types/euler.d.ts +0 -148
  124. package/cjs/types/euler.js +0 -15
  125. package/esm/eulerV2/index.d.ts +0 -40
  126. package/esm/eulerV2/index.js +0 -199
  127. package/esm/helpers/eulerHelpers/index.d.ts +0 -27
  128. package/esm/helpers/eulerHelpers/index.js +0 -219
  129. package/esm/markets/euler/index.d.ts +0 -10
  130. package/esm/markets/euler/index.js +0 -34
  131. package/esm/types/contracts/generated/EulerV2View.d.ts +0 -333
  132. package/esm/types/euler.d.ts +0 -148
  133. package/esm/types/euler.js +0 -12
  134. package/src/eulerV2/index.ts +0 -286
  135. package/src/helpers/eulerHelpers/index.ts +0 -231
  136. package/src/markets/euler/index.ts +0 -38
  137. package/src/types/contracts/generated/EulerV2View.ts +0 -434
  138. package/src/types/euler.ts +0 -171
  139. /package/cjs/types/contracts/generated/{EulerV2View.js → LiquityV2View.js} +0 -0
  140. /package/esm/types/contracts/generated/{EulerV2View.js → LiquityV2View.js} +0 -0
@@ -0,0 +1,98 @@
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.getLiquityV2TroveData = exports.getLiquityV2MarketData = void 0;
16
+ const decimal_js_1 = __importDefault(require("decimal.js"));
17
+ const tokens_1 = require("@defisaver/tokens");
18
+ const contracts_1 = require("../contracts");
19
+ const types_1 = require("../types");
20
+ const staking_1 = require("../staking");
21
+ const liquityV2Helpers_1 = require("../helpers/liquityV2Helpers");
22
+ const utils_1 = require("../services/utils");
23
+ const getLiquityV2MarketData = (web3, network, selectedMarket, mainnetWeb3) => __awaiter(void 0, void 0, void 0, function* () {
24
+ const viewContract = (0, contracts_1.LiquityV2ViewContract)(web3, network);
25
+ const { marketAddress, debtToken, collateralToken } = selectedMarket;
26
+ const data = yield viewContract.methods.getMarketData(marketAddress).call();
27
+ const assetsData = {};
28
+ assetsData[debtToken] = {
29
+ symbol: debtToken,
30
+ address: (0, tokens_1.getAssetInfo)(debtToken, network).address,
31
+ price: '1',
32
+ totalSupply: '0',
33
+ totalBorrow: (0, tokens_1.assetAmountInEth)(data.entireSystemDebt),
34
+ canBeSupplied: false,
35
+ canBeBorrowed: true,
36
+ };
37
+ assetsData[collateralToken] = {
38
+ symbol: collateralToken,
39
+ address: (0, tokens_1.getAssetInfo)((0, utils_1.ethToWeth)(collateralToken), network).address,
40
+ price: (0, tokens_1.assetAmountInEth)(data.collPrice),
41
+ totalSupply: (0, tokens_1.assetAmountInEth)(data.entireSystemColl),
42
+ totalBorrow: '0',
43
+ canBeSupplied: true,
44
+ canBeBorrowed: false,
45
+ };
46
+ if (staking_1.STAKING_ASSETS.includes(collateralToken)) {
47
+ assetsData[collateralToken].incentiveSupplyApy = yield (0, staking_1.getStakingApy)(collateralToken, mainnetWeb3);
48
+ assetsData[collateralToken].incentiveSupplyToken = collateralToken;
49
+ }
50
+ const minRatio = new decimal_js_1.default(data.MCR).div(1e16).toString();
51
+ return { assetsData, marketData: { minRatio } };
52
+ });
53
+ exports.getLiquityV2MarketData = getLiquityV2MarketData;
54
+ const getLiquityV2TroveData = (web3, network, { selectedMarket, assetsData, marketData, troveId, }) => __awaiter(void 0, void 0, void 0, function* () {
55
+ const viewContract = (0, contracts_1.LiquityV2ViewContract)(web3, network);
56
+ const { minRatio } = marketData;
57
+ const { collateralToken, marketAddress, debtToken } = selectedMarket;
58
+ const data = yield viewContract.methods.getTroveInfo(marketAddress, troveId).call();
59
+ const usedAssets = {};
60
+ const debtAssetData = assetsData[debtToken];
61
+ const borrowed = (0, tokens_1.assetAmountInEth)(data.debtAmount);
62
+ usedAssets[debtToken] = {
63
+ symbol: debtToken,
64
+ address: debtAssetData.address,
65
+ price: debtAssetData.price,
66
+ supplied: '0',
67
+ suppliedUsd: '0',
68
+ borrowed,
69
+ borrowedUsd: new decimal_js_1.default(borrowed).mul(debtAssetData.price).toString(),
70
+ isBorrowed: true,
71
+ isSupplied: false,
72
+ };
73
+ const collAssetData = assetsData[collateralToken];
74
+ const suppliedColl = (0, tokens_1.assetAmountInEth)(data.collAmount);
75
+ usedAssets[collateralToken] = {
76
+ symbol: collateralToken,
77
+ address: collAssetData.address,
78
+ price: collAssetData.price,
79
+ supplied: suppliedColl,
80
+ suppliedUsd: new decimal_js_1.default(suppliedColl).mul(collAssetData.price).toString(),
81
+ borrowed: '0',
82
+ borrowedUsd: '0',
83
+ isBorrowed: false,
84
+ isSupplied: true,
85
+ };
86
+ const ratio = new decimal_js_1.default(data.TCRatio).div(1e16).toString();
87
+ const interestRate = new decimal_js_1.default(data.annualInterestRate).div(1e16).toString();
88
+ const interestBatchManager = data.interestBatchManager;
89
+ const payload = Object.assign({ usedAssets,
90
+ troveId,
91
+ ratio,
92
+ interestRate,
93
+ interestBatchManager, troveStatus: types_1.LIQUITY_TROVE_STATUS_ENUM[parseInt(data.status, 10)] }, (0, liquityV2Helpers_1.getLiquityV2AggregatedPositionData)({
94
+ usedAssets, assetsData, minRatio, interestRate,
95
+ }));
96
+ return payload;
97
+ });
98
+ exports.getLiquityV2TroveData = getLiquityV2TroveData;
@@ -4,4 +4,4 @@ export { SparkMarkets } from './spark';
4
4
  export { CrvUsdMarkets } from './curveUsd';
5
5
  export { MorphoBlueMarkets, findMorphoBlueMarket } from './morphoBlue';
6
6
  export { LlamaLendMarkets } from './llamaLend';
7
- export { EulerV2Markets } from './euler';
7
+ export { LiquityV2Markets } from './liquityV2';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EulerV2Markets = exports.LlamaLendMarkets = exports.findMorphoBlueMarket = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.v3USDTCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.compoundV2CollateralAssets = exports.CompoundMarkets = exports.getAaveV3MarketByMarketAddress = exports.morphoAaveV3AssetEthMarket = exports.morphoAaveV2AssetDefaultMarket = exports.aaveV3AssetsDefaultMarket = exports.aaveV2AssetsDefaultMarket = exports.aaveV1AssetsDefaultMarket = exports.AaveMarkets = void 0;
3
+ exports.LiquityV2Markets = exports.LlamaLendMarkets = exports.findMorphoBlueMarket = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.v3USDTCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.compoundV2CollateralAssets = exports.CompoundMarkets = exports.getAaveV3MarketByMarketAddress = exports.morphoAaveV3AssetEthMarket = exports.morphoAaveV2AssetDefaultMarket = exports.aaveV3AssetsDefaultMarket = exports.aaveV2AssetsDefaultMarket = exports.aaveV1AssetsDefaultMarket = 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
  Object.defineProperty(exports, "aaveV1AssetsDefaultMarket", { enumerable: true, get: function () { return aave_1.aaveV1AssetsDefaultMarket; } });
@@ -26,5 +26,5 @@ Object.defineProperty(exports, "MorphoBlueMarkets", { enumerable: true, get: fun
26
26
  Object.defineProperty(exports, "findMorphoBlueMarket", { enumerable: true, get: function () { return morphoBlue_1.findMorphoBlueMarket; } });
27
27
  var llamaLend_1 = require("./llamaLend");
28
28
  Object.defineProperty(exports, "LlamaLendMarkets", { enumerable: true, get: function () { return llamaLend_1.LlamaLendMarkets; } });
29
- var euler_1 = require("./euler");
30
- Object.defineProperty(exports, "EulerV2Markets", { enumerable: true, get: function () { return euler_1.EulerV2Markets; } });
29
+ var liquityV2_1 = require("./liquityV2");
30
+ Object.defineProperty(exports, "LiquityV2Markets", { enumerable: true, get: function () { return liquityV2_1.LiquityV2Markets; } });
@@ -0,0 +1,8 @@
1
+ import { NetworkNumber } from '../../types/common';
2
+ import { LiquityV2MarketInfo } from '../../types/liquityV2';
3
+ export declare const LIQUITY_V2_ETH_MARKET: (networkId?: NetworkNumber) => LiquityV2MarketInfo;
4
+ export declare const LIQUITY_V2_WSTETH_MARKET: (networkId?: NetworkNumber) => LiquityV2MarketInfo;
5
+ export declare const LiquityV2Markets: (networkId: NetworkNumber) => {
6
+ readonly liquityv2eth: LiquityV2MarketInfo;
7
+ readonly liquityv2wsteth: LiquityV2MarketInfo;
8
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LiquityV2Markets = exports.LIQUITY_V2_WSTETH_MARKET = exports.LIQUITY_V2_ETH_MARKET = void 0;
4
+ const common_1 = require("../../types/common");
5
+ const liquityV2_1 = require("../../types/liquityV2");
6
+ const LIQUITY_V2_ETH_MARKET = (networkId = common_1.NetworkNumber.Eth) => ({
7
+ chainIds: [1],
8
+ label: 'Liquity V2 ETH',
9
+ shortLabel: 'ETH',
10
+ value: liquityV2_1.LiquityV2Versions.LiquityV2Eth,
11
+ url: 'eth',
12
+ debtToken: 'BOLD',
13
+ collateralToken: 'ETH',
14
+ marketAddress: '0xd7199b16945f1ebaa0b301bf3d05bf489caa408b',
15
+ protocolName: 'liquity-v2',
16
+ });
17
+ exports.LIQUITY_V2_ETH_MARKET = LIQUITY_V2_ETH_MARKET;
18
+ const LIQUITY_V2_WSTETH_MARKET = (networkId = common_1.NetworkNumber.Eth) => ({
19
+ chainIds: [1],
20
+ label: 'Liquity V2 wstETH',
21
+ shortLabel: 'wstETH',
22
+ value: liquityV2_1.LiquityV2Versions.LiquityV2WstEth,
23
+ url: 'wsteth',
24
+ debtToken: 'BOLD',
25
+ collateralToken: 'wstETH',
26
+ marketAddress: '0x0d22113a543826eeaf2ae0fc9d10aea66efba156',
27
+ protocolName: 'liquity-v2',
28
+ });
29
+ exports.LIQUITY_V2_WSTETH_MARKET = LIQUITY_V2_WSTETH_MARKET;
30
+ const LiquityV2Markets = (networkId) => ({
31
+ [liquityV2_1.LiquityV2Versions.LiquityV2Eth]: (0, exports.LIQUITY_V2_ETH_MARKET)(networkId),
32
+ [liquityV2_1.LiquityV2Versions.LiquityV2WstEth]: (0, exports.LIQUITY_V2_WSTETH_MARKET)(networkId),
33
+ });
34
+ exports.LiquityV2Markets = LiquityV2Markets;
@@ -20,5 +20,3 @@ export declare const bytesToString: (hex: string) => string;
20
20
  */
21
21
  export declare const mapRange: (input: number | string, minInput: number | string, maxInput: number | string, minOutput: number | string, maxOutput: number | string) => number;
22
22
  export declare const isEnabledOnBitmap: (bitmap: number, assetId: number) => bigint;
23
- export declare const MAXUINT: string;
24
- export declare const isMaxuint: (amount: string) => boolean;
@@ -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.isMaxuint = exports.MAXUINT = exports.isEnabledOnBitmap = 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;
6
+ exports.isEnabledOnBitmap = 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");
@@ -56,6 +56,3 @@ exports.mapRange = mapRange;
56
56
  // eslint-disable-next-line no-bitwise
57
57
  const isEnabledOnBitmap = (bitmap, assetId) => (BigInt(bitmap) >> BigInt(assetId)) & BigInt(1);
58
58
  exports.isEnabledOnBitmap = isEnabledOnBitmap;
59
- exports.MAXUINT = '115792089237316195423570985008687907853269984665640564039457584007913129639935';
60
- const isMaxuint = (amount) => (0, exports.compareAddresses)(exports.MAXUINT, amount);
61
- exports.isMaxuint = isMaxuint;
@@ -0,0 +1,222 @@
1
+ /// <reference types="node" />
2
+ import type BN from "bn.js";
3
+ import type { ContractOptions } from "web3-eth-contract";
4
+ import type { EventLog } from "web3-core";
5
+ import type { EventEmitter } from "events";
6
+ import type { Callback, NonPayableTransactionObject, BlockType, BaseContract } from "./types";
7
+ export interface EventOptions {
8
+ filter?: object;
9
+ fromBlock?: BlockType;
10
+ topics?: string[];
11
+ }
12
+ export declare namespace LiquityV2View {
13
+ type MarketDataStruct = [
14
+ string,
15
+ number | string | BN,
16
+ number | string | BN,
17
+ number | string | BN,
18
+ number | string | BN,
19
+ number | string | BN,
20
+ number | string | BN,
21
+ number | string | BN,
22
+ string,
23
+ string,
24
+ string,
25
+ string,
26
+ string,
27
+ string,
28
+ string,
29
+ string,
30
+ string,
31
+ number | string | BN,
32
+ boolean
33
+ ] | {
34
+ market: string;
35
+ CCR: number | string | BN;
36
+ MCR: number | string | BN;
37
+ SCR: number | string | BN;
38
+ LIQUIDATION_PENALTY_SP: number | string | BN;
39
+ LIQUIDATION_PENALTY_REDISTRIBUTION: number | string | BN;
40
+ entireSystemColl: number | string | BN;
41
+ entireSystemDebt: number | string | BN;
42
+ collToken: string;
43
+ troveNFT: string;
44
+ borrowerOperations: string;
45
+ troveManager: string;
46
+ stabilityPool: string;
47
+ sortedTroves: string;
48
+ collSurplusPool: string;
49
+ hintHelpers: string;
50
+ priceFeed: string;
51
+ collPrice: number | string | BN;
52
+ isShutDown: boolean;
53
+ };
54
+ type MarketDataStructOutputArray = [
55
+ string,
56
+ string,
57
+ string,
58
+ string,
59
+ string,
60
+ string,
61
+ string,
62
+ string,
63
+ string,
64
+ string,
65
+ string,
66
+ string,
67
+ string,
68
+ string,
69
+ string,
70
+ string,
71
+ string,
72
+ string,
73
+ boolean
74
+ ];
75
+ type MarketDataStructOutputStruct = {
76
+ market: string;
77
+ CCR: string;
78
+ MCR: string;
79
+ SCR: string;
80
+ LIQUIDATION_PENALTY_SP: string;
81
+ LIQUIDATION_PENALTY_REDISTRIBUTION: string;
82
+ entireSystemColl: string;
83
+ entireSystemDebt: string;
84
+ collToken: string;
85
+ troveNFT: string;
86
+ borrowerOperations: string;
87
+ troveManager: string;
88
+ stabilityPool: string;
89
+ sortedTroves: string;
90
+ collSurplusPool: string;
91
+ hintHelpers: string;
92
+ priceFeed: string;
93
+ collPrice: string;
94
+ isShutDown: boolean;
95
+ };
96
+ type MarketDataStructOutput = MarketDataStructOutputArray & MarketDataStructOutputStruct;
97
+ type TroveDataStruct = [
98
+ number | string | BN,
99
+ string,
100
+ string,
101
+ number | string | BN,
102
+ number | string | BN,
103
+ number | string | BN,
104
+ number | string | BN,
105
+ number | string | BN,
106
+ number | string | BN,
107
+ string,
108
+ number | string | BN
109
+ ] | {
110
+ troveId: number | string | BN;
111
+ owner: string;
112
+ collToken: string;
113
+ status: number | string | BN;
114
+ collAmount: number | string | BN;
115
+ debtAmount: number | string | BN;
116
+ collPrice: number | string | BN;
117
+ TCRatio: number | string | BN;
118
+ annualInterestRate: number | string | BN;
119
+ interestBatchManager: string;
120
+ batchDebtShares: number | string | BN;
121
+ };
122
+ type TroveDataStructOutputArray = [
123
+ string,
124
+ string,
125
+ string,
126
+ string,
127
+ string,
128
+ string,
129
+ string,
130
+ string,
131
+ string,
132
+ string,
133
+ string
134
+ ];
135
+ type TroveDataStructOutputStruct = {
136
+ troveId: string;
137
+ owner: string;
138
+ collToken: string;
139
+ status: string;
140
+ collAmount: string;
141
+ debtAmount: string;
142
+ collPrice: string;
143
+ TCRatio: string;
144
+ annualInterestRate: string;
145
+ interestBatchManager: string;
146
+ batchDebtShares: string;
147
+ };
148
+ type TroveDataStructOutput = TroveDataStructOutputArray & TroveDataStructOutputStruct;
149
+ }
150
+ export interface LiquityV2View extends BaseContract {
151
+ constructor(jsonInterface: any[], address?: string, options?: ContractOptions): LiquityV2View;
152
+ clone(): LiquityV2View;
153
+ methods: {
154
+ findInsertPosition(_market: string, _interestRate: number | string | BN, _prevId: number | string | BN, _nextId: number | string | BN): NonPayableTransactionObject<[
155
+ string,
156
+ string
157
+ ] & {
158
+ prevId: string;
159
+ nextId: string;
160
+ }>;
161
+ getApproxHint(_market: string, _collIndex: number | string | BN, _interestRate: number | string | BN, _numTrials: number | string | BN, _inputRandomSeed: number | string | BN): NonPayableTransactionObject<[
162
+ string,
163
+ string,
164
+ string
165
+ ] & {
166
+ hintId: string;
167
+ diff: string;
168
+ latestRandomSeed: string;
169
+ }>;
170
+ getDebtInFront(_market: string, _troveId: number | string | BN, _acc: number | string | BN, _iterations: number | string | BN): NonPayableTransactionObject<[
171
+ string,
172
+ string
173
+ ] & {
174
+ next: string;
175
+ debt: string;
176
+ }>;
177
+ getDebtInFrontByInterestRate(_market: string, _troveId: number | string | BN, _acc: number | string | BN, _iterations: number | string | BN, _targetIR: number | string | BN): NonPayableTransactionObject<[
178
+ string,
179
+ string
180
+ ] & {
181
+ next: string;
182
+ debt: string;
183
+ }>;
184
+ getDebtInFrontByTroveNum(_market: string, _numTroves: number | string | BN): NonPayableTransactionObject<string>;
185
+ getDepositorInfo(_market: string, _depositor: string): NonPayableTransactionObject<[
186
+ string,
187
+ string,
188
+ string
189
+ ] & {
190
+ compoundedBOLD: string;
191
+ collGain: string;
192
+ boldGain: string;
193
+ }>;
194
+ getInsertPosition(_market: string, _collIndex: number | string | BN, _interestRate: number | string | BN, _numTrials: number | string | BN, _inputRandomSeed: number | string | BN): NonPayableTransactionObject<[
195
+ string,
196
+ string
197
+ ] & {
198
+ prevId: string;
199
+ nextId: string;
200
+ }>;
201
+ getMarketData(_market: string): NonPayableTransactionObject<LiquityV2View.MarketDataStructOutput>;
202
+ getNumOfTrovesInFrontOfTrove(_market: string, _troveId: number | string | BN, _iterations: number | string | BN): NonPayableTransactionObject<[
203
+ string,
204
+ string
205
+ ] & {
206
+ next: string;
207
+ numTroves: string;
208
+ }>;
209
+ getTroveInfo(_market: string, _troveId: number | string | BN): NonPayableTransactionObject<LiquityV2View.TroveDataStructOutput>;
210
+ getTrovePosition(_market: string, _collIndex: number | string | BN, _troveId: number | string | BN, _numTrials: number | string | BN, _inputRandomSeed: number | string | BN): NonPayableTransactionObject<[
211
+ string,
212
+ string
213
+ ] & {
214
+ prevId: string;
215
+ nextId: string;
216
+ }>;
217
+ isShutDown(_market: string): NonPayableTransactionObject<boolean>;
218
+ };
219
+ events: {
220
+ allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
221
+ };
222
+ }
@@ -26,7 +26,6 @@ export type { CompoundLoanInfo } from "./CompoundLoanInfo";
26
26
  export type { Comptroller } from "./Comptroller";
27
27
  export type { ETHPriceFeed } from "./ETHPriceFeed";
28
28
  export type { Erc20 } from "./Erc20";
29
- export type { EulerV2View } from "./EulerV2View";
30
29
  export type { FeedRegistry } from "./FeedRegistry";
31
30
  export type { GHO } from "./GHO";
32
31
  export type { GhoDiscountRateStrategy } from "./GhoDiscountRateStrategy";
@@ -35,6 +34,7 @@ export type { IVariableDebtToken } from "./IVariableDebtToken";
35
34
  export type { LendingPoolAddressesProvider } from "./LendingPoolAddressesProvider";
36
35
  export type { Lido } from "./Lido";
37
36
  export type { LiquityActivePool } from "./LiquityActivePool";
37
+ export type { LiquityV2View } from "./LiquityV2View";
38
38
  export type { LiquityView } from "./LiquityView";
39
39
  export type { LlamaLendControllerAbi } from "./LlamaLendControllerAbi";
40
40
  export type { LlamaLendView } from "./LlamaLendView";
@@ -3,8 +3,8 @@ export * from './compound';
3
3
  export * from './spark';
4
4
  export * from './curveUsd';
5
5
  export * from './liquity';
6
+ export * from './liquityV2';
6
7
  export * from './maker';
7
8
  export * from './chickenBonds';
8
9
  export * from './morphoBlue';
9
10
  export * from './llamaLend';
10
- export * from './euler';
@@ -19,8 +19,8 @@ __exportStar(require("./compound"), exports);
19
19
  __exportStar(require("./spark"), exports);
20
20
  __exportStar(require("./curveUsd"), exports);
21
21
  __exportStar(require("./liquity"), exports);
22
+ __exportStar(require("./liquityV2"), exports);
22
23
  __exportStar(require("./maker"), exports);
23
24
  __exportStar(require("./chickenBonds"), exports);
24
25
  __exportStar(require("./morphoBlue"), exports);
25
26
  __exportStar(require("./llamaLend"), exports);
26
- __exportStar(require("./euler"), exports);
@@ -0,0 +1,81 @@
1
+ import { EthAddress, NetworkNumber } from './common';
2
+ export declare enum LiquityV2Versions {
3
+ LiquityV2Eth = "liquityv2eth",
4
+ LiquityV2WstEth = "liquityv2wsteth"
5
+ }
6
+ export interface LiquityV2MarketInfo {
7
+ chainIds: NetworkNumber[];
8
+ label: string;
9
+ shortLabel: string;
10
+ url: string;
11
+ value: LiquityV2Versions;
12
+ debtToken: string;
13
+ collateralToken: string;
14
+ marketAddress: string;
15
+ protocolName: string;
16
+ }
17
+ export interface LiquityV2AssetData {
18
+ symbol: string;
19
+ address: string;
20
+ price: string;
21
+ incentiveSupplyApy?: string;
22
+ incentiveSupplyToken?: string;
23
+ totalSupply: string;
24
+ totalBorrow: string;
25
+ canBeSupplied: boolean;
26
+ canBeBorrowed: boolean;
27
+ }
28
+ export type LiquityV2AssetsData = {
29
+ [key: string]: LiquityV2AssetData;
30
+ };
31
+ export interface InnerLiquityV2MarketData {
32
+ minRatio: string;
33
+ }
34
+ export interface LiquityV2MarketData {
35
+ assetsData: LiquityV2AssetsData;
36
+ marketData: InnerLiquityV2MarketData;
37
+ }
38
+ export interface LiquityV2UsedAsset {
39
+ symbol: string;
40
+ address: string;
41
+ price: string;
42
+ supplied: string;
43
+ suppliedUsd: string;
44
+ borrowed: string;
45
+ borrowedUsd: string;
46
+ isSupplied: boolean;
47
+ isBorrowed: boolean;
48
+ }
49
+ export type LiquityV2UsedAssets = {
50
+ [key: string]: LiquityV2UsedAsset;
51
+ };
52
+ export interface LiquityV2AggregatedTroveData {
53
+ suppliedUsd: string;
54
+ borrowedUsd: string;
55
+ borrowLimitUsd: string;
56
+ leftToBorrowUsd: string;
57
+ netApy: string;
58
+ incentiveUsd: string;
59
+ totalInterestUsd: string;
60
+ leveragedType: string;
61
+ leveragedAsset: string;
62
+ liquidationPrice: string;
63
+ }
64
+ export interface LiquityV2TroveData {
65
+ usedAssets: LiquityV2UsedAssets;
66
+ troveId: string;
67
+ ratio: string;
68
+ interestRate: string;
69
+ leftToBorrowUsd: string;
70
+ borrowLimitUsd: string;
71
+ suppliedUsd: string;
72
+ borrowedUsd: string;
73
+ netApy: string;
74
+ incentiveUsd: string;
75
+ totalInterestUsd: string;
76
+ interestBatchManager: EthAddress;
77
+ troveStatus: string;
78
+ leveragedType: string;
79
+ leveragedAsset: string;
80
+ liquidationPrice: string;
81
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LiquityV2Versions = void 0;
4
+ var LiquityV2Versions;
5
+ (function (LiquityV2Versions) {
6
+ LiquityV2Versions["LiquityV2Eth"] = "liquityv2eth";
7
+ LiquityV2Versions["LiquityV2WstEth"] = "liquityv2wsteth";
8
+ })(LiquityV2Versions || (exports.LiquityV2Versions = LiquityV2Versions = {}));
@@ -6696,7 +6696,7 @@ export namespace LlamaLendControllerAbi {
6696
6696
  let networks_76: {};
6697
6697
  export { networks_76 as networks };
6698
6698
  }
6699
- export namespace EulerV2View {
6699
+ export namespace LiquityV2View {
6700
6700
  let abi_77: ({
6701
6701
  inputs: {
6702
6702
  internalType: string;
@@ -6713,46 +6713,17 @@ export namespace EulerV2View {
6713
6713
  type: string;
6714
6714
  } | {
6715
6715
  inputs: {
6716
- components: {
6717
- internalType: string;
6718
- name: string;
6719
- type: string;
6720
- }[];
6721
6716
  internalType: string;
6722
6717
  name: string;
6723
6718
  type: string;
6724
6719
  }[];
6725
6720
  name: string;
6726
6721
  outputs: {
6727
- internalType: string;
6728
- name: string;
6729
- type: string;
6730
- }[];
6731
- stateMutability: string;
6732
- type: string;
6733
- } | {
6734
- inputs: {
6735
- internalType: string;
6736
- name: string;
6737
- type: string;
6738
- }[];
6739
- name: string;
6740
- outputs: {
6741
- components: ({
6742
- internalType: string;
6743
- name: string;
6744
- type: string;
6745
- components?: undefined;
6746
- } | {
6747
- components: {
6748
- internalType: string;
6749
- name: string;
6750
- type: string;
6751
- }[];
6722
+ components: {
6752
6723
  internalType: string;
6753
6724
  name: string;
6754
6725
  type: string;
6755
- })[];
6726
+ }[];
6756
6727
  internalType: string;
6757
6728
  name: string;
6758
6729
  type: string;