impermax-sdk 2.1.58 → 2.1.60
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 -2
- package/lib/index.js +5 -2
- package/lib/offchain/account/offchainMultichainAccount.d.ts +17 -1
- package/lib/offchain/account/offchainMultichainAccount.js +94 -3
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlp.d.ts +4 -2
- package/lib/onchain/account/lendingPool/nftlp/onchainAccountNftlp.js +3 -2
- package/lib/onchain/account/lendingPool/onchainAccountCollateralV3.d.ts +3 -0
- package/lib/onchain/account/lendingPool/onchainAccountCollateralV3.js +2 -0
- package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV3.d.ts +0 -1
- package/lib/onchain/account/lendingPool/onchainAccountLendingPoolV3.js +1 -2
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlp.d.ts +14 -8
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlp.js +28 -4
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlpUniswapV3.d.ts +8 -9
- package/lib/onchain/impermaxFactory/lendingPool/nftlp/onchainNftlpUniswapV3.js +5 -13
- package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV3.d.ts +3 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainCollateralV3.js +4 -0
- package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV3.d.ts +0 -1
- package/lib/onchain/impermaxFactory/lendingPool/onchainLendingPoolV3.js +1 -4
- package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlp.d.ts +4 -2
- package/lib/onchain/interactions/lendingPool/nftlp/onchainInteractionsNftlp.js +3 -2
- package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV3.d.ts +3 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsCollateralV3.js +2 -0
- package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV3.d.ts +0 -1
- package/lib/onchain/interactions/lendingPool/onchainInteractionsLendingPoolV3.js +1 -2
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as onchain from './onchain';
|
|
|
5
5
|
import { CLAIM_AGGREGATOR } from './config/contracts/claim-aggregators';
|
|
6
6
|
import { IMPERMAX_CHEF } from './config/contracts/impermax-chef';
|
|
7
7
|
import { IMX } from './config/contracts/imxes';
|
|
8
|
-
import { IMPERMAX_FACTORY, getNetworkFactories } from './config/contracts/impermax-factories';
|
|
8
|
+
import { IMPERMAX_FACTORY, getNetworkFactories, getFactoryByAddress } from './config/contracts/impermax-factories';
|
|
9
9
|
import { MERKLE_DISTRIBUTOR_ETH, MERKLE_DISTRIBUTOR_IBEX, MERKLE_DISTRIBUTOR_IBEX_2 } from './config/contracts/merkle-distributors';
|
|
10
10
|
import { MERKLE_URL_ETH, MERKLE_URL_IBEX, MERKLE_URL_IBEX_2 } from './config/endpoints/merkle-distributors';
|
|
11
11
|
import { ROUTER } from './config/contracts/routers';
|
|
@@ -36,4 +36,5 @@ import OffchainVault, { OffchainLendingVault, OffchainLeveragedVault, OffchainHe
|
|
|
36
36
|
import { SortDirection, VaultListOrderBy, VaultListParams, LendingPoolListParams, LendingPoolListOrderBy } from "./offchain/offchainMultichain";
|
|
37
37
|
import { VaultRisk } from "./offchain/vault/offchainVault";
|
|
38
38
|
import { LendingPoolVersion } from "./offchain/lendingPool/offchainLendingPool";
|
|
39
|
-
|
|
39
|
+
import { PositionType, AccountPosition } from "./offchain/account/offchainMultichainAccount";
|
|
40
|
+
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, BorrowableConfig, 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, PoolTokenType, Amms, Address, NetworkIndex, FactoryIndex, AddressIndex, NetworkFactoryIndex, LendingPoolIndex, AmmIndex, DistributorDetails, ProposalState, WhitelistState, VaultListOrderBy, VaultListParams, LendingPoolListOrderBy, LendingPoolListParams, SortDirection, LendingPoolVersion, PositionType, AccountPosition, PermitType, Permits, Permit, Borrowable };
|
package/lib/index.js
CHANGED
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
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;
|
|
27
|
-
exports.
|
|
28
|
-
exports.Borrowable = exports.PermitType = exports.LendingPoolVersion = exports.SortDirection = exports.LendingPoolListOrderBy = exports.VaultListOrderBy = void 0;
|
|
27
|
+
exports.ProposalState = exports.Amms = exports.PoolTokenType = 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;
|
|
28
|
+
exports.Borrowable = exports.PermitType = exports.PositionType = exports.LendingPoolVersion = exports.SortDirection = exports.LendingPoolListOrderBy = exports.VaultListOrderBy = exports.WhitelistState = void 0;
|
|
29
29
|
const offchain_1 = __importStar(require("./offchain"));
|
|
30
30
|
exports.Offchain = offchain_1.default;
|
|
31
31
|
Object.defineProperty(exports, "OffchainAccount", { enumerable: true, get: function () { return offchain_1.OffchainAccount; } });
|
|
@@ -55,6 +55,7 @@ Object.defineProperty(exports, "IMX", { enumerable: true, get: function () { ret
|
|
|
55
55
|
const impermax_factories_1 = require("./config/contracts/impermax-factories");
|
|
56
56
|
Object.defineProperty(exports, "IMPERMAX_FACTORY", { enumerable: true, get: function () { return impermax_factories_1.IMPERMAX_FACTORY; } });
|
|
57
57
|
Object.defineProperty(exports, "getNetworkFactories", { enumerable: true, get: function () { return impermax_factories_1.getNetworkFactories; } });
|
|
58
|
+
Object.defineProperty(exports, "getFactoryByAddress", { enumerable: true, get: function () { return impermax_factories_1.getFactoryByAddress; } });
|
|
58
59
|
const merkle_distributors_1 = require("./config/contracts/merkle-distributors");
|
|
59
60
|
Object.defineProperty(exports, "MERKLE_DISTRIBUTOR_ETH", { enumerable: true, get: function () { return merkle_distributors_1.MERKLE_DISTRIBUTOR_ETH; } });
|
|
60
61
|
Object.defineProperty(exports, "MERKLE_DISTRIBUTOR_IBEX", { enumerable: true, get: function () { return merkle_distributors_1.MERKLE_DISTRIBUTOR_IBEX; } });
|
|
@@ -170,3 +171,5 @@ const offchainVault_1 = require("./offchain/vault/offchainVault");
|
|
|
170
171
|
Object.defineProperty(exports, "VaultRisk", { enumerable: true, get: function () { return offchainVault_1.VaultRisk; } });
|
|
171
172
|
const offchainLendingPool_1 = require("./offchain/lendingPool/offchainLendingPool");
|
|
172
173
|
Object.defineProperty(exports, "LendingPoolVersion", { enumerable: true, get: function () { return offchainLendingPool_1.LendingPoolVersion; } });
|
|
174
|
+
const offchainMultichainAccount_1 = require("./offchain/account/offchainMultichainAccount");
|
|
175
|
+
Object.defineProperty(exports, "PositionType", { enumerable: true, get: function () { return offchainMultichainAccount_1.PositionType; } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, Networks } from "../../config/types";
|
|
1
|
+
import { Address, Factory, Networks } from "../../config/types";
|
|
2
2
|
import OffchainAccountLendingPool from "./lendingPool";
|
|
3
3
|
import OffchainAccountVault from "./vault";
|
|
4
4
|
import OffchainMultichain from "../offchainMultichain";
|
|
@@ -21,6 +21,20 @@ export declare enum VaultPositionsOrderBy {
|
|
|
21
21
|
export interface VaultPositionsParams {
|
|
22
22
|
networks?: Array<Networks>;
|
|
23
23
|
}
|
|
24
|
+
export declare enum PositionType {
|
|
25
|
+
MARKET = "Market",
|
|
26
|
+
VAULT = "Vault",
|
|
27
|
+
OTHER = "Other"
|
|
28
|
+
}
|
|
29
|
+
export type AccountPosition = {
|
|
30
|
+
id: Address;
|
|
31
|
+
network: Networks;
|
|
32
|
+
value: number;
|
|
33
|
+
type: PositionType;
|
|
34
|
+
name: string;
|
|
35
|
+
percentage: number;
|
|
36
|
+
factory: Factory | undefined;
|
|
37
|
+
};
|
|
24
38
|
export default class OffchainMultichainAccount {
|
|
25
39
|
readonly offchainMultichain: OffchainMultichain;
|
|
26
40
|
readonly accountAddress: Address;
|
|
@@ -33,5 +47,7 @@ export default class OffchainMultichainAccount {
|
|
|
33
47
|
getVaultPositions(params?: VaultPositionsParams, orderBy?: VaultPositionsOrderBy): Promise<Array<OffchainAccountVault>>;
|
|
34
48
|
getTotalBalanceUSD(): Promise<number>;
|
|
35
49
|
getVaultsBalanceUSD(): Promise<number>;
|
|
50
|
+
getSupplyBalanceUSD(): Promise<number>;
|
|
51
|
+
getTopPositions(limit?: number): Promise<Array<AccountPosition>>;
|
|
36
52
|
getNetAPR(): Promise<number>;
|
|
37
53
|
}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.VaultPositionsOrderBy = exports.SupplyPositionsOrderBy = exports.LeveragedPositionsOrderBy = void 0;
|
|
12
|
+
exports.PositionType = exports.VaultPositionsOrderBy = exports.SupplyPositionsOrderBy = exports.LeveragedPositionsOrderBy = void 0;
|
|
13
13
|
const types_1 = require("../../config/types");
|
|
14
14
|
var LeveragedPositionsOrderBy;
|
|
15
15
|
(function (LeveragedPositionsOrderBy) {
|
|
@@ -23,6 +23,13 @@ var VaultPositionsOrderBy;
|
|
|
23
23
|
(function (VaultPositionsOrderBy) {
|
|
24
24
|
VaultPositionsOrderBy[VaultPositionsOrderBy["TVL"] = 0] = "TVL";
|
|
25
25
|
})(VaultPositionsOrderBy = exports.VaultPositionsOrderBy || (exports.VaultPositionsOrderBy = {}));
|
|
26
|
+
var PositionType;
|
|
27
|
+
(function (PositionType) {
|
|
28
|
+
PositionType["MARKET"] = "Market";
|
|
29
|
+
PositionType["VAULT"] = "Vault";
|
|
30
|
+
PositionType["OTHER"] = "Other";
|
|
31
|
+
})(PositionType = exports.PositionType || (exports.PositionType = {}));
|
|
32
|
+
// TODO: Collateral positions
|
|
26
33
|
class OffchainMultichainAccount {
|
|
27
34
|
constructor(offchainMultichain, account) {
|
|
28
35
|
this.getOffchainMultichain = () => this.offchainMultichain;
|
|
@@ -94,8 +101,11 @@ class OffchainMultichainAccount {
|
|
|
94
101
|
// Account stats
|
|
95
102
|
getTotalBalanceUSD() {
|
|
96
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
const [vaultBalanceUSD, supplyBalanceUSD] = yield Promise.all([
|
|
105
|
+
this.getVaultsBalanceUSD(),
|
|
106
|
+
this.getSupplyBalanceUSD(),
|
|
107
|
+
]);
|
|
108
|
+
return vaultBalanceUSD + supplyBalanceUSD;
|
|
99
109
|
});
|
|
100
110
|
}
|
|
101
111
|
getVaultsBalanceUSD() {
|
|
@@ -105,6 +115,87 @@ class OffchainMultichainAccount {
|
|
|
105
115
|
return depositedValue.reduce((acc, val) => acc + val, 0);
|
|
106
116
|
});
|
|
107
117
|
}
|
|
118
|
+
getSupplyBalanceUSD() {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
const supplyPositions = yield this.getSupplyPositions();
|
|
121
|
+
const suppliedValue = yield Promise.all(supplyPositions.map((pool) => __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const [valueA, valueB] = yield Promise.all([
|
|
123
|
+
pool.getBorrowableA().getValue(),
|
|
124
|
+
pool.getBorrowableB().getValue(),
|
|
125
|
+
]);
|
|
126
|
+
return valueA + valueB;
|
|
127
|
+
})));
|
|
128
|
+
return suppliedValue.reduce((acc, val) => acc + val, 0);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
// Gets the top positions for a user
|
|
132
|
+
getTopPositions(limit = 10) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const [supplyPositions, vaultPositions] = yield Promise.all([
|
|
135
|
+
this.getSupplyPositions(),
|
|
136
|
+
this.getVaultPositions(),
|
|
137
|
+
]);
|
|
138
|
+
// Lending Market positions
|
|
139
|
+
const supplyValues = yield Promise.all(supplyPositions.map((pool) => __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
const [valueA, valueB, symbolA, symbolB, network, data, factory] = yield Promise.all([
|
|
141
|
+
pool.getBorrowableA().getValue(),
|
|
142
|
+
pool.getBorrowableB().getValue(),
|
|
143
|
+
pool.getBorrowableA().getPoolToken().getSymbol(),
|
|
144
|
+
pool.getBorrowableB().getPoolToken().getSymbol(),
|
|
145
|
+
pool.getLendingPool().getOffchain().network,
|
|
146
|
+
pool.getLendingPool().getLendingPoolData(),
|
|
147
|
+
pool.getLendingPool().getFactory()
|
|
148
|
+
]);
|
|
149
|
+
const totalValue = valueA + valueB;
|
|
150
|
+
return {
|
|
151
|
+
name: `${symbolA}/${symbolB}`,
|
|
152
|
+
value: totalValue,
|
|
153
|
+
type: PositionType.MARKET,
|
|
154
|
+
network: network,
|
|
155
|
+
id: data.id,
|
|
156
|
+
factory: factory
|
|
157
|
+
};
|
|
158
|
+
})));
|
|
159
|
+
// Vault positions
|
|
160
|
+
const vaultValues = yield Promise.all(vaultPositions.map((vault) => __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const [value, symbol, network, data] = yield Promise.all([
|
|
162
|
+
vault.getValue(),
|
|
163
|
+
vault.getPoolToken().getSymbol(),
|
|
164
|
+
vault.getPoolToken().getOffchain().network,
|
|
165
|
+
vault.getPoolToken().getPoolTokenData()
|
|
166
|
+
]);
|
|
167
|
+
return {
|
|
168
|
+
name: symbol,
|
|
169
|
+
value: value,
|
|
170
|
+
type: PositionType.VAULT,
|
|
171
|
+
network: network,
|
|
172
|
+
id: data.id,
|
|
173
|
+
factory: undefined
|
|
174
|
+
};
|
|
175
|
+
})));
|
|
176
|
+
const allPositions = [...supplyValues, ...vaultValues].sort((a, b) => b.value - a.value);
|
|
177
|
+
const totalValue = allPositions.reduce((sum, pos) => sum + pos.value, 0);
|
|
178
|
+
if (allPositions.length <= limit || limit <= 1) {
|
|
179
|
+
return allPositions.map((pos) => (Object.assign(Object.assign({}, pos), { percentage: (pos.value / totalValue) * 100 })));
|
|
180
|
+
}
|
|
181
|
+
// Top N-1 positions and calculate "Other"
|
|
182
|
+
const topNMinusOne = allPositions.slice(0, limit - 1);
|
|
183
|
+
const remainingPositions = allPositions.slice(limit - 1);
|
|
184
|
+
const remainingValue = remainingPositions.reduce((sum, pos) => sum + pos.value, 0);
|
|
185
|
+
const result = [
|
|
186
|
+
...topNMinusOne,
|
|
187
|
+
{
|
|
188
|
+
name: "Other",
|
|
189
|
+
value: remainingValue,
|
|
190
|
+
type: PositionType.OTHER,
|
|
191
|
+
network: types_1.Networks.Mainnet,
|
|
192
|
+
id: "",
|
|
193
|
+
factory: undefined
|
|
194
|
+
},
|
|
195
|
+
].map((pos) => (Object.assign(Object.assign({}, pos), { percentage: (pos.value / totalValue) * 100 })));
|
|
196
|
+
return result;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
108
199
|
getNetAPR() {
|
|
109
200
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
201
|
return 1;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import OnchainAccountLendingPoolV3 from "../onchainAccountLendingPoolV3";
|
|
2
|
+
import { OnchainAccountCollateralV3 } from "../index";
|
|
2
3
|
export default abstract class OnchainAccountNftlp {
|
|
3
|
-
protected readonly
|
|
4
|
+
protected readonly collateral: OnchainAccountCollateralV3;
|
|
4
5
|
protected cache: {};
|
|
5
|
-
constructor(
|
|
6
|
+
constructor(collateral: OnchainAccountCollateralV3);
|
|
7
|
+
getLendingPool: () => OnchainAccountLendingPoolV3;
|
|
6
8
|
cleanCache(): void;
|
|
7
9
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class OnchainAccountNftlp {
|
|
4
|
-
constructor(
|
|
4
|
+
constructor(collateral) {
|
|
5
5
|
this.cache = {};
|
|
6
|
-
this.
|
|
6
|
+
this.getLendingPool = () => this.collateral.getLendingPool();
|
|
7
|
+
this.collateral = collateral;
|
|
7
8
|
}
|
|
8
9
|
cleanCache() {
|
|
9
10
|
this.cache = {};
|
|
@@ -3,13 +3,16 @@ import OnchainAccountCollateral from "./onchainAccountCollateral";
|
|
|
3
3
|
import { OnchainCollateralV3 } from "../../impermaxFactory/lendingPool";
|
|
4
4
|
import OnchainAccountLendingPoolV3 from "./onchainAccountLendingPoolV3";
|
|
5
5
|
import { OnchainInteractionsCollateralV3 } from "../../interactions/lendingPool";
|
|
6
|
+
import OnchainAccountNftlp from "./nftlp";
|
|
6
7
|
export default class OnchainAccountCollateralV3 extends OnchainAccountCollateral {
|
|
7
8
|
protected readonly lendingPool: OnchainAccountLendingPoolV3;
|
|
8
9
|
protected readonly collateral: OnchainCollateralV3;
|
|
10
|
+
protected readonly nftlp: OnchainAccountNftlp;
|
|
9
11
|
protected collateralCache: {};
|
|
10
12
|
constructor(lendingPool: OnchainAccountLendingPoolV3);
|
|
11
13
|
getLendingPool: () => OnchainAccountLendingPoolV3;
|
|
12
14
|
getCollateral: () => OnchainCollateralV3;
|
|
15
|
+
getNftlp: () => OnchainAccountNftlp;
|
|
13
16
|
getAccount: () => import("..").default;
|
|
14
17
|
getInteractionsCollateral(): OnchainInteractionsCollateralV3;
|
|
15
18
|
getOffchainAccountCollateral(): Promise<OffchainAccountCollateral>;
|
|
@@ -19,9 +19,11 @@ class OnchainAccountCollateralV3 extends onchainAccountCollateral_1.default {
|
|
|
19
19
|
this.collateralCache = {};
|
|
20
20
|
this.getLendingPool = () => this.lendingPool;
|
|
21
21
|
this.getCollateral = () => this.collateral;
|
|
22
|
+
this.getNftlp = () => this.nftlp;
|
|
22
23
|
this.getAccount = () => this.lendingPool.getAccount();
|
|
23
24
|
this.lendingPool = lendingPool;
|
|
24
25
|
this.collateral = lendingPool.getLendingPool().getCollateral();
|
|
26
|
+
this.nftlp = lendingPool.getLendingPool().getNftlp().getNewAccountNftlpObject(this);
|
|
25
27
|
}
|
|
26
28
|
getInteractionsCollateral() {
|
|
27
29
|
return this.lendingPool.getInteractionsLendingPool().getCollateral();
|
|
@@ -13,7 +13,6 @@ export default class OnchainAccountLendingPoolV3 extends OnchainAccountLendingPo
|
|
|
13
13
|
[Borrowable.A]: OnchainAccountBorrowableV3;
|
|
14
14
|
[Borrowable.B]: OnchainAccountBorrowableV3;
|
|
15
15
|
};
|
|
16
|
-
protected readonly nftlp: OnchainAccountNftlp;
|
|
17
16
|
constructor(account: OnchainAccount, lendingPool: OnchainLendingPoolV3);
|
|
18
17
|
protected getNewCollateralObject(): OnchainAccountCollateralV3;
|
|
19
18
|
protected getNewBorrowableObject(borrowable: Borrowable): OnchainAccountBorrowableV3;
|
|
@@ -16,8 +16,7 @@ class OnchainAccountLendingPoolV3 extends onchainAccountLendingPool_1.default {
|
|
|
16
16
|
this.getBorrowableA = () => this.getBorrowable(types_1.Borrowable.A);
|
|
17
17
|
this.getBorrowableB = () => this.getBorrowable(types_1.Borrowable.B);
|
|
18
18
|
this.getCollateral = () => this.collateral;
|
|
19
|
-
this.getNftlp = () => this.
|
|
20
|
-
this.nftlp = lendingPool.getNftlp().getNewAccountNftlpObject(this);
|
|
19
|
+
this.getNftlp = () => this.collateral.getNftlp();
|
|
21
20
|
}
|
|
22
21
|
getNewCollateralObject() {
|
|
23
22
|
return new onchainAccountCollateralV3_1.default(this);
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import OnchainLendingPoolV3 from "../onchainLendingPoolV3";
|
|
2
2
|
import { Contract } from "../../../onchainTypes";
|
|
3
|
-
import {
|
|
3
|
+
import { OnchainAccountCollateralV3 } from "../../../account/lendingPool";
|
|
4
4
|
import OnchainAccountNftlp from "../../../account/lendingPool/nftlp";
|
|
5
|
-
import {
|
|
5
|
+
import { OnchainInteractionsCollateralV3 } from "../../../interactions/lendingPool";
|
|
6
6
|
import OnchainInteractionsNftlp from "../../../interactions/lendingPool/nftlp";
|
|
7
|
+
import OnchainCollateralV3 from "../onchainCollateralV3";
|
|
7
8
|
export default abstract class OnchainNftlp {
|
|
8
|
-
protected readonly
|
|
9
|
+
protected readonly collateral: OnchainCollateralV3;
|
|
9
10
|
protected cache: {
|
|
10
11
|
nftlp?: Contract;
|
|
12
|
+
marketPrice?: Promise<number>;
|
|
13
|
+
oraclePrice?: Promise<number>;
|
|
11
14
|
};
|
|
12
|
-
abstract getNewAccountNftlpObject(
|
|
13
|
-
abstract getNewInteractionsNftlpObject(
|
|
14
|
-
constructor(
|
|
15
|
+
abstract getNewAccountNftlpObject(accountCollateral: OnchainAccountCollateralV3): OnchainAccountNftlp;
|
|
16
|
+
abstract getNewInteractionsNftlpObject(interactionsCollateral: OnchainInteractionsCollateralV3): OnchainInteractionsNftlp;
|
|
17
|
+
constructor(collateral: OnchainCollateralV3);
|
|
15
18
|
cleanCache(): void;
|
|
19
|
+
getLendingPool: () => OnchainLendingPoolV3;
|
|
16
20
|
protected getContractHelper: () => import("../../..").OnchainContractsHelper;
|
|
17
21
|
getNftlpAddress: () => string;
|
|
18
22
|
protected abstract initializeNftlp(): Contract;
|
|
19
23
|
getNftlp(): any;
|
|
20
|
-
abstract
|
|
21
|
-
|
|
24
|
+
protected abstract initializeMarketPrice(): Promise<number>;
|
|
25
|
+
getMarketPrice(): Promise<number>;
|
|
26
|
+
protected abstract initializeOraclePrice(): Promise<number>;
|
|
27
|
+
getOraclePrice(): Promise<number>;
|
|
22
28
|
}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
class OnchainNftlp {
|
|
4
|
-
constructor(
|
|
13
|
+
constructor(collateral) {
|
|
5
14
|
this.cache = {};
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
15
|
+
this.getLendingPool = () => this.collateral.getLendingPool();
|
|
16
|
+
this.getContractHelper = () => this.getLendingPool().getImpermaxFactory().getOnchain().getContractHelper();
|
|
17
|
+
this.getNftlpAddress = () => this.getLendingPool().getId();
|
|
18
|
+
this.collateral = collateral;
|
|
9
19
|
}
|
|
10
20
|
cleanCache() {
|
|
11
21
|
this.cache = {};
|
|
@@ -15,5 +25,19 @@ class OnchainNftlp {
|
|
|
15
25
|
this.cache.nftlp = this.initializeNftlp();
|
|
16
26
|
return this.cache.nftlp;
|
|
17
27
|
}
|
|
28
|
+
getMarketPrice() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
if (!this.cache.marketPrice)
|
|
31
|
+
this.cache.marketPrice = this.initializeMarketPrice();
|
|
32
|
+
return this.cache.marketPrice;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getOraclePrice() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
if (!this.cache.oraclePrice)
|
|
38
|
+
this.cache.oraclePrice = this.initializeOraclePrice();
|
|
39
|
+
return this.cache.oraclePrice;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
18
42
|
}
|
|
19
43
|
exports.default = OnchainNftlp;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import OnchainNftlp from "./onchainNftlp";
|
|
2
2
|
import { Contract } from "../../../onchainTypes";
|
|
3
|
-
import {
|
|
3
|
+
import { OnchainAccountCollateralV3 } from "../../../account/lendingPool";
|
|
4
4
|
import { OnchainAccountNftlpUniswapV3 } from "../../../account/lendingPool/nftlp";
|
|
5
5
|
import { OnchainInteractionsNftlpUniswapV3 } from "../../../interactions/lendingPool/nftlp";
|
|
6
|
-
import {
|
|
6
|
+
import { OnchainInteractionsCollateralV3 } from "../../../interactions/lendingPool";
|
|
7
7
|
export default class OnchainNftlpUniswapV3 extends OnchainNftlp {
|
|
8
8
|
protected cache: {
|
|
9
9
|
nftlp?: Contract;
|
|
@@ -13,12 +13,11 @@ export default class OnchainNftlpUniswapV3 extends OnchainNftlp {
|
|
|
13
13
|
marketPrice?: Promise<number>;
|
|
14
14
|
oraclePrice?: Promise<number>;
|
|
15
15
|
};
|
|
16
|
-
getNewAccountNftlpObject(
|
|
17
|
-
getNewInteractionsNftlpObject(
|
|
18
|
-
initializeNftlp(): any;
|
|
19
|
-
initializeUniswapV3Pool(fee: number): Promise<Contract | null>;
|
|
16
|
+
getNewAccountNftlpObject(accountCollateral: OnchainAccountCollateralV3): OnchainAccountNftlpUniswapV3;
|
|
17
|
+
getNewInteractionsNftlpObject(interactionsCollateral: OnchainInteractionsCollateralV3): OnchainInteractionsNftlpUniswapV3;
|
|
18
|
+
protected initializeNftlp(): any;
|
|
19
|
+
protected initializeUniswapV3Pool(fee: number): Promise<Contract | null>;
|
|
20
20
|
getUniswapV3Pool(fee: number): Promise<any>;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
getOraclePrice(): Promise<number>;
|
|
21
|
+
protected initializeMarketPrice(): Promise<number>;
|
|
22
|
+
protected initializeOraclePrice(): Promise<number>;
|
|
24
23
|
}
|
|
@@ -26,11 +26,11 @@ class OnchainNftlpUniswapV3 extends onchainNftlp_1.default {
|
|
|
26
26
|
super(...arguments);
|
|
27
27
|
this.cache = {};
|
|
28
28
|
}
|
|
29
|
-
getNewAccountNftlpObject(
|
|
30
|
-
return new nftlp_1.OnchainAccountNftlpUniswapV3(
|
|
29
|
+
getNewAccountNftlpObject(accountCollateral) {
|
|
30
|
+
return new nftlp_1.OnchainAccountNftlpUniswapV3(accountCollateral);
|
|
31
31
|
}
|
|
32
|
-
getNewInteractionsNftlpObject(
|
|
33
|
-
return new nftlp_2.OnchainInteractionsNftlpUniswapV3(
|
|
32
|
+
getNewInteractionsNftlpObject(interactionsCollateral) {
|
|
33
|
+
return new nftlp_2.OnchainInteractionsNftlpUniswapV3(interactionsCollateral);
|
|
34
34
|
}
|
|
35
35
|
initializeNftlp() {
|
|
36
36
|
return this.getContractHelper().newNftlpUniV3(this.getNftlpAddress());
|
|
@@ -56,7 +56,7 @@ class OnchainNftlpUniswapV3 extends onchainNftlp_1.default {
|
|
|
56
56
|
return this.cache.uniswapV3Pools[fee];
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
initializeMarketPrice() {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
61
|
let priceCumulative = 0;
|
|
62
62
|
let liquidityCumulative = 0;
|
|
@@ -72,19 +72,11 @@ class OnchainNftlpUniswapV3 extends onchainNftlp_1.default {
|
|
|
72
72
|
return priceCumulative / liquidityCumulative;
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
;
|
|
76
75
|
initializeOraclePrice() {
|
|
77
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
77
|
const nftlp = yield this.getNftlp();
|
|
79
78
|
return Math.pow((nftlp.methods.oraclePriceSqrtX96().call() / Math.pow(2, 96)), 2);
|
|
80
79
|
});
|
|
81
80
|
}
|
|
82
|
-
getOraclePrice() {
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
if (!this.cache.oraclePrice)
|
|
85
|
-
this.cache.oraclePrice = this.initializeOraclePrice();
|
|
86
|
-
return this.cache.oraclePrice;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
81
|
}
|
|
90
82
|
exports.default = OnchainNftlpUniswapV3;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import OffchainCollateral from '../../../offchain/lendingPool/offchainCollateral';
|
|
2
2
|
import OnchainCollateral from "./onchainCollateral";
|
|
3
3
|
import OnchainLendingPoolV3 from "./onchainLendingPoolV3";
|
|
4
|
+
import OnchainNftlp from "./nftlp";
|
|
4
5
|
export default class OnchainCollateralV3 extends OnchainCollateral {
|
|
5
6
|
protected readonly lendingPool: OnchainLendingPoolV3;
|
|
7
|
+
protected readonly nftlp: OnchainNftlp;
|
|
6
8
|
protected collateralCache: {};
|
|
7
9
|
constructor(lendingPool: OnchainLendingPoolV3);
|
|
8
10
|
getLendingPool: () => OnchainLendingPoolV3;
|
|
11
|
+
getNftlp: () => OnchainNftlp;
|
|
9
12
|
cleanCache(): void;
|
|
10
13
|
private getContractHelper;
|
|
11
14
|
getCollateralAddress: () => Promise<string>;
|
|
@@ -13,15 +13,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const onchainCollateral_1 = __importDefault(require("./onchainCollateral"));
|
|
16
|
+
const nftlp_1 = require("./nftlp");
|
|
16
17
|
class OnchainCollateralV3 extends onchainCollateral_1.default {
|
|
17
18
|
constructor(lendingPool) {
|
|
18
19
|
super();
|
|
19
20
|
this.collateralCache = {};
|
|
20
21
|
this.getLendingPool = () => this.lendingPool;
|
|
22
|
+
this.getNftlp = () => this.nftlp;
|
|
21
23
|
// shortcuts
|
|
22
24
|
this.getContractHelper = () => this.lendingPool.getImpermaxFactory().getOnchain().getContractHelper();
|
|
23
25
|
this.getCollateralAddress = () => __awaiter(this, void 0, void 0, function* () { return this.lendingPool.getCollateralAddress(); });
|
|
24
26
|
this.lendingPool = lendingPool;
|
|
27
|
+
// TODO use the offchain object to get the type of nftlp
|
|
28
|
+
this.nftlp = new nftlp_1.OnchainNftlpUniswapV3(this);
|
|
25
29
|
}
|
|
26
30
|
cleanCache() {
|
|
27
31
|
this.collateralCache = {};
|
|
@@ -17,7 +17,6 @@ export default class OnchainLendingPoolV3 extends OnchainLendingPool {
|
|
|
17
17
|
[Borrowable.A]: OnchainBorrowableV3;
|
|
18
18
|
[Borrowable.B]: OnchainBorrowableV3;
|
|
19
19
|
};
|
|
20
|
-
protected readonly nftlp: OnchainNftlp;
|
|
21
20
|
protected cache: {
|
|
22
21
|
lendingPoolAddresses?: Promise<{
|
|
23
22
|
collateral: Address;
|
|
@@ -9,7 +9,6 @@ const lendingPool_1 = require("../../account/lendingPool");
|
|
|
9
9
|
const onchainCollateralV3_1 = __importDefault(require("./onchainCollateralV3"));
|
|
10
10
|
const onchainBorrowableV3_1 = __importDefault(require("./onchainBorrowableV3"));
|
|
11
11
|
const lendingPool_2 = require("../../interactions/lendingPool");
|
|
12
|
-
const nftlp_1 = require("./nftlp");
|
|
13
12
|
class OnchainLendingPoolV3 extends onchainLendingPool_1.default {
|
|
14
13
|
constructor(impermaxFactory, id) {
|
|
15
14
|
super(impermaxFactory, id);
|
|
@@ -19,9 +18,7 @@ class OnchainLendingPoolV3 extends onchainLendingPool_1.default {
|
|
|
19
18
|
this.getBorrowableA = () => this.getBorrowable(types_1.Borrowable.A);
|
|
20
19
|
this.getBorrowableB = () => this.getBorrowable(types_1.Borrowable.B);
|
|
21
20
|
this.getCollateral = () => this.collateral;
|
|
22
|
-
this.getNftlp = () => this.
|
|
23
|
-
// TODO use the offchain object to get the type of nftlp
|
|
24
|
-
this.nftlp = new nftlp_1.OnchainNftlpUniswapV3(this);
|
|
21
|
+
this.getNftlp = () => this.collateral.getNftlp();
|
|
25
22
|
}
|
|
26
23
|
getNewCollateralObject() {
|
|
27
24
|
return new onchainCollateralV3_1.default(this);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import OnchainInteractionsLendingPoolV3 from "../onchainInteractionsLendingPoolV3";
|
|
2
|
+
import { OnchainInteractionsCollateralV3 } from "../index";
|
|
2
3
|
export default abstract class OnchainInteractionsNftlp {
|
|
3
|
-
protected readonly
|
|
4
|
+
protected readonly collateral: OnchainInteractionsCollateralV3;
|
|
4
5
|
protected cache: {};
|
|
5
|
-
constructor(
|
|
6
|
+
constructor(collateral: OnchainInteractionsCollateralV3);
|
|
7
|
+
getLendingPool: () => OnchainInteractionsLendingPoolV3;
|
|
6
8
|
cleanCache(): void;
|
|
7
9
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class OnchainInteractionsNftlp {
|
|
4
|
-
constructor(
|
|
4
|
+
constructor(collateral) {
|
|
5
5
|
this.cache = {};
|
|
6
|
-
this.
|
|
6
|
+
this.getLendingPool = () => this.collateral.getLendingPool();
|
|
7
|
+
this.collateral = collateral;
|
|
7
8
|
}
|
|
8
9
|
cleanCache() {
|
|
9
10
|
this.cache = {};
|
|
@@ -2,12 +2,15 @@ import OnchainInteractionsCollateral from "./onchainInteractionsCollateral";
|
|
|
2
2
|
import { OnchainCollateralV3 } from "../../impermaxFactory/lendingPool";
|
|
3
3
|
import { OnchainAccountCollateralV3 } from "../../account/lendingPool";
|
|
4
4
|
import OnchainInteractionsLendingPoolV3 from "./onchainInteractionsLendingPoolV3";
|
|
5
|
+
import OnchainInteractionsNftlp from "./nftlp";
|
|
5
6
|
export default class OnchainInteractionsCollateralV3 extends OnchainInteractionsCollateral {
|
|
6
7
|
protected readonly lendingPool: OnchainInteractionsLendingPoolV3;
|
|
7
8
|
protected readonly collateral: OnchainCollateralV3;
|
|
9
|
+
protected readonly nftlp: OnchainInteractionsNftlp;
|
|
8
10
|
constructor(interactionsLendingPool: OnchainInteractionsLendingPoolV3);
|
|
9
11
|
getLendingPool: () => OnchainInteractionsLendingPoolV3;
|
|
10
12
|
getCollateral: () => OnchainCollateralV3;
|
|
13
|
+
getNftlp: () => OnchainInteractionsNftlp;
|
|
11
14
|
getInteractions: () => import("..").default;
|
|
12
15
|
getAccountCollateral(): OnchainAccountCollateralV3;
|
|
13
16
|
}
|
|
@@ -9,9 +9,11 @@ class OnchainInteractionsCollateralV3 extends onchainInteractionsCollateral_1.de
|
|
|
9
9
|
super();
|
|
10
10
|
this.getLendingPool = () => this.lendingPool;
|
|
11
11
|
this.getCollateral = () => this.collateral;
|
|
12
|
+
this.getNftlp = () => this.nftlp;
|
|
12
13
|
this.getInteractions = () => this.lendingPool.getInteractions();
|
|
13
14
|
this.lendingPool = interactionsLendingPool;
|
|
14
15
|
this.collateral = interactionsLendingPool.getLendingPool().getCollateral();
|
|
16
|
+
this.nftlp = interactionsLendingPool.getLendingPool().getNftlp().getNewInteractionsNftlpObject(this);
|
|
15
17
|
}
|
|
16
18
|
getAccountCollateral() {
|
|
17
19
|
return this.lendingPool.getAccountLendingPool().getCollateral();
|
|
@@ -13,7 +13,6 @@ export default class OnchainInteractionsLendingPoolV3 extends OnchainInteraction
|
|
|
13
13
|
[Borrowable.A]: OnchainInteractionsBorrowableV3;
|
|
14
14
|
[Borrowable.B]: OnchainInteractionsBorrowableV3;
|
|
15
15
|
};
|
|
16
|
-
protected readonly nftlp: OnchainInteractionsNftlp;
|
|
17
16
|
constructor(interactions: OnchainInteractions, lendingPool: OnchainLendingPoolV3);
|
|
18
17
|
protected getNewCollateralObject(): OnchainInteractionsCollateralV3;
|
|
19
18
|
protected getNewBorrowableObject(borrowable: Borrowable): OnchainInteractionsBorrowableV3;
|
|
@@ -16,8 +16,7 @@ class OnchainInteractionsLendingPoolV3 extends onchainInteractionsLendingPool_1.
|
|
|
16
16
|
this.getBorrowableA = () => this.getBorrowable(types_1.Borrowable.A);
|
|
17
17
|
this.getBorrowableB = () => this.getBorrowable(types_1.Borrowable.B);
|
|
18
18
|
this.getCollateral = () => this.collateral;
|
|
19
|
-
this.getNftlp = () => this.
|
|
20
|
-
this.nftlp = lendingPool.getNftlp().getNewInteractionsNftlpObject(this);
|
|
19
|
+
this.getNftlp = () => this.collateral.getNftlp();
|
|
21
20
|
}
|
|
22
21
|
getNewCollateralObject() {
|
|
23
22
|
return new onchainInteractionsCollateralV3_1.default(this);
|