impermax-sdk 2.1.127 → 2.1.129
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/lib/index.d.ts +3 -3
- package/lib/index.js +3 -1
- package/lib/offchain/account/offchainAccount.js +1 -1
- package/lib/offchain/initializer/lendingPools.js +1 -1
- package/lib/offchain/initializer/user/lendingPools.js +1 -1
- package/lib/offchain/lendingPool/offchainBorrowable.d.ts +1 -0
- package/lib/offchain/lendingPool/offchainBorrowable.js +7 -0
- package/lib/offchain/offchainTypes.d.ts +1 -1
- package/lib/offchain/offchainTypes.js +3 -3
- package/lib/onchain/configManager/onchainPairConfig.d.ts +6 -3
- package/lib/onchain/configManager/onchainPairConfig.js +6 -2
- package/lib/onchain/onchainTypes.d.ts +10 -1
- package/lib/onchain/onchainTypes.js +9 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ import { FarmIndex, Farms, getFarmByStakedLPFactory, hrFarms, STAKED_LP_FACTORY
|
|
|
19
19
|
import { APPROVE_AMOUNT, DEADLINE, NOT_SYNCED, ZERO } from './config/general';
|
|
20
20
|
import { BLOCKS_SUBGRAPH_URL, IMPERMAX_CHEF_SUBGRAPH_URL, IMPERMAX_SUBGRAPH_URL, XIMX_SUBGRAPH_URL } from './config/subgraphs';
|
|
21
21
|
import { Address, AddressIndex, AmmIndex, DistributorDetails, Factory, Extension, FactoryIndex, LendingPoolIndex, NetworkFactoryIndex, NetworkIndex, Networks, PoolTokenType, ProposalState, WhitelistState, VaultType, Borrowable } from './config/types';
|
|
22
|
-
import { AirdropData, ApprovalType, Changes, Contract, OnchainConfig, NO_CHANGES, PendingRewardUI, PermitData, Values, CollateralConfig,
|
|
23
|
-
import { BorrowableData, BorrowablePastData, BorrowPosition, CollateralData, CollateralPosition, FarmingPoolData, LendingPoolData, LendingPoolPastData, PairData, PoolTokenData, RewardData, SupplyPosition, TokenData, TvlData, UserData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata } from './offchain/offchainTypes';
|
|
22
|
+
import { AirdropData, ApprovalType, Changes, Contract, OnchainConfig, NO_CHANGES, PendingRewardUI, PermitData, Values, CollateralConfig, BorrowableV2Config, BorrowableV3Config, PairConfig, Permits, Permit, PermitType } from './onchain/onchainTypes';
|
|
23
|
+
import { BorrowableData, BorrowablePastData, BorrowPosition, CollateralData, CollateralPosition, FarmingPoolData, LendingPoolData, LendingPoolPastData, PairData, PoolTokenData, RewardData, SupplyPosition, TokenData, TvlData, UserData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata, isV3Factory } from './offchain/offchainTypes';
|
|
24
24
|
import { OffchainBorrowable, OffchainCollateral } from './offchain/lendingPool';
|
|
25
25
|
import OffchainConfigManager, { OffchainPairConfig, OffchainProposal } from './offchain/configManager';
|
|
26
26
|
import OffchainAccountLendingPool, { OffchainAccountBorrowable, OffchainAccountCollateral, OffchainLeveragedPosition } from './offchain/account/lendingPool';
|
|
@@ -42,4 +42,4 @@ import { decimalToBalance } from './utils/ether-utils';
|
|
|
42
42
|
import OffchainAccountLendingPoolV3 from "./offchain/account/lendingPool/offchainAccountLendingPoolV3";
|
|
43
43
|
import OffchainAccountNftlpUniswapV3 from './offchain/account/lendingPool/nftlp/offchainAccountNftlpUniswapV3';
|
|
44
44
|
import { MAX_TICK, MIN_TICK, formatPriceSqrtX96, uniV3TickToPrice } from "./utils/nftlpMath/uniswapV3General";
|
|
45
|
-
export { offchain, OffchainMultichain, Offchain, OffchainLendingPool, OffchainPoolToken, OffchainCollateral, OffchainBorrowable, OffchainVault, OffchainLeveragedVault, OffchainLendingVault, OffchainHedgedVault, OffchainConfigManager, OffchainPairConfig, OffchainProposal, OffchainMultichainAccount, OffchainAccount, OffchainAccountLendingPool, OffchainAccountPoolToken, OffchainAccountCollateral, OffchainAccountBorrowable, OffchainLeveragedPosition, OffchainAccountVault, OffchainPriceHelper, OffchainSolidexHelper, PoolTokenData, BorrowableData, CollateralData, BorrowablePastData, TokenData, RewardData, PairData, FarmingPoolData, LendingPoolPastData, LendingPoolData, CollateralPosition, SupplyPosition, BorrowPosition, UserData, TvlData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata, VaultRisk, VaultType, onchain, Onchain, OnchainLendingPool, OnchainPoolToken, OnchainBorrowable, OnchainCollateral, OnchainLendingVault, OnchainConfigManager, OnchainProposal, OnchainPairConfig, OnchainAccount, OnchainAccountLendingPool, OnchainAccountPoolToken, OnchainAccountBorrowable, OnchainAccountCollateral, OnchainAccountLendingVault, OnchainContractsHelper, OnchainImpermaxFactory, OnchainInteractions, OnchainInteractionsLendingPool, OnchainInteractionsPoolToken, OnchainInteractionsCollateral, OnchainInteractionsBorrowable, OnchainInteractionsLendingVault, OnchainInteractionsConfigManager, Contract, ApprovalType, PermitData, OnchainConfig, Changes, NO_CHANGES, Values, AirdropData, PendingRewardUI, CollateralConfig,
|
|
45
|
+
export { offchain, OffchainMultichain, Offchain, OffchainLendingPool, OffchainPoolToken, OffchainCollateral, OffchainBorrowable, OffchainVault, OffchainLeveragedVault, OffchainLendingVault, OffchainHedgedVault, OffchainConfigManager, OffchainPairConfig, OffchainProposal, OffchainMultichainAccount, OffchainAccount, OffchainAccountLendingPool, OffchainAccountPoolToken, OffchainAccountCollateral, OffchainAccountBorrowable, OffchainLeveragedPosition, OffchainAccountVault, OffchainPriceHelper, OffchainSolidexHelper, PoolTokenData, BorrowableData, CollateralData, BorrowablePastData, TokenData, RewardData, PairData, FarmingPoolData, LendingPoolPastData, LendingPoolData, CollateralPosition, SupplyPosition, BorrowPosition, UserData, TvlData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata, VaultRisk, VaultType, onchain, Onchain, OnchainLendingPool, OnchainPoolToken, OnchainBorrowable, OnchainCollateral, OnchainLendingVault, OnchainConfigManager, OnchainProposal, OnchainPairConfig, OnchainAccount, OnchainAccountLendingPool, OnchainAccountPoolToken, OnchainAccountBorrowable, OnchainAccountCollateral, OnchainAccountLendingVault, OnchainContractsHelper, OnchainImpermaxFactory, OnchainInteractions, OnchainInteractionsLendingPool, OnchainInteractionsPoolToken, OnchainInteractionsCollateral, OnchainInteractionsBorrowable, OnchainInteractionsLendingVault, OnchainInteractionsConfigManager, Contract, ApprovalType, PermitData, OnchainConfig, Changes, NO_CHANGES, Values, AirdropData, PendingRewardUI, CollateralConfig, BorrowableV2Config, BorrowableV3Config, PairConfig, CLAIM_AGGREGATOR, IMPERMAX_CHEF, IMX, IMPERMAX_FACTORY, getNetworkFactories, getFactoryByAddress, LENDING_VAULT_WATCHER, MERKLE_DISTRIBUTOR_IBEX, MERKLE_DISTRIBUTOR_IBEX_2, MERKLE_DISTRIBUTOR_ETH, ROUTER, SIMPLE_UNISWAP_ORACLE, WETH, MERKLE_URL_ETH, MERKLE_URL_IBEX, MERKLE_URL_IBEX_2, hrAmms, AMM_FACTORY, getAmmByFactory, AMM_SUBGRAPH_URLS, ADD_LIQUIDITY_URLS, AMM_LP_FEE, DEBANK_IDS, ETH_SYMBOL, ETH_NAME, SOLIDEX_FACTORIES, BORROW_FEE_FACTORIES, OLD_KINK_MULTIPLIER_FACTORIES, LIQUIDATION_FEE_FACTORIES, V2_FACTORIES, Farms, hrFarms, FarmIndex, STAKED_LP_FACTORY, getFarmByStakedLPFactory, NOT_SYNCED, DEADLINE, ZERO, APPROVE_AMOUNT, IMPERMAX_SUBGRAPH_URL, IMPERMAX_CHEF_SUBGRAPH_URL, BLOCKS_SUBGRAPH_URL, XIMX_SUBGRAPH_URL, Networks, Factory, Extension, PoolTokenType, Amms, Address, NetworkIndex, FactoryIndex, AddressIndex, NetworkFactoryIndex, LendingPoolIndex, AmmIndex, DistributorDetails, ProposalState, WhitelistState, VaultListOrderBy, VaultListParams, LendingPoolListOrderBy, LendingPoolListParams, SortDirection, LendingPoolVersion, PositionType, AccountPosition, PermitType, Permits, Permit, Borrowable, OnchainInteractionsLendingPoolV3, OnchainInteractionsNftlpUniswapV3, decimalToBalance, OffchainAccountLendingPoolV3, OffchainAccountNftlpUniswapV3, MAX_TICK, MIN_TICK, formatPriceSqrtX96, uniV3TickToPrice, isV3Factory };
|
package/lib/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.OnchainInteractionsLendingVault = exports.OnchainInteractionsBorrowable = exports.OnchainInteractionsCollateral = exports.OnchainInteractionsPoolToken = exports.OnchainInteractionsLendingPool = exports.OnchainInteractions = exports.OnchainImpermaxFactory = exports.OnchainContractsHelper = exports.OnchainAccountLendingVault = exports.OnchainAccountCollateral = exports.OnchainAccountBorrowable = exports.OnchainAccountPoolToken = exports.OnchainAccountLendingPool = exports.OnchainAccount = exports.OnchainPairConfig = exports.OnchainProposal = exports.OnchainConfigManager = exports.OnchainLendingVault = exports.OnchainCollateral = exports.OnchainBorrowable = exports.OnchainPoolToken = exports.OnchainLendingPool = exports.Onchain = exports.onchain = exports.VaultType = exports.VaultRisk = exports.OffchainSolidexHelper = exports.OffchainPriceHelper = exports.OffchainAccountVault = exports.OffchainLeveragedPosition = exports.OffchainAccountBorrowable = exports.OffchainAccountCollateral = exports.OffchainAccountPoolToken = exports.OffchainAccountLendingPool = exports.OffchainAccount = exports.OffchainMultichainAccount = exports.OffchainProposal = exports.OffchainPairConfig = exports.OffchainConfigManager = exports.OffchainHedgedVault = exports.OffchainLendingVault = exports.OffchainLeveragedVault = exports.OffchainVault = exports.OffchainBorrowable = exports.OffchainCollateral = exports.OffchainPoolToken = exports.OffchainLendingPool = exports.Offchain = exports.OffchainMultichain = exports.offchain = void 0;
|
|
30
30
|
exports.Amms = exports.PoolTokenType = exports.Extension = exports.Factory = exports.Networks = exports.XIMX_SUBGRAPH_URL = exports.BLOCKS_SUBGRAPH_URL = exports.IMPERMAX_CHEF_SUBGRAPH_URL = exports.IMPERMAX_SUBGRAPH_URL = exports.APPROVE_AMOUNT = exports.ZERO = exports.DEADLINE = exports.NOT_SYNCED = exports.getFarmByStakedLPFactory = exports.STAKED_LP_FACTORY = exports.hrFarms = exports.Farms = exports.V2_FACTORIES = exports.LIQUIDATION_FEE_FACTORIES = exports.OLD_KINK_MULTIPLIER_FACTORIES = exports.BORROW_FEE_FACTORIES = exports.SOLIDEX_FACTORIES = exports.ETH_NAME = exports.ETH_SYMBOL = exports.DEBANK_IDS = exports.AMM_LP_FEE = exports.ADD_LIQUIDITY_URLS = exports.AMM_SUBGRAPH_URLS = exports.getAmmByFactory = exports.AMM_FACTORY = exports.hrAmms = exports.MERKLE_URL_IBEX_2 = exports.MERKLE_URL_IBEX = exports.MERKLE_URL_ETH = exports.WETH = exports.SIMPLE_UNISWAP_ORACLE = exports.ROUTER = exports.MERKLE_DISTRIBUTOR_ETH = exports.MERKLE_DISTRIBUTOR_IBEX_2 = exports.MERKLE_DISTRIBUTOR_IBEX = exports.LENDING_VAULT_WATCHER = exports.getFactoryByAddress = exports.getNetworkFactories = exports.IMPERMAX_FACTORY = exports.IMX = exports.IMPERMAX_CHEF = exports.CLAIM_AGGREGATOR = exports.NO_CHANGES = exports.ApprovalType = exports.OnchainInteractionsConfigManager = void 0;
|
|
31
|
-
exports.uniV3TickToPrice = exports.formatPriceSqrtX96 = exports.MIN_TICK = exports.MAX_TICK = exports.OffchainAccountNftlpUniswapV3 = exports.OffchainAccountLendingPoolV3 = exports.decimalToBalance = exports.OnchainInteractionsNftlpUniswapV3 = exports.OnchainInteractionsLendingPoolV3 = exports.Borrowable = exports.PermitType = exports.PositionType = exports.LendingPoolVersion = exports.SortDirection = exports.LendingPoolListOrderBy = exports.VaultListOrderBy = exports.WhitelistState = exports.ProposalState = void 0;
|
|
31
|
+
exports.isV3Factory = exports.uniV3TickToPrice = exports.formatPriceSqrtX96 = exports.MIN_TICK = exports.MAX_TICK = exports.OffchainAccountNftlpUniswapV3 = exports.OffchainAccountLendingPoolV3 = exports.decimalToBalance = exports.OnchainInteractionsNftlpUniswapV3 = exports.OnchainInteractionsLendingPoolV3 = exports.Borrowable = exports.PermitType = exports.PositionType = exports.LendingPoolVersion = exports.SortDirection = exports.LendingPoolListOrderBy = exports.VaultListOrderBy = exports.WhitelistState = exports.ProposalState = void 0;
|
|
32
32
|
const offchain_1 = __importStar(require("./offchain"));
|
|
33
33
|
exports.Offchain = offchain_1.default;
|
|
34
34
|
Object.defineProperty(exports, "OffchainAccount", { enumerable: true, get: function () { return offchain_1.OffchainAccount; } });
|
|
@@ -120,6 +120,8 @@ const onchainTypes_1 = require("./onchain/onchainTypes");
|
|
|
120
120
|
Object.defineProperty(exports, "ApprovalType", { enumerable: true, get: function () { return onchainTypes_1.ApprovalType; } });
|
|
121
121
|
Object.defineProperty(exports, "NO_CHANGES", { enumerable: true, get: function () { return onchainTypes_1.NO_CHANGES; } });
|
|
122
122
|
Object.defineProperty(exports, "PermitType", { enumerable: true, get: function () { return onchainTypes_1.PermitType; } });
|
|
123
|
+
const offchainTypes_1 = require("./offchain/offchainTypes");
|
|
124
|
+
Object.defineProperty(exports, "isV3Factory", { enumerable: true, get: function () { return offchainTypes_1.isV3Factory; } });
|
|
123
125
|
const lendingPool_1 = require("./offchain/lendingPool");
|
|
124
126
|
Object.defineProperty(exports, "OffchainBorrowable", { enumerable: true, get: function () { return lendingPool_1.OffchainBorrowable; } });
|
|
125
127
|
Object.defineProperty(exports, "OffchainCollateral", { enumerable: true, get: function () { return lendingPool_1.OffchainCollateral; } });
|
|
@@ -148,7 +148,7 @@ class OffchainAccount {
|
|
|
148
148
|
return result;
|
|
149
149
|
for (const factory in userData) {
|
|
150
150
|
// Check for V3 explicitely, not necesary since `positions` doesn't exist in v2
|
|
151
|
-
if (!(0, offchainTypes_1.
|
|
151
|
+
if (!(0, offchainTypes_1.isV3Factory)(factory))
|
|
152
152
|
continue;
|
|
153
153
|
result[factory] = [];
|
|
154
154
|
const collateralPositions = userData[factory].positions;
|
|
@@ -72,7 +72,7 @@ function initializeLendingPoolsData() {
|
|
|
72
72
|
for (const factory in lendingPools) {
|
|
73
73
|
for (const lendingPool of lendingPools[factory]) {
|
|
74
74
|
// WARN: Quick temporary fix, to be removed after
|
|
75
|
-
if ((0, offchainTypes_1.
|
|
75
|
+
if ((0, offchainTypes_1.isV3Factory)(factory))
|
|
76
76
|
lendingPool["pair"] = lendingPool["nftlp"];
|
|
77
77
|
lendingPool.pair.uniswapAPR = 0;
|
|
78
78
|
if (impermaxChefRewardRates) {
|
|
@@ -48,7 +48,7 @@ function initializeUserData(account) {
|
|
|
48
48
|
borrowPositions: {},
|
|
49
49
|
};
|
|
50
50
|
// Get collateral/borrow positions for V2/V3
|
|
51
|
-
if ((0, offchainTypes_1.
|
|
51
|
+
if ((0, offchainTypes_1.isV3Factory)(factory)) {
|
|
52
52
|
const v3Data = yield (0, positionsV3_1.initializeV3Positions)(this, factory, userDataOfFactory);
|
|
53
53
|
result[factory].positions = v3Data.positions;
|
|
54
54
|
}
|
|
@@ -17,6 +17,7 @@ export default class OffchainBorrowable extends OffchainPoolToken {
|
|
|
17
17
|
getKinkUtilizationRate(): Promise<number>;
|
|
18
18
|
getAdjustSpeed(): Promise<number>;
|
|
19
19
|
getBorrowTracker(): Promise<Address>;
|
|
20
|
+
getDebtCeiling(): Promise<Address>;
|
|
20
21
|
getBorrowIndex(): Promise<number>;
|
|
21
22
|
getAccrualTimestamp(): Promise<number>;
|
|
22
23
|
getTotalBorrows(): Promise<number>;
|
|
@@ -141,6 +141,13 @@ class OffchainBorrowable extends offchainPoolToken_1.default {
|
|
|
141
141
|
return borrowTracker !== null && borrowTracker !== void 0 ? borrowTracker : "0x0000000000000000000000000000000000000000";
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
+
// Debt deciling
|
|
145
|
+
getDebtCeiling() {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
const debtCeiling = yield this.getPoolTokenParam("debtCeiling");
|
|
148
|
+
return debtCeiling !== null && debtCeiling !== void 0 ? debtCeiling : Number.POSITIVE_INFINITY;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
144
151
|
// Borrow Index
|
|
145
152
|
getBorrowIndex() {
|
|
146
153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, AddressIndex, PoolTokenType, ProposalState, WhitelistState, VaultType } from '../config/types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const isV3Factory: (factory: string) => boolean;
|
|
3
3
|
export interface TokenData {
|
|
4
4
|
id: Address;
|
|
5
5
|
symbol: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isV3Factory = void 0;
|
|
4
4
|
const types_1 = require("../config/types");
|
|
5
5
|
// Condition mgiht need to be reworked but enough for now
|
|
6
|
-
const
|
|
7
|
-
exports.
|
|
6
|
+
const isV3Factory = (factory) => Number(factory) >= 8;
|
|
7
|
+
exports.isV3Factory = isV3Factory;
|
|
@@ -21,18 +21,21 @@ export default class OnchainPairConfig {
|
|
|
21
21
|
getReserveFactor: () => Promise<number>;
|
|
22
22
|
getKinkUtilizationRate: () => Promise<number>;
|
|
23
23
|
getAdjustSpeed: () => Promise<number>;
|
|
24
|
-
getBorrowTracker: () => Promise<Address>;
|
|
24
|
+
getBorrowTracker: () => Promise<Address | undefined>;
|
|
25
|
+
getDebtCeiling: () => Promise<string | undefined>;
|
|
25
26
|
};
|
|
26
27
|
getBorrowableA: () => {
|
|
27
28
|
getReserveFactor: () => Promise<number>;
|
|
28
29
|
getKinkUtilizationRate: () => Promise<number>;
|
|
29
30
|
getAdjustSpeed: () => Promise<number>;
|
|
30
|
-
getBorrowTracker: () => Promise<Address>;
|
|
31
|
+
getBorrowTracker: () => Promise<Address | undefined>;
|
|
32
|
+
getDebtCeiling: () => Promise<string | undefined>;
|
|
31
33
|
};
|
|
32
34
|
getBorrowableB: () => {
|
|
33
35
|
getReserveFactor: () => Promise<number>;
|
|
34
36
|
getKinkUtilizationRate: () => Promise<number>;
|
|
35
37
|
getAdjustSpeed: () => Promise<number>;
|
|
36
|
-
getBorrowTracker: () => Promise<Address>;
|
|
38
|
+
getBorrowTracker: () => Promise<Address | undefined>;
|
|
39
|
+
getDebtCeiling: () => Promise<string | undefined>;
|
|
37
40
|
};
|
|
38
41
|
}
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const types_1 = require("../../config/types");
|
|
13
13
|
const impermax_factories_1 = require("../../config/contracts/impermax-factories");
|
|
14
|
+
const onchainTypes_1 = require("../onchainTypes");
|
|
14
15
|
class OnchainPairConfig {
|
|
15
16
|
constructor(proposal, pairConfig) {
|
|
16
17
|
this.getProposal = () => this.proposal;
|
|
@@ -36,7 +37,7 @@ class OnchainPairConfig {
|
|
|
36
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
38
|
if (!this.lendingPool)
|
|
38
39
|
this.lendingPool = (() => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const impermaxFactory =
|
|
40
|
+
const impermaxFactory = this.getOnchain().getImpermaxFactory(yield this.getFactory());
|
|
40
41
|
return impermaxFactory.getLendingPool(yield this.getPairAddress());
|
|
41
42
|
}))();
|
|
42
43
|
return this.lendingPool;
|
|
@@ -77,7 +78,10 @@ class OnchainPairConfig {
|
|
|
77
78
|
return parseInt(borrowableConfig.adjustSpeed) / 1e18;
|
|
78
79
|
}),
|
|
79
80
|
getBorrowTracker: () => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
return borrowableConfig.borrowTracker;
|
|
81
|
+
return (0, onchainTypes_1.isBorrowableV2Config)(borrowableConfig) ? borrowableConfig.borrowTracker : undefined;
|
|
82
|
+
}),
|
|
83
|
+
getDebtCeiling: () => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
return (0, onchainTypes_1.isBorrowableV3Config)(borrowableConfig) ? borrowableConfig.debtCeiling : undefined;
|
|
81
85
|
}),
|
|
82
86
|
};
|
|
83
87
|
}
|
|
@@ -60,12 +60,19 @@ export interface CollateralConfig {
|
|
|
60
60
|
liquidationIncentive: string;
|
|
61
61
|
liquidationFee: string;
|
|
62
62
|
}
|
|
63
|
-
export interface
|
|
63
|
+
export interface BorrowableV2Config {
|
|
64
64
|
reserveFactor: string;
|
|
65
65
|
kinkUtilizationRate: string;
|
|
66
66
|
adjustSpeed: string;
|
|
67
67
|
borrowTracker: string;
|
|
68
68
|
}
|
|
69
|
+
export interface BorrowableV3Config {
|
|
70
|
+
reserveFactor: string;
|
|
71
|
+
kinkUtilizationRate: string;
|
|
72
|
+
adjustSpeed: string;
|
|
73
|
+
debtCeiling: string;
|
|
74
|
+
}
|
|
75
|
+
export type BorrowableConfig = BorrowableV2Config | BorrowableV3Config;
|
|
69
76
|
export interface PairConfig {
|
|
70
77
|
factory: string;
|
|
71
78
|
pair: string;
|
|
@@ -74,3 +81,5 @@ export interface PairConfig {
|
|
|
74
81
|
borrowable0Config: BorrowableConfig;
|
|
75
82
|
borrowable1Config: BorrowableConfig;
|
|
76
83
|
}
|
|
84
|
+
export declare const isBorrowableV2Config: (config: BorrowableConfig) => config is BorrowableV2Config;
|
|
85
|
+
export declare const isBorrowableV3Config: (config: BorrowableConfig) => config is BorrowableV3Config;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NO_CHANGES = exports.PermitType = exports.ApprovalType = void 0;
|
|
3
|
+
exports.isBorrowableV3Config = exports.isBorrowableV2Config = exports.NO_CHANGES = exports.PermitType = exports.ApprovalType = void 0;
|
|
4
4
|
var ApprovalType;
|
|
5
5
|
(function (ApprovalType) {
|
|
6
6
|
ApprovalType[ApprovalType["POOL_TOKEN"] = 0] = "POOL_TOKEN";
|
|
@@ -19,3 +19,11 @@ exports.NO_CHANGES = {
|
|
|
19
19
|
changeBorrowedB: 0,
|
|
20
20
|
changeCollateral: 0,
|
|
21
21
|
};
|
|
22
|
+
const isBorrowableV2Config = (config) => {
|
|
23
|
+
return 'borrowTracker' in config;
|
|
24
|
+
};
|
|
25
|
+
exports.isBorrowableV2Config = isBorrowableV2Config;
|
|
26
|
+
const isBorrowableV3Config = (config) => {
|
|
27
|
+
return 'debtCeiling' in config;
|
|
28
|
+
};
|
|
29
|
+
exports.isBorrowableV3Config = isBorrowableV3Config;
|