impermax-sdk 1.2.66 → 1.2.68
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.js +1 -1
- package/lib/offchain/offchainPriceHelper.js +8 -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.js
CHANGED
|
@@ -161,7 +161,7 @@ exports.AMM_FACTORY = {
|
|
|
161
161
|
[Amms.tokanStable]: '0x6c041ff2d25310a2751C57555265F2364CaCA195', //NOTICE: this is actually the staked LP factory
|
|
162
162
|
},
|
|
163
163
|
[types_1.Networks.Optimism]: {
|
|
164
|
-
[Amms.velodrome]: '
|
|
164
|
+
[Amms.velodrome]: '0xF1046053aa5682b4F9a81b5481394DA16BE5FF5a',
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
167
|
function getAmmByFactory(network, address) {
|
|
@@ -48,6 +48,10 @@ const coingecko_ids = {
|
|
|
48
48
|
"0x4200000000000000000000000000000000000006": "ethereum",
|
|
49
49
|
"0x54016a4848a38f257b6e96331f7404073fd9c32c": "equalizer-base",
|
|
50
50
|
"0xa3d1a8deb97b111454b294e2324efad13a9d8396": "overnight-finance",
|
|
51
|
+
// optimism
|
|
52
|
+
"0x9560e827af36c94d2ac33a39bce1fe78631088db": "velodrome-finance",
|
|
53
|
+
"0x4200000000000000000000000000000000000042": "optimism",
|
|
54
|
+
"0x1f32b1c2345538c0c6f582fcb022739c4a194ebb": "wrapped-steth",
|
|
51
55
|
};
|
|
52
56
|
const dexscreener_ids = {
|
|
53
57
|
// ibex on scroll
|
|
@@ -58,12 +62,14 @@ const dexscreener_ids = {
|
|
|
58
62
|
"0x56659245931cb6920e39c189d2a0e7dd0da2d57b": "arbitrum",
|
|
59
63
|
// ibex on zksync
|
|
60
64
|
"0xbe9f8c0d6f0fd7e46cdacca340747ea2f247991d": "zksync",
|
|
61
|
-
//
|
|
62
|
-
"
|
|
65
|
+
// preon on scroll
|
|
66
|
+
"0x135f9b3d5dec9d73c042cf380adfff95f4fe9e35": "scroll",
|
|
63
67
|
// more on scroll
|
|
64
68
|
"0x25ea98ac87a38142561ea70143fd44c4772a16b6": "scroll",
|
|
65
69
|
// axlOP on base
|
|
66
70
|
"0x994ac01750047B9d35431a7Ae4Ed312ee955E030": "base",
|
|
71
|
+
// opxvelo on op
|
|
72
|
+
"0xc38464250f51123078bbd7ea574e185f6623d037": "optimism"
|
|
67
73
|
};
|
|
68
74
|
const fantom_ids = {
|
|
69
75
|
// uponly on ftm
|
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
|
-
}
|