impermax-sdk 2.1.5 → 2.1.7
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/subgraphs.d.ts +2 -2
- package/lib/config/subgraphs.js +205 -131
- package/lib/config/types.d.ts +10 -0
- package/lib/config/types.js +7 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -1
- package/lib/offchain/account/offchainAccount.d.ts +6 -6
- package/lib/offchain/account/offchainAccount.js +33 -24
- package/lib/offchain/account/vault/offchainAccountVault.js +10 -3
- package/lib/offchain/offchain.d.ts +13 -10
- package/lib/offchain/offchain.js +18 -11
- package/lib/offchain/offchainInitializer.d.ts +11 -11
- package/lib/offchain/offchainInitializer.js +151 -91
- package/lib/offchain/offchainMultichain.d.ts +4 -4
- package/lib/offchain/offchainMultichain.js +28 -56
- package/lib/offchain/offchainTypes.d.ts +17 -1
- package/lib/offchain/queries/apis/ponder/index.d.ts +3 -3
- package/lib/offchain/queries/apis/ponder/index.js +45 -24
- package/lib/offchain/queries/apis/thegraph/index.d.ts +3 -3
- package/lib/offchain/queries/apis/thegraph/index.js +4 -2
- package/lib/offchain/queries/interfaces/query-builder.d.ts +3 -3
- package/lib/offchain/vault/offchainHedgedVault.js +2 -25
- package/lib/offchain/vault/offchainLendingVault.d.ts +3 -3
- package/lib/offchain/vault/offchainLendingVault.js +11 -27
- package/lib/offchain/vault/offchainLeveragedVault.js +2 -25
- package/lib/offchain/vault/offchainVault.d.ts +3 -8
- package/lib/offchain/vault/offchainVault.js +3 -8
- package/lib/onchain/account/onchainAccountLendingVault.js +1 -1
- package/lib/onchain/onchainLendingVault.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Address, NetworkFactoryIndex, NetworkIndex } from
|
|
1
|
+
import { Address, NetworkFactoryIndex, NetworkIndex, NetworkVaultTypeIndex } from "./types";
|
|
2
2
|
export declare const IMPERMAX_SUBGRAPH_URL: NetworkFactoryIndex<Address[]>;
|
|
3
|
+
export declare const VAULT_SUBGRAPH_URL: NetworkVaultTypeIndex<Address[]>;
|
|
3
4
|
export declare const IMPERMAX_CHEF_SUBGRAPH_URL: NetworkIndex<string>;
|
|
4
|
-
export declare const LENDING_VAULT_SUBGRAPH_URL: NetworkIndex<string>;
|
|
5
5
|
export declare const BLOCKS_SUBGRAPH_URL: NetworkIndex<string>;
|
|
6
6
|
export declare const XIMX_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/impermax-finance/imx-staking";
|
|
7
7
|
export declare const CONFIG_MANAGER_SUBGRAPH_URL: {
|
package/lib/config/subgraphs.js
CHANGED
|
@@ -1,187 +1,261 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WHITELIST_SUBGRAPH_URL = exports.CONFIG_MANAGER_SUBGRAPH_URL = exports.XIMX_SUBGRAPH_URL = exports.BLOCKS_SUBGRAPH_URL = exports.
|
|
3
|
+
exports.WHITELIST_SUBGRAPH_URL = exports.CONFIG_MANAGER_SUBGRAPH_URL = exports.XIMX_SUBGRAPH_URL = exports.BLOCKS_SUBGRAPH_URL = exports.IMPERMAX_CHEF_SUBGRAPH_URL = exports.VAULT_SUBGRAPH_URL = exports.IMPERMAX_SUBGRAPH_URL = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
|
5
5
|
exports.IMPERMAX_SUBGRAPH_URL = {
|
|
6
6
|
[types_1.Networks.Ropsten]: {},
|
|
7
7
|
[types_1.Networks.Mainnet]: {
|
|
8
|
-
[types_1.Factory.V2V1]: [
|
|
8
|
+
[types_1.Factory.V2V1]: [
|
|
9
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/Dn5WZv53V1K8LrKqqYn29hhuhpwfuFfmsrsTqMgFjrD3",
|
|
10
|
+
],
|
|
9
11
|
},
|
|
10
12
|
[types_1.Networks.Polygon]: {
|
|
11
|
-
[types_1.Factory.V2V1_1]: [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[types_1.Factory.
|
|
13
|
+
[types_1.Factory.V2V1_1]: [
|
|
14
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/F3BfecWo2by5QKrwhkXwuXjyLZnQqJ1wqoejwe67KuyG",
|
|
15
|
+
],
|
|
16
|
+
[types_1.Factory.V2V2]: [
|
|
17
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/5JbuAaWwyRm78yWpRCJJS217hXXft59g9MbsjTTZnYQa",
|
|
18
|
+
],
|
|
19
|
+
[types_1.Factory.SOLV2]: [
|
|
20
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/Giwg5N4SCehmUzNwXtAQZnZvUuTjcp7cr3nzUZosRDFU",
|
|
21
|
+
],
|
|
22
|
+
[types_1.Factory.SOL_STABLE]: [
|
|
23
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/EWckMdMiZeDSGHxq2V8gZBDF549Xjr9iKkPvisqckF11",
|
|
24
|
+
],
|
|
15
25
|
},
|
|
16
26
|
[types_1.Networks.Arbitrum]: {
|
|
17
|
-
[types_1.Factory.V2V1_1]: [
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
[types_1.Factory.V2V1_1]: [
|
|
28
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/3PMyaq269mDMwhJ7E285RYD1r43x996b6xZmJSCGvtkm",
|
|
29
|
+
],
|
|
30
|
+
[types_1.Factory.V2V2]: [
|
|
31
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/BkMRb8mR5zgCbjFSgau6s27pnANhR6k64RGVKUbWaZdY",
|
|
32
|
+
],
|
|
33
|
+
[types_1.Factory.SOLV2]: [
|
|
34
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/AdLbcSfG6JnpZ7RDdHNHq3bJ21waGnRi7AJ5x3YFGYFo",
|
|
35
|
+
],
|
|
20
36
|
},
|
|
21
37
|
[types_1.Networks.Avalanche]: {
|
|
22
|
-
[types_1.Factory.V2V1_2]: [
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
[types_1.Factory.V2V1_2]: [
|
|
39
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/HXhHppWXhFqgLfdmTahFj2x7F5Xq8BwADxGY3nbCUAwr",
|
|
40
|
+
],
|
|
41
|
+
[types_1.Factory.V2V2]: [
|
|
42
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/8Gz5ZGyRkSA7WBrSteeyez39AgZQsoEbtXe8GtHD7JMQ",
|
|
43
|
+
],
|
|
44
|
+
[types_1.Factory.SOLV2]: [
|
|
45
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/78e6cZp11r2coLx8YYo5y4AqzEhQXYT6sw3Bg5Tiy5XU",
|
|
46
|
+
],
|
|
25
47
|
},
|
|
26
48
|
[types_1.Networks.Mantle]: {
|
|
27
|
-
[types_1.Factory.V2V2]: [
|
|
49
|
+
[types_1.Factory.V2V2]: [
|
|
50
|
+
"https://subgraph-api.mantle.xyz/subgraphs/name/impermax-finance/impermax-mantle-v2",
|
|
51
|
+
],
|
|
28
52
|
},
|
|
29
53
|
[types_1.Networks.Moonriver]: {
|
|
30
|
-
[types_1.Factory.V2V1_2]: [
|
|
54
|
+
[types_1.Factory.V2V1_2]: [
|
|
55
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/6NqkDBwiybbB3BjErF6QGGYJCqzyhVFKpNYHQTN2j8Jn",
|
|
56
|
+
],
|
|
31
57
|
},
|
|
32
58
|
[types_1.Networks.Aurora]: {},
|
|
33
59
|
[types_1.Networks.Cronos]: {},
|
|
34
60
|
[types_1.Networks.Fantom]: {
|
|
35
|
-
[types_1.Factory.SOLV1_2]: [
|
|
36
|
-
|
|
37
|
-
|
|
61
|
+
[types_1.Factory.SOLV1_2]: [
|
|
62
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/8vssJypWas5oenzsjjQq1yLqMe7FRt2evcqZdzCNEWt7",
|
|
63
|
+
],
|
|
64
|
+
[types_1.Factory.SOLV2]: [
|
|
65
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/DJ2bTPinDji7Kwev3WjyfxRo487tJHiEEMEo8kmTMT8F",
|
|
66
|
+
],
|
|
67
|
+
[types_1.Factory.V2V2]: [
|
|
68
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/DPk9E2c9fLKF8N6rN3jcyvSrEq4VEgjdeeJcnaEKAngG",
|
|
69
|
+
],
|
|
38
70
|
},
|
|
39
71
|
[types_1.Networks.Canto]: {
|
|
40
|
-
[types_1.Factory.SOLV2]: [
|
|
72
|
+
[types_1.Factory.SOLV2]: [
|
|
73
|
+
"https://api.impermax.finance/subgraphs/name/impermax-finance/impermax-canto-solv2",
|
|
74
|
+
],
|
|
41
75
|
},
|
|
42
76
|
[types_1.Networks.ZksyncEra]: {
|
|
43
|
-
[types_1.Factory.SOLV2]: [
|
|
77
|
+
[types_1.Factory.SOLV2]: [
|
|
78
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/8YSS88X8ChDw1QvuAMtxjezSXNiYer9k9d3Uu8XFLHzX",
|
|
79
|
+
],
|
|
44
80
|
},
|
|
45
81
|
[types_1.Networks.Harmony]: {},
|
|
46
82
|
[types_1.Networks.Moonbeam]: {},
|
|
47
83
|
[types_1.Networks.Sxnetwork]: {},
|
|
48
84
|
[types_1.Networks.Blast]: {
|
|
49
|
-
[types_1.Factory.SOLV2]: [
|
|
50
|
-
|
|
85
|
+
[types_1.Factory.SOLV2]: [
|
|
86
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/4FDikpVjE2XnDJ5QcpQ1YJXWcUDiAgE7x8ErtsHh33UB",
|
|
87
|
+
],
|
|
88
|
+
[types_1.Factory.V2V2]: [
|
|
89
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/6xkrXFPJ4wqh9cy9ayP19WGr2wZVSMP3FniMjcW2LUG4",
|
|
90
|
+
],
|
|
51
91
|
},
|
|
52
92
|
[types_1.Networks.Base]: {
|
|
53
93
|
[types_1.Factory.SOLV2]: [
|
|
54
|
-
|
|
55
|
-
|
|
94
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/EjB7Dsb7WnfFf1NPPr5rbGnGmk2Jqs42nWPVHjv9997u",
|
|
95
|
+
"https://base-start-production.up.railway.app/",
|
|
56
96
|
],
|
|
57
97
|
[types_1.Factory.SOL_STABLE]: [
|
|
58
|
-
|
|
59
|
-
|
|
98
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/9wN7xinUXf8RP8dbwpkzSmCNQKfz31FDpvPEvTQyT8SL",
|
|
99
|
+
"https://base-start-production.up.railway.app/",
|
|
60
100
|
],
|
|
61
101
|
[types_1.Factory.V2V2]: [
|
|
62
|
-
|
|
63
|
-
|
|
102
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/B7xsBeef3FohKaFPcsAsviyLKaWXTqcSELjAsPj2B7iW",
|
|
103
|
+
"https://base-start-production.up.railway.app/",
|
|
64
104
|
],
|
|
65
105
|
},
|
|
66
106
|
[types_1.Networks.Scroll]: {
|
|
67
|
-
[types_1.Factory.SOLV2]: [
|
|
68
|
-
|
|
107
|
+
[types_1.Factory.SOLV2]: [
|
|
108
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/9HL6kLRt3AbQsprTvk7KZdaHunJ5GGsLdYWd27nNfCFC",
|
|
109
|
+
],
|
|
110
|
+
[types_1.Factory.SOL_STABLE]: [
|
|
111
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/C42ymmkDArE1T5wdYKwao6mntqNSjP2E34TeGusiF3sk",
|
|
112
|
+
],
|
|
69
113
|
},
|
|
70
114
|
[types_1.Networks.Optimism]: {
|
|
71
115
|
[types_1.Factory.SOLV2]: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
]
|
|
116
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/74C2pMzH3wNKf38PNheGZfSiY4FzmJoKiGtHLYa7oD2s",
|
|
117
|
+
"https://optimism-factory-production.up.railway.app/",
|
|
118
|
+
],
|
|
75
119
|
},
|
|
76
120
|
[types_1.Networks.Real]: {
|
|
77
|
-
[types_1.Factory.SOL_STABLE]: [
|
|
78
|
-
|
|
121
|
+
[types_1.Factory.SOL_STABLE]: [
|
|
122
|
+
"https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/impermax-finance/impermax-real-v2-stable/gn",
|
|
123
|
+
],
|
|
124
|
+
[types_1.Factory.SOLV2]: [
|
|
125
|
+
"https://api.goldsky.com/api/public/project_cm2rhb30ot9wu01to8c9h9e37/subgraphs/impermax-real-solv2/3.0/gn",
|
|
126
|
+
],
|
|
79
127
|
},
|
|
80
128
|
};
|
|
129
|
+
// TODO: Since these are part of core we should add redundancy like above, left arrays to fill
|
|
130
|
+
exports.VAULT_SUBGRAPH_URL = {
|
|
131
|
+
[types_1.Networks.Ropsten]: {},
|
|
132
|
+
[types_1.Networks.Mainnet]: {},
|
|
133
|
+
[types_1.Networks.Polygon]: {
|
|
134
|
+
[types_1.VaultType.LENDING]: [
|
|
135
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/BNWJQpKBT24mYzLYZ7hdBiJpvfBoEwjSemNkQ1Rryknp",
|
|
136
|
+
],
|
|
137
|
+
[types_1.VaultType.HEDGED]: [],
|
|
138
|
+
[types_1.VaultType.LEVERAGED]: [],
|
|
139
|
+
},
|
|
140
|
+
[types_1.Networks.Arbitrum]: {
|
|
141
|
+
[types_1.VaultType.LENDING]: [
|
|
142
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/BhmcL1CZmw9hftXPviiTeMY7kghbbkpHZtpiHXWVhNNN",
|
|
143
|
+
],
|
|
144
|
+
[types_1.VaultType.HEDGED]: [],
|
|
145
|
+
[types_1.VaultType.LEVERAGED]: [],
|
|
146
|
+
},
|
|
147
|
+
[types_1.Networks.Avalanche]: {},
|
|
148
|
+
[types_1.Networks.Moonriver]: {},
|
|
149
|
+
[types_1.Networks.Aurora]: {},
|
|
150
|
+
[types_1.Networks.Cronos]: {},
|
|
151
|
+
[types_1.Networks.Fantom]: {},
|
|
152
|
+
[types_1.Networks.Harmony]: {},
|
|
153
|
+
[types_1.Networks.Moonbeam]: {},
|
|
154
|
+
[types_1.Networks.Sxnetwork]: {},
|
|
155
|
+
[types_1.Networks.Canto]: {},
|
|
156
|
+
[types_1.Networks.ZksyncEra]: {},
|
|
157
|
+
[types_1.Networks.Base]: {
|
|
158
|
+
[types_1.VaultType.LENDING]: [
|
|
159
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/2TdbQKGWPRHUwuHJgxQzh8kZ7FVpBgZaFtnbjTS6iYng",
|
|
160
|
+
"https://base-lendingvaults-production.up.railway.app/",
|
|
161
|
+
],
|
|
162
|
+
[types_1.VaultType.HEDGED]: [],
|
|
163
|
+
[types_1.VaultType.LEVERAGED]: [],
|
|
164
|
+
},
|
|
165
|
+
[types_1.Networks.Mantle]: {},
|
|
166
|
+
[types_1.Networks.Scroll]: {
|
|
167
|
+
[types_1.VaultType.LENDING]: [
|
|
168
|
+
"https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/BaPMX2ubiRZ4ujqTFmWyrk72fPo6yFLQ7A5Z4BLXCTFU",
|
|
169
|
+
],
|
|
170
|
+
[types_1.VaultType.HEDGED]: [],
|
|
171
|
+
[types_1.VaultType.LEVERAGED]: [],
|
|
172
|
+
},
|
|
173
|
+
[types_1.Networks.Optimism]: {},
|
|
174
|
+
[types_1.Networks.Real]: {},
|
|
175
|
+
[types_1.Networks.Blast]: {},
|
|
176
|
+
};
|
|
81
177
|
exports.IMPERMAX_CHEF_SUBGRAPH_URL = {
|
|
82
|
-
[types_1.Networks.Ropsten]:
|
|
83
|
-
[types_1.Networks.Mainnet]:
|
|
84
|
-
[types_1.Networks.Polygon]:
|
|
178
|
+
[types_1.Networks.Ropsten]: "",
|
|
179
|
+
[types_1.Networks.Mainnet]: "",
|
|
180
|
+
[types_1.Networks.Polygon]: "https://api.studio.thegraph.com/query/46041/impermax-chef-polygon/v0.0.1",
|
|
85
181
|
//[Networks.Arbitrum]: 'https://api.thegraph.com/subgraphs/name/impermax-finance/impermax-chef-arbitrum',
|
|
86
|
-
[types_1.Networks.Arbitrum]:
|
|
87
|
-
[types_1.Networks.Avalanche]:
|
|
88
|
-
[types_1.Networks.Moonriver]:
|
|
89
|
-
[types_1.Networks.Fantom]:
|
|
90
|
-
[types_1.Networks.Aurora]:
|
|
91
|
-
[types_1.Networks.Cronos]:
|
|
92
|
-
[types_1.Networks.Harmony]:
|
|
93
|
-
[types_1.Networks.Moonbeam]:
|
|
94
|
-
[types_1.Networks.Sxnetwork]:
|
|
95
|
-
[types_1.Networks.Canto]:
|
|
96
|
-
[types_1.Networks.ZksyncEra]:
|
|
97
|
-
[types_1.Networks.Blast]:
|
|
98
|
-
[types_1.Networks.Base]:
|
|
99
|
-
[types_1.Networks.Mantle]:
|
|
100
|
-
[types_1.Networks.Scroll]:
|
|
101
|
-
[types_1.Networks.Optimism]:
|
|
102
|
-
[types_1.Networks.Real]:
|
|
103
|
-
};
|
|
104
|
-
exports.LENDING_VAULT_SUBGRAPH_URL = {
|
|
105
|
-
[types_1.Networks.Ropsten]: '',
|
|
106
|
-
[types_1.Networks.Mainnet]: '',
|
|
107
|
-
[types_1.Networks.Polygon]: 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/BNWJQpKBT24mYzLYZ7hdBiJpvfBoEwjSemNkQ1Rryknp',
|
|
108
|
-
[types_1.Networks.Arbitrum]: 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/BhmcL1CZmw9hftXPviiTeMY7kghbbkpHZtpiHXWVhNNN',
|
|
109
|
-
[types_1.Networks.Avalanche]: '',
|
|
110
|
-
[types_1.Networks.Moonriver]: '',
|
|
111
|
-
[types_1.Networks.Fantom]: '',
|
|
112
|
-
[types_1.Networks.Aurora]: '',
|
|
113
|
-
[types_1.Networks.Cronos]: '',
|
|
114
|
-
[types_1.Networks.Harmony]: '',
|
|
115
|
-
[types_1.Networks.Moonbeam]: '',
|
|
116
|
-
[types_1.Networks.Sxnetwork]: '',
|
|
117
|
-
[types_1.Networks.Canto]: '',
|
|
118
|
-
[types_1.Networks.ZksyncEra]: '',
|
|
119
|
-
[types_1.Networks.Blast]: '',
|
|
120
|
-
[types_1.Networks.Base]: 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/2TdbQKGWPRHUwuHJgxQzh8kZ7FVpBgZaFtnbjTS6iYng',
|
|
121
|
-
[types_1.Networks.Mantle]: '',
|
|
122
|
-
[types_1.Networks.Optimism]: '',
|
|
123
|
-
[types_1.Networks.Real]: '',
|
|
124
|
-
[types_1.Networks.Scroll]: 'https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/BaPMX2ubiRZ4ujqTFmWyrk72fPo6yFLQ7A5Z4BLXCTFU',
|
|
182
|
+
[types_1.Networks.Arbitrum]: "https://api.studio.thegraph.com/query/46041/impermax-chef-arbitrum-ibex/v0.0.1",
|
|
183
|
+
[types_1.Networks.Avalanche]: "https://api.studio.thegraph.com/query/46041/impermax-chef-avalanche/v0.0.1",
|
|
184
|
+
[types_1.Networks.Moonriver]: "https://api.studio.thegraph.com/query/46041/impermax-chef-moonriver/v0.0.1",
|
|
185
|
+
[types_1.Networks.Fantom]: "https://api.studio.thegraph.com/query/46041/impermax-chef-fantom/v0.0.1",
|
|
186
|
+
[types_1.Networks.Aurora]: "",
|
|
187
|
+
[types_1.Networks.Cronos]: "",
|
|
188
|
+
[types_1.Networks.Harmony]: "",
|
|
189
|
+
[types_1.Networks.Moonbeam]: "",
|
|
190
|
+
[types_1.Networks.Sxnetwork]: "",
|
|
191
|
+
[types_1.Networks.Canto]: "",
|
|
192
|
+
[types_1.Networks.ZksyncEra]: "",
|
|
193
|
+
[types_1.Networks.Blast]: "",
|
|
194
|
+
[types_1.Networks.Base]: "",
|
|
195
|
+
[types_1.Networks.Mantle]: "",
|
|
196
|
+
[types_1.Networks.Scroll]: "",
|
|
197
|
+
[types_1.Networks.Optimism]: "",
|
|
198
|
+
[types_1.Networks.Real]: "",
|
|
125
199
|
};
|
|
126
200
|
exports.BLOCKS_SUBGRAPH_URL = {
|
|
127
|
-
[types_1.Networks.Ropsten]:
|
|
128
|
-
[types_1.Networks.Mainnet]:
|
|
129
|
-
[types_1.Networks.Polygon]:
|
|
130
|
-
[types_1.Networks.Arbitrum]:
|
|
131
|
-
[types_1.Networks.Avalanche]:
|
|
132
|
-
[types_1.Networks.Moonriver]:
|
|
133
|
-
[types_1.Networks.Aurora]:
|
|
134
|
-
[types_1.Networks.Cronos]:
|
|
135
|
-
[types_1.Networks.Fantom]:
|
|
136
|
-
[types_1.Networks.Canto]:
|
|
137
|
-
[types_1.Networks.ZksyncEra]:
|
|
138
|
-
[types_1.Networks.Blast]:
|
|
139
|
-
[types_1.Networks.Harmony]:
|
|
140
|
-
[types_1.Networks.Moonbeam]:
|
|
141
|
-
[types_1.Networks.Sxnetwork]:
|
|
142
|
-
[types_1.Networks.Base]:
|
|
143
|
-
[types_1.Networks.Mantle]:
|
|
144
|
-
[types_1.Networks.Scroll]:
|
|
145
|
-
[types_1.Networks.Real]:
|
|
146
|
-
[types_1.Networks.Optimism]:
|
|
201
|
+
[types_1.Networks.Ropsten]: "",
|
|
202
|
+
[types_1.Networks.Mainnet]: "https://api.thegraph.com/subgraphs/name/blocklytics/ethereum-blocks",
|
|
203
|
+
[types_1.Networks.Polygon]: "https://api.thegraph.com/subgraphs/name/matthewlilley/polygon-blocks",
|
|
204
|
+
[types_1.Networks.Arbitrum]: "https://api.thegraph.com/subgraphs/name/sushiswap/arbitrum-blocks",
|
|
205
|
+
[types_1.Networks.Avalanche]: "https://api.thegraph.com/subgraphs/name/dasconnor/avalanche-blocks",
|
|
206
|
+
[types_1.Networks.Moonriver]: "https://api.thegraph.com/subgraphs/name/sushiswap/moonriver-blocks",
|
|
207
|
+
[types_1.Networks.Aurora]: "",
|
|
208
|
+
[types_1.Networks.Cronos]: "",
|
|
209
|
+
[types_1.Networks.Fantom]: "https://gateway.thegraph.com/api/031cf65e6bf1e03a781f69aeba9770d2/subgraphs/id/3drjZDpA9hAuYGA19ttEkhW432mVe2XHy5YarBDVYHbz",
|
|
210
|
+
[types_1.Networks.Canto]: "https://api.impermax.finance/subgraphs/name/blocklytics/canto-blocks",
|
|
211
|
+
[types_1.Networks.ZksyncEra]: "https://api.impermax.finance/subgraphs/name/blocklytics/canto-blocks",
|
|
212
|
+
[types_1.Networks.Blast]: "",
|
|
213
|
+
[types_1.Networks.Harmony]: "",
|
|
214
|
+
[types_1.Networks.Moonbeam]: "",
|
|
215
|
+
[types_1.Networks.Sxnetwork]: "",
|
|
216
|
+
[types_1.Networks.Base]: "https://api.thegraph.com/subgraphs/name/blocklytics/base-blocks",
|
|
217
|
+
[types_1.Networks.Mantle]: "",
|
|
218
|
+
[types_1.Networks.Scroll]: "",
|
|
219
|
+
[types_1.Networks.Real]: "",
|
|
220
|
+
[types_1.Networks.Optimism]: "",
|
|
147
221
|
};
|
|
148
222
|
exports.XIMX_SUBGRAPH_URL = "https://api.thegraph.com/subgraphs/name/impermax-finance/imx-staking";
|
|
149
223
|
exports.CONFIG_MANAGER_SUBGRAPH_URL = {
|
|
150
|
-
[types_1.Networks.Ropsten]:
|
|
151
|
-
[types_1.Networks.Mainnet]:
|
|
152
|
-
[types_1.Networks.Polygon]:
|
|
153
|
-
[types_1.Networks.Arbitrum]:
|
|
154
|
-
[types_1.Networks.Avalanche]:
|
|
155
|
-
[types_1.Networks.Moonriver]:
|
|
156
|
-
[types_1.Networks.Aurora]:
|
|
157
|
-
[types_1.Networks.Cronos]:
|
|
158
|
-
[types_1.Networks.Fantom]:
|
|
159
|
-
[types_1.Networks.Canto]:
|
|
160
|
-
[types_1.Networks.ZksyncEra]:
|
|
161
|
-
[types_1.Networks.Harmony]:
|
|
162
|
-
[types_1.Networks.Moonbeam]:
|
|
163
|
-
[types_1.Networks.Sxnetwork]:
|
|
164
|
-
[types_1.Networks.Blast]:
|
|
165
|
-
[types_1.Networks.Scroll]:
|
|
166
|
-
[types_1.Networks.Base]:
|
|
167
|
-
[types_1.Networks.Optimism]:
|
|
168
|
-
[types_1.Networks.Real]:
|
|
224
|
+
[types_1.Networks.Ropsten]: "",
|
|
225
|
+
[types_1.Networks.Mainnet]: "",
|
|
226
|
+
[types_1.Networks.Polygon]: "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/42W3457WecJ4foXk3tBeVpmX8MUHS3L8qXvUvhDSE6p2",
|
|
227
|
+
[types_1.Networks.Arbitrum]: "",
|
|
228
|
+
[types_1.Networks.Avalanche]: "",
|
|
229
|
+
[types_1.Networks.Moonriver]: "",
|
|
230
|
+
[types_1.Networks.Aurora]: "",
|
|
231
|
+
[types_1.Networks.Cronos]: "",
|
|
232
|
+
[types_1.Networks.Fantom]: "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/D6WHTfFEaUkHyLavPQM5BcivWYMe41Aj6PbdaKhKdfUm",
|
|
233
|
+
[types_1.Networks.Canto]: "",
|
|
234
|
+
[types_1.Networks.ZksyncEra]: "",
|
|
235
|
+
[types_1.Networks.Harmony]: "",
|
|
236
|
+
[types_1.Networks.Moonbeam]: "",
|
|
237
|
+
[types_1.Networks.Sxnetwork]: "",
|
|
238
|
+
[types_1.Networks.Blast]: "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/2ARmGYURb2DAHxfJeA1fhVUDeJpHSvCoJTDiBfmTvESN",
|
|
239
|
+
[types_1.Networks.Scroll]: "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/9vmJatgwfrm7MMWXy3MhAZ2bsbrbbHzik9q9f5hfzZE9",
|
|
240
|
+
[types_1.Networks.Base]: "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/6y4Bb2KSFsqyjbARM8EpKkqFRt62ELasVCVckg2bv7jB",
|
|
241
|
+
[types_1.Networks.Optimism]: "https://gateway.thegraph.com/api/1350441d268f171aeb0934412dfadf3b/subgraphs/id/GWFrv8MNg5fpD19fxdu32G1Wt6om8qb1wbacpgHDyvC8",
|
|
242
|
+
[types_1.Networks.Real]: "https://api.goldsky.com/api/public/project_cm2d5q4l4w31601vz4swb3vmi/subgraphs/impermax-config-manager-real/1.0/gn",
|
|
169
243
|
};
|
|
170
244
|
exports.WHITELIST_SUBGRAPH_URL = {
|
|
171
|
-
[types_1.Networks.Ropsten]:
|
|
172
|
-
[types_1.Networks.Mainnet]:
|
|
173
|
-
[types_1.Networks.Polygon]:
|
|
174
|
-
[types_1.Networks.Arbitrum]:
|
|
175
|
-
[types_1.Networks.Avalanche]:
|
|
176
|
-
[types_1.Networks.Moonriver]:
|
|
177
|
-
[types_1.Networks.Aurora]:
|
|
178
|
-
[types_1.Networks.Cronos]:
|
|
179
|
-
[types_1.Networks.Fantom]:
|
|
180
|
-
[types_1.Networks.Canto]:
|
|
181
|
-
[types_1.Networks.ZksyncEra]:
|
|
182
|
-
[types_1.Networks.Harmony]:
|
|
183
|
-
[types_1.Networks.Moonbeam]:
|
|
184
|
-
[types_1.Networks.Sxnetwork]:
|
|
185
|
-
[types_1.Networks.Mantle]:
|
|
186
|
-
[types_1.Networks.Base]:
|
|
245
|
+
[types_1.Networks.Ropsten]: "",
|
|
246
|
+
[types_1.Networks.Mainnet]: "",
|
|
247
|
+
[types_1.Networks.Polygon]: "https://api.studio.thegraph.com/query/46041/impermax-whitelist-polygon/v0.0.1",
|
|
248
|
+
[types_1.Networks.Arbitrum]: "",
|
|
249
|
+
[types_1.Networks.Avalanche]: "",
|
|
250
|
+
[types_1.Networks.Moonriver]: "",
|
|
251
|
+
[types_1.Networks.Aurora]: "",
|
|
252
|
+
[types_1.Networks.Cronos]: "",
|
|
253
|
+
[types_1.Networks.Fantom]: "",
|
|
254
|
+
[types_1.Networks.Canto]: "",
|
|
255
|
+
[types_1.Networks.ZksyncEra]: "",
|
|
256
|
+
[types_1.Networks.Harmony]: "",
|
|
257
|
+
[types_1.Networks.Moonbeam]: "",
|
|
258
|
+
[types_1.Networks.Sxnetwork]: "",
|
|
259
|
+
[types_1.Networks.Mantle]: "",
|
|
260
|
+
[types_1.Networks.Base]: "https://api.studio.thegraph.com/query/46041/impermax-whitelist-base/v0.0.1",
|
|
187
261
|
};
|
package/lib/config/types.d.ts
CHANGED
|
@@ -83,3 +83,13 @@ export declare enum WhitelistState {
|
|
|
83
83
|
Deprecated = 2,
|
|
84
84
|
Blacklisted = 3
|
|
85
85
|
}
|
|
86
|
+
export declare enum VaultType {
|
|
87
|
+
LENDING = "Lending",
|
|
88
|
+
HEDGED = "Hedged",
|
|
89
|
+
LEVERAGED = "Leverage"
|
|
90
|
+
}
|
|
91
|
+
export type NetworkVaultTypeIndex<Type> = {
|
|
92
|
+
[key in Networks]: {
|
|
93
|
+
[key in VaultType]?: Type;
|
|
94
|
+
};
|
|
95
|
+
};
|
package/lib/config/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WhitelistState = exports.ProposalState = exports.Borrowable = exports.PoolTokenType = exports.Extension = exports.Factory = exports.Networks = void 0;
|
|
3
|
+
exports.VaultType = exports.WhitelistState = exports.ProposalState = exports.Borrowable = exports.PoolTokenType = exports.Extension = exports.Factory = exports.Networks = void 0;
|
|
4
4
|
var Networks;
|
|
5
5
|
(function (Networks) {
|
|
6
6
|
Networks["Ropsten"] = "ropsten";
|
|
@@ -70,3 +70,9 @@ var WhitelistState;
|
|
|
70
70
|
WhitelistState[WhitelistState["Blacklisted"] = 3] = "Blacklisted";
|
|
71
71
|
})(WhitelistState = exports.WhitelistState || (exports.WhitelistState = {}));
|
|
72
72
|
;
|
|
73
|
+
var VaultType;
|
|
74
|
+
(function (VaultType) {
|
|
75
|
+
VaultType["LENDING"] = "Lending";
|
|
76
|
+
VaultType["HEDGED"] = "Hedged";
|
|
77
|
+
VaultType["LEVERAGED"] = "Leverage";
|
|
78
|
+
})(VaultType = exports.VaultType || (exports.VaultType = {}));
|
package/lib/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { BORROW_FEE_FACTORIES, LIQUIDATION_FEE_FACTORIES, OLD_KINK_MULTIPLIER_FA
|
|
|
18
18
|
import { FarmIndex, Farms, getFarmByStakedLPFactory, hrFarms, STAKED_LP_FACTORY } from './config/farms';
|
|
19
19
|
import { APPROVE_AMOUNT, DEADLINE, NOT_SYNCED, ZERO } from './config/general';
|
|
20
20
|
import { BLOCKS_SUBGRAPH_URL, IMPERMAX_CHEF_SUBGRAPH_URL, IMPERMAX_SUBGRAPH_URL, XIMX_SUBGRAPH_URL } from './config/subgraphs';
|
|
21
|
-
import { Address, AddressIndex, AmmIndex, DistributorDetails, Factory, FactoryIndex, LendingPoolIndex, NetworkFactoryIndex, NetworkIndex, Networks, PoolTokenType, ProposalState, WhitelistState } from './config/types';
|
|
21
|
+
import { Address, AddressIndex, AmmIndex, DistributorDetails, Factory, FactoryIndex, LendingPoolIndex, NetworkFactoryIndex, NetworkIndex, Networks, PoolTokenType, ProposalState, WhitelistState, VaultType } from './config/types';
|
|
22
22
|
import { AirdropData, ApprovalType, Changes, Contract, OnchainConfig, NO_CHANGES, PendingRewardUI, PermitData, Values, CollateralConfig, BorrowableConfig, PairConfig } from './onchain/onchainTypes';
|
|
23
23
|
import { BorrowableData, BorrowablePastData, BorrowPosition, CollateralData, CollateralPosition, FarmingPoolData, LendingPoolData, LendingPoolPastData, PairData, PoolTokenData, RewardData, SupplyPosition, TokenData, TvlData, UserData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata } from './offchain/offchainTypes';
|
|
24
24
|
import { OffchainBorrowable, OffchainCollateral } from './offchain/lendingPool';
|
|
@@ -34,5 +34,5 @@ import { OnchainInteractionsBorrowable, OnchainInteractionsCollateral } from './
|
|
|
34
34
|
import { LENDING_VAULT_WATCHER } from './config/contracts/lending-vault-watcher';
|
|
35
35
|
import OffchainVault, { OffchainLendingVault, OffchainLeveragedVault, OffchainHedgedVault } from './offchain/vault';
|
|
36
36
|
import { SortDirection, VaultOrderBy, VaultListParams } from "./offchain/offchainMultichain";
|
|
37
|
-
import { VaultRisk
|
|
37
|
+
import { VaultRisk } from "./offchain/vault/offchainVault";
|
|
38
38
|
export { offchain, OffchainMultichain, Offchain, OffchainLendingPool, OffchainPoolToken, OffchainCollateral, OffchainBorrowable, OffchainVault, OffchainLeveragedVault, OffchainLendingVault, OffchainHedgedVault, OffchainConfigManager, OffchainPairConfig, OffchainProposal, OffchainMultichainAccount, OffchainAccount, OffchainAccountLendingPool, OffchainAccountPoolToken, OffchainAccountCollateral, OffchainAccountBorrowable, OffchainLeveragedPosition, OffchainAccountVault, OffchainPriceHelper, OffchainSolidexHelper, PoolTokenData, BorrowableData, CollateralData, BorrowablePastData, TokenData, RewardData, PairData, FarmingPoolData, LendingPoolPastData, LendingPoolData, CollateralPosition, SupplyPosition, BorrowPosition, UserData, TvlData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata, VaultRisk, VaultType, onchain, Onchain, OnchainLendingPool, OnchainPoolToken, OnchainBorrowable, OnchainCollateral, OnchainLendingVault, OnchainConfigManager, OnchainProposal, OnchainPairConfig, OnchainAccount, OnchainAccountLendingPool, OnchainAccountPoolToken, OnchainAccountBorrowable, OnchainAccountCollateral, OnchainAccountLendingVault, OnchainContractsHelper, OnchainImpermaxFactory, OnchainInteractions, OnchainInteractionsLendingPool, OnchainInteractionsPoolToken, OnchainInteractionsCollateral, OnchainInteractionsBorrowable, OnchainInteractionsLendingVault, OnchainInteractionsConfigManager, Contract, ApprovalType, PermitData, OnchainConfig, Changes, NO_CHANGES, Values, AirdropData, PendingRewardUI, CollateralConfig, BorrowableConfig, PairConfig, CLAIM_AGGREGATOR, IMPERMAX_CHEF, IMX, IMPERMAX_FACTORY, getNetworkFactories, LENDING_VAULT_WATCHER, 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, ProposalState, WhitelistState, VaultOrderBy, VaultListParams, SortDirection };
|
package/lib/index.js
CHANGED
|
@@ -109,6 +109,7 @@ Object.defineProperty(exports, "Networks", { enumerable: true, get: function ()
|
|
|
109
109
|
Object.defineProperty(exports, "PoolTokenType", { enumerable: true, get: function () { return types_1.PoolTokenType; } });
|
|
110
110
|
Object.defineProperty(exports, "ProposalState", { enumerable: true, get: function () { return types_1.ProposalState; } });
|
|
111
111
|
Object.defineProperty(exports, "WhitelistState", { enumerable: true, get: function () { return types_1.WhitelistState; } });
|
|
112
|
+
Object.defineProperty(exports, "VaultType", { enumerable: true, get: function () { return types_1.VaultType; } });
|
|
112
113
|
const onchainTypes_1 = require("./onchain/onchainTypes");
|
|
113
114
|
Object.defineProperty(exports, "ApprovalType", { enumerable: true, get: function () { return onchainTypes_1.ApprovalType; } });
|
|
114
115
|
Object.defineProperty(exports, "NO_CHANGES", { enumerable: true, get: function () { return onchainTypes_1.NO_CHANGES; } });
|
|
@@ -164,4 +165,3 @@ Object.defineProperty(exports, "SortDirection", { enumerable: true, get: functio
|
|
|
164
165
|
Object.defineProperty(exports, "VaultOrderBy", { enumerable: true, get: function () { return offchainMultichain_1.VaultOrderBy; } });
|
|
165
166
|
const offchainVault_1 = require("./offchain/vault/offchainVault");
|
|
166
167
|
Object.defineProperty(exports, "VaultRisk", { enumerable: true, get: function () { return offchainVault_1.VaultRisk; } });
|
|
167
|
-
Object.defineProperty(exports, "VaultType", { enumerable: true, get: function () { return offchainVault_1.VaultType; } });
|
|
@@ -13,13 +13,13 @@ export default class OffchainAccount {
|
|
|
13
13
|
getAccountAddress: () => string;
|
|
14
14
|
private initializeLendingPool;
|
|
15
15
|
getLendingPool(factory: Factory, pair: Address): Promise<OffchainAccountLendingPool>;
|
|
16
|
-
private
|
|
17
|
-
|
|
16
|
+
private initializeVault;
|
|
17
|
+
getVault(vaultAddress: Address): Promise<OffchainAccountVault>;
|
|
18
18
|
getUserData(): Promise<FactoryIndex<UserData> | null>;
|
|
19
|
-
|
|
19
|
+
getVaultsUserData(): Promise<AddressIndex<AddressIndex<VaultPosition>>>;
|
|
20
20
|
getBorrowPositions(): Promise<FactoryIndex<Address[]>>;
|
|
21
21
|
getSupplyPositions(): Promise<FactoryIndex<Address[]>>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
getVaultsSuppliedUSD(): Promise<number>;
|
|
23
|
+
getVaultsEarningsUSD(): Promise<number>;
|
|
24
|
+
getVaultsYearlyYieldUSD(): Promise<number>;
|
|
25
25
|
}
|
|
@@ -39,16 +39,16 @@ class OffchainAccount {
|
|
|
39
39
|
return lendingPoolsOfFactory[pair];
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
initializeVault(vaultAddress) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const lendingVault = yield this.offchain.
|
|
44
|
+
const lendingVault = yield this.offchain.getVault(vaultAddress);
|
|
45
45
|
return new offchainAccountVault_1.default(this, lendingVault);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
getVault(vaultAddress) {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
50
|
if (!this.vaults[vaultAddress])
|
|
51
|
-
this.vaults[vaultAddress] = this.
|
|
51
|
+
this.vaults[vaultAddress] = this.initializeVault(vaultAddress);
|
|
52
52
|
return this.vaults[vaultAddress];
|
|
53
53
|
});
|
|
54
54
|
}
|
|
@@ -57,9 +57,9 @@ class OffchainAccount {
|
|
|
57
57
|
return this.offchain.getUserData(this.accountAddress);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
getVaultsUserData() {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
return this.offchain.
|
|
62
|
+
return this.offchain.getVaultsUserData(this.accountAddress);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
getBorrowPositions() {
|
|
@@ -86,41 +86,50 @@ class OffchainAccount {
|
|
|
86
86
|
return result;
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
getVaultsSuppliedUSD() {
|
|
90
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
91
|
let suppliedUSD = 0;
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
92
|
+
const vaultsUserData = yield this.getVaultsUserData();
|
|
93
|
+
if (!vaultsUserData)
|
|
94
94
|
return 0;
|
|
95
|
-
for (const
|
|
96
|
-
const
|
|
97
|
-
|
|
95
|
+
for (const vaultType in vaultsUserData) {
|
|
96
|
+
const vaultsOfType = vaultsUserData[vaultType];
|
|
97
|
+
for (const address in vaultsOfType) {
|
|
98
|
+
const vault = yield this.getVault(address);
|
|
99
|
+
suppliedUSD += yield vault.getValue();
|
|
100
|
+
}
|
|
98
101
|
}
|
|
99
102
|
return suppliedUSD;
|
|
100
103
|
});
|
|
101
104
|
}
|
|
102
|
-
|
|
105
|
+
getVaultsEarningsUSD() {
|
|
103
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
107
|
let earningsUSD = 0;
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
108
|
+
const vaultsUserData = yield this.getVaultsUserData();
|
|
109
|
+
if (!vaultsUserData)
|
|
107
110
|
return 0;
|
|
108
|
-
for (const
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
+
for (const vaultType in vaultsUserData) {
|
|
112
|
+
const vaultsOfType = vaultsUserData[vaultType];
|
|
113
|
+
for (const address in vaultsOfType) {
|
|
114
|
+
const vault = yield this.getVault(address);
|
|
115
|
+
earningsUSD += yield vault.getEarningsUSD();
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
118
|
return earningsUSD;
|
|
113
119
|
});
|
|
114
120
|
}
|
|
115
|
-
|
|
121
|
+
getVaultsYearlyYieldUSD() {
|
|
116
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
123
|
let yieldUSD = 0;
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
124
|
+
const vaultsUserData = yield this.getVaultsUserData();
|
|
125
|
+
if (!vaultsUserData)
|
|
120
126
|
return 0;
|
|
121
|
-
for (const
|
|
122
|
-
const
|
|
123
|
-
|
|
127
|
+
for (const vaultType in vaultsUserData) {
|
|
128
|
+
const vaultsOfType = vaultsUserData[vaultType];
|
|
129
|
+
for (const address in vaultsOfType) {
|
|
130
|
+
const vault = yield this.getVault(address);
|
|
131
|
+
yieldUSD += (yield vault.getValue()) * (yield vault.getPoolToken().getSupplyAPR());
|
|
132
|
+
}
|
|
124
133
|
}
|
|
125
134
|
return yieldUSD;
|
|
126
135
|
});
|