impermax-sdk 2.1.4 → 2.1.5
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 -1
- package/lib/index.js +10 -2
- package/lib/offchain/index.d.ts +2 -1
- package/lib/offchain/index.js +3 -1
- package/lib/offchain/offchainInitializer.js +2 -0
- package/lib/offchain/offchainMultichain.d.ts +7 -2
- package/lib/offchain/offchainMultichain.js +68 -4
- package/lib/offchain/vault/offchainVault.d.ts +16 -0
- package/lib/offchain/vault/offchainVault.js +17 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -33,4 +33,6 @@ import { OnchainInteractionsLendingPool, OnchainInteractionsLendingVault, Onchai
|
|
|
33
33
|
import { OnchainInteractionsBorrowable, OnchainInteractionsCollateral } from './onchain/interactions/lendingPool';
|
|
34
34
|
import { LENDING_VAULT_WATCHER } from './config/contracts/lending-vault-watcher';
|
|
35
35
|
import OffchainVault, { OffchainLendingVault, OffchainLeveragedVault, OffchainHedgedVault } from './offchain/vault';
|
|
36
|
-
|
|
36
|
+
import { SortDirection, VaultOrderBy, VaultListParams } from "./offchain/offchainMultichain";
|
|
37
|
+
import { VaultRisk, VaultType } from "./offchain/vault/offchainVault";
|
|
38
|
+
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, 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, VaultOrderBy, VaultListParams, SortDirection };
|
package/lib/index.js
CHANGED
|
@@ -23,8 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.WhitelistState = 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.getNetworkFactories = exports.IMPERMAX_FACTORY = exports.IMX = exports.IMPERMAX_CHEF = exports.CLAIM_AGGREGATOR = exports.NO_CHANGES = void 0;
|
|
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.WhitelistState = 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.getNetworkFactories = exports.IMPERMAX_FACTORY = exports.IMX = exports.IMPERMAX_CHEF = exports.CLAIM_AGGREGATOR = exports.NO_CHANGES = exports.ApprovalType = exports.OnchainInteractionsConfigManager = void 0;
|
|
28
|
+
exports.SortDirection = exports.VaultOrderBy = void 0;
|
|
28
29
|
const offchain_1 = __importStar(require("./offchain"));
|
|
29
30
|
exports.Offchain = offchain_1.default;
|
|
30
31
|
Object.defineProperty(exports, "OffchainAccount", { enumerable: true, get: function () { return offchain_1.OffchainAccount; } });
|
|
@@ -157,3 +158,10 @@ exports.OffchainVault = vault_1.default;
|
|
|
157
158
|
Object.defineProperty(exports, "OffchainLendingVault", { enumerable: true, get: function () { return vault_1.OffchainLendingVault; } });
|
|
158
159
|
Object.defineProperty(exports, "OffchainLeveragedVault", { enumerable: true, get: function () { return vault_1.OffchainLeveragedVault; } });
|
|
159
160
|
Object.defineProperty(exports, "OffchainHedgedVault", { enumerable: true, get: function () { return vault_1.OffchainHedgedVault; } });
|
|
161
|
+
// Data helpers (sort, filter)
|
|
162
|
+
const offchainMultichain_1 = require("./offchain/offchainMultichain");
|
|
163
|
+
Object.defineProperty(exports, "SortDirection", { enumerable: true, get: function () { return offchainMultichain_1.SortDirection; } });
|
|
164
|
+
Object.defineProperty(exports, "VaultOrderBy", { enumerable: true, get: function () { return offchainMultichain_1.VaultOrderBy; } });
|
|
165
|
+
const offchainVault_1 = require("./offchain/vault/offchainVault");
|
|
166
|
+
Object.defineProperty(exports, "VaultRisk", { enumerable: true, get: function () { return offchainVault_1.VaultRisk; } });
|
|
167
|
+
Object.defineProperty(exports, "VaultType", { enumerable: true, get: function () { return offchainVault_1.VaultType; } });
|
package/lib/offchain/index.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ import OffchainPoolToken from "./offchainPoolToken";
|
|
|
11
11
|
import Offchain from './offchain';
|
|
12
12
|
import OffchainConfigManager from "./configManager";
|
|
13
13
|
import OffchainMultichain from "./offchainMultichain";
|
|
14
|
-
|
|
14
|
+
import * as offchainMultichain from "./offchainMultichain";
|
|
15
|
+
export { account, lendingPool, vault, configManager, offchainMultichain, OffchainMultichain, OffchainAccount, OffchainLendingPool, OffchainConfigManager, OffchainPoolToken, OffchainSolidexHelper, OffchainPriceHelper, OffchainAPRHelper };
|
|
15
16
|
export default Offchain;
|
package/lib/offchain/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.OffchainAPRHelper = exports.OffchainPriceHelper = exports.OffchainSolidexHelper = exports.OffchainPoolToken = exports.OffchainConfigManager = exports.OffchainLendingPool = exports.OffchainAccount = exports.OffchainMultichain = exports.configManager = exports.vault = exports.lendingPool = exports.account = void 0;
|
|
29
|
+
exports.OffchainAPRHelper = exports.OffchainPriceHelper = exports.OffchainSolidexHelper = exports.OffchainPoolToken = exports.OffchainConfigManager = exports.OffchainLendingPool = exports.OffchainAccount = exports.OffchainMultichain = exports.offchainMultichain = exports.configManager = exports.vault = exports.lendingPool = exports.account = void 0;
|
|
30
30
|
const lendingPool_1 = __importDefault(require("./lendingPool"));
|
|
31
31
|
exports.OffchainLendingPool = lendingPool_1.default;
|
|
32
32
|
const lendingPool = __importStar(require("./lendingPool"));
|
|
@@ -52,4 +52,6 @@ const configManager_1 = __importDefault(require("./configManager"));
|
|
|
52
52
|
exports.OffchainConfigManager = configManager_1.default;
|
|
53
53
|
const offchainMultichain_1 = __importDefault(require("./offchainMultichain"));
|
|
54
54
|
exports.OffchainMultichain = offchainMultichain_1.default;
|
|
55
|
+
const offchainMultichain = __importStar(require("./offchainMultichain"));
|
|
56
|
+
exports.offchainMultichain = offchainMultichain;
|
|
55
57
|
exports.default = offchain_1.default;
|
|
@@ -659,6 +659,8 @@ exports.getXimxData = getXimxData;
|
|
|
659
659
|
function fetchLendingVaults() {
|
|
660
660
|
return __awaiter(this, void 0, void 0, function* () {
|
|
661
661
|
const subgraph = subgraphs_1.LENDING_VAULT_SUBGRAPH_URL[this.network];
|
|
662
|
+
if (subgraph.length == 0)
|
|
663
|
+
return [];
|
|
662
664
|
const query = queries_1.QueryBuilderFactory.getQuery(subgraph);
|
|
663
665
|
const result = yield this.apolloFetcher(subgraph, query.lendingVaultsQuery([]));
|
|
664
666
|
return result.data.lendingVaults;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NetworkIndex, Networks } from
|
|
1
|
+
import { NetworkIndex, Networks } from "../config/types";
|
|
2
2
|
import Offchain from "./offchain";
|
|
3
3
|
import OffchainVault, { VaultType } from "./vault/offchainVault";
|
|
4
4
|
import { Amms } from "../config/amms";
|
|
@@ -6,6 +6,10 @@ import { Farms } from "../config/farms";
|
|
|
6
6
|
import { RiskLevel } from "./vault/offchainLendingVault";
|
|
7
7
|
import OffchainLendingPool from "./lendingPool";
|
|
8
8
|
import { LendingPoolVersion } from "./lendingPool/offchainLendingPool";
|
|
9
|
+
export declare enum SortDirection {
|
|
10
|
+
ASC = "asc",
|
|
11
|
+
DESC = "desc"
|
|
12
|
+
}
|
|
9
13
|
export declare enum VaultOrderBy {
|
|
10
14
|
TVL = 0,
|
|
11
15
|
APR = 1,
|
|
@@ -45,6 +49,7 @@ export default class OffchainMultichain {
|
|
|
45
49
|
private constructor();
|
|
46
50
|
static get instance(): OffchainMultichain;
|
|
47
51
|
getOffchain(network: Networks): Offchain;
|
|
48
|
-
getVaultList(params?: VaultListParams, orderBy?: VaultOrderBy): Promise<Array<OffchainVault>>;
|
|
52
|
+
getVaultList(params?: VaultListParams, orderBy?: VaultOrderBy, sortDirection?: SortDirection): Promise<Array<OffchainVault>>;
|
|
53
|
+
private getVaultSortValue;
|
|
49
54
|
getLendingPoolList(params?: LendingPoolListParams, orderBy?: LendingPoolListOrderBy): Promise<Array<OffchainLendingPool>>;
|
|
50
55
|
}
|
|
@@ -24,14 +24,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
var _a, _OffchainMultichain_instance;
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.LendingPoolListOrderBy = exports.VaultOrderBy = void 0;
|
|
27
|
+
exports.LendingPoolListOrderBy = exports.VaultOrderBy = exports.SortDirection = void 0;
|
|
28
|
+
const types_1 = require("../config/types");
|
|
28
29
|
const offchain_1 = __importDefault(require("./offchain"));
|
|
30
|
+
const subgraphs_1 = require("../config/subgraphs");
|
|
31
|
+
// For vaults and pools
|
|
32
|
+
var SortDirection;
|
|
33
|
+
(function (SortDirection) {
|
|
34
|
+
SortDirection["ASC"] = "asc";
|
|
35
|
+
SortDirection["DESC"] = "desc";
|
|
36
|
+
})(SortDirection = exports.SortDirection || (exports.SortDirection = {}));
|
|
37
|
+
// Vaults //
|
|
29
38
|
var VaultOrderBy;
|
|
30
39
|
(function (VaultOrderBy) {
|
|
31
40
|
VaultOrderBy[VaultOrderBy["TVL"] = 0] = "TVL";
|
|
32
41
|
VaultOrderBy[VaultOrderBy["APR"] = 1] = "APR";
|
|
33
42
|
VaultOrderBy[VaultOrderBy["DEPOSITED"] = 2] = "DEPOSITED";
|
|
34
43
|
})(VaultOrderBy = exports.VaultOrderBy || (exports.VaultOrderBy = {}));
|
|
44
|
+
// Pools //
|
|
35
45
|
var LendingPoolListOrderBy;
|
|
36
46
|
(function (LendingPoolListOrderBy) {
|
|
37
47
|
LendingPoolListOrderBy[LendingPoolListOrderBy["TVL"] = 0] = "TVL";
|
|
@@ -57,10 +67,64 @@ class OffchainMultichain {
|
|
|
57
67
|
this.offchains[network] = new offchain_1.default(this, network);
|
|
58
68
|
return this.offchains[network];
|
|
59
69
|
}
|
|
60
|
-
getVaultList(params = {}, orderBy = VaultOrderBy.TVL) {
|
|
70
|
+
getVaultList(params = {}, orderBy = VaultOrderBy.TVL, sortDirection = SortDirection.DESC) {
|
|
61
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
try {
|
|
73
|
+
const allNetworks = params.networks || Object.values(types_1.Networks);
|
|
74
|
+
const networksWithVaults = allNetworks.filter((network) => subgraphs_1.LENDING_VAULT_SUBGRAPH_URL[network]);
|
|
75
|
+
const vaults = yield Promise.all(networksWithVaults.map((network) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
try {
|
|
77
|
+
const offchain = this.getOffchain(network);
|
|
78
|
+
const vaultsData = yield offchain.getLendingVaultsData();
|
|
79
|
+
if (!vaultsData)
|
|
80
|
+
return [];
|
|
81
|
+
const vaultResults = yield Promise.all(Object.keys(vaultsData).map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
try {
|
|
83
|
+
const vault = yield offchain.getLendingVault(address);
|
|
84
|
+
const sortValue = yield this.getVaultSortValue(vault, orderBy);
|
|
85
|
+
return { vault, sortValue };
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
console.error(`Error processing vault ${address}:`, err);
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
})));
|
|
92
|
+
return vaultResults.filter((result) => result !== null);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
console.error(`Error fetching network ${network}:`, err);
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
})));
|
|
99
|
+
const flatVaults = vaults.flat();
|
|
100
|
+
const multiplier = sortDirection === SortDirection.ASC ? 1 : -1;
|
|
101
|
+
const sortedVaults = flatVaults.sort((a, b) => (a.sortValue - b.sortValue) * multiplier);
|
|
102
|
+
return sortedVaults.map(({ vault }) => vault);
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
console.error("Error in getVaultList:", err);
|
|
106
|
+
throw err;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
getVaultSortValue(vault, orderBy) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
try {
|
|
113
|
+
switch (orderBy) {
|
|
114
|
+
case VaultOrderBy.TVL:
|
|
115
|
+
return yield vault.getVaultSupplyUSD();
|
|
116
|
+
case VaultOrderBy.APR:
|
|
117
|
+
return yield vault.getSupplyAPR();
|
|
118
|
+
case VaultOrderBy.DEPOSITED:
|
|
119
|
+
return yield vault.getTotalBalance();
|
|
120
|
+
default:
|
|
121
|
+
return 0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
console.error("Error getting sort value:", err);
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
64
128
|
});
|
|
65
129
|
}
|
|
66
130
|
getLendingPoolList(params = {}, orderBy = LendingPoolListOrderBy.TVL) {
|
|
@@ -7,14 +7,30 @@ export declare enum VaultType {
|
|
|
7
7
|
HEDGED = 1,
|
|
8
8
|
LEVERAGED = 2
|
|
9
9
|
}
|
|
10
|
+
export declare enum VaultRisk {
|
|
11
|
+
VERY_LOW = "very-low",
|
|
12
|
+
LOW = "low",
|
|
13
|
+
MEDIUM = "medium",
|
|
14
|
+
HIGH = "high",
|
|
15
|
+
VERY_HIGH = "very-high"
|
|
16
|
+
}
|
|
17
|
+
export declare enum VaultStatus {
|
|
18
|
+
DEPRECATED = "Deprecated",
|
|
19
|
+
BLACKLISTED = "Blacklisted",
|
|
20
|
+
ACTIVE = "Active"
|
|
21
|
+
}
|
|
10
22
|
export default class OffchainVault extends OffchainPoolToken {
|
|
11
23
|
private readonly offchain;
|
|
12
24
|
private readonly vaultAddress;
|
|
13
25
|
protected vaultType: VaultType;
|
|
26
|
+
protected vaultRisk: VaultRisk;
|
|
27
|
+
protected vaultStatus: VaultStatus;
|
|
14
28
|
constructor(offchain: Offchain, vaultAddress: Address);
|
|
15
29
|
getOffchain: () => Offchain;
|
|
16
30
|
getVaultAddress: () => string;
|
|
17
31
|
getVaultType: () => VaultType;
|
|
32
|
+
getVaultRisk: () => VaultRisk;
|
|
33
|
+
getVaultStatus: () => VaultStatus;
|
|
18
34
|
getPoolTokenData(): Promise<PoolTokenData>;
|
|
19
35
|
private getTotalSupply;
|
|
20
36
|
private getLastUpdate;
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.VaultType = void 0;
|
|
15
|
+
exports.VaultStatus = exports.VaultRisk = exports.VaultType = void 0;
|
|
16
16
|
const offchainPoolToken_1 = __importDefault(require("../offchainPoolToken"));
|
|
17
17
|
const utils_1 = require("../../utils");
|
|
18
18
|
var VaultType;
|
|
@@ -21,12 +21,28 @@ var VaultType;
|
|
|
21
21
|
VaultType[VaultType["HEDGED"] = 1] = "HEDGED";
|
|
22
22
|
VaultType[VaultType["LEVERAGED"] = 2] = "LEVERAGED";
|
|
23
23
|
})(VaultType = exports.VaultType || (exports.VaultType = {}));
|
|
24
|
+
var VaultRisk;
|
|
25
|
+
(function (VaultRisk) {
|
|
26
|
+
VaultRisk["VERY_LOW"] = "very-low";
|
|
27
|
+
VaultRisk["LOW"] = "low";
|
|
28
|
+
VaultRisk["MEDIUM"] = "medium";
|
|
29
|
+
VaultRisk["HIGH"] = "high";
|
|
30
|
+
VaultRisk["VERY_HIGH"] = "very-high";
|
|
31
|
+
})(VaultRisk = exports.VaultRisk || (exports.VaultRisk = {}));
|
|
32
|
+
var VaultStatus;
|
|
33
|
+
(function (VaultStatus) {
|
|
34
|
+
VaultStatus["DEPRECATED"] = "Deprecated";
|
|
35
|
+
VaultStatus["BLACKLISTED"] = "Blacklisted";
|
|
36
|
+
VaultStatus["ACTIVE"] = "Active";
|
|
37
|
+
})(VaultStatus = exports.VaultStatus || (exports.VaultStatus = {}));
|
|
24
38
|
class OffchainVault extends offchainPoolToken_1.default {
|
|
25
39
|
constructor(offchain, vaultAddress) {
|
|
26
40
|
super();
|
|
27
41
|
this.getOffchain = () => this.offchain;
|
|
28
42
|
this.getVaultAddress = () => this.vaultAddress;
|
|
29
43
|
this.getVaultType = () => this.vaultType;
|
|
44
|
+
this.getVaultRisk = () => this.vaultRisk;
|
|
45
|
+
this.getVaultStatus = () => this.vaultStatus;
|
|
30
46
|
this.offchain = offchain;
|
|
31
47
|
this.vaultAddress = vaultAddress;
|
|
32
48
|
}
|