impermax-sdk 1.2.67 → 1.2.69
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 +2 -0
- package/lib/config/amms.js +3 -0
- package/lib/config/farms.d.ts +2 -0
- package/lib/config/farms.js +3 -0
- package/lib/offchain/offchainPriceHelper.js +4 -2
- package/lib/offchain/query.js +247 -247
- package/package.json +1 -1
- package/lib/offchain/account/lendingPool/borrowable.d.ts +0 -14
- package/lib/offchain/account/lendingPool/borrowable.js +0 -73
- package/lib/offchain/account/lendingPool/collateral.d.ts +0 -12
- package/lib/offchain/account/lendingPool/collateral.js +0 -42
- package/lib/offchain/account/lendingVault.d.ts +0 -11
- package/lib/offchain/account/lendingVault.js +0 -38
- package/lib/offchain/account/poolToken.d.ts +0 -6
- package/lib/offchain/account/poolToken.js +0 -21
- package/lib/offchain/initializer.d.ts +0 -32
- package/lib/offchain/initializer.js +0 -627
- package/lib/offchain/lendingPool/borrowable.d.ts +0 -55
- package/lib/offchain/lendingPool/borrowable.js +0 -351
- package/lib/offchain/lendingPool/collateral.d.ts +0 -17
- package/lib/offchain/lendingPool/collateral.js +0 -72
- package/lib/offchain/lendingVault.d.ts +0 -22
- package/lib/offchain/lendingVault.js +0 -115
- package/lib/offchain/poolToken.d.ts +0 -20
- package/lib/offchain/poolToken.js +0 -120
- package/lib/offchain/priceHelper.d.ts +0 -21
- package/lib/offchain/priceHelper.js +0 -195
- package/lib/offchain/solidexHelper.d.ts +0 -16
- package/lib/offchain/solidexHelper.js +0 -58
- package/lib/offchain/types.d.ts +0 -150
- package/lib/offchain/types.js +0 -3
- package/lib/onchain/account/interactions/index.d.ts +0 -28
- package/lib/onchain/account/interactions/index.js +0 -158
- package/lib/onchain/account/interactions/lendingPool/borrowable.d.ts +0 -16
- package/lib/onchain/account/interactions/lendingPool/borrowable.js +0 -49
- package/lib/onchain/account/interactions/lendingPool/collateral.d.ts +0 -15
- package/lib/onchain/account/interactions/lendingPool/collateral.js +0 -33
- package/lib/onchain/account/interactions/lendingPool/index.d.ts +0 -41
- package/lib/onchain/account/interactions/lendingPool/index.js +0 -120
- package/lib/onchain/account/interactions/lendingVault.d.ts +0 -10
- package/lib/onchain/account/interactions/lendingVault.js +0 -12
- package/lib/onchain/account/interactions/poolToken.d.ts +0 -33
- package/lib/onchain/account/interactions/poolToken.js +0 -180
- package/lib/onchain/account/lendingPool/borrowable.d.ts +0 -29
- package/lib/onchain/account/lendingPool/borrowable.js +0 -135
- package/lib/onchain/account/lendingPool/collateral.d.ts +0 -15
- package/lib/onchain/account/lendingPool/collateral.js +0 -66
- package/lib/onchain/account/lendingVault.d.ts +0 -10
- package/lib/onchain/account/lendingVault.js +0 -35
- package/lib/onchain/account/poolToken.d.ts +0 -24
- package/lib/onchain/account/poolToken.js +0 -84
- package/lib/onchain/contractsHelper.d.ts +0 -29
- package/lib/onchain/contractsHelper.js +0 -52
- package/lib/onchain/impermaxFactory/lendingPool/borrowable.d.ts +0 -36
- package/lib/onchain/impermaxFactory/lendingPool/borrowable.js +0 -153
- package/lib/onchain/impermaxFactory/lendingPool/collateral.d.ts +0 -17
- package/lib/onchain/impermaxFactory/lendingPool/collateral.js +0 -59
- package/lib/onchain/interactions/lendingPool/borrowable.d.ts +0 -14
- package/lib/onchain/interactions/lendingPool/borrowable.js +0 -47
- package/lib/onchain/interactions/lendingPool/collateral.d.ts +0 -13
- package/lib/onchain/interactions/lendingPool/collateral.js +0 -31
- package/lib/onchain/interactions/lendingVault.d.ts +0 -8
- package/lib/onchain/interactions/lendingVault.js +0 -15
- package/lib/onchain/interactions/poolToken.d.ts +0 -31
- package/lib/onchain/interactions/poolToken.js +0 -181
- package/lib/onchain/lendingVault.d.ts +0 -17
- package/lib/onchain/lendingVault.js +0 -56
- package/lib/onchain/poolToken.d.ts +0 -32
- package/lib/onchain/poolToken.js +0 -121
- package/lib/onchain/types.d.ts +0 -45
- package/lib/onchain/types.js +0 -14
- package/lib/utils/price-from-reserves.d.ts +0 -2
- package/lib/utils/price-from-reserves.js +0 -19
package/lib/config/amms.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare enum Amms {
|
|
|
34
34
|
pearlStable = "pearlStable",
|
|
35
35
|
aerodrome = "aerodrome",
|
|
36
36
|
aeroStable = "aeroStable",
|
|
37
|
+
aeroStable1 = "aeroStable1",
|
|
37
38
|
merchantmoe = "merchantmoe",
|
|
38
39
|
tokan = "tokan",
|
|
39
40
|
tokanStable = "tokanStable",
|
|
@@ -76,6 +77,7 @@ export declare const hrAmms: {
|
|
|
76
77
|
solunea: string;
|
|
77
78
|
aerodrome: string;
|
|
78
79
|
aeroStable: string;
|
|
80
|
+
aeroStable1: string;
|
|
79
81
|
scale: string;
|
|
80
82
|
merchantmoe: string;
|
|
81
83
|
tokan: string;
|
package/lib/config/amms.js
CHANGED
|
@@ -38,6 +38,7 @@ var Amms;
|
|
|
38
38
|
Amms["pearlStable"] = "pearlStable";
|
|
39
39
|
Amms["aerodrome"] = "aerodrome";
|
|
40
40
|
Amms["aeroStable"] = "aeroStable";
|
|
41
|
+
Amms["aeroStable1"] = "aeroStable1";
|
|
41
42
|
Amms["merchantmoe"] = "merchantmoe";
|
|
42
43
|
Amms["tokan"] = "tokan";
|
|
43
44
|
Amms["tokanStable"] = "tokanStable";
|
|
@@ -80,6 +81,7 @@ exports.hrAmms = {
|
|
|
80
81
|
[Amms.solunea]: 'Solunea',
|
|
81
82
|
[Amms.aerodrome]: 'Aerodrome',
|
|
82
83
|
[Amms.aeroStable]: 'Aerodrome Stable',
|
|
84
|
+
[Amms.aeroStable1]: 'Aerodrome Stable',
|
|
83
85
|
[Amms.scale]: 'Scale',
|
|
84
86
|
[Amms.merchantmoe]: 'MerchantMoe',
|
|
85
87
|
[Amms.tokan]: 'Tokan',
|
|
@@ -153,6 +155,7 @@ exports.AMM_FACTORY = {
|
|
|
153
155
|
[types_1.Networks.Base]: {
|
|
154
156
|
[Amms.aerodrome]: '0x420DD381b31aEf6683db6B902084cB0FFECe40Da',
|
|
155
157
|
[Amms.aeroStable]: '0x8f50a6d5ea6715f878E2984569975e8875eeBafB',
|
|
158
|
+
[Amms.aeroStable1]: '0x9111b8D7Cc1a676A70015BEA3A3a9968A44C52c3',
|
|
156
159
|
[Amms.scale]: '0xEd8db60aCc29e14bC867a497D94ca6e3CeB5eC04',
|
|
157
160
|
[Amms.uniswap]: '0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6'
|
|
158
161
|
},
|
package/lib/config/farms.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export declare enum Farms {
|
|
|
41
41
|
oxdao = "oxdao",
|
|
42
42
|
aerodrome = "aerodrome",
|
|
43
43
|
aeroStable = "aeroStable",
|
|
44
|
+
aeroStable1 = "aeroStable1",
|
|
44
45
|
merchantmoe = "merchantmoe",
|
|
45
46
|
tokan = "tokan",
|
|
46
47
|
tokanStable = "tokanStable",
|
|
@@ -88,6 +89,7 @@ export declare const hrFarms: {
|
|
|
88
89
|
oxdao: string;
|
|
89
90
|
aerodrome: string;
|
|
90
91
|
aeroStable: string;
|
|
92
|
+
aeroStable1: string;
|
|
91
93
|
tokan: string;
|
|
92
94
|
tokanStable: string;
|
|
93
95
|
velodrome: string;
|
package/lib/config/farms.js
CHANGED
|
@@ -45,6 +45,7 @@ var Farms;
|
|
|
45
45
|
Farms["oxdao"] = "oxdao";
|
|
46
46
|
Farms["aerodrome"] = "aerodrome";
|
|
47
47
|
Farms["aeroStable"] = "aeroStable";
|
|
48
|
+
Farms["aeroStable1"] = "aeroStable1";
|
|
48
49
|
Farms["merchantmoe"] = "merchantmoe";
|
|
49
50
|
Farms["tokan"] = "tokan";
|
|
50
51
|
Farms["tokanStable"] = "tokanStable";
|
|
@@ -92,6 +93,7 @@ exports.hrFarms = {
|
|
|
92
93
|
[Farms.oxdao]: '0xDAO',
|
|
93
94
|
[Farms.aerodrome]: 'Aerodrome',
|
|
94
95
|
[Farms.aeroStable]: 'Aerodrome Stable',
|
|
96
|
+
[Farms.aeroStable1]: 'Aerodrome Stable',
|
|
95
97
|
[Farms.tokan]: 'Tokan',
|
|
96
98
|
[Farms.tokanStable]: 'Tokan Stable',
|
|
97
99
|
[Farms.velodrome]: 'Velodrome',
|
|
@@ -163,6 +165,7 @@ exports.STAKED_LP_FACTORY = {
|
|
|
163
165
|
[types_1.Networks.Base]: {
|
|
164
166
|
[Farms.aerodrome]: '0x2a32215Ba106039f5A96b6366338BDb9FB0b62E8',
|
|
165
167
|
[Farms.aeroStable]: '0x8f50a6d5ea6715f878E2984569975e8875eeBafB',
|
|
168
|
+
[Farms.aeroStable1]: '0x9111b8D7Cc1a676A70015BEA3A3a9968A44C52c3',
|
|
166
169
|
},
|
|
167
170
|
[types_1.Networks.Mantle]: {
|
|
168
171
|
[Farms.merchantmoe]: '0x49bfE341232caE3CCB55ab99b11631CDE0AC9289',
|
|
@@ -48,6 +48,8 @@ const coingecko_ids = {
|
|
|
48
48
|
"0x4200000000000000000000000000000000000006": "ethereum",
|
|
49
49
|
"0x54016a4848a38f257b6e96331f7404073fd9c32c": "equalizer-base",
|
|
50
50
|
"0xa3d1a8deb97b111454b294e2324efad13a9d8396": "overnight-finance",
|
|
51
|
+
"0x4154550f4db74dc38d1fe98e1f3f28ed6dad627d": "jarvis-synthetic-euro",
|
|
52
|
+
"0xa61beb4a3d02decb01039e378237032b351125b4": "eura",
|
|
51
53
|
// optimism
|
|
52
54
|
"0x9560e827af36c94d2ac33a39bce1fe78631088db": "velodrome-finance",
|
|
53
55
|
"0x4200000000000000000000000000000000000042": "optimism",
|
|
@@ -62,8 +64,8 @@ const dexscreener_ids = {
|
|
|
62
64
|
"0x56659245931cb6920e39c189d2a0e7dd0da2d57b": "arbitrum",
|
|
63
65
|
// ibex on zksync
|
|
64
66
|
"0xbe9f8c0d6f0fd7e46cdacca340747ea2f247991d": "zksync",
|
|
65
|
-
//
|
|
66
|
-
"
|
|
67
|
+
// preon on scroll
|
|
68
|
+
"0x135f9b3d5dec9d73c042cf380adfff95f4fe9e35": "scroll",
|
|
67
69
|
// more on scroll
|
|
68
70
|
"0x25ea98ac87a38142561ea70143fd44c4772a16b6": "scroll",
|
|
69
71
|
// axlOP on base
|
package/lib/offchain/query.js
CHANGED
|
@@ -7,317 +7,317 @@ exports.whitelistQuery = exports.proposalQuery = exports.proposalsMetaQuery = ex
|
|
|
7
7
|
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
8
|
const factories_1 = require("../config/factories");
|
|
9
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
|
-
}
|
|
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
19
|
}`;
|
|
20
20
|
}
|
|
21
21
|
exports.blockQuery = blockQuery;
|
|
22
22
|
function lendingPoolsQuery(factory, addressesFilter) {
|
|
23
|
-
const tokenStr = `{
|
|
24
|
-
id
|
|
25
|
-
symbol
|
|
26
|
-
name
|
|
27
|
-
decimals
|
|
28
|
-
derivedUSD
|
|
23
|
+
const tokenStr = `{
|
|
24
|
+
id
|
|
25
|
+
symbol
|
|
26
|
+
name
|
|
27
|
+
decimals
|
|
28
|
+
derivedUSD
|
|
29
29
|
}`;
|
|
30
|
-
const distributorStr = `{
|
|
31
|
-
id
|
|
30
|
+
const distributorStr = `{
|
|
31
|
+
id
|
|
32
32
|
}`;
|
|
33
|
-
const farmingPoolStr = `{
|
|
34
|
-
epochAmount
|
|
35
|
-
epochBegin
|
|
36
|
-
segmentLength
|
|
37
|
-
vestingBegin
|
|
38
|
-
sharePercentage
|
|
39
|
-
distributor ${distributorStr}
|
|
33
|
+
const farmingPoolStr = `{
|
|
34
|
+
epochAmount
|
|
35
|
+
epochBegin
|
|
36
|
+
segmentLength
|
|
37
|
+
vestingBegin
|
|
38
|
+
sharePercentage
|
|
39
|
+
distributor ${distributorStr}
|
|
40
40
|
}`;
|
|
41
|
-
const borrowableStr = `{
|
|
42
|
-
id
|
|
43
|
-
underlying ${tokenStr}
|
|
44
|
-
totalBalance
|
|
45
|
-
totalBorrows
|
|
46
|
-
borrowRate
|
|
47
|
-
reserveFactor
|
|
48
|
-
kinkBorrowRate
|
|
49
|
-
kinkUtilizationRate
|
|
50
|
-
adjustSpeed
|
|
51
|
-
borrowIndex
|
|
52
|
-
accrualTimestamp
|
|
53
|
-
exchangeRate
|
|
54
|
-
totalBalanceUSD
|
|
55
|
-
totalSupplyUSD
|
|
56
|
-
totalBorrowsUSD
|
|
57
|
-
borrowTracker
|
|
58
|
-
farmingPool ${farmingPoolStr}
|
|
41
|
+
const borrowableStr = `{
|
|
42
|
+
id
|
|
43
|
+
underlying ${tokenStr}
|
|
44
|
+
totalBalance
|
|
45
|
+
totalBorrows
|
|
46
|
+
borrowRate
|
|
47
|
+
reserveFactor
|
|
48
|
+
kinkBorrowRate
|
|
49
|
+
kinkUtilizationRate
|
|
50
|
+
adjustSpeed
|
|
51
|
+
borrowIndex
|
|
52
|
+
accrualTimestamp
|
|
53
|
+
exchangeRate
|
|
54
|
+
totalBalanceUSD
|
|
55
|
+
totalSupplyUSD
|
|
56
|
+
totalBorrowsUSD
|
|
57
|
+
borrowTracker
|
|
58
|
+
farmingPool ${farmingPoolStr}
|
|
59
59
|
}`;
|
|
60
|
-
const collateralStr = `{
|
|
61
|
-
id
|
|
62
|
-
totalBalance
|
|
63
|
-
totalBalanceUSD
|
|
64
|
-
safetyMargin
|
|
65
|
-
liquidationIncentive
|
|
66
|
-
${factories_1.LIQUIDATION_FEE_FACTORIES.includes(factory) ? "liquidationFee" : ""}
|
|
67
|
-
exchangeRate
|
|
60
|
+
const collateralStr = `{
|
|
61
|
+
id
|
|
62
|
+
totalBalance
|
|
63
|
+
totalBalanceUSD
|
|
64
|
+
safetyMargin
|
|
65
|
+
liquidationIncentive
|
|
66
|
+
${factories_1.LIQUIDATION_FEE_FACTORIES.includes(factory) ? "liquidationFee" : ""}
|
|
67
|
+
exchangeRate
|
|
68
68
|
}`;
|
|
69
|
-
const pairStr = `{
|
|
70
|
-
factory
|
|
71
|
-
reserve0
|
|
72
|
-
reserve1
|
|
73
|
-
totalSupply
|
|
74
|
-
reserveUSD
|
|
75
|
-
token0Price
|
|
76
|
-
token1Price
|
|
77
|
-
derivedUSD
|
|
78
|
-
uniswapV2PairAddress
|
|
79
|
-
uniswapV2Factory
|
|
80
|
-
isStakedLPToken
|
|
81
|
-
exchangeRate
|
|
82
|
-
stakingRewards
|
|
83
|
-
masterChef
|
|
84
|
-
pid
|
|
85
|
-
stakedTotalSupply
|
|
86
|
-
rewards {
|
|
87
|
-
id
|
|
88
|
-
rewardRate
|
|
89
|
-
rewardsToken ${tokenStr}
|
|
90
|
-
periodFinish
|
|
91
|
-
}
|
|
69
|
+
const pairStr = `{
|
|
70
|
+
factory
|
|
71
|
+
reserve0
|
|
72
|
+
reserve1
|
|
73
|
+
totalSupply
|
|
74
|
+
reserveUSD
|
|
75
|
+
token0Price
|
|
76
|
+
token1Price
|
|
77
|
+
derivedUSD
|
|
78
|
+
uniswapV2PairAddress
|
|
79
|
+
uniswapV2Factory
|
|
80
|
+
isStakedLPToken
|
|
81
|
+
exchangeRate
|
|
82
|
+
stakingRewards
|
|
83
|
+
masterChef
|
|
84
|
+
pid
|
|
85
|
+
stakedTotalSupply
|
|
86
|
+
rewards {
|
|
87
|
+
id
|
|
88
|
+
rewardRate
|
|
89
|
+
rewardsToken ${tokenStr}
|
|
90
|
+
periodFinish
|
|
91
|
+
}
|
|
92
92
|
}`;
|
|
93
93
|
const id_in_string = addressesFilter.length > 0 ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
|
|
94
|
-
return (0, graphql_tag_1.default) `{
|
|
95
|
-
lendingPools(first: 1000, orderBy: totalBorrowsUSD, orderDirection: desc ${id_in_string}) {
|
|
96
|
-
id
|
|
97
|
-
borrowable0 ${borrowableStr}
|
|
98
|
-
borrowable1 ${borrowableStr}
|
|
99
|
-
collateral ${collateralStr}
|
|
100
|
-
pair ${pairStr}
|
|
101
|
-
}
|
|
102
|
-
_meta {
|
|
103
|
-
block {
|
|
104
|
-
number
|
|
105
|
-
}
|
|
106
|
-
hasIndexingErrors
|
|
107
|
-
}
|
|
94
|
+
return (0, graphql_tag_1.default) `{
|
|
95
|
+
lendingPools(first: 1000, orderBy: totalBorrowsUSD, orderDirection: desc ${id_in_string}) {
|
|
96
|
+
id
|
|
97
|
+
borrowable0 ${borrowableStr}
|
|
98
|
+
borrowable1 ${borrowableStr}
|
|
99
|
+
collateral ${collateralStr}
|
|
100
|
+
pair ${pairStr}
|
|
101
|
+
}
|
|
102
|
+
_meta {
|
|
103
|
+
block {
|
|
104
|
+
number
|
|
105
|
+
}
|
|
106
|
+
hasIndexingErrors
|
|
107
|
+
}
|
|
108
108
|
}`;
|
|
109
109
|
}
|
|
110
110
|
exports.lendingPoolsQuery = lendingPoolsQuery;
|
|
111
111
|
function lendingPoolsPastQuery(blockNumber, addressesFilter) {
|
|
112
|
-
const borrowablePastStr = `{
|
|
113
|
-
borrowIndex
|
|
114
|
-
accrualTimestamp
|
|
115
|
-
exchangeRate
|
|
112
|
+
const borrowablePastStr = `{
|
|
113
|
+
borrowIndex
|
|
114
|
+
accrualTimestamp
|
|
115
|
+
exchangeRate
|
|
116
116
|
}`;
|
|
117
117
|
const id_in_string = addressesFilter.length > 0 ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
|
|
118
|
-
return (0, graphql_tag_1.default) `{
|
|
119
|
-
lendingPools(first: 1000, orderBy: totalBorrowsUSD, orderDirection: desc, block: {number: ${blockNumber}} ${id_in_string}) {
|
|
120
|
-
id
|
|
121
|
-
borrowable0 ${borrowablePastStr}
|
|
122
|
-
borrowable1 ${borrowablePastStr}
|
|
123
|
-
}
|
|
118
|
+
return (0, graphql_tag_1.default) `{
|
|
119
|
+
lendingPools(first: 1000, orderBy: totalBorrowsUSD, orderDirection: desc, block: {number: ${blockNumber}} ${id_in_string}) {
|
|
120
|
+
id
|
|
121
|
+
borrowable0 ${borrowablePastStr}
|
|
122
|
+
borrowable1 ${borrowablePastStr}
|
|
123
|
+
}
|
|
124
124
|
}`;
|
|
125
125
|
}
|
|
126
126
|
exports.lendingPoolsPastQuery = lendingPoolsPastQuery;
|
|
127
127
|
function impermaxChefQuery() {
|
|
128
|
-
return (0, graphql_tag_1.default) `{
|
|
129
|
-
impermaxChefs(first: 1) {
|
|
130
|
-
id
|
|
131
|
-
rewardToken
|
|
132
|
-
rewardPerSec
|
|
133
|
-
totalAllocPoint
|
|
134
|
-
}
|
|
135
|
-
pools(first: 1000) {
|
|
136
|
-
id
|
|
137
|
-
allocPoint
|
|
138
|
-
rewarder {id}
|
|
139
|
-
}
|
|
140
|
-
impermaxRewarders(first: 1000) {
|
|
141
|
-
rewardToken
|
|
142
|
-
rewardPerSec
|
|
143
|
-
totalAllocPoint
|
|
144
|
-
pools(first: 1000) {
|
|
145
|
-
borrowable
|
|
146
|
-
allocPoint
|
|
147
|
-
}
|
|
148
|
-
}
|
|
128
|
+
return (0, graphql_tag_1.default) `{
|
|
129
|
+
impermaxChefs(first: 1) {
|
|
130
|
+
id
|
|
131
|
+
rewardToken
|
|
132
|
+
rewardPerSec
|
|
133
|
+
totalAllocPoint
|
|
134
|
+
}
|
|
135
|
+
pools(first: 1000) {
|
|
136
|
+
id
|
|
137
|
+
allocPoint
|
|
138
|
+
rewarder {id}
|
|
139
|
+
}
|
|
140
|
+
impermaxRewarders(first: 1000) {
|
|
141
|
+
rewardToken
|
|
142
|
+
rewardPerSec
|
|
143
|
+
totalAllocPoint
|
|
144
|
+
pools(first: 1000) {
|
|
145
|
+
borrowable
|
|
146
|
+
allocPoint
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
149
|
}`;
|
|
150
150
|
}
|
|
151
151
|
exports.impermaxChefQuery = impermaxChefQuery;
|
|
152
152
|
function pastVolumeQuery(blockNumber, addressesFilter) {
|
|
153
153
|
const id_in_string = addressesFilter.length > 0 ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
|
|
154
|
-
return (0, graphql_tag_1.default) `{
|
|
155
|
-
pairs (block: {number: ${blockNumber}} ${id_in_string}) {
|
|
156
|
-
id
|
|
157
|
-
volumeUSD
|
|
158
|
-
}
|
|
154
|
+
return (0, graphql_tag_1.default) `{
|
|
155
|
+
pairs (block: {number: ${blockNumber}} ${id_in_string}) {
|
|
156
|
+
id
|
|
157
|
+
volumeUSD
|
|
158
|
+
}
|
|
159
159
|
}`;
|
|
160
160
|
}
|
|
161
161
|
exports.pastVolumeQuery = pastVolumeQuery;
|
|
162
162
|
function currentVolumeAndReservesQuery(addressesFilter) {
|
|
163
163
|
const id_in_string = addressesFilter.length > 0 ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
|
|
164
|
-
return (0, graphql_tag_1.default) `{
|
|
165
|
-
pairs (${id_in_string}) {
|
|
166
|
-
id
|
|
167
|
-
reserveUSD
|
|
168
|
-
volumeUSD
|
|
169
|
-
}
|
|
164
|
+
return (0, graphql_tag_1.default) `{
|
|
165
|
+
pairs (${id_in_string}) {
|
|
166
|
+
id
|
|
167
|
+
reserveUSD
|
|
168
|
+
volumeUSD
|
|
169
|
+
}
|
|
170
170
|
}`;
|
|
171
171
|
}
|
|
172
172
|
exports.currentVolumeAndReservesQuery = currentVolumeAndReservesQuery;
|
|
173
173
|
function tvlQuery() {
|
|
174
|
-
return (0, graphql_tag_1.default) `{
|
|
175
|
-
impermaxFactories(first: 1) {
|
|
176
|
-
totalBalanceUSD
|
|
177
|
-
totalSupplyUSD
|
|
178
|
-
totalBorrowsUSD
|
|
179
|
-
}
|
|
174
|
+
return (0, graphql_tag_1.default) `{
|
|
175
|
+
impermaxFactories(first: 1) {
|
|
176
|
+
totalBalanceUSD
|
|
177
|
+
totalSupplyUSD
|
|
178
|
+
totalBorrowsUSD
|
|
179
|
+
}
|
|
180
180
|
}`;
|
|
181
181
|
}
|
|
182
182
|
exports.tvlQuery = tvlQuery;
|
|
183
183
|
function userQuery(account) {
|
|
184
|
-
return (0, graphql_tag_1.default) `{
|
|
185
|
-
user(id: "${account.toLowerCase()}") {
|
|
186
|
-
collateralPositions(first:1000) {
|
|
187
|
-
balance
|
|
188
|
-
collateral {
|
|
189
|
-
lendingPool {
|
|
190
|
-
id
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
supplyPositions(first:1000) {
|
|
195
|
-
balance
|
|
196
|
-
borrowable {
|
|
197
|
-
underlying {
|
|
198
|
-
id
|
|
199
|
-
}
|
|
200
|
-
lendingPool {
|
|
201
|
-
id
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
borrowPositions(first:1000) {
|
|
206
|
-
borrowBalance
|
|
207
|
-
borrowIndex
|
|
208
|
-
borrowable {
|
|
209
|
-
underlying {
|
|
210
|
-
id
|
|
211
|
-
}
|
|
212
|
-
lendingPool {
|
|
213
|
-
id
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
184
|
+
return (0, graphql_tag_1.default) `{
|
|
185
|
+
user(id: "${account.toLowerCase()}") {
|
|
186
|
+
collateralPositions(first:1000) {
|
|
187
|
+
balance
|
|
188
|
+
collateral {
|
|
189
|
+
lendingPool {
|
|
190
|
+
id
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
supplyPositions(first:1000) {
|
|
195
|
+
balance
|
|
196
|
+
borrowable {
|
|
197
|
+
underlying {
|
|
198
|
+
id
|
|
199
|
+
}
|
|
200
|
+
lendingPool {
|
|
201
|
+
id
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
borrowPositions(first:1000) {
|
|
206
|
+
borrowBalance
|
|
207
|
+
borrowIndex
|
|
208
|
+
borrowable {
|
|
209
|
+
underlying {
|
|
210
|
+
id
|
|
211
|
+
}
|
|
212
|
+
lendingPool {
|
|
213
|
+
id
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
218
|
}`;
|
|
219
219
|
}
|
|
220
220
|
exports.userQuery = userQuery;
|
|
221
221
|
function ximxQuery() {
|
|
222
|
-
return (0, graphql_tag_1.default) `{
|
|
223
|
-
ximxes(first: 1) {
|
|
224
|
-
totalSupply
|
|
225
|
-
totalBalance
|
|
226
|
-
exchangeRate
|
|
227
|
-
dailyAPR
|
|
228
|
-
}
|
|
222
|
+
return (0, graphql_tag_1.default) `{
|
|
223
|
+
ximxes(first: 1) {
|
|
224
|
+
totalSupply
|
|
225
|
+
totalBalance
|
|
226
|
+
exchangeRate
|
|
227
|
+
dailyAPR
|
|
228
|
+
}
|
|
229
229
|
}`;
|
|
230
230
|
}
|
|
231
231
|
exports.ximxQuery = ximxQuery;
|
|
232
232
|
function lendingVaultsQuery(addressesFilter) {
|
|
233
233
|
const id_in_string = addressesFilter.length > 0 ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
|
|
234
|
-
return (0, graphql_tag_1.default) `{
|
|
235
|
-
lendingVaults(first: 1000 ${id_in_string}) {
|
|
236
|
-
id
|
|
237
|
-
underlying {
|
|
238
|
-
id
|
|
239
|
-
symbol
|
|
240
|
-
name
|
|
241
|
-
decimals
|
|
242
|
-
}
|
|
243
|
-
totalBalance
|
|
244
|
-
totalSupply
|
|
245
|
-
supplyRate
|
|
246
|
-
reserveFactor
|
|
247
|
-
exchangeRate
|
|
248
|
-
availableLiquidity
|
|
249
|
-
lastUpdate
|
|
250
|
-
}
|
|
251
|
-
_meta {
|
|
252
|
-
block {
|
|
253
|
-
number
|
|
254
|
-
}
|
|
255
|
-
hasIndexingErrors
|
|
256
|
-
}
|
|
234
|
+
return (0, graphql_tag_1.default) `{
|
|
235
|
+
lendingVaults(first: 1000 ${id_in_string}) {
|
|
236
|
+
id
|
|
237
|
+
underlying {
|
|
238
|
+
id
|
|
239
|
+
symbol
|
|
240
|
+
name
|
|
241
|
+
decimals
|
|
242
|
+
}
|
|
243
|
+
totalBalance
|
|
244
|
+
totalSupply
|
|
245
|
+
supplyRate
|
|
246
|
+
reserveFactor
|
|
247
|
+
exchangeRate
|
|
248
|
+
availableLiquidity
|
|
249
|
+
lastUpdate
|
|
250
|
+
}
|
|
251
|
+
_meta {
|
|
252
|
+
block {
|
|
253
|
+
number
|
|
254
|
+
}
|
|
255
|
+
hasIndexingErrors
|
|
256
|
+
}
|
|
257
257
|
}`;
|
|
258
258
|
}
|
|
259
259
|
exports.lendingVaultsQuery = lendingVaultsQuery;
|
|
260
260
|
function lendingVaultsUserQuery(account) {
|
|
261
|
-
return (0, graphql_tag_1.default) `{
|
|
262
|
-
user(id: "${account.toLowerCase()}") {
|
|
263
|
-
positions(first:1000) {
|
|
264
|
-
tokenBalance
|
|
265
|
-
lastExchangeRate
|
|
266
|
-
cumulativeEarnings
|
|
267
|
-
lendingVault {
|
|
268
|
-
id
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
261
|
+
return (0, graphql_tag_1.default) `{
|
|
262
|
+
user(id: "${account.toLowerCase()}") {
|
|
263
|
+
positions(first:1000) {
|
|
264
|
+
tokenBalance
|
|
265
|
+
lastExchangeRate
|
|
266
|
+
cumulativeEarnings
|
|
267
|
+
lendingVault {
|
|
268
|
+
id
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
272
|
}`;
|
|
273
273
|
}
|
|
274
274
|
exports.lendingVaultsUserQuery = lendingVaultsUserQuery;
|
|
275
275
|
function proposalsMetaQuery(rangeBegin, rangeLength, descending) {
|
|
276
|
-
return (0, graphql_tag_1.default) `{
|
|
277
|
-
proposals(
|
|
278
|
-
orderBy: idInt,
|
|
279
|
-
orderDirection: ${descending ? "desc" : "asc"},
|
|
280
|
-
first: ${rangeLength},
|
|
281
|
-
skip: ${rangeBegin}
|
|
282
|
-
) {
|
|
283
|
-
id
|
|
284
|
-
state
|
|
285
|
-
}
|
|
276
|
+
return (0, graphql_tag_1.default) `{
|
|
277
|
+
proposals(
|
|
278
|
+
orderBy: idInt,
|
|
279
|
+
orderDirection: ${descending ? "desc" : "asc"},
|
|
280
|
+
first: ${rangeLength},
|
|
281
|
+
skip: ${rangeBegin}
|
|
282
|
+
) {
|
|
283
|
+
id
|
|
284
|
+
state
|
|
285
|
+
}
|
|
286
286
|
}`;
|
|
287
287
|
}
|
|
288
288
|
exports.proposalsMetaQuery = proposalsMetaQuery;
|
|
289
289
|
function proposalQuery(id) {
|
|
290
|
-
return (0, graphql_tag_1.default) `{
|
|
291
|
-
proposal(id:${id}) {
|
|
292
|
-
id
|
|
293
|
-
state
|
|
294
|
-
pairConfig {
|
|
295
|
-
factory
|
|
296
|
-
pair
|
|
297
|
-
safetyMarginSqrt
|
|
298
|
-
liquidationIncentive
|
|
299
|
-
liquidationFee
|
|
300
|
-
reserveFactor0
|
|
301
|
-
reserveFactor1
|
|
302
|
-
kinkUtilizationRate0
|
|
303
|
-
kinkUtilizationRate1
|
|
304
|
-
adjustSpeed0
|
|
305
|
-
adjustSpeed1
|
|
306
|
-
borrowTracker0
|
|
307
|
-
borrowTracker1
|
|
308
|
-
whiteListState
|
|
309
|
-
}
|
|
310
|
-
}
|
|
290
|
+
return (0, graphql_tag_1.default) `{
|
|
291
|
+
proposal(id:${id}) {
|
|
292
|
+
id
|
|
293
|
+
state
|
|
294
|
+
pairConfig {
|
|
295
|
+
factory
|
|
296
|
+
pair
|
|
297
|
+
safetyMarginSqrt
|
|
298
|
+
liquidationIncentive
|
|
299
|
+
liquidationFee
|
|
300
|
+
reserveFactor0
|
|
301
|
+
reserveFactor1
|
|
302
|
+
kinkUtilizationRate0
|
|
303
|
+
kinkUtilizationRate1
|
|
304
|
+
adjustSpeed0
|
|
305
|
+
adjustSpeed1
|
|
306
|
+
borrowTracker0
|
|
307
|
+
borrowTracker1
|
|
308
|
+
whiteListState
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
311
|
}`;
|
|
312
312
|
}
|
|
313
313
|
exports.proposalQuery = proposalQuery;
|
|
314
314
|
function whitelistQuery() {
|
|
315
|
-
return (0, graphql_tag_1.default) `{
|
|
316
|
-
whitelistStates(first:1000) {
|
|
317
|
-
factory
|
|
318
|
-
pair
|
|
319
|
-
state
|
|
320
|
-
}
|
|
315
|
+
return (0, graphql_tag_1.default) `{
|
|
316
|
+
whitelistStates(first:1000) {
|
|
317
|
+
factory
|
|
318
|
+
pair
|
|
319
|
+
state
|
|
320
|
+
}
|
|
321
321
|
}`;
|
|
322
322
|
}
|
|
323
323
|
exports.whitelistQuery = whitelistQuery;
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PoolTokenType } from '../../../config/types';
|
|
2
|
-
import LendingPool from './index';
|
|
3
|
-
import PoolToken from '../poolToken';
|
|
4
|
-
import * as offchain from '../../index';
|
|
5
|
-
export default class Borrowable extends PoolToken {
|
|
6
|
-
accountLendingPool: LendingPool;
|
|
7
|
-
poolToken: offchain.lendingPool.Borrowable;
|
|
8
|
-
constructor(accountLendingPool: LendingPool, poolTokenType: PoolTokenType);
|
|
9
|
-
private getSupplyPosition;
|
|
10
|
-
getAmount(): Promise<number>;
|
|
11
|
-
private getBorrowPosition;
|
|
12
|
-
getBorrowedAmount(): Promise<number>;
|
|
13
|
-
getBorrowedValue(): Promise<number>;
|
|
14
|
-
}
|