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.
Files changed (108) hide show
  1. package/package.json +1 -1
  2. package/lib/esm/abis/ImpermaxABI.d.ts +0 -2
  3. package/lib/esm/abis/ImpermaxABI.js +0 -3
  4. package/lib/esm/abis/contracts/ClaimAggregator.json +0 -2015
  5. package/lib/esm/abis/contracts/IBorrowable.json +0 -13207
  6. package/lib/esm/abis/contracts/IClaimable.json +0 -406
  7. package/lib/esm/abis/contracts/ICollateral.json +0 -8952
  8. package/lib/esm/abis/contracts/IERC20.json +0 -2376
  9. package/lib/esm/abis/contracts/IFactory.json +0 -3660
  10. package/lib/esm/abis/contracts/IFarmingPool.json +0 -3584
  11. package/lib/esm/abis/contracts/IMerkleDistributor.json +0 -1134
  12. package/lib/esm/abis/contracts/IRouter02.json +0 -7283
  13. package/lib/esm/abis/contracts/ISimpleUniswapOracle.json +0 -1469
  14. package/lib/esm/abis/contracts/IStakedLPToken.json +0 -7309
  15. package/lib/esm/abis/contracts/IStakingRewards.json +0 -1036
  16. package/lib/esm/abis/contracts/IUniswapV2Factory.json +0 -1690
  17. package/lib/esm/abis/contracts/IUniswapV2Pair.json +0 -6761
  18. package/lib/esm/abis/contracts/ImpermaxChef.json +0 -20945
  19. package/lib/esm/config/amms.d.ts +0 -25
  20. package/lib/esm/config/amms.js +0 -196
  21. package/lib/esm/config/contracts/claim-aggregators.d.ts +0 -2
  22. package/lib/esm/config/contracts/claim-aggregators.js +0 -18
  23. package/lib/esm/config/contracts/impermax-chef.d.ts +0 -2
  24. package/lib/esm/config/contracts/impermax-chef.js +0 -18
  25. package/lib/esm/config/contracts/imxes.d.ts +0 -2
  26. package/lib/esm/config/contracts/imxes.js +0 -18
  27. package/lib/esm/config/contracts/merkle-distributors.d.ts +0 -4
  28. package/lib/esm/config/contracts/merkle-distributors.js +0 -13
  29. package/lib/esm/config/contracts/routers.d.ts +0 -2
  30. package/lib/esm/config/contracts/routers.js +0 -38
  31. package/lib/esm/config/contracts/simple-uniswap-oracles.d.ts +0 -2
  32. package/lib/esm/config/contracts/simple-uniswap-oracles.js +0 -35
  33. package/lib/esm/config/contracts/weths.d.ts +0 -2
  34. package/lib/esm/config/contracts/weths.js +0 -19
  35. package/lib/esm/config/debank-ids.d.ts +0 -2
  36. package/lib/esm/config/debank-ids.js +0 -17
  37. package/lib/esm/config/endpoints/merkle-distributors.d.ts +0 -4
  38. package/lib/esm/config/endpoints/merkle-distributors.js +0 -13
  39. package/lib/esm/config/eth.d.ts +0 -3
  40. package/lib/esm/config/eth.js +0 -32
  41. package/lib/esm/config/factories.d.ts +0 -6
  42. package/lib/esm/config/factories.js +0 -24
  43. package/lib/esm/config/farms.d.ts +0 -59
  44. package/lib/esm/config/farms.js +0 -114
  45. package/lib/esm/config/general.d.ts +0 -3
  46. package/lib/esm/config/general.js +0 -8
  47. package/lib/esm/config/subgraphs.d.ts +0 -5
  48. package/lib/esm/config/subgraphs.js +0 -68
  49. package/lib/esm/config/types.d.ts +0 -67
  50. package/lib/esm/config/types.js +0 -54
  51. package/lib/esm/impermax-router/Account.d.ts +0 -31
  52. package/lib/esm/impermax-router/Account.js +0 -154
  53. package/lib/esm/impermax-router/AccountBorrowable.d.ts +0 -22
  54. package/lib/esm/impermax-router/AccountBorrowable.js +0 -141
  55. package/lib/esm/impermax-router/AccountCollateral.d.ts +0 -11
  56. package/lib/esm/impermax-router/AccountCollateral.js +0 -63
  57. package/lib/esm/impermax-router/AccountLendingPool.d.ts +0 -57
  58. package/lib/esm/impermax-router/AccountLendingPool.js +0 -266
  59. package/lib/esm/impermax-router/AccountPoolToken.d.ts +0 -29
  60. package/lib/esm/impermax-router/AccountPoolToken.js +0 -89
  61. package/lib/esm/impermax-router/Borrowable.d.ts +0 -27
  62. package/lib/esm/impermax-router/Borrowable.js +0 -128
  63. package/lib/esm/impermax-router/Collateral.d.ts +0 -9
  64. package/lib/esm/impermax-router/Collateral.js +0 -45
  65. package/lib/esm/impermax-router/ContractsHelper.d.ts +0 -28
  66. package/lib/esm/impermax-router/ContractsHelper.js +0 -50
  67. package/lib/esm/impermax-router/ImpermaxFactory.d.ts +0 -15
  68. package/lib/esm/impermax-router/ImpermaxFactory.js +0 -42
  69. package/lib/esm/impermax-router/Interactions.d.ts +0 -16
  70. package/lib/esm/impermax-router/Interactions.js +0 -105
  71. package/lib/esm/impermax-router/InteractionsLendingPool.d.ts +0 -43
  72. package/lib/esm/impermax-router/InteractionsLendingPool.js +0 -124
  73. package/lib/esm/impermax-router/InteractionsPoolToken.d.ts +0 -23
  74. package/lib/esm/impermax-router/InteractionsPoolToken.js +0 -194
  75. package/lib/esm/impermax-router/LendingPool.d.ts +0 -69
  76. package/lib/esm/impermax-router/LendingPool.js +0 -291
  77. package/lib/esm/impermax-router/PoolToken.d.ts +0 -36
  78. package/lib/esm/impermax-router/PoolToken.js +0 -140
  79. package/lib/esm/impermax-router/index.d.ts +0 -20
  80. package/lib/esm/impermax-router/index.js +0 -34
  81. package/lib/esm/impermax-router/interfaces.d.ts +0 -218
  82. package/lib/esm/impermax-router/interfaces.js +0 -15
  83. package/lib/esm/index.d.ts +0 -3
  84. package/lib/esm/index.js +0 -10
  85. package/lib/esm/subgraph/Account.d.ts +0 -18
  86. package/lib/esm/subgraph/Account.js +0 -111
  87. package/lib/esm/subgraph/AccountLendingPool.d.ts +0 -19
  88. package/lib/esm/subgraph/AccountLendingPool.js +0 -71
  89. package/lib/esm/subgraph/AccountPoolToken.d.ts +0 -14
  90. package/lib/esm/subgraph/AccountPoolToken.js +0 -75
  91. package/lib/esm/subgraph/LendingPool.d.ts +0 -38
  92. package/lib/esm/subgraph/LendingPool.js +0 -204
  93. package/lib/esm/subgraph/PoolToken.d.ts +0 -64
  94. package/lib/esm/subgraph/PoolToken.js +0 -462
  95. package/lib/esm/subgraph/PriceHelper.d.ts +0 -21
  96. package/lib/esm/subgraph/PriceHelper.js +0 -166
  97. package/lib/esm/subgraph/SolidexHelper.d.ts +0 -16
  98. package/lib/esm/subgraph/SolidexHelper.js +0 -58
  99. package/lib/esm/subgraph/index.d.ts +0 -73
  100. package/lib/esm/subgraph/index.js +0 -185
  101. package/lib/esm/subgraph/initializer.d.ts +0 -34
  102. package/lib/esm/subgraph/initializer.js +0 -517
  103. package/lib/esm/subgraph/query.d.ts +0 -10
  104. package/lib/esm/subgraph/query.js +0 -229
  105. package/lib/esm/utils/ether-utils.d.ts +0 -5
  106. package/lib/esm/utils/ether-utils.js +0 -26
  107. package/lib/esm/utils/index.d.ts +0 -3
  108. package/lib/esm/utils/index.js +0 -16
@@ -1,229 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ximxQuery = exports.userQuery = exports.tvlQuery = exports.currentVolumeAndReservesQuery = exports.pastVolumeQuery = exports.impermaxChefQuery = exports.lendingPoolsPastQuery = exports.lendingPoolsQuery = exports.blockQuery = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- const factories_1 = require("../config/factories");
9
- function blockQuery(timestamp) {
10
- return (0, graphql_tag_1.default) `{
11
- blocks (first: 1, orderBy: timestamp, orderDirection: desc, where: { timestamp_gt: ${timestamp}, timestamp_lt: ${timestamp + 600} }) {
12
- number
13
- }
14
- _meta {
15
- block {
16
- number
17
- }
18
- }
19
- }`;
20
- }
21
- exports.blockQuery = blockQuery;
22
- function lendingPoolsQuery(factory, addressesFilter) {
23
- const tokenStr = `{
24
- id
25
- symbol
26
- name
27
- decimals
28
- derivedUSD
29
- }`;
30
- const distributorStr = `{
31
- id
32
- }`;
33
- const farmingPoolStr = `{
34
- epochAmount
35
- epochBegin
36
- segmentLength
37
- vestingBegin
38
- sharePercentage
39
- distributor ${distributorStr}
40
- }`;
41
- const borrowableStr = `{
42
- id
43
- underlying ${tokenStr}
44
- totalBalance
45
- totalBorrows
46
- borrowRate
47
- reserveFactor
48
- kinkBorrowRate
49
- kinkUtilizationRate
50
- borrowIndex
51
- accrualTimestamp
52
- exchangeRate
53
- totalBalanceUSD
54
- totalSupplyUSD
55
- totalBorrowsUSD
56
- farmingPool ${farmingPoolStr}
57
- }`;
58
- const collateralStr = `{
59
- id
60
- totalBalance
61
- totalBalanceUSD
62
- safetyMargin
63
- liquidationIncentive
64
- ${factories_1.LIQUIDATION_FEE_FACTORIES.includes(factory) ? "liquidationFee" : ""}
65
- exchangeRate
66
- }`;
67
- const pairStr = `{
68
- factory
69
- reserve0
70
- reserve1
71
- totalSupply
72
- reserveUSD
73
- token0Price
74
- token1Price
75
- derivedUSD
76
- uniswapV2PairAddress
77
- uniswapV2Factory
78
- isStakedLPToken
79
- exchangeRate
80
- stakingRewards
81
- masterChef
82
- pid
83
- stakedTotalSupply
84
- rewards {
85
- id
86
- rewardRate
87
- rewardsToken ${tokenStr}
88
- periodFinish
89
- }
90
- }`;
91
- const id_in_string = addressesFilter.length > 0 ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
92
- return (0, graphql_tag_1.default) `{
93
- lendingPools(first: 1000, orderBy: totalBorrowsUSD, orderDirection: desc ${id_in_string}) {
94
- id
95
- borrowable0 ${borrowableStr}
96
- borrowable1 ${borrowableStr}
97
- collateral ${collateralStr}
98
- pair ${pairStr}
99
- }
100
- _meta {
101
- block {
102
- number
103
- }
104
- hasIndexingErrors
105
- }
106
- }`;
107
- }
108
- exports.lendingPoolsQuery = lendingPoolsQuery;
109
- function lendingPoolsPastQuery(blockNumber, addressesFilter) {
110
- const borrowablePastStr = `{
111
- borrowIndex
112
- accrualTimestamp
113
- exchangeRate
114
- }`;
115
- const id_in_string = addressesFilter.length > 0 ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
116
- return (0, graphql_tag_1.default) `{
117
- lendingPools(first: 1000, orderBy: totalBorrowsUSD, orderDirection: desc, block: {number: ${blockNumber}} ${id_in_string}) {
118
- id
119
- borrowable0 ${borrowablePastStr}
120
- borrowable1 ${borrowablePastStr}
121
- }
122
- }`;
123
- }
124
- exports.lendingPoolsPastQuery = lendingPoolsPastQuery;
125
- function impermaxChefQuery() {
126
- return (0, graphql_tag_1.default) `{
127
- impermaxChefs(first: 1) {
128
- id
129
- rewardToken
130
- rewardPerSec
131
- totalAllocPoint
132
- }
133
- pools(first: 1000) {
134
- id
135
- allocPoint
136
- rewarder {id}
137
- }
138
- impermaxRewarders(first: 1000) {
139
- rewardToken
140
- rewardPerSec
141
- totalAllocPoint
142
- pools(first: 1000) {
143
- borrowable
144
- allocPoint
145
- }
146
- }
147
- }`;
148
- }
149
- exports.impermaxChefQuery = impermaxChefQuery;
150
- function pastVolumeQuery(blockNumber, addressesFilter) {
151
- const id_in_string = addressesFilter.length > 0 ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
152
- return (0, graphql_tag_1.default) `{
153
- pairs (block: {number: ${blockNumber}} ${id_in_string}) {
154
- id
155
- volumeUSD
156
- }
157
- }`;
158
- }
159
- exports.pastVolumeQuery = pastVolumeQuery;
160
- function currentVolumeAndReservesQuery(addressesFilter) {
161
- const id_in_string = addressesFilter.length > 0 ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
162
- return (0, graphql_tag_1.default) `{
163
- pairs (${id_in_string}) {
164
- id
165
- reserveUSD
166
- volumeUSD
167
- }
168
- }`;
169
- }
170
- exports.currentVolumeAndReservesQuery = currentVolumeAndReservesQuery;
171
- function tvlQuery() {
172
- return (0, graphql_tag_1.default) `{
173
- impermaxFactories(first: 1) {
174
- totalBalanceUSD
175
- totalSupplyUSD
176
- totalBorrowsUSD
177
- }
178
- }`;
179
- }
180
- exports.tvlQuery = tvlQuery;
181
- function userQuery(account) {
182
- return (0, graphql_tag_1.default) `{
183
- user(id: "${account.toLowerCase()}") {
184
- collateralPositions(first:1000) {
185
- balance
186
- collateral {
187
- lendingPool {
188
- id
189
- }
190
- }
191
- }
192
- supplyPositions(first:1000) {
193
- balance
194
- borrowable {
195
- underlying {
196
- id
197
- }
198
- lendingPool {
199
- id
200
- }
201
- }
202
- }
203
- borrowPositions(first:1000) {
204
- borrowBalance
205
- borrowIndex
206
- borrowable {
207
- underlying {
208
- id
209
- }
210
- lendingPool {
211
- id
212
- }
213
- }
214
- }
215
- }
216
- }`;
217
- }
218
- exports.userQuery = userQuery;
219
- function ximxQuery() {
220
- return (0, graphql_tag_1.default) `{
221
- ximxes(first: 1) {
222
- totalSupply
223
- totalBalance
224
- exchangeRate
225
- dailyAPR
226
- }
227
- }`;
228
- }
229
- exports.ximxQuery = ximxQuery;
@@ -1,5 +0,0 @@
1
- import { BigNumber } from 'ethers';
2
- export declare function balanceToDecimal(s: string): string;
3
- export declare function formatToDecimals(n: number, decimals?: number): string;
4
- export declare function decimalToBalance(d: string | number, decimals?: number): BigNumber;
5
- export declare function address(n: number): string;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.address = exports.decimalToBalance = exports.formatToDecimals = exports.balanceToDecimal = void 0;
4
- const utils_1 = require("ethers/lib/utils");
5
- function balanceToDecimal(s) {
6
- return (0, utils_1.formatUnits)(s);
7
- }
8
- exports.balanceToDecimal = balanceToDecimal;
9
- function formatToDecimals(n, decimals = 2) {
10
- if (n === null || n === undefined || isNaN(n))
11
- return "-";
12
- if (n == Infinity)
13
- return "Infinity"; //return "∞";
14
- return (Math.round(n * (Math.pow(10, decimals))) / (Math.pow(10, decimals))).toFixed(decimals);
15
- }
16
- exports.formatToDecimals = formatToDecimals;
17
- function decimalToBalance(d, decimals = 18) {
18
- const n = parseFloat(d.toString());
19
- const s = formatToDecimals(Math.max(n, 0), decimals);
20
- return (0, utils_1.parseUnits)(s, decimals);
21
- }
22
- exports.decimalToBalance = decimalToBalance;
23
- function address(n) {
24
- return `0x${n.toString(16).padStart(40, '0')}`;
25
- }
26
- exports.address = address;
@@ -1,3 +0,0 @@
1
- export declare function toAPR(n: number): number;
2
- export declare function impermanentLoss(priceSwing: number): number;
3
- export declare function isValidNumber(n: number): boolean;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidNumber = exports.impermanentLoss = exports.toAPR = void 0;
4
- function toAPR(n) {
5
- const SECONDS_IN_YEAR = 365 * 24 * 3600;
6
- return n * SECONDS_IN_YEAR;
7
- }
8
- exports.toAPR = toAPR;
9
- function impermanentLoss(priceSwing) {
10
- return Math.sqrt(priceSwing) / (priceSwing + 1) * 2;
11
- }
12
- exports.impermanentLoss = impermanentLoss;
13
- function isValidNumber(n) {
14
- return !(n === null || n === undefined || isNaN(n));
15
- }
16
- exports.isValidNumber = isValidNumber;