impermax-sdk 1.0.1 → 1.0.2
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/esm/abis/ImpermaxABI.d.ts +2 -0
- package/lib/esm/abis/ImpermaxABI.js +3 -0
- package/lib/esm/abis/contracts/ClaimAggregator.json +2015 -0
- package/lib/esm/abis/contracts/IBorrowable.json +13207 -0
- package/lib/esm/abis/contracts/IClaimable.json +406 -0
- package/lib/esm/abis/contracts/ICollateral.json +8952 -0
- package/lib/esm/abis/contracts/IERC20.json +2376 -0
- package/lib/esm/abis/contracts/IFactory.json +3660 -0
- package/lib/esm/abis/contracts/IFarmingPool.json +3584 -0
- package/lib/esm/abis/contracts/IMerkleDistributor.json +1134 -0
- package/lib/esm/abis/contracts/IRouter02.json +7283 -0
- package/lib/esm/abis/contracts/ISimpleUniswapOracle.json +1469 -0
- package/lib/esm/abis/contracts/IStakedLPToken.json +7309 -0
- package/lib/esm/abis/contracts/IStakingRewards.json +1036 -0
- package/lib/esm/abis/contracts/IUniswapV2Factory.json +1690 -0
- package/lib/esm/abis/contracts/IUniswapV2Pair.json +6761 -0
- package/lib/esm/abis/contracts/ImpermaxChef.json +20945 -0
- package/lib/esm/config/amms.d.ts +25 -0
- package/lib/esm/config/amms.js +196 -0
- package/lib/esm/config/contracts/claim-aggregators.d.ts +2 -0
- package/lib/esm/config/contracts/claim-aggregators.js +18 -0
- package/lib/esm/config/contracts/impermax-chef.d.ts +2 -0
- package/lib/esm/config/contracts/impermax-chef.js +18 -0
- package/lib/esm/config/contracts/imxes.d.ts +2 -0
- package/lib/esm/config/contracts/imxes.js +18 -0
- package/lib/esm/config/contracts/merkle-distributors.d.ts +4 -0
- package/lib/esm/config/contracts/merkle-distributors.js +13 -0
- package/lib/esm/config/contracts/routers.d.ts +2 -0
- package/lib/esm/config/contracts/routers.js +38 -0
- package/lib/esm/config/contracts/simple-uniswap-oracles.d.ts +2 -0
- package/lib/esm/config/contracts/simple-uniswap-oracles.js +35 -0
- package/lib/esm/config/contracts/weths.d.ts +2 -0
- package/lib/esm/config/contracts/weths.js +19 -0
- package/lib/esm/config/debank-ids.d.ts +2 -0
- package/lib/esm/config/debank-ids.js +17 -0
- package/lib/esm/config/endpoints/merkle-distributors.d.ts +4 -0
- package/lib/esm/config/endpoints/merkle-distributors.js +13 -0
- package/lib/esm/config/eth.d.ts +3 -0
- package/lib/esm/config/eth.js +32 -0
- package/lib/esm/config/factories.d.ts +6 -0
- package/lib/esm/config/factories.js +24 -0
- package/lib/esm/config/farms.d.ts +59 -0
- package/lib/esm/config/farms.js +114 -0
- package/lib/esm/config/general.d.ts +3 -0
- package/lib/esm/config/general.js +8 -0
- package/lib/esm/config/subgraphs.d.ts +5 -0
- package/lib/esm/config/subgraphs.js +68 -0
- package/lib/esm/config/types.d.ts +67 -0
- package/lib/esm/config/types.js +54 -0
- package/lib/esm/impermax-router/Account.d.ts +31 -0
- package/lib/esm/impermax-router/Account.js +154 -0
- package/lib/esm/impermax-router/AccountBorrowable.d.ts +22 -0
- package/lib/esm/impermax-router/AccountBorrowable.js +141 -0
- package/lib/esm/impermax-router/AccountCollateral.d.ts +11 -0
- package/lib/esm/impermax-router/AccountCollateral.js +63 -0
- package/lib/esm/impermax-router/AccountLendingPool.d.ts +57 -0
- package/lib/esm/impermax-router/AccountLendingPool.js +266 -0
- package/lib/esm/impermax-router/AccountPoolToken.d.ts +29 -0
- package/lib/esm/impermax-router/AccountPoolToken.js +89 -0
- package/lib/esm/impermax-router/Borrowable.d.ts +27 -0
- package/lib/esm/impermax-router/Borrowable.js +128 -0
- package/lib/esm/impermax-router/Collateral.d.ts +9 -0
- package/lib/esm/impermax-router/Collateral.js +45 -0
- package/lib/esm/impermax-router/ContractsHelper.d.ts +28 -0
- package/lib/esm/impermax-router/ContractsHelper.js +50 -0
- package/lib/esm/impermax-router/ImpermaxFactory.d.ts +15 -0
- package/lib/esm/impermax-router/ImpermaxFactory.js +42 -0
- package/lib/esm/impermax-router/Interactions.d.ts +16 -0
- package/lib/esm/impermax-router/Interactions.js +105 -0
- package/lib/esm/impermax-router/InteractionsLendingPool.d.ts +43 -0
- package/lib/esm/impermax-router/InteractionsLendingPool.js +124 -0
- package/lib/esm/impermax-router/InteractionsPoolToken.d.ts +23 -0
- package/lib/esm/impermax-router/InteractionsPoolToken.js +194 -0
- package/lib/esm/impermax-router/LendingPool.d.ts +69 -0
- package/lib/esm/impermax-router/LendingPool.js +291 -0
- package/lib/esm/impermax-router/PoolToken.d.ts +36 -0
- package/lib/esm/impermax-router/PoolToken.js +140 -0
- package/lib/esm/impermax-router/index.d.ts +20 -0
- package/lib/esm/impermax-router/index.js +34 -0
- package/lib/esm/impermax-router/interfaces.d.ts +218 -0
- package/lib/esm/impermax-router/interfaces.js +15 -0
- package/{index.ts → lib/esm/index.d.ts} +1 -3
- package/lib/esm/index.js +10 -0
- package/lib/esm/subgraph/Account.d.ts +18 -0
- package/lib/esm/subgraph/Account.js +111 -0
- package/lib/esm/subgraph/AccountLendingPool.d.ts +19 -0
- package/lib/esm/subgraph/AccountLendingPool.js +71 -0
- package/lib/esm/subgraph/AccountPoolToken.d.ts +14 -0
- package/lib/esm/subgraph/AccountPoolToken.js +75 -0
- package/lib/esm/subgraph/LendingPool.d.ts +38 -0
- package/lib/esm/subgraph/LendingPool.js +204 -0
- package/lib/esm/subgraph/PoolToken.d.ts +64 -0
- package/lib/esm/subgraph/PoolToken.js +462 -0
- package/lib/esm/subgraph/PriceHelper.d.ts +21 -0
- package/lib/esm/subgraph/PriceHelper.js +166 -0
- package/lib/esm/subgraph/SolidexHelper.d.ts +16 -0
- package/lib/esm/subgraph/SolidexHelper.js +58 -0
- package/lib/esm/subgraph/index.d.ts +73 -0
- package/lib/esm/subgraph/index.js +185 -0
- package/lib/esm/subgraph/initializer.d.ts +34 -0
- package/lib/esm/subgraph/initializer.js +517 -0
- package/lib/esm/subgraph/query.d.ts +10 -0
- package/lib/esm/subgraph/query.js +229 -0
- package/lib/esm/utils/ether-utils.d.ts +5 -0
- package/lib/esm/utils/ether-utils.js +26 -0
- package/lib/esm/utils/index.d.ts +3 -0
- package/lib/esm/utils/index.js +16 -0
- package/package.json +9 -3
- package/.idea/impermax-sdk.iml +0 -12
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/workspace.xml +0 -642
- package/abis/ImpermaxABI.ts +0 -3
- package/abis/contracts/BAllowance.json +0 -4735
- package/abis/contracts/BDeployer.json +0 -1195
- package/abis/contracts/BInterestRateModel.json +0 -10796
- package/abis/contracts/BSetter.json +0 -6219
- package/abis/contracts/BStorage.json +0 -2613
- package/abis/contracts/Borrowable.json +0 -19937
- package/abis/contracts/CDeployer.json +0 -1104
- package/abis/contracts/CSetter.json +0 -5094
- package/abis/contracts/CStorage.json +0 -516
- package/abis/contracts/ClaimAggregator.json +0 -2015
- package/abis/contracts/Collateral.json +0 -21615
- package/abis/contracts/ERC20.json +0 -819
- package/abis/contracts/Factory.json +0 -21986
- package/abis/contracts/FarmingPool.json +0 -8601
- package/abis/contracts/IBDeployer.json +0 -351
- package/abis/contracts/IBorrowTracker.json +0 -346
- package/abis/contracts/IBorrowable.json +0 -13207
- package/abis/contracts/ICDeployer.json +0 -294
- package/abis/contracts/IClaimable.json +0 -406
- package/abis/contracts/ICollateral.json +0 -8952
- package/abis/contracts/IERC20.json +0 -2376
- package/abis/contracts/IFactory.json +0 -3660
- package/abis/contracts/IFarmingPool.json +0 -3584
- package/abis/contracts/IImpermaxCallee.json +0 -679
- package/abis/contracts/IMerkleDistributor.json +0 -1134
- package/abis/contracts/IPoolToken.json +0 -5343
- package/abis/contracts/IRouter01.json +0 -6891
- package/abis/contracts/IRouter02.json +0 -7283
- package/abis/contracts/ISimpleUniswapOracle.json +0 -1469
- package/abis/contracts/IStakedLPToken.json +0 -7309
- package/abis/contracts/IStakingRewards.json +0 -1036
- package/abis/contracts/IUniswapV2Callee.json +0 -403
- package/abis/contracts/IUniswapV2ERC20.json +0 -3155
- package/abis/contracts/IUniswapV2Factory.json +0 -1690
- package/abis/contracts/IUniswapV2Pair.json +0 -6761
- package/abis/contracts/IWETH.json +0 -561
- package/abis/contracts/ImpermaxChef.json +0 -20945
- package/abis/contracts/ImpermaxERC20.json +0 -12095
- package/abis/contracts/Math.json +0 -1966
- package/abis/contracts/MockERC20.json +0 -8884
- package/abis/contracts/PoolToken.json +0 -10784
- package/abis/contracts/Router01.json +0 -43963
- package/abis/contracts/SafeMath.json +0 -6828
- package/abis/contracts/SimpleUniswapOracle.json +0 -9640
- package/abis/contracts/TransferHelper.json +0 -4875
- package/abis/contracts/UQ112x112.json +0 -1201
- package/abis/contracts/UniswapV2ERC20.json +0 -10969
- package/abis/contracts/UniswapV2Factory.json +0 -5521
- package/abis/contracts/UniswapV2Library.json +0 -13789
- package/abis/contracts/UniswapV2Pair.json +0 -30782
- package/abis/contracts/WETH9.json +0 -6613
- package/config/amms.ts +0 -199
- package/config/contracts/claim-aggregators.ts +0 -16
- package/config/contracts/impermax-chef.ts +0 -16
- package/config/contracts/imxes.ts +0 -16
- package/config/contracts/merkle-distributors.ts +0 -13
- package/config/contracts/routers.ts +0 -36
- package/config/contracts/simple-uniswap-oracles.ts +0 -33
- package/config/contracts/weths.ts +0 -18
- package/config/debank-ids.ts +0 -15
- package/config/endpoints/merkle-distributors.ts +0 -13
- package/config/eth.ts +0 -32
- package/config/factories.ts +0 -26
- package/config/farms.ts +0 -119
- package/config/general.ts +0 -8
- package/config/subgraphs.ts +0 -69
- package/config/types.ts +0 -81
- package/impermax-router/Account.ts +0 -123
- package/impermax-router/AccountBorrowable.ts +0 -110
- package/impermax-router/AccountCollateral.ts +0 -40
- package/impermax-router/AccountLendingPool.ts +0 -231
- package/impermax-router/AccountPoolToken.ts +0 -76
- package/impermax-router/Borrowable.ts +0 -86
- package/impermax-router/Collateral.ts +0 -26
- package/impermax-router/ContractsHelper.ts +0 -64
- package/impermax-router/ImpermaxFactory.ts +0 -47
- package/impermax-router/Interactions.ts +0 -94
- package/impermax-router/InteractionsLendingPool.ts +0 -129
- package/impermax-router/InteractionsPoolToken.ts +0 -187
- package/impermax-router/LendingPool.ts +0 -256
- package/impermax-router/PoolToken.ts +0 -112
- package/impermax-router/index.ts +0 -49
- package/impermax-router/interfaces.ts +0 -233
- package/subgraph/Account.ts +0 -93
- package/subgraph/AccountLendingPool.ts +0 -60
- package/subgraph/AccountPoolToken.ts +0 -60
- package/subgraph/LendingPool.ts +0 -179
- package/subgraph/PoolToken.ts +0 -381
- package/subgraph/PriceHelper.ts +0 -150
- package/subgraph/SolidexHelper.ts +0 -54
- package/subgraph/index.ts +0 -166
- package/subgraph/initializer.ts +0 -509
- package/subgraph/query.ts +0 -224
- package/tsconfig.json +0 -16
- package/utils/ether-utils.ts +0 -22
- package/utils/index.ts +0 -12
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFarmByStakedLPFactory = exports.STAKED_LP_FACTORY = exports.hrFarms = exports.Farms = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
var Farms;
|
|
6
|
+
(function (Farms) {
|
|
7
|
+
Farms["quickswapOld"] = "quickswapOld";
|
|
8
|
+
Farms["quickswap"] = "quickswap";
|
|
9
|
+
Farms["quickswapDual"] = "quickswapDual";
|
|
10
|
+
Farms["sushiswap"] = "sushiswap";
|
|
11
|
+
Farms["arbinyan"] = "arbinyan";
|
|
12
|
+
Farms["swapr"] = "swapr";
|
|
13
|
+
Farms["swapfish"] = "swapfish";
|
|
14
|
+
Farms["zyberswap"] = "zyberswap";
|
|
15
|
+
Farms["radiant"] = "";
|
|
16
|
+
Farms["plutusDao"] = "";
|
|
17
|
+
Farms["pangolin"] = "pangolin";
|
|
18
|
+
Farms["pangolinV2"] = "pangolinV2";
|
|
19
|
+
Farms["traderJoeV2"] = "traderJoeV2";
|
|
20
|
+
Farms["traderJoeV3"] = "traderJoeV3";
|
|
21
|
+
Farms["traderJoeV4"] = "traderJoeV4";
|
|
22
|
+
Farms["solarbeam"] = "solarbeam";
|
|
23
|
+
Farms["solarbeam2"] = "solarbeam2";
|
|
24
|
+
Farms["thorus"] = "thorus";
|
|
25
|
+
Farms["tetuswap"] = "tetuswap";
|
|
26
|
+
Farms["solidex"] = "solidex";
|
|
27
|
+
Farms["solidexB"] = "solidexB";
|
|
28
|
+
Farms["solidexUSDC"] = "solidexUSDC";
|
|
29
|
+
Farms["solidexUSDCB"] = "solidexUSDCB";
|
|
30
|
+
Farms["oxdao"] = "oxdao";
|
|
31
|
+
})(Farms = exports.Farms || (exports.Farms = {}));
|
|
32
|
+
exports.hrFarms = {
|
|
33
|
+
[Farms.quickswapOld]: 'QuickSwap',
|
|
34
|
+
[Farms.quickswap]: 'QuickSwap',
|
|
35
|
+
[Farms.quickswapDual]: 'QuickSwap',
|
|
36
|
+
[Farms.sushiswap]: 'SushiSwap',
|
|
37
|
+
[Farms.arbinyan]: 'ArbyNYAN',
|
|
38
|
+
[Farms.swapr]: 'Swapr',
|
|
39
|
+
[Farms.swapfish]: 'SwapFish',
|
|
40
|
+
[Farms.zyberswap]: 'ZyberSwap',
|
|
41
|
+
[Farms.radiant]: 'Radiant',
|
|
42
|
+
[Farms.plutusDao]: 'Plutus DAO',
|
|
43
|
+
[Farms.pangolin]: 'Pangolin',
|
|
44
|
+
[Farms.pangolinV2]: 'Pangolin',
|
|
45
|
+
[Farms.traderJoeV2]: 'TraderJoe',
|
|
46
|
+
[Farms.traderJoeV3]: 'TraderJoe',
|
|
47
|
+
[Farms.traderJoeV4]: 'TraderJoe',
|
|
48
|
+
[Farms.solarbeam]: 'Solarbeam',
|
|
49
|
+
[Farms.solarbeam2]: 'Solarbeam',
|
|
50
|
+
[Farms.thorus]: 'Thorus',
|
|
51
|
+
[Farms.tetuswap]: 'TetuSwap',
|
|
52
|
+
[Farms.solidex]: 'Solidex',
|
|
53
|
+
[Farms.solidexB]: 'Solidex',
|
|
54
|
+
[Farms.solidexUSDC]: 'Solidex',
|
|
55
|
+
[Farms.solidexUSDCB]: 'Solidex',
|
|
56
|
+
[Farms.oxdao]: '0xDAO',
|
|
57
|
+
};
|
|
58
|
+
exports.STAKED_LP_FACTORY = {
|
|
59
|
+
[types_1.Networks.Ropsten]: {},
|
|
60
|
+
[types_1.Networks.Mainnet]: {},
|
|
61
|
+
[types_1.Networks.Polygon]: {
|
|
62
|
+
[Farms.quickswapOld]: '0xF47B652cDE9b30D6aDd0b13027Bb7AD2F7AF04f4',
|
|
63
|
+
[Farms.quickswap]: '0x846019FB6f136fC98b80e527C3d34F39D16a38c4',
|
|
64
|
+
[Farms.quickswapDual]: '0xC4505Cc6125d61E2A352ce5cf2129f2fb19259a8',
|
|
65
|
+
[Farms.sushiswap]: '0xcb30A66e72Ed90D1b34f78fc0655895FC28bB6CF',
|
|
66
|
+
[Farms.tetuswap]: '0x8E45622663Bb01dc285B4F51Eb8F9FE4fa7b5899',
|
|
67
|
+
},
|
|
68
|
+
[types_1.Networks.Arbitrum]: {
|
|
69
|
+
[Farms.arbinyan]: '0x6659a9c5cD313974343E30b4fDfFD95bD4b4dCd2',
|
|
70
|
+
[Farms.sushiswap]: '0x270250F59C1ffA06C9e3234D528858Ff59aFCE68',
|
|
71
|
+
[Farms.swapr]: '0x5643C3aCEC0D4970a385fb9Cc1555bec1d912bb8',
|
|
72
|
+
//[Farms.swapfish]: '0xcDAeC65495Fa5c0545c5a405224214e3594f30d8',
|
|
73
|
+
[Farms.swapfish]: '0x3bE7B59Ab6558845FfA1f026Dff40b305dd47b37',
|
|
74
|
+
[Farms.zyberswap]: '0xBCE93e2D822CfDD70F106e32FCB266457cece45F',
|
|
75
|
+
[Farms.radiant]: '0x4aE11dC7D7e70eE16d7eaE32851302e55f6CA85e',
|
|
76
|
+
[Farms.plutusDao]: '0x4dC48B93855F42cCcc54f65615AeF6FFC12EC1DF',
|
|
77
|
+
},
|
|
78
|
+
[types_1.Networks.Avalanche]: {
|
|
79
|
+
[Farms.pangolin]: '0xBB92270716C8c424849F17cCc12F4F24AD4064D6',
|
|
80
|
+
[Farms.pangolinV2]: '0xC596f6455054D8cdDE627096bE671e377791E295',
|
|
81
|
+
[Farms.traderJoeV2]: '0x16ED59ffbfbe62ebA9a69a304D38901F86461282',
|
|
82
|
+
[Farms.traderJoeV3]: '0x58Fde5bdB2C6Bd828Bc41c12a68189C7cd93dCE2',
|
|
83
|
+
[Farms.traderJoeV4]: '0xbc1bb900e34adbb99957672361433c6ad62a0cac',
|
|
84
|
+
[Farms.thorus]: '0x9141B3d02443a84793794f661Ae1e6607A03A201',
|
|
85
|
+
},
|
|
86
|
+
[types_1.Networks.Moonriver]: {
|
|
87
|
+
[Farms.sushiswap]: '0xBB92270716C8c424849F17cCc12F4F24AD4064D6',
|
|
88
|
+
[Farms.solarbeam]: '0x95887654d8646c26fab33f344576e2e74b211256',
|
|
89
|
+
[Farms.solarbeam2]: '0x23bdECdB7073D5f899708f33FCaFff787b81e287',
|
|
90
|
+
},
|
|
91
|
+
[types_1.Networks.Aurora]: {},
|
|
92
|
+
[types_1.Networks.Cronos]: {},
|
|
93
|
+
[types_1.Networks.Fantom]: {
|
|
94
|
+
[Farms.solidex]: '0x95887654d8646C26fAb33F344576E2E74b211256',
|
|
95
|
+
[Farms.solidexB]: '0x8610Dc1912a55761a713D827a1a1ad131bE8f579',
|
|
96
|
+
[Farms.solidexUSDC]: '0xF14f98E6F34C12Bd74fcEAC1668aF749fc269cFf',
|
|
97
|
+
[Farms.solidexUSDCB]: '0x9B1434a02Ee86302d463bB6B365EbdFAc56e067A',
|
|
98
|
+
[Farms.oxdao]: '0xB83D21F60B73B21506c69DEcdBcF7Ab5AB737eB2',
|
|
99
|
+
},
|
|
100
|
+
[types_1.Networks.Harmony]: {},
|
|
101
|
+
[types_1.Networks.Moonbeam]: {},
|
|
102
|
+
[types_1.Networks.Sxnetwork]: {},
|
|
103
|
+
};
|
|
104
|
+
function getFarmByStakedLPFactory(network, address) {
|
|
105
|
+
if (!address)
|
|
106
|
+
return null;
|
|
107
|
+
for (const farm of Object.keys(Farms)) {
|
|
108
|
+
if (exports.STAKED_LP_FACTORY[network][farm] &&
|
|
109
|
+
address.toLowerCase() == exports.STAKED_LP_FACTORY[network][farm].toLowerCase())
|
|
110
|
+
return farm;
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
exports.getFarmByStakedLPFactory = getFarmByStakedLPFactory;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEADLINE = exports.NOT_SYNCED = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
exports.NOT_SYNCED = false;
|
|
6
|
+
exports.DEADLINE = ethers_1.BigNumber.from(Math.floor(Date.now() / 1000) + 3600 * 24 * 365); //1 year deadline
|
|
7
|
+
const ZERO = ethers_1.ethers.constants.Zero;
|
|
8
|
+
const APPROVE_AMOUNT = ethers_1.ethers.constants.MaxUint256;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Address, NetworkFactoryIndex, NetworkIndex } from './types';
|
|
2
|
+
export declare const IMPERMAX_SUBGRAPH_URL: NetworkFactoryIndex<Address>;
|
|
3
|
+
export declare const IMPERMAX_CHEF_SUBGRAPH_URL: NetworkIndex<string>;
|
|
4
|
+
export declare const BLOCKS_SUBGRAPH_URL: NetworkIndex<string>;
|
|
5
|
+
export declare const XIMX_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/impermax-finance/imx-staking";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XIMX_SUBGRAPH_URL = exports.BLOCKS_SUBGRAPH_URL = exports.IMPERMAX_CHEF_SUBGRAPH_URL = exports.IMPERMAX_SUBGRAPH_URL = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
exports.IMPERMAX_SUBGRAPH_URL = {
|
|
6
|
+
[types_1.Networks.Ropsten]: {
|
|
7
|
+
[types_1.Factory.V2V1]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-ropsten'
|
|
8
|
+
},
|
|
9
|
+
[types_1.Networks.Mainnet]: {
|
|
10
|
+
[types_1.Factory.V2V1]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap1'
|
|
11
|
+
},
|
|
12
|
+
[types_1.Networks.Polygon]: {
|
|
13
|
+
[types_1.Factory.V2V1_1]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-polygon',
|
|
14
|
+
[types_1.Factory.V2V2]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-polygon-v2',
|
|
15
|
+
},
|
|
16
|
+
[types_1.Networks.Arbitrum]: {
|
|
17
|
+
[types_1.Factory.V2V1_1]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-arbitrum',
|
|
18
|
+
[types_1.Factory.V2V2]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-arbitrum-v2',
|
|
19
|
+
//[F.V2V1_1]: 'https://api.impermax.finance/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-arbitrum02'
|
|
20
|
+
},
|
|
21
|
+
[types_1.Networks.Avalanche]: {
|
|
22
|
+
[types_1.Factory.V2V1_2]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-avalanche1',
|
|
23
|
+
[types_1.Factory.V2V2]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-avalanche-v2',
|
|
24
|
+
},
|
|
25
|
+
[types_1.Networks.Moonriver]: {
|
|
26
|
+
[types_1.Factory.V2V1_2]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-moonriver'
|
|
27
|
+
},
|
|
28
|
+
[types_1.Networks.Aurora]: {
|
|
29
|
+
[types_1.Factory.V2V1_2]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-aurora'
|
|
30
|
+
},
|
|
31
|
+
[types_1.Networks.Cronos]: {},
|
|
32
|
+
[types_1.Networks.Fantom]: {
|
|
33
|
+
[types_1.Factory.SOLV1_2]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-fantom',
|
|
34
|
+
//[Factory.SOLV2]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-x-uniswap-v2-fantom-v2',
|
|
35
|
+
},
|
|
36
|
+
[types_1.Networks.Harmony]: {},
|
|
37
|
+
[types_1.Networks.Moonbeam]: {},
|
|
38
|
+
[types_1.Networks.Sxnetwork]: {},
|
|
39
|
+
};
|
|
40
|
+
exports.IMPERMAX_CHEF_SUBGRAPH_URL = {
|
|
41
|
+
[types_1.Networks.Ropsten]: '',
|
|
42
|
+
[types_1.Networks.Mainnet]: '',
|
|
43
|
+
[types_1.Networks.Polygon]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-chef-polygon',
|
|
44
|
+
[types_1.Networks.Arbitrum]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-chef-arbitrum',
|
|
45
|
+
[types_1.Networks.Avalanche]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-chef-avalanche',
|
|
46
|
+
[types_1.Networks.Moonriver]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-chef-moonriver',
|
|
47
|
+
[types_1.Networks.Fantom]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-chef-fantom',
|
|
48
|
+
[types_1.Networks.Aurora]: '',
|
|
49
|
+
[types_1.Networks.Cronos]: '',
|
|
50
|
+
[types_1.Networks.Harmony]: '',
|
|
51
|
+
[types_1.Networks.Moonbeam]: '',
|
|
52
|
+
[types_1.Networks.Sxnetwork]: '',
|
|
53
|
+
};
|
|
54
|
+
exports.BLOCKS_SUBGRAPH_URL = {
|
|
55
|
+
[types_1.Networks.Ropsten]: '',
|
|
56
|
+
[types_1.Networks.Mainnet]: 'https://api.thegraph.com/subgraphs/name/blocklytics/ethereum-blocks',
|
|
57
|
+
[types_1.Networks.Polygon]: 'https://api.thegraph.com/subgraphs/name/matthewlilley/polygon-blocks',
|
|
58
|
+
[types_1.Networks.Arbitrum]: 'https://api.thegraph.com/subgraphs/name/sushiswap/arbitrum-blocks',
|
|
59
|
+
[types_1.Networks.Avalanche]: 'https://api.thegraph.com/subgraphs/name/dasconnor/avalanche-blocks',
|
|
60
|
+
[types_1.Networks.Moonriver]: 'https://api.thegraph.com/subgraphs/name/sushiswap/moonriver-blocks',
|
|
61
|
+
[types_1.Networks.Aurora]: '',
|
|
62
|
+
[types_1.Networks.Cronos]: '',
|
|
63
|
+
[types_1.Networks.Fantom]: 'https://api.thegraph.com/subgraphs/name/matthewlilley/fantom-blocks',
|
|
64
|
+
[types_1.Networks.Harmony]: '',
|
|
65
|
+
[types_1.Networks.Moonbeam]: '',
|
|
66
|
+
[types_1.Networks.Sxnetwork]: '',
|
|
67
|
+
};
|
|
68
|
+
exports.XIMX_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/impermax-finance/imx-staking";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare enum Networks {
|
|
2
|
+
Ropsten = "ropsten",
|
|
3
|
+
Mainnet = "mainnet",
|
|
4
|
+
Polygon = "polygon",
|
|
5
|
+
Arbitrum = "arbitrum",
|
|
6
|
+
Avalanche = "avalanche",
|
|
7
|
+
Moonriver = "moonriver",
|
|
8
|
+
Aurora = "aurora",
|
|
9
|
+
Cronos = "cronos",
|
|
10
|
+
Fantom = "fantom",
|
|
11
|
+
Harmony = "harmony",
|
|
12
|
+
Moonbeam = "moonbeam",
|
|
13
|
+
Sxnetwork = "sxnetwork"
|
|
14
|
+
}
|
|
15
|
+
export declare enum Factory {
|
|
16
|
+
V2V1 = "1",
|
|
17
|
+
V2V1_1 = "2",
|
|
18
|
+
V2V1_2 = "3",
|
|
19
|
+
V2V2 = "4",
|
|
20
|
+
SOLV1_2 = "5",
|
|
21
|
+
SOLV2 = "6"
|
|
22
|
+
}
|
|
23
|
+
export declare enum PoolTokenType {
|
|
24
|
+
Collateral = "collateral",
|
|
25
|
+
BorrowableA = "borrowable0",
|
|
26
|
+
BorrowableB = "borrowable1"
|
|
27
|
+
}
|
|
28
|
+
export declare enum Amms {
|
|
29
|
+
uniswap = "uniswap",
|
|
30
|
+
quickswap = "quickswap",
|
|
31
|
+
sushiswap = "sushiswap",
|
|
32
|
+
swapr = "swapr",
|
|
33
|
+
swapfish = "swapfish",
|
|
34
|
+
zyberswap = "zyberswap",
|
|
35
|
+
pangolin = "pangolin",
|
|
36
|
+
traderJoe = "traderJoe",
|
|
37
|
+
solarbeam = "solarbeam",
|
|
38
|
+
thorus = "thorus",
|
|
39
|
+
tetuswap = "tetuswap",
|
|
40
|
+
solidly = "solidly",
|
|
41
|
+
solidlyB = "solidlyB",
|
|
42
|
+
solidlyUSDC = "solidlyUSDC",
|
|
43
|
+
solidlyUSDCB = "solidlyUSDCB",
|
|
44
|
+
solidly091 = "solidly091",
|
|
45
|
+
solidlyOxd = "solidlyOxd"
|
|
46
|
+
}
|
|
47
|
+
export type Address = string;
|
|
48
|
+
export type NetworkIndex<Type> = {
|
|
49
|
+
[key in Networks]?: Type;
|
|
50
|
+
};
|
|
51
|
+
export type FactoryIndex<Type> = {
|
|
52
|
+
[key in Factory]?: Type;
|
|
53
|
+
};
|
|
54
|
+
export type AddressIndex<Type> = {
|
|
55
|
+
[key in Address]: Type;
|
|
56
|
+
};
|
|
57
|
+
export type NetworkFactoryIndex<Type> = NetworkIndex<FactoryIndex<Type>>;
|
|
58
|
+
export type LendingPoolIndex<Type> = FactoryIndex<AddressIndex<Type>>;
|
|
59
|
+
export type AmmIndex = {
|
|
60
|
+
[key in Networks]: {
|
|
61
|
+
[key in Amms]?: any;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export type DistributorDetails = {
|
|
65
|
+
claimableAddress: Address;
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Amms = exports.PoolTokenType = exports.Factory = exports.Networks = void 0;
|
|
4
|
+
var Networks;
|
|
5
|
+
(function (Networks) {
|
|
6
|
+
Networks["Ropsten"] = "ropsten";
|
|
7
|
+
Networks["Mainnet"] = "mainnet";
|
|
8
|
+
Networks["Polygon"] = "polygon";
|
|
9
|
+
Networks["Arbitrum"] = "arbitrum";
|
|
10
|
+
Networks["Avalanche"] = "avalanche";
|
|
11
|
+
Networks["Moonriver"] = "moonriver";
|
|
12
|
+
Networks["Aurora"] = "aurora";
|
|
13
|
+
Networks["Cronos"] = "cronos";
|
|
14
|
+
Networks["Fantom"] = "fantom";
|
|
15
|
+
Networks["Harmony"] = "harmony";
|
|
16
|
+
Networks["Moonbeam"] = "moonbeam";
|
|
17
|
+
Networks["Sxnetwork"] = "sxnetwork";
|
|
18
|
+
})(Networks = exports.Networks || (exports.Networks = {}));
|
|
19
|
+
// FACTORIES
|
|
20
|
+
var Factory;
|
|
21
|
+
(function (Factory) {
|
|
22
|
+
Factory["V2V1"] = "1";
|
|
23
|
+
Factory["V2V1_1"] = "2";
|
|
24
|
+
Factory["V2V1_2"] = "3";
|
|
25
|
+
Factory["V2V2"] = "4";
|
|
26
|
+
Factory["SOLV1_2"] = "5";
|
|
27
|
+
Factory["SOLV2"] = "6";
|
|
28
|
+
})(Factory = exports.Factory || (exports.Factory = {}));
|
|
29
|
+
var PoolTokenType;
|
|
30
|
+
(function (PoolTokenType) {
|
|
31
|
+
PoolTokenType["Collateral"] = "collateral";
|
|
32
|
+
PoolTokenType["BorrowableA"] = "borrowable0";
|
|
33
|
+
PoolTokenType["BorrowableB"] = "borrowable1";
|
|
34
|
+
})(PoolTokenType = exports.PoolTokenType || (exports.PoolTokenType = {}));
|
|
35
|
+
var Amms;
|
|
36
|
+
(function (Amms) {
|
|
37
|
+
Amms["uniswap"] = "uniswap";
|
|
38
|
+
Amms["quickswap"] = "quickswap";
|
|
39
|
+
Amms["sushiswap"] = "sushiswap";
|
|
40
|
+
Amms["swapr"] = "swapr";
|
|
41
|
+
Amms["swapfish"] = "swapfish";
|
|
42
|
+
Amms["zyberswap"] = "zyberswap";
|
|
43
|
+
Amms["pangolin"] = "pangolin";
|
|
44
|
+
Amms["traderJoe"] = "traderJoe";
|
|
45
|
+
Amms["solarbeam"] = "solarbeam";
|
|
46
|
+
Amms["thorus"] = "thorus";
|
|
47
|
+
Amms["tetuswap"] = "tetuswap";
|
|
48
|
+
Amms["solidly"] = "solidly";
|
|
49
|
+
Amms["solidlyB"] = "solidlyB";
|
|
50
|
+
Amms["solidlyUSDC"] = "solidlyUSDC";
|
|
51
|
+
Amms["solidlyUSDCB"] = "solidlyUSDCB";
|
|
52
|
+
Amms["solidly091"] = "solidly091";
|
|
53
|
+
Amms["solidlyOxd"] = "solidlyOxd";
|
|
54
|
+
})(Amms = exports.Amms || (exports.Amms = {}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AirdropData, PendingRewardUI } from "./interfaces";
|
|
2
|
+
import ImpermaxRouter from "./index";
|
|
3
|
+
import AccountLendingPool from "./AccountLendingPool";
|
|
4
|
+
import { Address, Factory, FactoryIndex, LendingPoolIndex } from '../config/types';
|
|
5
|
+
export default class Account {
|
|
6
|
+
router: ImpermaxRouter;
|
|
7
|
+
account: Address;
|
|
8
|
+
accountLLPs: LendingPoolIndex<Promise<AccountLendingPool>>;
|
|
9
|
+
cache: {
|
|
10
|
+
airdropData: {
|
|
11
|
+
[key in string]?: Promise<AirdropData>;
|
|
12
|
+
};
|
|
13
|
+
claimableIBEX?: {
|
|
14
|
+
[key in Address]?: Promise<number>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
constructor(router: ImpermaxRouter, account: Address);
|
|
18
|
+
cleanCache(): Promise<void>;
|
|
19
|
+
private initializeAccountLendingPool;
|
|
20
|
+
getAccountLendingPool(factory: Factory, pair: Address): Promise<AccountLendingPool>;
|
|
21
|
+
getMassAvailableReward(pairs: FactoryIndex<Address[]>): Promise<LendingPoolIndex<PendingRewardUI[]>>;
|
|
22
|
+
private initializeAirdropData;
|
|
23
|
+
private getAirdropData;
|
|
24
|
+
getIbexAirdropData(): Promise<AirdropData>;
|
|
25
|
+
getIbex2AirdropData(): Promise<AirdropData>;
|
|
26
|
+
getEthAirdropData(): Promise<AirdropData>;
|
|
27
|
+
hasIbexClaimableAirdrop(): Promise<boolean>;
|
|
28
|
+
hasEthClaimableAirdrop(): Promise<boolean>;
|
|
29
|
+
initializeClaimableIBEX(claimableAddress: Address): Promise<number>;
|
|
30
|
+
getClaimableIBEX(claimableAddress: Address): Promise<number>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
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
|
+
const AccountLendingPool_1 = __importDefault(require("./AccountLendingPool"));
|
|
16
|
+
const ethers_1 = require("ethers");
|
|
17
|
+
const merkle_distributors_1 = require("../config/endpoints/merkle-distributors");
|
|
18
|
+
class Account {
|
|
19
|
+
constructor(router, account) {
|
|
20
|
+
this.cache = { airdropData: {} };
|
|
21
|
+
this.router = router;
|
|
22
|
+
this.account = account;
|
|
23
|
+
this.accountLLPs = {};
|
|
24
|
+
this.cache.claimableIBEX = {};
|
|
25
|
+
}
|
|
26
|
+
cleanCache() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
this.cache = { airdropData: {} };
|
|
29
|
+
this.cache.claimableIBEX = {};
|
|
30
|
+
for (const factory of Object.keys(this.accountLLPs)) {
|
|
31
|
+
for (const pairAddress of Object.keys(this.accountLLPs[factory])) {
|
|
32
|
+
(yield this.accountLLPs[factory][pairAddress]).cleanCache();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
initializeAccountLendingPool(factory, pair) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const lendingPool = yield this.router.getFactory(factory).getLendingPool(pair);
|
|
40
|
+
return new AccountLendingPool_1.default(this, lendingPool);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
getAccountLendingPool(factory, pair) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
if (!this.accountLLPs[factory])
|
|
46
|
+
this.accountLLPs[factory] = {};
|
|
47
|
+
if (!this.accountLLPs[factory][pair])
|
|
48
|
+
this.accountLLPs[factory][pair] = this.initializeAccountLendingPool(factory, pair);
|
|
49
|
+
return this.accountLLPs[factory][pair];
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Mass Available Reward (only supports ImpermaxChef)
|
|
53
|
+
getMassAvailableReward(pairs) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const result = {};
|
|
56
|
+
if (!pairs)
|
|
57
|
+
return result;
|
|
58
|
+
const requests = [];
|
|
59
|
+
const factories = Object.keys(pairs);
|
|
60
|
+
for (const factory of factories) {
|
|
61
|
+
const requestsLocal = [];
|
|
62
|
+
for (const pairAddress of pairs[factory]) {
|
|
63
|
+
requestsLocal.push((yield this.getAccountLendingPool(factory, pairAddress)).getAvailableReward());
|
|
64
|
+
}
|
|
65
|
+
requests.push(Promise.all(requestsLocal));
|
|
66
|
+
}
|
|
67
|
+
const data = yield Promise.all(requests);
|
|
68
|
+
for (let i = 0; i < factories.length; i++) {
|
|
69
|
+
const factory = factories[i];
|
|
70
|
+
result[factory] = {};
|
|
71
|
+
for (let j = 0; j < pairs[factory].length; j++) {
|
|
72
|
+
result[factory][pairs[factory][j]] = data[i][j];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
// Airdrop Data
|
|
79
|
+
initializeAirdropData(airdropURL, merkleDistributor) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
if (airdropURL && airdropURL !== '') {
|
|
82
|
+
try {
|
|
83
|
+
const json = yield fetch(airdropURL + '/' + this.account);
|
|
84
|
+
const data = yield json.json();
|
|
85
|
+
if (data) {
|
|
86
|
+
data.amount = ethers_1.BigNumber.from(data.amount);
|
|
87
|
+
const isClaimed = yield merkleDistributor.methods.isClaimed(data.index).call();
|
|
88
|
+
if (!isClaimed)
|
|
89
|
+
return data;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (e) { }
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
index: -1,
|
|
96
|
+
amount: null,
|
|
97
|
+
proof: [],
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
getAirdropData(airdropURL, merkleDistributor) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
if (!this.cache.airdropData[airdropURL])
|
|
104
|
+
this.cache.airdropData[airdropURL] = this.initializeAirdropData(airdropURL, merkleDistributor);
|
|
105
|
+
return this.cache.airdropData[airdropURL];
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
getIbexAirdropData() {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
return this.getAirdropData(merkle_distributors_1.MERKLE_URL_IBEX[this.router.network], this.router.contractsHelper.merkleDistributorIbex);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
getIbex2AirdropData() {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
return this.getAirdropData(merkle_distributors_1.MERKLE_URL_IBEX_2[this.router.network], this.router.contractsHelper.merkleDistributorIbex2);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
getEthAirdropData() {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
return this.getAirdropData(merkle_distributors_1.MERKLE_URL_ETH[this.router.network], this.router.contractsHelper.merkleDistributorEth);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
hasIbexClaimableAirdrop() {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
const airdropData = yield this.getIbexAirdropData();
|
|
126
|
+
if (airdropData.amount)
|
|
127
|
+
return true;
|
|
128
|
+
return false;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
hasEthClaimableAirdrop() {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
const airdropData = yield this.getEthAirdropData();
|
|
134
|
+
if (airdropData.amount)
|
|
135
|
+
return true;
|
|
136
|
+
return false;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// Claim Claimable IBEX
|
|
140
|
+
initializeClaimableIBEX(claimableAddress) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
const claimable = this.router.contractsHelper.newClaimable(claimableAddress);
|
|
143
|
+
return (yield claimable.methods.claim().call({ from: this.account })) / 1e18;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
getClaimableIBEX(claimableAddress) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
if (!this.cache.claimableIBEX[claimableAddress])
|
|
149
|
+
this.cache.claimableIBEX[claimableAddress] = this.initializeClaimableIBEX(claimableAddress);
|
|
150
|
+
return this.cache.claimableIBEX[claimableAddress];
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.default = Account;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import AccountPoolToken from "./AccountPoolToken";
|
|
2
|
+
import Borrowable from "./Borrowable";
|
|
3
|
+
export default class AccountBorrowable extends AccountPoolToken {
|
|
4
|
+
poolToken: Borrowable;
|
|
5
|
+
borrowableCache: {
|
|
6
|
+
borrowed?: Promise<number>;
|
|
7
|
+
farmingShares?: Promise<number>;
|
|
8
|
+
availableIMXReward?: Promise<number>;
|
|
9
|
+
availableRewarderReward?: Promise<number>;
|
|
10
|
+
};
|
|
11
|
+
cleanCache(): void;
|
|
12
|
+
private initializeBorrowed;
|
|
13
|
+
getBorrowed(): Promise<number>;
|
|
14
|
+
getBorrowedUSD(): Promise<number>;
|
|
15
|
+
getMaxBorrowable(): Promise<number>;
|
|
16
|
+
private initializeFarmingShares;
|
|
17
|
+
getFarmingShares(): Promise<number>;
|
|
18
|
+
private initializeAvailableIMXReward;
|
|
19
|
+
getAvailableIMXReward(): Promise<number>;
|
|
20
|
+
private initializeAvailableRewarderReward;
|
|
21
|
+
getAvailableRewarderReward(): Promise<number>;
|
|
22
|
+
}
|