impermax-sdk 1.0.2 → 1.0.3
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/package.json +1 -1
- package/lib/esm/abis/ImpermaxABI.d.ts +0 -2
- package/lib/esm/abis/ImpermaxABI.js +0 -3
- package/lib/esm/abis/contracts/ClaimAggregator.json +0 -2015
- package/lib/esm/abis/contracts/IBorrowable.json +0 -13207
- package/lib/esm/abis/contracts/IClaimable.json +0 -406
- package/lib/esm/abis/contracts/ICollateral.json +0 -8952
- package/lib/esm/abis/contracts/IERC20.json +0 -2376
- package/lib/esm/abis/contracts/IFactory.json +0 -3660
- package/lib/esm/abis/contracts/IFarmingPool.json +0 -3584
- package/lib/esm/abis/contracts/IMerkleDistributor.json +0 -1134
- package/lib/esm/abis/contracts/IRouter02.json +0 -7283
- package/lib/esm/abis/contracts/ISimpleUniswapOracle.json +0 -1469
- package/lib/esm/abis/contracts/IStakedLPToken.json +0 -7309
- package/lib/esm/abis/contracts/IStakingRewards.json +0 -1036
- package/lib/esm/abis/contracts/IUniswapV2Factory.json +0 -1690
- package/lib/esm/abis/contracts/IUniswapV2Pair.json +0 -6761
- package/lib/esm/abis/contracts/ImpermaxChef.json +0 -20945
- package/lib/esm/config/amms.d.ts +0 -25
- package/lib/esm/config/amms.js +0 -196
- package/lib/esm/config/contracts/claim-aggregators.d.ts +0 -2
- package/lib/esm/config/contracts/claim-aggregators.js +0 -18
- package/lib/esm/config/contracts/impermax-chef.d.ts +0 -2
- package/lib/esm/config/contracts/impermax-chef.js +0 -18
- package/lib/esm/config/contracts/imxes.d.ts +0 -2
- package/lib/esm/config/contracts/imxes.js +0 -18
- package/lib/esm/config/contracts/merkle-distributors.d.ts +0 -4
- package/lib/esm/config/contracts/merkle-distributors.js +0 -13
- package/lib/esm/config/contracts/routers.d.ts +0 -2
- package/lib/esm/config/contracts/routers.js +0 -38
- package/lib/esm/config/contracts/simple-uniswap-oracles.d.ts +0 -2
- package/lib/esm/config/contracts/simple-uniswap-oracles.js +0 -35
- package/lib/esm/config/contracts/weths.d.ts +0 -2
- package/lib/esm/config/contracts/weths.js +0 -19
- package/lib/esm/config/debank-ids.d.ts +0 -2
- package/lib/esm/config/debank-ids.js +0 -17
- package/lib/esm/config/endpoints/merkle-distributors.d.ts +0 -4
- package/lib/esm/config/endpoints/merkle-distributors.js +0 -13
- package/lib/esm/config/eth.d.ts +0 -3
- package/lib/esm/config/eth.js +0 -32
- package/lib/esm/config/factories.d.ts +0 -6
- package/lib/esm/config/factories.js +0 -24
- package/lib/esm/config/farms.d.ts +0 -59
- package/lib/esm/config/farms.js +0 -114
- package/lib/esm/config/general.d.ts +0 -3
- package/lib/esm/config/general.js +0 -8
- package/lib/esm/config/subgraphs.d.ts +0 -5
- package/lib/esm/config/subgraphs.js +0 -68
- package/lib/esm/config/types.d.ts +0 -67
- package/lib/esm/config/types.js +0 -54
- package/lib/esm/impermax-router/Account.d.ts +0 -31
- package/lib/esm/impermax-router/Account.js +0 -154
- package/lib/esm/impermax-router/AccountBorrowable.d.ts +0 -22
- package/lib/esm/impermax-router/AccountBorrowable.js +0 -141
- package/lib/esm/impermax-router/AccountCollateral.d.ts +0 -11
- package/lib/esm/impermax-router/AccountCollateral.js +0 -63
- package/lib/esm/impermax-router/AccountLendingPool.d.ts +0 -57
- package/lib/esm/impermax-router/AccountLendingPool.js +0 -266
- package/lib/esm/impermax-router/AccountPoolToken.d.ts +0 -29
- package/lib/esm/impermax-router/AccountPoolToken.js +0 -89
- package/lib/esm/impermax-router/Borrowable.d.ts +0 -27
- package/lib/esm/impermax-router/Borrowable.js +0 -128
- package/lib/esm/impermax-router/Collateral.d.ts +0 -9
- package/lib/esm/impermax-router/Collateral.js +0 -45
- package/lib/esm/impermax-router/ContractsHelper.d.ts +0 -28
- package/lib/esm/impermax-router/ContractsHelper.js +0 -50
- package/lib/esm/impermax-router/ImpermaxFactory.d.ts +0 -15
- package/lib/esm/impermax-router/ImpermaxFactory.js +0 -42
- package/lib/esm/impermax-router/Interactions.d.ts +0 -16
- package/lib/esm/impermax-router/Interactions.js +0 -105
- package/lib/esm/impermax-router/InteractionsLendingPool.d.ts +0 -43
- package/lib/esm/impermax-router/InteractionsLendingPool.js +0 -124
- package/lib/esm/impermax-router/InteractionsPoolToken.d.ts +0 -23
- package/lib/esm/impermax-router/InteractionsPoolToken.js +0 -194
- package/lib/esm/impermax-router/LendingPool.d.ts +0 -69
- package/lib/esm/impermax-router/LendingPool.js +0 -291
- package/lib/esm/impermax-router/PoolToken.d.ts +0 -36
- package/lib/esm/impermax-router/PoolToken.js +0 -140
- package/lib/esm/impermax-router/index.d.ts +0 -20
- package/lib/esm/impermax-router/index.js +0 -34
- package/lib/esm/impermax-router/interfaces.d.ts +0 -218
- package/lib/esm/impermax-router/interfaces.js +0 -15
- package/lib/esm/index.d.ts +0 -3
- package/lib/esm/index.js +0 -10
- package/lib/esm/subgraph/Account.d.ts +0 -18
- package/lib/esm/subgraph/Account.js +0 -111
- package/lib/esm/subgraph/AccountLendingPool.d.ts +0 -19
- package/lib/esm/subgraph/AccountLendingPool.js +0 -71
- package/lib/esm/subgraph/AccountPoolToken.d.ts +0 -14
- package/lib/esm/subgraph/AccountPoolToken.js +0 -75
- package/lib/esm/subgraph/LendingPool.d.ts +0 -38
- package/lib/esm/subgraph/LendingPool.js +0 -204
- package/lib/esm/subgraph/PoolToken.d.ts +0 -64
- package/lib/esm/subgraph/PoolToken.js +0 -462
- package/lib/esm/subgraph/PriceHelper.d.ts +0 -21
- package/lib/esm/subgraph/PriceHelper.js +0 -166
- package/lib/esm/subgraph/SolidexHelper.d.ts +0 -16
- package/lib/esm/subgraph/SolidexHelper.js +0 -58
- package/lib/esm/subgraph/index.d.ts +0 -73
- package/lib/esm/subgraph/index.js +0 -185
- package/lib/esm/subgraph/initializer.d.ts +0 -34
- package/lib/esm/subgraph/initializer.js +0 -517
- package/lib/esm/subgraph/query.d.ts +0 -10
- package/lib/esm/subgraph/query.js +0 -229
- package/lib/esm/utils/ether-utils.d.ts +0 -5
- package/lib/esm/utils/ether-utils.js +0 -26
- package/lib/esm/utils/index.d.ts +0 -3
- package/lib/esm/utils/index.js +0 -16
package/lib/esm/config/farms.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
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;
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1,5 +0,0 @@
|
|
|
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";
|
|
@@ -1,68 +0,0 @@
|
|
|
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";
|
|
@@ -1,67 +0,0 @@
|
|
|
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
|
-
};
|
package/lib/esm/config/types.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
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 = {}));
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
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;
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}
|