impermax-sdk 1.0.4 → 1.0.6
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/config/amms.d.ts +22 -1
- package/lib/config/amms.js +123 -97
- package/lib/config/contracts/routers.js +1 -0
- package/lib/config/farms.d.ts +2 -0
- package/lib/config/farms.js +3 -0
- package/lib/config/general.d.ts +2 -0
- package/lib/config/general.js +3 -3
- package/lib/config/types.d.ts +1 -19
- package/lib/config/types.js +1 -21
- package/lib/impermax-router/Account.d.ts +1 -1
- package/lib/impermax-router/AccountBorrowable.js +4 -4
- package/lib/impermax-router/AccountCollateral.js +2 -2
- package/lib/impermax-router/AccountLendingPool.d.ts +1 -1
- package/lib/impermax-router/AccountLendingPool.js +12 -12
- package/lib/impermax-router/Borrowable.d.ts +1 -1
- package/lib/impermax-router/Collateral.d.ts +1 -1
- package/lib/impermax-router/ContractsHelper.d.ts +1 -1
- package/lib/impermax-router/Interactions.d.ts +1 -1
- package/lib/impermax-router/InteractionsLendingPool.d.ts +1 -1
- package/lib/impermax-router/InteractionsPoolToken.d.ts +1 -1
- package/lib/impermax-router/InteractionsPoolToken.js +13 -13
- package/lib/impermax-router/LendingPool.d.ts +2 -2
- package/lib/impermax-router/PoolToken.d.ts +2 -2
- package/lib/impermax-router/index.d.ts +1 -1
- package/lib/impermax-router/types.d.ts +45 -0
- package/lib/impermax-router/{interfaces.js → types.js} +0 -1
- package/lib/index.d.ts +40 -1
- package/lib/index.js +105 -1
- package/lib/subgraph/Account.d.ts +1 -1
- package/lib/subgraph/AccountLendingPool.d.ts +1 -1
- package/lib/subgraph/LendingPool.d.ts +3 -2
- package/lib/subgraph/PoolToken.d.ts +1 -1
- package/lib/subgraph/PriceHelper.js +1 -0
- package/lib/subgraph/index.d.ts +5 -2
- package/lib/subgraph/initializer.d.ts +3 -2
- package/lib/{impermax-router/interfaces.d.ts → subgraph/types.d.ts} +1 -74
- package/lib/subgraph/types.js +3 -0
- package/package.json +1 -1
package/lib/config/amms.d.ts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import { Address, AmmIndex,
|
|
1
|
+
import { Address, AmmIndex, Networks } from './types';
|
|
2
|
+
export declare enum Amms {
|
|
3
|
+
uniswap = "uniswap",
|
|
4
|
+
quickswap = "quickswap",
|
|
5
|
+
sushiswap = "sushiswap",
|
|
6
|
+
swapr = "swapr",
|
|
7
|
+
swapfish = "swapfish",
|
|
8
|
+
zyberswap = "zyberswap",
|
|
9
|
+
solidlizard = "solidlizard",
|
|
10
|
+
pangolin = "pangolin",
|
|
11
|
+
traderJoe = "traderJoe",
|
|
12
|
+
solarbeam = "solarbeam",
|
|
13
|
+
thorus = "thorus",
|
|
14
|
+
tetuswap = "tetuswap",
|
|
15
|
+
solidly = "solidly",
|
|
16
|
+
solidlyB = "solidlyB",
|
|
17
|
+
solidlyUSDC = "solidlyUSDC",
|
|
18
|
+
solidlyUSDCB = "solidlyUSDCB",
|
|
19
|
+
solidly091 = "solidly091",
|
|
20
|
+
solidlyOxd = "solidlyOxd"
|
|
21
|
+
}
|
|
2
22
|
export declare const hrAmms: {
|
|
3
23
|
uniswap: string;
|
|
4
24
|
quickswap: string;
|
|
@@ -6,6 +26,7 @@ export declare const hrAmms: {
|
|
|
6
26
|
swapr: string;
|
|
7
27
|
swapfish: string;
|
|
8
28
|
zyberswap: string;
|
|
29
|
+
solidlizard: string;
|
|
9
30
|
pangolin: string;
|
|
10
31
|
traderJoe: string;
|
|
11
32
|
solarbeam: string;
|
package/lib/config/amms.js
CHANGED
|
@@ -1,62 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AMM_LP_FEE = exports.ADD_LIQUIDITY_URLS = exports.AMM_SUBGRAPH_URLS = exports.getAmmByFactory = exports.AMM_FACTORY = exports.hrAmms = void 0;
|
|
3
|
+
exports.AMM_LP_FEE = exports.ADD_LIQUIDITY_URLS = exports.AMM_SUBGRAPH_URLS = exports.getAmmByFactory = exports.AMM_FACTORY = exports.hrAmms = exports.Amms = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
|
5
|
+
var Amms;
|
|
6
|
+
(function (Amms) {
|
|
7
|
+
Amms["uniswap"] = "uniswap";
|
|
8
|
+
Amms["quickswap"] = "quickswap";
|
|
9
|
+
Amms["sushiswap"] = "sushiswap";
|
|
10
|
+
Amms["swapr"] = "swapr";
|
|
11
|
+
Amms["swapfish"] = "swapfish";
|
|
12
|
+
Amms["zyberswap"] = "zyberswap";
|
|
13
|
+
Amms["solidlizard"] = "solidlizard";
|
|
14
|
+
Amms["pangolin"] = "pangolin";
|
|
15
|
+
Amms["traderJoe"] = "traderJoe";
|
|
16
|
+
Amms["solarbeam"] = "solarbeam";
|
|
17
|
+
Amms["thorus"] = "thorus";
|
|
18
|
+
Amms["tetuswap"] = "tetuswap";
|
|
19
|
+
Amms["solidly"] = "solidly";
|
|
20
|
+
Amms["solidlyB"] = "solidlyB";
|
|
21
|
+
Amms["solidlyUSDC"] = "solidlyUSDC";
|
|
22
|
+
Amms["solidlyUSDCB"] = "solidlyUSDCB";
|
|
23
|
+
Amms["solidly091"] = "solidly091";
|
|
24
|
+
Amms["solidlyOxd"] = "solidlyOxd";
|
|
25
|
+
})(Amms = exports.Amms || (exports.Amms = {}));
|
|
5
26
|
exports.hrAmms = {
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
27
|
+
[Amms.uniswap]: 'Uniswap',
|
|
28
|
+
[Amms.quickswap]: 'QuickSwap',
|
|
29
|
+
[Amms.sushiswap]: 'SushiSwap',
|
|
30
|
+
[Amms.swapr]: 'Swapr',
|
|
31
|
+
[Amms.swapfish]: 'SwapFish',
|
|
32
|
+
[Amms.zyberswap]: 'ZyberSwap',
|
|
33
|
+
[Amms.solidlizard]: 'SolidLizard',
|
|
34
|
+
[Amms.pangolin]: 'Pangolin',
|
|
35
|
+
[Amms.traderJoe]: 'TraderJoe',
|
|
36
|
+
[Amms.solarbeam]: 'Solarbeam',
|
|
37
|
+
[Amms.thorus]: 'Thorus',
|
|
38
|
+
[Amms.tetuswap]: 'TetuSwap',
|
|
39
|
+
[Amms.solidly]: 'Solidly',
|
|
40
|
+
[Amms.solidlyB]: 'Solidly',
|
|
41
|
+
[Amms.solidlyUSDC]: 'Solidly',
|
|
42
|
+
[Amms.solidlyUSDCB]: 'Solidly',
|
|
43
|
+
[Amms.solidly091]: 'Solidly',
|
|
44
|
+
[Amms.solidlyOxd]: 'Solidly',
|
|
23
45
|
};
|
|
24
46
|
exports.AMM_FACTORY = {
|
|
25
47
|
[types_1.Networks.Ropsten]: {
|
|
26
|
-
[
|
|
48
|
+
[Amms.uniswap]: '0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f',
|
|
27
49
|
},
|
|
28
50
|
[types_1.Networks.Mainnet]: {
|
|
29
|
-
[
|
|
51
|
+
[Amms.uniswap]: '0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f',
|
|
30
52
|
},
|
|
31
53
|
[types_1.Networks.Polygon]: {
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
54
|
+
[Amms.quickswap]: '0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32',
|
|
55
|
+
[Amms.sushiswap]: '0xc35dadb65012ec5796536bd9864ed8773abc74c4',
|
|
56
|
+
[Amms.tetuswap]: '0x684d8c187be836171a1Af8D533e4724893031828',
|
|
35
57
|
},
|
|
36
58
|
[types_1.Networks.Arbitrum]: {
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
59
|
+
[Amms.sushiswap]: '0xc35DADB65012eC5796536bD9864eD8773aBc74C4',
|
|
60
|
+
[Amms.swapr]: '0x359F20Ad0F42D75a5077e65F30274cABe6f4F01a',
|
|
61
|
+
[Amms.swapfish]: '0x71539D09D3890195dDa87A6198B98B75211b72F3',
|
|
62
|
+
[Amms.zyberswap]: '0xac2ee06a14c52570ef3b9812ed240bce359772e7',
|
|
63
|
+
[Amms.solidlizard]: '0x734d84631f00dc0d3fcd18b04b6cf42bfd407074',
|
|
41
64
|
},
|
|
42
65
|
[types_1.Networks.Avalanche]: {
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
66
|
+
[Amms.pangolin]: '0xefa94DE7a4656D787667C749f7E1223D71E9FD88',
|
|
67
|
+
[Amms.traderJoe]: '0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10',
|
|
68
|
+
[Amms.thorus]: '0xa98ea6356A316b44Bf710D5f9b6b4eA0081409Ef',
|
|
46
69
|
},
|
|
47
70
|
[types_1.Networks.Moonriver]: {
|
|
48
|
-
[
|
|
49
|
-
[
|
|
71
|
+
[Amms.sushiswap]: '0xc35DADB65012eC5796536bD9864eD8773aBc74C4',
|
|
72
|
+
[Amms.solarbeam]: '0x049581aEB6Fe262727f290165C29BDAB065a1B68',
|
|
50
73
|
},
|
|
51
74
|
[types_1.Networks.Aurora]: {},
|
|
52
75
|
[types_1.Networks.Cronos]: {},
|
|
53
76
|
[types_1.Networks.Fantom]: {
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
77
|
+
[Amms.solidly]: '0x95887654d8646c26fab33f344576e2e74b211256',
|
|
78
|
+
[Amms.solidlyB]: '0x8610Dc1912a55761a713D827a1a1ad131bE8f579',
|
|
79
|
+
[Amms.solidlyUSDC]: '0xF14f98E6F34C12Bd74fcEAC1668aF749fc269cFf',
|
|
80
|
+
[Amms.solidlyUSDCB]: '0x9B1434a02Ee86302d463bB6B365EbdFAc56e067A',
|
|
81
|
+
[Amms.solidly091]: '0xdc4baf3b4b1df79083eedf3e46ec2c4ec1296f60',
|
|
82
|
+
[Amms.solidlyOxd]: '0xB83D21F60B73B21506c69DEcdBcF7Ab5AB737eB2', //NOTICE: this is actually the staked LP factory
|
|
60
83
|
},
|
|
61
84
|
[types_1.Networks.Harmony]: {},
|
|
62
85
|
[types_1.Networks.Moonbeam]: {},
|
|
@@ -65,7 +88,7 @@ exports.AMM_FACTORY = {
|
|
|
65
88
|
function getAmmByFactory(network, address) {
|
|
66
89
|
if (!address)
|
|
67
90
|
return null;
|
|
68
|
-
for (const amm of Object.keys(
|
|
91
|
+
for (const amm of Object.keys(Amms)) {
|
|
69
92
|
if (exports.AMM_FACTORY[network][amm] &&
|
|
70
93
|
address.toLowerCase() == exports.AMM_FACTORY[network][amm].toLowerCase())
|
|
71
94
|
return amm;
|
|
@@ -76,37 +99,38 @@ exports.getAmmByFactory = getAmmByFactory;
|
|
|
76
99
|
exports.AMM_SUBGRAPH_URLS = {
|
|
77
100
|
[types_1.Networks.Ropsten]: {},
|
|
78
101
|
[types_1.Networks.Mainnet]: {
|
|
79
|
-
[
|
|
102
|
+
[Amms.uniswap]: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2',
|
|
80
103
|
},
|
|
81
104
|
[types_1.Networks.Polygon]: {
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[
|
|
105
|
+
[Amms.quickswap]: 'https://api.fura.org/subgraphs/name/quickswap',
|
|
106
|
+
[Amms.sushiswap]: 'https://api.thegraph.com/subgraphs/name/sushiswap/matic-exchange',
|
|
107
|
+
[Amms.tetuswap]: 'https://api.thegraph.com/subgraphs/name/tetu-io/tetu-swap',
|
|
85
108
|
},
|
|
86
109
|
[types_1.Networks.Arbitrum]: {
|
|
87
|
-
[
|
|
88
|
-
[
|
|
89
|
-
[
|
|
110
|
+
[Amms.sushiswap]: 'https://api.thegraph.com/subgraphs/name/sushiswap/arbitrum-exchange',
|
|
111
|
+
[Amms.swapr]: 'https://api.thegraph.com/subgraphs/name/luzzif/swapr-arbitrum-one-v2',
|
|
112
|
+
[Amms.zyberswap]: 'https://api.thegraph.com/subgraphs/name/zyberswap-arbitrum/zyber-amm',
|
|
113
|
+
[Amms.solidlizard]: 'https://api.thegraph.com/subgraphs/name/solidlizardfinance/sliz',
|
|
90
114
|
//[Amms.swapfish]: 'https://bsc.streamingfast.io/subgraphs/name/pancakeswap/exchange-v2',
|
|
91
115
|
},
|
|
92
116
|
[types_1.Networks.Avalanche]: {
|
|
93
|
-
[
|
|
94
|
-
[
|
|
95
|
-
[
|
|
117
|
+
[Amms.pangolin]: 'https://api.thegraph.com/subgraphs/name/dasconnor/pangolin-dex',
|
|
118
|
+
[Amms.traderJoe]: 'https://api.thegraph.com/subgraphs/name/traderjoe-xyz/exchange',
|
|
119
|
+
[Amms.thorus]: '',
|
|
96
120
|
},
|
|
97
121
|
[types_1.Networks.Moonriver]: {
|
|
98
|
-
[
|
|
99
|
-
[
|
|
122
|
+
[Amms.sushiswap]: 'https://api.thegraph.com/subgraphs/name/sushiswap/moonriver-exchange',
|
|
123
|
+
[Amms.solarbeam]: 'https://analytics.solarbeam.io/api/subgraph',
|
|
100
124
|
},
|
|
101
125
|
[types_1.Networks.Aurora]: {},
|
|
102
126
|
[types_1.Networks.Cronos]: {},
|
|
103
127
|
[types_1.Networks.Fantom]: {
|
|
104
|
-
[
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
[
|
|
108
|
-
[
|
|
109
|
-
[
|
|
128
|
+
[Amms.solidly]: 'https://api.thegraph.com/subgraphs/name/spartacus-finance/solidly',
|
|
129
|
+
[Amms.solidlyB]: 'https://api.thegraph.com/subgraphs/name/spartacus-finance/solidly',
|
|
130
|
+
[Amms.solidlyUSDC]: 'https://api.thegraph.com/subgraphs/name/spartacus-finance/solidly',
|
|
131
|
+
[Amms.solidlyUSDCB]: 'https://api.thegraph.com/subgraphs/name/spartacus-finance/solidly',
|
|
132
|
+
[Amms.solidly091]: 'https://api.thegraph.com/subgraphs/name/spartacus-finance/solidly',
|
|
133
|
+
[Amms.solidlyOxd]: 'https://api.thegraph.com/subgraphs/name/spartacus-finance/solidly',
|
|
110
134
|
},
|
|
111
135
|
[types_1.Networks.Harmony]: {},
|
|
112
136
|
[types_1.Networks.Moonbeam]: {},
|
|
@@ -114,40 +138,41 @@ exports.AMM_SUBGRAPH_URLS = {
|
|
|
114
138
|
};
|
|
115
139
|
exports.ADD_LIQUIDITY_URLS = {
|
|
116
140
|
[types_1.Networks.Ropsten]: {
|
|
117
|
-
[
|
|
141
|
+
[Amms.uniswap]: 'https://app.uniswap.org/#/add/V2/',
|
|
118
142
|
},
|
|
119
143
|
[types_1.Networks.Mainnet]: {
|
|
120
|
-
[
|
|
144
|
+
[Amms.uniswap]: 'https://app.uniswap.org/#/add/V2/',
|
|
121
145
|
},
|
|
122
146
|
[types_1.Networks.Polygon]: {
|
|
123
|
-
[
|
|
124
|
-
[
|
|
125
|
-
[
|
|
147
|
+
[Amms.quickswap]: 'https://quickswap.exchange/#/add/',
|
|
148
|
+
[Amms.sushiswap]: 'https://app.sushi.com/legacy/add/',
|
|
149
|
+
[Amms.tetuswap]: 'https://swap.tetu.io/#/add/',
|
|
126
150
|
},
|
|
127
151
|
[types_1.Networks.Arbitrum]: {
|
|
128
|
-
[
|
|
129
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[
|
|
152
|
+
[Amms.sushiswap]: 'https://app.sushi.com/legacy/add/',
|
|
153
|
+
[Amms.swapr]: 'https://swapr.eth.link/#/add/',
|
|
154
|
+
[Amms.swapfish]: 'https://swapfish.fi/add/',
|
|
155
|
+
[Amms.zyberswap]: 'https://app.zyberswap.io/exchange/add/',
|
|
156
|
+
[Amms.solidlizard]: 'https://solidlizard.finance/liquidity/create/',
|
|
132
157
|
},
|
|
133
158
|
[types_1.Networks.Avalanche]: {
|
|
134
|
-
[
|
|
135
|
-
[
|
|
136
|
-
[
|
|
159
|
+
[Amms.pangolin]: 'https://app.pangolin.exchange/#/add/',
|
|
160
|
+
[Amms.traderJoe]: 'https://www.traderjoexyz.com/#/pool/',
|
|
161
|
+
[Amms.thorus]: 'https://app.thorus.fi/add/',
|
|
137
162
|
},
|
|
138
163
|
[types_1.Networks.Moonriver]: {
|
|
139
|
-
[
|
|
140
|
-
[
|
|
164
|
+
[Amms.sushiswap]: 'https://app.sushi.com/legacy/add/',
|
|
165
|
+
[Amms.solarbeam]: 'https://app.solarbeam.io/exchange/add/',
|
|
141
166
|
},
|
|
142
167
|
[types_1.Networks.Aurora]: {},
|
|
143
168
|
[types_1.Networks.Cronos]: {},
|
|
144
169
|
[types_1.Networks.Fantom]: {
|
|
145
|
-
[
|
|
146
|
-
[
|
|
147
|
-
[
|
|
148
|
-
[
|
|
149
|
-
[
|
|
150
|
-
[
|
|
170
|
+
[Amms.solidly]: 'https://solidly.exchange/liquidity/create',
|
|
171
|
+
[Amms.solidlyB]: 'https://solidly.exchange/liquidity/create',
|
|
172
|
+
[Amms.solidlyUSDC]: 'https://solidly.exchange/liquidity/create',
|
|
173
|
+
[Amms.solidlyUSDCB]: 'https://solidly.exchange/liquidity/create',
|
|
174
|
+
[Amms.solidly091]: 'https://solidly.exchange/liquidity/create',
|
|
175
|
+
[Amms.solidlyOxd]: 'https://solidly.exchange/liquidity/create',
|
|
151
176
|
},
|
|
152
177
|
[types_1.Networks.Harmony]: {},
|
|
153
178
|
[types_1.Networks.Moonbeam]: {},
|
|
@@ -155,40 +180,41 @@ exports.ADD_LIQUIDITY_URLS = {
|
|
|
155
180
|
};
|
|
156
181
|
exports.AMM_LP_FEE = {
|
|
157
182
|
[types_1.Networks.Ropsten]: {
|
|
158
|
-
[
|
|
183
|
+
[Amms.uniswap]: 0.003,
|
|
159
184
|
},
|
|
160
185
|
[types_1.Networks.Mainnet]: {
|
|
161
|
-
[
|
|
186
|
+
[Amms.uniswap]: 0.003,
|
|
162
187
|
},
|
|
163
188
|
[types_1.Networks.Polygon]: {
|
|
164
|
-
[
|
|
165
|
-
[
|
|
166
|
-
[
|
|
189
|
+
[Amms.quickswap]: 0.0025,
|
|
190
|
+
[Amms.sushiswap]: 0.0025,
|
|
191
|
+
[Amms.tetuswap]: 0,
|
|
167
192
|
},
|
|
168
193
|
[types_1.Networks.Arbitrum]: {
|
|
169
|
-
[
|
|
170
|
-
[
|
|
171
|
-
[
|
|
172
|
-
[
|
|
194
|
+
[Amms.sushiswap]: 0.0025,
|
|
195
|
+
[Amms.swapr]: 0.00225,
|
|
196
|
+
[Amms.swapfish]: 0.0017,
|
|
197
|
+
[Amms.zyberswap]: 0.0015,
|
|
198
|
+
[Amms.solidlizard]: 0.002,
|
|
173
199
|
},
|
|
174
200
|
[types_1.Networks.Avalanche]: {
|
|
175
|
-
[
|
|
176
|
-
[
|
|
177
|
-
[
|
|
201
|
+
[Amms.pangolin]: 0.0025,
|
|
202
|
+
[Amms.traderJoe]: 0.0025,
|
|
203
|
+
[Amms.thorus]: 0,
|
|
178
204
|
},
|
|
179
205
|
[types_1.Networks.Moonriver]: {
|
|
180
|
-
[
|
|
181
|
-
[
|
|
206
|
+
[Amms.sushiswap]: 0.0025,
|
|
207
|
+
[Amms.solarbeam]: 0.002,
|
|
182
208
|
},
|
|
183
209
|
[types_1.Networks.Aurora]: {},
|
|
184
210
|
[types_1.Networks.Cronos]: {},
|
|
185
211
|
[types_1.Networks.Fantom]: {
|
|
186
|
-
[
|
|
187
|
-
[
|
|
188
|
-
[
|
|
189
|
-
[
|
|
190
|
-
[
|
|
191
|
-
[
|
|
212
|
+
[Amms.solidly]: 0,
|
|
213
|
+
[Amms.solidlyB]: 0,
|
|
214
|
+
[Amms.solidlyUSDC]: 0,
|
|
215
|
+
[Amms.solidlyUSDCB]: 0,
|
|
216
|
+
[Amms.solidly091]: 0,
|
|
217
|
+
[Amms.solidlyOxd]: 0,
|
|
192
218
|
},
|
|
193
219
|
[types_1.Networks.Harmony]: {},
|
|
194
220
|
[types_1.Networks.Moonbeam]: {},
|
|
@@ -16,6 +16,7 @@ exports.ROUTER = {
|
|
|
16
16
|
[types_1.Networks.Arbitrum]: {
|
|
17
17
|
[types_1.Factory.V2V1_1]: '0x5475aEd9d11BeaA822e122C36ACDfa0dA2eb086f',
|
|
18
18
|
[types_1.Factory.V2V2]: '0xaf82ee9246a608484e8567fadbef64ac1b8a87ab',
|
|
19
|
+
[types_1.Factory.SOLV2]: '0xdD7aC67fA9576b4096e86f251088189C3659Da0d',
|
|
19
20
|
},
|
|
20
21
|
[types_1.Networks.Avalanche]: {
|
|
21
22
|
[types_1.Factory.V2V1_2]: '0x3039C26F9126833bAca8EdBF61c761CD909F461f',
|
package/lib/config/farms.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare enum Farms {
|
|
|
8
8
|
swapr = "swapr",
|
|
9
9
|
swapfish = "swapfish",
|
|
10
10
|
zyberswap = "zyberswap",
|
|
11
|
+
solidlizard = "solidlizard",
|
|
11
12
|
radiant = "",
|
|
12
13
|
plutusDao = "",
|
|
13
14
|
pangolin = "pangolin",
|
|
@@ -34,6 +35,7 @@ export declare const hrFarms: {
|
|
|
34
35
|
swapr: string;
|
|
35
36
|
swapfish: string;
|
|
36
37
|
zyberswap: string;
|
|
38
|
+
solidlizard: string;
|
|
37
39
|
"": string;
|
|
38
40
|
pangolin: string;
|
|
39
41
|
pangolinV2: string;
|
package/lib/config/farms.js
CHANGED
|
@@ -12,6 +12,7 @@ var Farms;
|
|
|
12
12
|
Farms["swapr"] = "swapr";
|
|
13
13
|
Farms["swapfish"] = "swapfish";
|
|
14
14
|
Farms["zyberswap"] = "zyberswap";
|
|
15
|
+
Farms["solidlizard"] = "solidlizard";
|
|
15
16
|
Farms["radiant"] = "";
|
|
16
17
|
Farms["plutusDao"] = "";
|
|
17
18
|
Farms["pangolin"] = "pangolin";
|
|
@@ -38,6 +39,7 @@ exports.hrFarms = {
|
|
|
38
39
|
[Farms.swapr]: 'Swapr',
|
|
39
40
|
[Farms.swapfish]: 'SwapFish',
|
|
40
41
|
[Farms.zyberswap]: 'ZyberSwap',
|
|
42
|
+
[Farms.solidlizard]: 'SolidLizard',
|
|
41
43
|
[Farms.radiant]: 'Radiant',
|
|
42
44
|
[Farms.plutusDao]: 'Plutus DAO',
|
|
43
45
|
[Farms.pangolin]: 'Pangolin',
|
|
@@ -72,6 +74,7 @@ exports.STAKED_LP_FACTORY = {
|
|
|
72
74
|
//[Farms.swapfish]: '0xcDAeC65495Fa5c0545c5a405224214e3594f30d8',
|
|
73
75
|
[Farms.swapfish]: '0x3bE7B59Ab6558845FfA1f026Dff40b305dd47b37',
|
|
74
76
|
[Farms.zyberswap]: '0xBCE93e2D822CfDD70F106e32FCB266457cece45F',
|
|
77
|
+
[Farms.solidlizard]: '0x30d7ef0d94b43BFa4Ff5935DBC608D7fc0116BB7',
|
|
75
78
|
[Farms.radiant]: '0x4aE11dC7D7e70eE16d7eaE32851302e55f6CA85e',
|
|
76
79
|
[Farms.plutusDao]: '0x4dC48B93855F42cCcc54f65615AeF6FFC12EC1DF',
|
|
77
80
|
},
|
package/lib/config/general.d.ts
CHANGED
package/lib/config/general.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEADLINE = exports.NOT_SYNCED = void 0;
|
|
3
|
+
exports.APPROVE_AMOUNT = exports.ZERO = exports.DEADLINE = exports.NOT_SYNCED = void 0;
|
|
4
4
|
const ethers_1 = require("ethers");
|
|
5
5
|
exports.NOT_SYNCED = false;
|
|
6
6
|
exports.DEADLINE = ethers_1.BigNumber.from(Math.floor(Date.now() / 1000) + 3600 * 24 * 365); //1 year deadline
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
exports.ZERO = ethers_1.ethers.constants.Zero;
|
|
8
|
+
exports.APPROVE_AMOUNT = ethers_1.ethers.constants.MaxUint256;
|
package/lib/config/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Amms } from './amms';
|
|
1
2
|
export declare enum Networks {
|
|
2
3
|
Ropsten = "ropsten",
|
|
3
4
|
Mainnet = "mainnet",
|
|
@@ -25,25 +26,6 @@ export declare enum PoolTokenType {
|
|
|
25
26
|
BorrowableA = "borrowable0",
|
|
26
27
|
BorrowableB = "borrowable1"
|
|
27
28
|
}
|
|
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
29
|
export type Address = string;
|
|
48
30
|
export type NetworkIndex<Type> = {
|
|
49
31
|
[key in Networks]?: Type;
|
package/lib/config/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PoolTokenType = exports.Factory = exports.Networks = void 0;
|
|
4
4
|
var Networks;
|
|
5
5
|
(function (Networks) {
|
|
6
6
|
Networks["Ropsten"] = "ropsten";
|
|
@@ -32,23 +32,3 @@ var PoolTokenType;
|
|
|
32
32
|
PoolTokenType["BorrowableA"] = "borrowable0";
|
|
33
33
|
PoolTokenType["BorrowableB"] = "borrowable1";
|
|
34
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,4 +1,4 @@
|
|
|
1
|
-
import { AirdropData, PendingRewardUI } from "./
|
|
1
|
+
import { AirdropData, PendingRewardUI } from "./types";
|
|
2
2
|
import ImpermaxRouter from "./index";
|
|
3
3
|
import AccountLendingPool from "./AccountLendingPool";
|
|
4
4
|
import { Address, Factory, FactoryIndex, LendingPoolIndex } from '../config/types';
|
|
@@ -12,9 +12,9 @@ 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
|
-
const
|
|
15
|
+
const types_1 = require("./types");
|
|
16
16
|
const AccountPoolToken_1 = __importDefault(require("./AccountPoolToken"));
|
|
17
|
-
const
|
|
17
|
+
const types_2 = require("../config/types");
|
|
18
18
|
class AccountBorrowable extends AccountPoolToken_1.default {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
@@ -53,8 +53,8 @@ class AccountBorrowable extends AccountPoolToken_1.default {
|
|
|
53
53
|
getMaxBorrowable() {
|
|
54
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
55
|
const availableCash = yield this.poolToken.getTotalBalance();
|
|
56
|
-
const { valueCollateral, valueA, valueB } = yield this.accountLendingPool.getValues(
|
|
57
|
-
const [valueBorrowed, valueOther] = this.poolToken.poolTokenType ==
|
|
56
|
+
const { valueCollateral, valueA, valueB } = yield this.accountLendingPool.getValues(types_1.NO_CHANGES);
|
|
57
|
+
const [valueBorrowed, valueOther] = this.poolToken.poolTokenType == types_2.PoolTokenType.BorrowableA ? [valueA, valueB] : [valueB, valueA];
|
|
58
58
|
const safetyMargin = (yield this.accountLendingPool.getSafetyMargin()) * this.getUiMargin();
|
|
59
59
|
const liquidationPenalty = yield this.accountLendingPool.getLiquidationPenalty();
|
|
60
60
|
const actualCollateral = valueCollateral / liquidationPenalty;
|
|
@@ -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
|
-
const
|
|
15
|
+
const types_1 = require("./types");
|
|
16
16
|
const AccountPoolToken_1 = __importDefault(require("./AccountPoolToken"));
|
|
17
17
|
class AccountCollateral extends AccountPoolToken_1.default {
|
|
18
18
|
constructor() {
|
|
@@ -50,7 +50,7 @@ class AccountCollateral extends AccountPoolToken_1.default {
|
|
|
50
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
51
|
const deposited = yield this.getDeposited();
|
|
52
52
|
const availableCash = yield this.poolToken.getTotalBalance();
|
|
53
|
-
const { valueCollateral, valueA, valueB } = yield this.accountLendingPool.getValues(
|
|
53
|
+
const { valueCollateral, valueA, valueB } = yield this.accountLendingPool.getValues(types_1.NO_CHANGES);
|
|
54
54
|
const safetyMargin = (yield this.accountLendingPool.getSafetyMargin()) * this.getUiMargin();
|
|
55
55
|
const liquidationPenalty = yield this.accountLendingPool.getLiquidationPenalty();
|
|
56
56
|
const actualCollateral = valueCollateral / liquidationPenalty;
|
|
@@ -12,26 +12,26 @@ 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
|
-
const
|
|
15
|
+
const types_1 = require("./types");
|
|
16
16
|
const AccountBorrowable_1 = __importDefault(require("./AccountBorrowable"));
|
|
17
17
|
const AccountCollateral_1 = __importDefault(require("./AccountCollateral"));
|
|
18
|
-
const
|
|
18
|
+
const types_2 = require("../config/types");
|
|
19
19
|
class AccountLendingPool {
|
|
20
20
|
constructor(account, lendingPool) {
|
|
21
21
|
this.cache = {};
|
|
22
22
|
// Shortcuts
|
|
23
|
-
this.pta = () => this.accountPoolTokens[
|
|
24
|
-
this.ptb = () => this.accountPoolTokens[
|
|
25
|
-
this.ptc = () => this.accountPoolTokens[
|
|
23
|
+
this.pta = () => this.accountPoolTokens[types_2.PoolTokenType.BorrowableA];
|
|
24
|
+
this.ptb = () => this.accountPoolTokens[types_2.PoolTokenType.BorrowableB];
|
|
25
|
+
this.ptc = () => this.accountPoolTokens[types_2.PoolTokenType.Collateral];
|
|
26
26
|
this.getSafetyMargin = () => __awaiter(this, void 0, void 0, function* () { return (yield this.lendingPool.getSubgraphLendingPool()).getSafetyMargin(); });
|
|
27
27
|
this.getLiquidationPenalty = () => __awaiter(this, void 0, void 0, function* () { return (yield this.lendingPool.getSubgraphLendingPool()).getLiquidationPenalty(); });
|
|
28
28
|
this.getUiMargin = () => this.account.router.uiMargin;
|
|
29
29
|
this.account = account;
|
|
30
30
|
this.lendingPool = lendingPool;
|
|
31
31
|
this.accountPoolTokens = {
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
32
|
+
[types_2.PoolTokenType.Collateral]: new AccountCollateral_1.default(this, types_2.PoolTokenType.Collateral),
|
|
33
|
+
[types_2.PoolTokenType.BorrowableA]: new AccountBorrowable_1.default(this, types_2.PoolTokenType.BorrowableA),
|
|
34
|
+
[types_2.PoolTokenType.BorrowableB]: new AccountBorrowable_1.default(this, types_2.PoolTokenType.BorrowableB),
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
cleanCache() {
|
|
@@ -130,7 +130,7 @@ class AccountLendingPool {
|
|
|
130
130
|
getLeverage(changes) {
|
|
131
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
132
|
if (!changes)
|
|
133
|
-
changes =
|
|
133
|
+
changes = types_1.NO_CHANGES;
|
|
134
134
|
const { valueCollateral, valueA, valueB } = yield this.getValues(changes);
|
|
135
135
|
const valueDebt = valueA + valueB;
|
|
136
136
|
if (valueDebt == 0)
|
|
@@ -177,7 +177,7 @@ class AccountLendingPool {
|
|
|
177
177
|
getLiquidationPrices(changes) {
|
|
178
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
179
179
|
if (!changes)
|
|
180
|
-
changes =
|
|
180
|
+
changes = types_1.NO_CHANGES;
|
|
181
181
|
const values = yield this.getValues(changes);
|
|
182
182
|
return this.getLiquidationPricesGivenValues(values);
|
|
183
183
|
});
|
|
@@ -193,7 +193,7 @@ class AccountLendingPool {
|
|
|
193
193
|
const adjustFactor = 1 / diff;
|
|
194
194
|
const availableCashValue1 = availableCashA * priceA;
|
|
195
195
|
const availableCashValue2 = availableCashB * priceB;
|
|
196
|
-
const { valueCollateral, valueA, valueB } = yield this.getValues(
|
|
196
|
+
const { valueCollateral, valueA, valueB } = yield this.getValues(types_1.NO_CHANGES);
|
|
197
197
|
const safetyMargin = (yield this.getSafetyMargin()) * this.getUiMargin();
|
|
198
198
|
const liquidationPenalty = yield this.getLiquidationPenalty();
|
|
199
199
|
const actualCollateral = valueCollateral / liquidationPenalty;
|
|
@@ -211,7 +211,7 @@ class AccountLendingPool {
|
|
|
211
211
|
// Max Deleverage
|
|
212
212
|
getMaxDeleverage(slippage) {
|
|
213
213
|
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
-
const { valueCollateral, valueA, valueB } = yield this.getMarketValues(
|
|
214
|
+
const { valueCollateral, valueA, valueB } = yield this.getMarketValues(types_1.NO_CHANGES);
|
|
215
215
|
const minRepayPerSide = valueCollateral / 2 / Math.sqrt(slippage);
|
|
216
216
|
if (minRepayPerSide >= valueA && minRepayPerSide >= valueB) {
|
|
217
217
|
return this.ptc().getDeposited();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BigNumber } from "ethers";
|
|
2
2
|
import Account from "./Account";
|
|
3
3
|
import InteractionsLendingPool from "./InteractionsLendingPool";
|
|
4
|
-
import { AirdropData, Contract } from "./
|
|
4
|
+
import { AirdropData, Contract } from "./types";
|
|
5
5
|
import { Address, Factory, FactoryIndex, LendingPoolIndex } from '../config/types';
|
|
6
6
|
export default class Interactions {
|
|
7
7
|
account: Account;
|
|
@@ -3,7 +3,7 @@ import AccountLendingPool from "./AccountLendingPool";
|
|
|
3
3
|
import InteractionsPoolToken from "./InteractionsPoolToken";
|
|
4
4
|
import { BigNumber } from "ethers";
|
|
5
5
|
import { PoolTokenType } from '../config/types';
|
|
6
|
-
import { PermitData } from './
|
|
6
|
+
import { PermitData } from './types';
|
|
7
7
|
export default class InteractionsLendingPool {
|
|
8
8
|
interactions: Interactions;
|
|
9
9
|
accountLendingPool: AccountLendingPool;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ethers, BigNumber } from "ethers";
|
|
2
2
|
import AccountPoolToken from "./AccountPoolToken";
|
|
3
3
|
import InteractionsLendingPool from "./InteractionsLendingPool";
|
|
4
|
-
import { ApprovalType, PermitData } from "./
|
|
4
|
+
import { ApprovalType, PermitData } from "./types";
|
|
5
5
|
import { PoolTokenType } from '../config/types';
|
|
6
6
|
export default class InteractionsPoolToken {
|
|
7
7
|
interactionsLendingPool: InteractionsLendingPool;
|
|
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const ethers_1 = require("ethers");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const types_1 = require("./types");
|
|
14
|
+
const types_2 = require("../config/types");
|
|
15
15
|
const weths_1 = require("../config/contracts/weths");
|
|
16
16
|
const general_1 = require("../config/general");
|
|
17
17
|
const MAX_UINT256 = ethers_1.ethers.constants.MaxUint256;
|
|
@@ -50,18 +50,18 @@ class InteractionsPoolToken {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
isCollateral() {
|
|
53
|
-
return this.getPoolToken().poolTokenType ==
|
|
53
|
+
return this.getPoolToken().poolTokenType == types_2.PoolTokenType.Collateral;
|
|
54
54
|
}
|
|
55
55
|
getAllowance(approvalType) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
57
|
const poolToken = yield this.getPoolToken().getPoolToken();
|
|
58
58
|
const token = yield this.getPoolToken().getToken();
|
|
59
|
-
if ((yield this.isWETH()) && approvalType ==
|
|
59
|
+
if ((yield this.isWETH()) && approvalType == types_1.ApprovalType.UNDERLYING)
|
|
60
60
|
return MAX_UINT256;
|
|
61
61
|
const { owner, spender } = this.interactionsLendingPool.getOwnerSpender();
|
|
62
|
-
const allowance = (approvalType ==
|
|
63
|
-
(approvalType ==
|
|
64
|
-
(approvalType ==
|
|
62
|
+
const allowance = (approvalType == types_1.ApprovalType.POOL_TOKEN) ? yield poolToken.methods.allowance(owner, spender).call() :
|
|
63
|
+
(approvalType == types_1.ApprovalType.UNDERLYING) ? yield token.methods.allowance(owner, spender).call() :
|
|
64
|
+
(approvalType == types_1.ApprovalType.BORROW) ? yield poolToken.methods.borrowAllowance(owner, spender).call() : 0;
|
|
65
65
|
return ethers_1.BigNumber.from(allowance);
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -71,23 +71,23 @@ class InteractionsPoolToken {
|
|
|
71
71
|
const poolToken = yield this.getPoolToken().getPoolToken();
|
|
72
72
|
const token = yield this.getPoolToken().getToken();
|
|
73
73
|
let method;
|
|
74
|
-
if (approvalType ==
|
|
74
|
+
if (approvalType == types_1.ApprovalType.POOL_TOKEN)
|
|
75
75
|
method = poolToken.methods.approve(spender, amount);
|
|
76
|
-
if (approvalType ==
|
|
76
|
+
if (approvalType == types_1.ApprovalType.UNDERLYING)
|
|
77
77
|
method = token.methods.approve(spender, amount);
|
|
78
|
-
if (approvalType ==
|
|
78
|
+
if (approvalType == types_1.ApprovalType.BORROW)
|
|
79
79
|
method = poolToken.methods.borrowApprove(spender, amount);
|
|
80
80
|
return this.send(method, onTransactionHash);
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
getPermitData(approvalType, amount, deadlineArg, callBack) {
|
|
84
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
if (approvalType ===
|
|
85
|
+
if (approvalType === types_1.ApprovalType.UNDERLYING && this.getPoolToken().poolTokenType != types_2.PoolTokenType.Collateral)
|
|
86
86
|
return callBack(null);
|
|
87
87
|
const { owner, spender } = this.interactionsLendingPool.getOwnerSpender();
|
|
88
88
|
const poolToken = yield this.getPoolToken().getPoolToken();
|
|
89
89
|
const token = yield this.getPoolToken().getToken();
|
|
90
|
-
const contract = approvalType ==
|
|
90
|
+
const contract = approvalType == types_1.ApprovalType.UNDERLYING ? token : poolToken;
|
|
91
91
|
const nonce = yield contract.methods.nonces(owner).call();
|
|
92
92
|
const name = yield contract.methods.name().call();
|
|
93
93
|
const deadline = deadlineArg ? deadlineArg : general_1.DEADLINE;
|
|
@@ -99,7 +99,7 @@ class InteractionsPoolToken {
|
|
|
99
99
|
chainId: this.getImpermaxRouter().chainId,
|
|
100
100
|
verifyingContract: contract._address,
|
|
101
101
|
},
|
|
102
|
-
primaryType: approvalType ==
|
|
102
|
+
primaryType: approvalType == types_1.ApprovalType.BORROW ? "BorrowPermit" : "Permit",
|
|
103
103
|
message: {
|
|
104
104
|
owner: owner,
|
|
105
105
|
spender: spender,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PendingRewardUI } from "./
|
|
1
|
+
import { PendingRewardUI } from "./types";
|
|
2
2
|
import PoolToken from "./PoolToken";
|
|
3
3
|
import ImpermaxFactory from "./ImpermaxFactory";
|
|
4
4
|
import { Contract } from "ethers";
|
|
@@ -35,7 +35,7 @@ export default class LendingPool {
|
|
|
35
35
|
ptb: () => Borrowable;
|
|
36
36
|
ptc: () => Collateral;
|
|
37
37
|
getPoolToken(poolTokenType: PoolTokenType): PoolToken;
|
|
38
|
-
getSubgraphLendingPool(): Promise<import("
|
|
38
|
+
getSubgraphLendingPool(): Promise<import("..").SubgraphLendingPool>;
|
|
39
39
|
private initializePoolTokenAddresses;
|
|
40
40
|
getPoolTokenAddresses(): Promise<{
|
|
41
41
|
collateral: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigNumber } from "ethers";
|
|
2
|
-
import { Contract } from "./
|
|
2
|
+
import { Contract } from "./types";
|
|
3
3
|
import LendingPool from "./LendingPool";
|
|
4
4
|
import { Address, PoolTokenType } from '../config/types';
|
|
5
5
|
export default abstract class PoolToken {
|
|
@@ -14,7 +14,7 @@ export default abstract class PoolToken {
|
|
|
14
14
|
constructor(lendingPool: LendingPool, poolTokenType: PoolTokenType);
|
|
15
15
|
cleanCache(): void;
|
|
16
16
|
getContractHelper: () => import("./ContractsHelper").default;
|
|
17
|
-
getSubgraphPoolToken(): Promise<import("
|
|
17
|
+
getSubgraphPoolToken(): Promise<import("..").SubgraphPoolToken>;
|
|
18
18
|
protected getPoolTokenAddressFromLendingPool(): Promise<string>;
|
|
19
19
|
abstract initializePoolToken(): Promise<Contract>;
|
|
20
20
|
getPoolToken(): Promise<any>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BigNumber } from "ethers";
|
|
2
|
+
import Subgraph from "../subgraph";
|
|
3
|
+
import { Networks } from '../config/types';
|
|
4
|
+
export type Contract = any;
|
|
5
|
+
export declare enum ApprovalType {
|
|
6
|
+
POOL_TOKEN = 0,
|
|
7
|
+
UNDERLYING = 1,
|
|
8
|
+
BORROW = 2
|
|
9
|
+
}
|
|
10
|
+
export interface PermitData {
|
|
11
|
+
permitData: string;
|
|
12
|
+
amount: BigNumber;
|
|
13
|
+
deadline: BigNumber;
|
|
14
|
+
}
|
|
15
|
+
export interface ImpermaxRouterCfg {
|
|
16
|
+
network: Networks;
|
|
17
|
+
subgraph: Subgraph;
|
|
18
|
+
web3: any;
|
|
19
|
+
chainId: number;
|
|
20
|
+
priceInverted: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface Changes {
|
|
23
|
+
changeBorrowedA: number;
|
|
24
|
+
changeBorrowedB: number;
|
|
25
|
+
changeCollateral: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const NO_CHANGES: {
|
|
28
|
+
changeBorrowedA: number;
|
|
29
|
+
changeBorrowedB: number;
|
|
30
|
+
changeCollateral: number;
|
|
31
|
+
};
|
|
32
|
+
export interface Values {
|
|
33
|
+
valueCollateral: number;
|
|
34
|
+
valueA: number;
|
|
35
|
+
valueB: number;
|
|
36
|
+
}
|
|
37
|
+
export interface AirdropData {
|
|
38
|
+
index: number;
|
|
39
|
+
amount: BigNumber;
|
|
40
|
+
proof: Array<string>;
|
|
41
|
+
}
|
|
42
|
+
export interface PendingRewardUI {
|
|
43
|
+
symbol: string;
|
|
44
|
+
amount: number;
|
|
45
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NO_CHANGES = exports.ApprovalType = void 0;
|
|
4
|
-
const types_1 = require("../config/types");
|
|
5
4
|
var ApprovalType;
|
|
6
5
|
(function (ApprovalType) {
|
|
7
6
|
ApprovalType[ApprovalType["POOL_TOKEN"] = 0] = "POOL_TOKEN";
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
1
|
import Subgraph from './subgraph';
|
|
2
2
|
import ImpermaxRouter from './impermax-router';
|
|
3
|
-
|
|
3
|
+
import { CLAIM_AGGREGATOR } from './config/contracts/claim-aggregators';
|
|
4
|
+
import { IMPERMAX_CHEF } from './config/contracts/impermax-chef';
|
|
5
|
+
import { IMX } from './config/contracts/imxes';
|
|
6
|
+
import { MERKLE_DISTRIBUTOR_ETH, MERKLE_DISTRIBUTOR_IBEX, MERKLE_DISTRIBUTOR_IBEX_2 } from './config/contracts/merkle-distributors';
|
|
7
|
+
import { MERKLE_URL_ETH, MERKLE_URL_IBEX, MERKLE_URL_IBEX_2 } from './config/endpoints/merkle-distributors';
|
|
8
|
+
import { ROUTER } from './config/contracts/routers';
|
|
9
|
+
import { SIMPLE_UNISWAP_ORACLE } from './config/contracts/simple-uniswap-oracles';
|
|
10
|
+
import { WETH } from './config/contracts/weths';
|
|
11
|
+
import { ADD_LIQUIDITY_URLS, Amms, AMM_FACTORY, AMM_LP_FEE, AMM_SUBGRAPH_URLS, getAmmByFactory, hrAmms } from './config/amms';
|
|
12
|
+
import { DEBANK_IDS } from './config/debank-ids';
|
|
13
|
+
import { ETH_NAME, ETH_SYMBOL } from './config/eth';
|
|
14
|
+
import { BORROW_FEE_FACTORIES, LIQUIDATION_FEE_FACTORIES, OLD_KINK_MULTIPLIER_FACTORIES, SOLIDEX_FACTORIES, V2_FACTORIES } from './config/factories';
|
|
15
|
+
import { FarmIndex, Farms, getFarmByStakedLPFactory, hrFarms, STAKED_LP_FACTORY } from './config/farms';
|
|
16
|
+
import { APPROVE_AMOUNT, DEADLINE, NOT_SYNCED, ZERO } from './config/general';
|
|
17
|
+
import { BLOCKS_SUBGRAPH_URL, IMPERMAX_CHEF_SUBGRAPH_URL, IMPERMAX_SUBGRAPH_URL, XIMX_SUBGRAPH_URL } from './config/subgraphs';
|
|
18
|
+
import { Address, AddressIndex, AmmIndex, DistributorDetails, Factory, FactoryIndex, LendingPoolIndex, NetworkFactoryIndex, NetworkIndex, Networks, PoolTokenType } from './config/types';
|
|
19
|
+
import SubgraphAccount from './subgraph/Account';
|
|
20
|
+
import SubgraphAccountLendingPool from './subgraph/AccountLendingPool';
|
|
21
|
+
import SubgraphAccountPoolToken from './subgraph/AccountPoolToken';
|
|
22
|
+
import SubgraphLendingPool from './subgraph/LendingPool';
|
|
23
|
+
import SubgraphPoolToken from './subgraph/PoolToken';
|
|
24
|
+
import PriceHelper from './subgraph/PriceHelper';
|
|
25
|
+
import SolidexHelper from './subgraph/SolidexHelper';
|
|
26
|
+
import ImpermaxRouterAccount from './impermax-router/Account';
|
|
27
|
+
import ImpermaxRouterAccountPoolToken from './impermax-router/AccountPoolToken';
|
|
28
|
+
import ImpermaxRouterAccountLendingPool from './impermax-router/AccountLendingPool';
|
|
29
|
+
import AccountBorrowable from './impermax-router/AccountBorrowable';
|
|
30
|
+
import AccountCollateral from './impermax-router/AccountCollateral';
|
|
31
|
+
import Borrowable from './impermax-router/Borrowable';
|
|
32
|
+
import Collateral from './impermax-router/Collateral';
|
|
33
|
+
import ContractsHelper from './impermax-router/ContractsHelper';
|
|
34
|
+
import ImpermaxFactory from './impermax-router/ImpermaxFactory';
|
|
35
|
+
import Interactions from './impermax-router/Interactions';
|
|
36
|
+
import InteractionsLendingPool from './impermax-router/InteractionsLendingPool';
|
|
37
|
+
import InteractionsPoolToken from './impermax-router/InteractionsPoolToken';
|
|
38
|
+
import ImpermaxRouterLendingPool from './impermax-router/LendingPool';
|
|
39
|
+
import ImpermaxRouterPoolToken from './impermax-router/PoolToken';
|
|
40
|
+
import { AirdropData, ApprovalType, Changes, Contract, ImpermaxRouterCfg, NO_CHANGES, PendingRewardUI, PermitData, Values } from './impermax-router/types';
|
|
41
|
+
import { BorrowableData, BorrowablePastData, BorrowPosition, CollateralData, CollateralPosition, FarmingPoolData, LendingPoolData, LendingPoolPastData, PairData, PoolTokenData, RewardData, SupplyPosition, TokenData, TvlData, UserData, XimxData } from './subgraph/types';
|
|
42
|
+
export { CLAIM_AGGREGATOR, IMPERMAX_CHEF, IMX, 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, Subgraph, SubgraphAccount, SubgraphAccountLendingPool, SubgraphAccountPoolToken, SubgraphLendingPool, SubgraphPoolToken, PriceHelper, SolidexHelper, PoolTokenData, BorrowableData, CollateralData, BorrowablePastData, TokenData, RewardData, PairData, FarmingPoolData, LendingPoolPastData, LendingPoolData, CollateralPosition, SupplyPosition, BorrowPosition, UserData, TvlData, XimxData, ImpermaxRouter, ImpermaxRouterAccount, ImpermaxRouterAccountPoolToken, ImpermaxRouterAccountLendingPool, AccountBorrowable, AccountCollateral, Borrowable, Collateral, ContractsHelper, ImpermaxFactory, Interactions, InteractionsLendingPool, InteractionsPoolToken, ImpermaxRouterLendingPool, ImpermaxRouterPoolToken, Contract, ApprovalType, PermitData, ImpermaxRouterCfg, Changes, NO_CHANGES, Values, AirdropData, PendingRewardUI, };
|
package/lib/index.js
CHANGED
|
@@ -3,8 +3,112 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.SolidexHelper = exports.PriceHelper = exports.SubgraphPoolToken = exports.SubgraphLendingPool = exports.SubgraphAccountPoolToken = exports.SubgraphAccountLendingPool = exports.SubgraphAccount = exports.Subgraph = 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.IMX = exports.IMPERMAX_CHEF = exports.CLAIM_AGGREGATOR = void 0;
|
|
7
|
+
exports.NO_CHANGES = exports.ApprovalType = exports.ImpermaxRouterPoolToken = exports.ImpermaxRouterLendingPool = exports.InteractionsPoolToken = exports.InteractionsLendingPool = exports.Interactions = exports.ImpermaxFactory = exports.ContractsHelper = exports.Collateral = exports.Borrowable = exports.AccountCollateral = exports.AccountBorrowable = exports.ImpermaxRouterAccountLendingPool = exports.ImpermaxRouterAccountPoolToken = exports.ImpermaxRouterAccount = exports.ImpermaxRouter = void 0;
|
|
7
8
|
const subgraph_1 = __importDefault(require("./subgraph"));
|
|
8
9
|
exports.Subgraph = subgraph_1.default;
|
|
9
10
|
const impermax_router_1 = __importDefault(require("./impermax-router"));
|
|
10
11
|
exports.ImpermaxRouter = impermax_router_1.default;
|
|
12
|
+
const claim_aggregators_1 = require("./config/contracts/claim-aggregators");
|
|
13
|
+
Object.defineProperty(exports, "CLAIM_AGGREGATOR", { enumerable: true, get: function () { return claim_aggregators_1.CLAIM_AGGREGATOR; } });
|
|
14
|
+
const impermax_chef_1 = require("./config/contracts/impermax-chef");
|
|
15
|
+
Object.defineProperty(exports, "IMPERMAX_CHEF", { enumerable: true, get: function () { return impermax_chef_1.IMPERMAX_CHEF; } });
|
|
16
|
+
const imxes_1 = require("./config/contracts/imxes");
|
|
17
|
+
Object.defineProperty(exports, "IMX", { enumerable: true, get: function () { return imxes_1.IMX; } });
|
|
18
|
+
const merkle_distributors_1 = require("./config/contracts/merkle-distributors");
|
|
19
|
+
Object.defineProperty(exports, "MERKLE_DISTRIBUTOR_ETH", { enumerable: true, get: function () { return merkle_distributors_1.MERKLE_DISTRIBUTOR_ETH; } });
|
|
20
|
+
Object.defineProperty(exports, "MERKLE_DISTRIBUTOR_IBEX", { enumerable: true, get: function () { return merkle_distributors_1.MERKLE_DISTRIBUTOR_IBEX; } });
|
|
21
|
+
Object.defineProperty(exports, "MERKLE_DISTRIBUTOR_IBEX_2", { enumerable: true, get: function () { return merkle_distributors_1.MERKLE_DISTRIBUTOR_IBEX_2; } });
|
|
22
|
+
const merkle_distributors_2 = require("./config/endpoints/merkle-distributors");
|
|
23
|
+
Object.defineProperty(exports, "MERKLE_URL_ETH", { enumerable: true, get: function () { return merkle_distributors_2.MERKLE_URL_ETH; } });
|
|
24
|
+
Object.defineProperty(exports, "MERKLE_URL_IBEX", { enumerable: true, get: function () { return merkle_distributors_2.MERKLE_URL_IBEX; } });
|
|
25
|
+
Object.defineProperty(exports, "MERKLE_URL_IBEX_2", { enumerable: true, get: function () { return merkle_distributors_2.MERKLE_URL_IBEX_2; } });
|
|
26
|
+
const routers_1 = require("./config/contracts/routers");
|
|
27
|
+
Object.defineProperty(exports, "ROUTER", { enumerable: true, get: function () { return routers_1.ROUTER; } });
|
|
28
|
+
const simple_uniswap_oracles_1 = require("./config/contracts/simple-uniswap-oracles");
|
|
29
|
+
Object.defineProperty(exports, "SIMPLE_UNISWAP_ORACLE", { enumerable: true, get: function () { return simple_uniswap_oracles_1.SIMPLE_UNISWAP_ORACLE; } });
|
|
30
|
+
const weths_1 = require("./config/contracts/weths");
|
|
31
|
+
Object.defineProperty(exports, "WETH", { enumerable: true, get: function () { return weths_1.WETH; } });
|
|
32
|
+
const amms_1 = require("./config/amms");
|
|
33
|
+
Object.defineProperty(exports, "ADD_LIQUIDITY_URLS", { enumerable: true, get: function () { return amms_1.ADD_LIQUIDITY_URLS; } });
|
|
34
|
+
Object.defineProperty(exports, "Amms", { enumerable: true, get: function () { return amms_1.Amms; } });
|
|
35
|
+
Object.defineProperty(exports, "AMM_FACTORY", { enumerable: true, get: function () { return amms_1.AMM_FACTORY; } });
|
|
36
|
+
Object.defineProperty(exports, "AMM_LP_FEE", { enumerable: true, get: function () { return amms_1.AMM_LP_FEE; } });
|
|
37
|
+
Object.defineProperty(exports, "AMM_SUBGRAPH_URLS", { enumerable: true, get: function () { return amms_1.AMM_SUBGRAPH_URLS; } });
|
|
38
|
+
Object.defineProperty(exports, "getAmmByFactory", { enumerable: true, get: function () { return amms_1.getAmmByFactory; } });
|
|
39
|
+
Object.defineProperty(exports, "hrAmms", { enumerable: true, get: function () { return amms_1.hrAmms; } });
|
|
40
|
+
const debank_ids_1 = require("./config/debank-ids");
|
|
41
|
+
Object.defineProperty(exports, "DEBANK_IDS", { enumerable: true, get: function () { return debank_ids_1.DEBANK_IDS; } });
|
|
42
|
+
const eth_1 = require("./config/eth");
|
|
43
|
+
Object.defineProperty(exports, "ETH_NAME", { enumerable: true, get: function () { return eth_1.ETH_NAME; } });
|
|
44
|
+
Object.defineProperty(exports, "ETH_SYMBOL", { enumerable: true, get: function () { return eth_1.ETH_SYMBOL; } });
|
|
45
|
+
const factories_1 = require("./config/factories");
|
|
46
|
+
Object.defineProperty(exports, "BORROW_FEE_FACTORIES", { enumerable: true, get: function () { return factories_1.BORROW_FEE_FACTORIES; } });
|
|
47
|
+
Object.defineProperty(exports, "LIQUIDATION_FEE_FACTORIES", { enumerable: true, get: function () { return factories_1.LIQUIDATION_FEE_FACTORIES; } });
|
|
48
|
+
Object.defineProperty(exports, "OLD_KINK_MULTIPLIER_FACTORIES", { enumerable: true, get: function () { return factories_1.OLD_KINK_MULTIPLIER_FACTORIES; } });
|
|
49
|
+
Object.defineProperty(exports, "SOLIDEX_FACTORIES", { enumerable: true, get: function () { return factories_1.SOLIDEX_FACTORIES; } });
|
|
50
|
+
Object.defineProperty(exports, "V2_FACTORIES", { enumerable: true, get: function () { return factories_1.V2_FACTORIES; } });
|
|
51
|
+
const farms_1 = require("./config/farms");
|
|
52
|
+
Object.defineProperty(exports, "Farms", { enumerable: true, get: function () { return farms_1.Farms; } });
|
|
53
|
+
Object.defineProperty(exports, "getFarmByStakedLPFactory", { enumerable: true, get: function () { return farms_1.getFarmByStakedLPFactory; } });
|
|
54
|
+
Object.defineProperty(exports, "hrFarms", { enumerable: true, get: function () { return farms_1.hrFarms; } });
|
|
55
|
+
Object.defineProperty(exports, "STAKED_LP_FACTORY", { enumerable: true, get: function () { return farms_1.STAKED_LP_FACTORY; } });
|
|
56
|
+
const general_1 = require("./config/general");
|
|
57
|
+
Object.defineProperty(exports, "APPROVE_AMOUNT", { enumerable: true, get: function () { return general_1.APPROVE_AMOUNT; } });
|
|
58
|
+
Object.defineProperty(exports, "DEADLINE", { enumerable: true, get: function () { return general_1.DEADLINE; } });
|
|
59
|
+
Object.defineProperty(exports, "NOT_SYNCED", { enumerable: true, get: function () { return general_1.NOT_SYNCED; } });
|
|
60
|
+
Object.defineProperty(exports, "ZERO", { enumerable: true, get: function () { return general_1.ZERO; } });
|
|
61
|
+
const subgraphs_1 = require("./config/subgraphs");
|
|
62
|
+
Object.defineProperty(exports, "BLOCKS_SUBGRAPH_URL", { enumerable: true, get: function () { return subgraphs_1.BLOCKS_SUBGRAPH_URL; } });
|
|
63
|
+
Object.defineProperty(exports, "IMPERMAX_CHEF_SUBGRAPH_URL", { enumerable: true, get: function () { return subgraphs_1.IMPERMAX_CHEF_SUBGRAPH_URL; } });
|
|
64
|
+
Object.defineProperty(exports, "IMPERMAX_SUBGRAPH_URL", { enumerable: true, get: function () { return subgraphs_1.IMPERMAX_SUBGRAPH_URL; } });
|
|
65
|
+
Object.defineProperty(exports, "XIMX_SUBGRAPH_URL", { enumerable: true, get: function () { return subgraphs_1.XIMX_SUBGRAPH_URL; } });
|
|
66
|
+
const types_1 = require("./config/types");
|
|
67
|
+
Object.defineProperty(exports, "Factory", { enumerable: true, get: function () { return types_1.Factory; } });
|
|
68
|
+
Object.defineProperty(exports, "Networks", { enumerable: true, get: function () { return types_1.Networks; } });
|
|
69
|
+
Object.defineProperty(exports, "PoolTokenType", { enumerable: true, get: function () { return types_1.PoolTokenType; } });
|
|
70
|
+
const Account_1 = __importDefault(require("./subgraph/Account"));
|
|
71
|
+
exports.SubgraphAccount = Account_1.default;
|
|
72
|
+
const AccountLendingPool_1 = __importDefault(require("./subgraph/AccountLendingPool"));
|
|
73
|
+
exports.SubgraphAccountLendingPool = AccountLendingPool_1.default;
|
|
74
|
+
const AccountPoolToken_1 = __importDefault(require("./subgraph/AccountPoolToken"));
|
|
75
|
+
exports.SubgraphAccountPoolToken = AccountPoolToken_1.default;
|
|
76
|
+
const LendingPool_1 = __importDefault(require("./subgraph/LendingPool"));
|
|
77
|
+
exports.SubgraphLendingPool = LendingPool_1.default;
|
|
78
|
+
const PoolToken_1 = __importDefault(require("./subgraph/PoolToken"));
|
|
79
|
+
exports.SubgraphPoolToken = PoolToken_1.default;
|
|
80
|
+
const PriceHelper_1 = __importDefault(require("./subgraph/PriceHelper"));
|
|
81
|
+
exports.PriceHelper = PriceHelper_1.default;
|
|
82
|
+
const SolidexHelper_1 = __importDefault(require("./subgraph/SolidexHelper"));
|
|
83
|
+
exports.SolidexHelper = SolidexHelper_1.default;
|
|
84
|
+
const Account_2 = __importDefault(require("./impermax-router/Account"));
|
|
85
|
+
exports.ImpermaxRouterAccount = Account_2.default;
|
|
86
|
+
const AccountPoolToken_2 = __importDefault(require("./impermax-router/AccountPoolToken"));
|
|
87
|
+
exports.ImpermaxRouterAccountPoolToken = AccountPoolToken_2.default;
|
|
88
|
+
const AccountLendingPool_2 = __importDefault(require("./impermax-router/AccountLendingPool"));
|
|
89
|
+
exports.ImpermaxRouterAccountLendingPool = AccountLendingPool_2.default;
|
|
90
|
+
const AccountBorrowable_1 = __importDefault(require("./impermax-router/AccountBorrowable"));
|
|
91
|
+
exports.AccountBorrowable = AccountBorrowable_1.default;
|
|
92
|
+
const AccountCollateral_1 = __importDefault(require("./impermax-router/AccountCollateral"));
|
|
93
|
+
exports.AccountCollateral = AccountCollateral_1.default;
|
|
94
|
+
const Borrowable_1 = __importDefault(require("./impermax-router/Borrowable"));
|
|
95
|
+
exports.Borrowable = Borrowable_1.default;
|
|
96
|
+
const Collateral_1 = __importDefault(require("./impermax-router/Collateral"));
|
|
97
|
+
exports.Collateral = Collateral_1.default;
|
|
98
|
+
const ContractsHelper_1 = __importDefault(require("./impermax-router/ContractsHelper"));
|
|
99
|
+
exports.ContractsHelper = ContractsHelper_1.default;
|
|
100
|
+
const ImpermaxFactory_1 = __importDefault(require("./impermax-router/ImpermaxFactory"));
|
|
101
|
+
exports.ImpermaxFactory = ImpermaxFactory_1.default;
|
|
102
|
+
const Interactions_1 = __importDefault(require("./impermax-router/Interactions"));
|
|
103
|
+
exports.Interactions = Interactions_1.default;
|
|
104
|
+
const InteractionsLendingPool_1 = __importDefault(require("./impermax-router/InteractionsLendingPool"));
|
|
105
|
+
exports.InteractionsLendingPool = InteractionsLendingPool_1.default;
|
|
106
|
+
const InteractionsPoolToken_1 = __importDefault(require("./impermax-router/InteractionsPoolToken"));
|
|
107
|
+
exports.InteractionsPoolToken = InteractionsPoolToken_1.default;
|
|
108
|
+
const LendingPool_2 = __importDefault(require("./impermax-router/LendingPool"));
|
|
109
|
+
exports.ImpermaxRouterLendingPool = LendingPool_2.default;
|
|
110
|
+
const PoolToken_2 = __importDefault(require("./impermax-router/PoolToken"));
|
|
111
|
+
exports.ImpermaxRouterPoolToken = PoolToken_2.default;
|
|
112
|
+
const types_2 = require("./impermax-router/types");
|
|
113
|
+
Object.defineProperty(exports, "ApprovalType", { enumerable: true, get: function () { return types_2.ApprovalType; } });
|
|
114
|
+
Object.defineProperty(exports, "NO_CHANGES", { enumerable: true, get: function () { return types_2.NO_CHANGES; } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UserData } from "../impermax-router/interfaces";
|
|
2
1
|
import Subgraph from "./index";
|
|
3
2
|
import AccountLendingPool from "./AccountLendingPool";
|
|
4
3
|
import { Address, Factory, FactoryIndex, LendingPoolIndex } from '../config/types';
|
|
4
|
+
import { UserData } from './types';
|
|
5
5
|
export default class Account {
|
|
6
6
|
subgraph: Subgraph;
|
|
7
7
|
account: Address;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CollateralPosition, UserData } from "../impermax-router/interfaces";
|
|
2
1
|
import Account from "./Account";
|
|
3
2
|
import AccountPoolToken from "./AccountPoolToken";
|
|
4
3
|
import LendingPool from "./LendingPool";
|
|
5
4
|
import { PoolTokenType } from '../config/types';
|
|
5
|
+
import { CollateralPosition, UserData } from './types';
|
|
6
6
|
export default class AccountLendingPool {
|
|
7
7
|
account: Account;
|
|
8
8
|
lendingPool: LendingPool;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { LendingPoolData, LendingPoolPastData } from "../impermax-router/interfaces";
|
|
2
1
|
import Subgraph from "./index";
|
|
3
2
|
import PoolToken from "./PoolToken";
|
|
4
|
-
import { Address,
|
|
3
|
+
import { Address, Factory, PoolTokenType } from '../config/types';
|
|
4
|
+
import { Amms } from '../config/amms';
|
|
5
5
|
import { Farms } from '../config/farms';
|
|
6
|
+
import { LendingPoolData, LendingPoolPastData } from './types';
|
|
6
7
|
export default class LendingPool {
|
|
7
8
|
subgraph: Subgraph;
|
|
8
9
|
factory: Factory;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PoolTokenData, BorrowablePastData } from "../impermax-router/interfaces";
|
|
2
1
|
import LendingPool from "./LendingPool";
|
|
3
2
|
import { Address, PoolTokenType } from '../config/types';
|
|
3
|
+
import { BorrowablePastData, PoolTokenData } from './types';
|
|
4
4
|
export default class PoolToken {
|
|
5
5
|
lendingPool: LendingPool;
|
|
6
6
|
poolTokenType: PoolTokenType;
|
|
@@ -16,6 +16,7 @@ const coingecko_ids = {
|
|
|
16
16
|
// Arbitrum
|
|
17
17
|
"0xb348b87b23d5977e2948e6f36ca07e1ec94d7328": "swapfish",
|
|
18
18
|
"0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f": "wrapped-bitcoin",
|
|
19
|
+
"0x463913D3a3D3D291667D53B8325c598Eb88D3B0e": "solidlizard",
|
|
19
20
|
};
|
|
20
21
|
class PriceHelper {
|
|
21
22
|
constructor(subgraph) {
|
package/lib/subgraph/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { LendingPoolData, TvlData, UserData, XimxData } from "../impermax-router/interfaces";
|
|
2
1
|
import * as initializer from "./initializer";
|
|
3
2
|
import LendingPool from "./LendingPool";
|
|
4
3
|
import PriceHelper from "./PriceHelper";
|
|
5
4
|
import SolidexHelper from "./SolidexHelper";
|
|
6
5
|
import Account from "./Account";
|
|
7
6
|
import { Address, Factory, FactoryIndex, LendingPoolIndex, Networks } from '../config/types';
|
|
7
|
+
import { LendingPoolData, TvlData, UserData, XimxData } from './types';
|
|
8
8
|
export interface SubgraphCfg {
|
|
9
9
|
network: Networks;
|
|
10
10
|
chainId: number;
|
|
@@ -59,7 +59,10 @@ export default class Subgraph {
|
|
|
59
59
|
/**
|
|
60
60
|
* DATA GETTERS
|
|
61
61
|
*/
|
|
62
|
-
getPairList(): Promise<
|
|
62
|
+
getPairList(): Promise<{
|
|
63
|
+
pairAddress: string;
|
|
64
|
+
factory: Factory;
|
|
65
|
+
}[]>;
|
|
63
66
|
private getPairData;
|
|
64
67
|
getPairListWithData(pairList: {
|
|
65
68
|
pairAddress: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { LendingPoolData, TvlData, UserData, CollateralPosition, SupplyPosition, BorrowPosition, XimxData } from "../impermax-router/interfaces";
|
|
2
1
|
import Subgraph from "./index";
|
|
3
2
|
import { DocumentNode } from "graphql";
|
|
4
|
-
import { Address, AddressIndex,
|
|
3
|
+
import { Address, AddressIndex, Factory, FactoryIndex, LendingPoolIndex } from '../config/types';
|
|
4
|
+
import { Amms } from '../config/amms';
|
|
5
|
+
import { BorrowPosition, CollateralPosition, LendingPoolData, SupplyPosition, TvlData, UserData, XimxData } from './types';
|
|
5
6
|
export declare function apolloFetcher(subgraphUrl: string, query: DocumentNode): Promise<import("apollo-client").ApolloQueryResult<any>>;
|
|
6
7
|
export declare function fetchBlockByTimestamp(this: Subgraph, timestamp: number): Promise<number>;
|
|
7
8
|
export declare function fetchLendingPools(this: Subgraph): Promise<FactoryIndex<LendingPoolData[]>>;
|
|
@@ -1,64 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Subgraph from "../subgraph";
|
|
3
|
-
import { Address, Networks, PoolTokenType } from '../config/types';
|
|
4
|
-
export type Contract = any;
|
|
5
|
-
export type RouterContract = Contract;
|
|
6
|
-
export type FactoryContract = Contract;
|
|
7
|
-
export type SimpleUniswapOracleContract = Contract;
|
|
8
|
-
export type ERC20Contract = Contract;
|
|
9
|
-
export type UniswapV2PairContract = Contract;
|
|
10
|
-
export type UniswapV2FactoryContract = Contract;
|
|
11
|
-
export type BorrowableContract = Contract;
|
|
12
|
-
export type CollateralContract = Contract;
|
|
13
|
-
export type MerkleDistributorContract = Contract;
|
|
14
|
-
export type FarmingPoolContract = Contract;
|
|
15
|
-
export type ClaimAggregatorContract = Contract;
|
|
16
|
-
export type ClaimableContract = Contract;
|
|
17
|
-
export type StakedLPTokenContract = Contract;
|
|
18
|
-
export type ImpermaxChefContract = Contract;
|
|
19
|
-
export type LendingPool = {
|
|
20
|
-
uniswapV2Pair: UniswapV2PairContract;
|
|
21
|
-
tokenA: ERC20Contract;
|
|
22
|
-
tokenB: ERC20Contract;
|
|
23
|
-
collateral: CollateralContract;
|
|
24
|
-
borrowableA: BorrowableContract;
|
|
25
|
-
borrowableB: BorrowableContract;
|
|
26
|
-
farmingPoolA: FarmingPoolContract;
|
|
27
|
-
farmingPoolB: FarmingPoolContract;
|
|
28
|
-
stakedLPToken: StakedLPTokenContract;
|
|
29
|
-
};
|
|
30
|
-
export declare enum ApprovalType {
|
|
31
|
-
POOL_TOKEN = 0,
|
|
32
|
-
UNDERLYING = 1,
|
|
33
|
-
BORROW = 2
|
|
34
|
-
}
|
|
35
|
-
export interface PermitData {
|
|
36
|
-
permitData: string;
|
|
37
|
-
amount: BigNumber;
|
|
38
|
-
deadline: BigNumber;
|
|
39
|
-
}
|
|
40
|
-
export interface Changes {
|
|
41
|
-
changeBorrowedA: number;
|
|
42
|
-
changeBorrowedB: number;
|
|
43
|
-
changeCollateral: number;
|
|
44
|
-
}
|
|
45
|
-
export declare const NO_CHANGES: {
|
|
46
|
-
changeBorrowedA: number;
|
|
47
|
-
changeBorrowedB: number;
|
|
48
|
-
changeCollateral: number;
|
|
49
|
-
};
|
|
50
|
-
export interface Values {
|
|
51
|
-
valueCollateral: number;
|
|
52
|
-
valueA: number;
|
|
53
|
-
valueB: number;
|
|
54
|
-
}
|
|
55
|
-
export interface ImpermaxRouterCfg {
|
|
56
|
-
network: Networks;
|
|
57
|
-
subgraph: Subgraph;
|
|
58
|
-
web3: any;
|
|
59
|
-
chainId: number;
|
|
60
|
-
priceInverted: boolean;
|
|
61
|
-
}
|
|
1
|
+
import { Address, PoolTokenType } from '../config/types';
|
|
62
2
|
export interface PoolTokenData {
|
|
63
3
|
id: Address;
|
|
64
4
|
totalBalance: string;
|
|
@@ -197,22 +137,9 @@ export interface TvlData {
|
|
|
197
137
|
totalBorrowsUSD: number;
|
|
198
138
|
totalSupplyUSD: number;
|
|
199
139
|
}
|
|
200
|
-
export interface AirdropData {
|
|
201
|
-
index: number;
|
|
202
|
-
amount: BigNumber;
|
|
203
|
-
proof: Array<string>;
|
|
204
|
-
}
|
|
205
|
-
export interface ClaimEvent {
|
|
206
|
-
amount: number;
|
|
207
|
-
transactionHash: string;
|
|
208
|
-
}
|
|
209
140
|
export interface XimxData {
|
|
210
141
|
totalSupply: string;
|
|
211
142
|
totalBalance: string;
|
|
212
143
|
exchangeRate: string;
|
|
213
144
|
dailyAPR: string;
|
|
214
145
|
}
|
|
215
|
-
export interface PendingRewardUI {
|
|
216
|
-
symbol: string;
|
|
217
|
-
amount: number;
|
|
218
|
-
}
|