@berachain/berajs 0.2.8-beta.4 → 0.2.8-beta.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/dist/abi/exports.cjs +1 -4452
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.mjs +1 -4452
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -918
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +95 -50
- package/dist/actions/exports.d.ts +95 -50
- package/dist/actions/exports.mjs +1 -918
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-3MZ7MLKF.mjs +2 -0
- package/dist/{chunk-PBCE7JTE.mjs.map → chunk-3MZ7MLKF.mjs.map} +1 -1
- package/dist/chunk-53TSJM6P.cjs +2 -0
- package/dist/chunk-53TSJM6P.cjs.map +1 -0
- package/dist/chunk-575OK77P.mjs +2 -0
- package/dist/{chunk-GLWPRM33.mjs.map → chunk-575OK77P.mjs.map} +1 -1
- package/dist/chunk-5W7UKRHX.mjs +2 -0
- package/dist/{chunk-J6EHBYSV.mjs.map → chunk-5W7UKRHX.mjs.map} +1 -1
- package/dist/chunk-6K252BGM.mjs +2 -0
- package/dist/{chunk-CYBZH6U3.mjs.map → chunk-6K252BGM.mjs.map} +1 -1
- package/dist/chunk-CWKDFUFR.mjs +2 -0
- package/dist/{chunk-OWUI3VPI.mjs.map → chunk-CWKDFUFR.mjs.map} +1 -1
- package/dist/chunk-D6L7LTA2.cjs +2 -0
- package/dist/chunk-D6L7LTA2.cjs.map +1 -0
- package/dist/chunk-DDEQFR3M.cjs +2 -0
- package/dist/chunk-DDEQFR3M.cjs.map +1 -0
- package/dist/chunk-DKY4QPWU.cjs +2 -0
- package/dist/chunk-DKY4QPWU.cjs.map +1 -0
- package/dist/chunk-DTBJO6VT.cjs +2 -0
- package/dist/chunk-DTBJO6VT.cjs.map +1 -0
- package/dist/chunk-ESAVA5OD.mjs +2 -0
- package/dist/{chunk-ALPEMPZI.mjs.map → chunk-ESAVA5OD.mjs.map} +1 -1
- package/dist/chunk-JDZGYU5T.mjs +2 -0
- package/dist/{chunk-WEULAXBE.mjs.map → chunk-JDZGYU5T.mjs.map} +1 -1
- package/dist/chunk-JLFBRMOF.cjs +2 -0
- package/dist/chunk-JLFBRMOF.cjs.map +1 -0
- package/dist/chunk-KT6L4K4K.cjs +2 -0
- package/dist/chunk-KT6L4K4K.cjs.map +1 -0
- package/dist/chunk-MASD43N5.mjs +4 -0
- package/dist/chunk-MASD43N5.mjs.map +1 -0
- package/dist/chunk-MGGPHKA2.cjs +4 -0
- package/dist/chunk-MGGPHKA2.cjs.map +1 -0
- package/dist/chunk-MK5NS5B5.mjs +2 -0
- package/dist/{chunk-7TFV6UKF.mjs.map → chunk-MK5NS5B5.mjs.map} +1 -1
- package/dist/chunk-NAXAZJJY.mjs +2 -0
- package/dist/{chunk-ZCEFC2TK.mjs.map → chunk-NAXAZJJY.mjs.map} +1 -1
- package/dist/chunk-NLVWRMGD.mjs +2 -0
- package/dist/{chunk-GWSTVITN.mjs.map → chunk-NLVWRMGD.mjs.map} +1 -1
- package/dist/chunk-OGBD5YOG.mjs +2 -0
- package/dist/{chunk-JA4DHMTG.mjs.map → chunk-OGBD5YOG.mjs.map} +1 -1
- package/dist/chunk-OGJMSGB2.mjs +2 -0
- package/dist/{chunk-KL6YZ5VR.mjs.map → chunk-OGJMSGB2.mjs.map} +1 -1
- package/dist/chunk-OIYXOKTT.cjs +2 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -0
- package/dist/chunk-OUD27MU7.cjs +2 -0
- package/dist/chunk-OUD27MU7.cjs.map +1 -0
- package/dist/chunk-QFLDL4UV.cjs +2 -0
- package/dist/chunk-QFLDL4UV.cjs.map +1 -0
- package/dist/chunk-RSDCKN4Q.mjs +2 -0
- package/dist/chunk-RSDCKN4Q.mjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs +2 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -0
- package/dist/chunk-SSPFPAWX.mjs +2 -0
- package/dist/{chunk-WAFQFAI7.mjs.map → chunk-SSPFPAWX.mjs.map} +1 -1
- package/dist/chunk-UENDEN3M.mjs +2 -0
- package/dist/{chunk-MKS6W5NI.mjs.map → chunk-UENDEN3M.mjs.map} +1 -1
- package/dist/chunk-UFIM7WQ4.cjs +2 -0
- package/dist/chunk-UFIM7WQ4.cjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs +2 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -0
- package/dist/chunk-XNJLSA6P.cjs +2 -0
- package/dist/chunk-XNJLSA6P.cjs.map +1 -0
- package/dist/chunk-ZYXVUXFQ.cjs +2 -0
- package/dist/chunk-ZYXVUXFQ.cjs.map +1 -0
- package/dist/contexts/exports.cjs +1 -82
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.mjs +1 -82
- package/dist/contexts/exports.mjs.map +1 -1
- package/dist/enum/exports.cjs +1 -58
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/enum/exports.mjs +1 -58
- package/dist/enum/exports.mjs.map +1 -1
- package/dist/errors/exports.cjs +1 -38
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.mjs +1 -38
- package/dist/{getValidatorQueuedOperatorAddress-DUZOmxLV.d.ts → getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts} +2 -2
- package/dist/{getValidatorQueuedOperatorAddress-BQXkSFd9.d.cts → getValidatorQueuedOperatorAddress-Cql_D50j.d.cts} +2 -2
- package/dist/{global.d-SU9Epq0M.d.ts → global.d-5w_lvl2J.d.ts} +1 -1
- package/dist/{global.d-6aSWIkV_.d.cts → global.d-B7IeayVX.d.cts} +1 -1
- package/dist/hooks/exports.cjs +3 -8327
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +4 -4
- package/dist/hooks/exports.d.ts +4 -4
- package/dist/hooks/exports.mjs +3 -8327
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-CCuQUFlh.d.cts → txnEnum-7_o92X3N.d.cts} +2 -0
- package/dist/{txnEnum-CCuQUFlh.d.ts → txnEnum-7_o92X3N.d.ts} +2 -0
- package/dist/types/exports.d.cts +2 -2
- package/dist/types/exports.d.ts +2 -2
- package/dist/utils/exports.cjs +1 -786
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.mjs +1 -786
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +5 -5
- package/src/actions/clients/getApolloClient.ts +11 -4
- package/src/actions/dex/aggregators/base.ts +1 -3
- package/src/actions/dex/getOnChainPool.ts +1 -1
- package/src/actions/enso/getBendMultiplyBundle.ts +9 -2
- package/src/actions/enso/util.ts +6 -8
- package/src/actions/governance/checkProposalField.ts +108 -54
- package/src/actions/governance/computeActualStatus.ts +7 -3
- package/src/actions/governance/getAllProposals.ts +15 -8
- package/src/actions/governance/getBodyErrors.ts +13 -5
- package/src/actions/governance/getDecodedFunctionData.ts +31 -27
- package/src/actions/governance/getProposalDetails.ts +8 -4
- package/src/actions/governance/getProposalFromTx.ts +19 -10
- package/src/actions/governance/getProposalParams.ts +17 -17
- package/src/actions/governance/getProposalVotes.ts +7 -3
- package/src/actions/governance/getQuorum.ts +7 -7
- package/src/actions/governance/parseProposalBody.ts +19 -9
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
- package/src/actions/tokens/getTokenInformation.ts +8 -15
- package/src/actions/tokens/getUnderlyingToken.ts +1 -3
- package/src/enum/txnEnum.ts +2 -0
- package/src/errors/BeraError.ts +7 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +1 -1
- package/src/hooks/enso/useBendZapSupply.ts +1 -1
- package/src/hooks/perps/usePythUpdateFee.ts +1 -1
- package/src/hooks/validators/useValidatorRewardAllocation.ts +1 -1
- package/dist/chunk-24HMIYTN.cjs +0 -36
- package/dist/chunk-24HMIYTN.cjs.map +0 -1
- package/dist/chunk-2LL77B3T.cjs +0 -135
- package/dist/chunk-2LL77B3T.cjs.map +0 -1
- package/dist/chunk-3LXVARBJ.cjs +0 -417
- package/dist/chunk-3LXVARBJ.cjs.map +0 -1
- package/dist/chunk-4HDIUUSV.cjs +0 -130
- package/dist/chunk-4HDIUUSV.cjs.map +0 -1
- package/dist/chunk-7ONKBHXY.cjs +0 -169
- package/dist/chunk-7ONKBHXY.cjs.map +0 -1
- package/dist/chunk-7TFV6UKF.mjs +0 -24
- package/dist/chunk-A4FPM7U3.cjs +0 -63
- package/dist/chunk-A4FPM7U3.cjs.map +0 -1
- package/dist/chunk-A7P3JVU7.cjs +0 -4694
- package/dist/chunk-A7P3JVU7.cjs.map +0 -1
- package/dist/chunk-ALPEMPZI.mjs +0 -417
- package/dist/chunk-BEHP54S3.cjs +0 -24
- package/dist/chunk-BEHP54S3.cjs.map +0 -1
- package/dist/chunk-CYBZH6U3.mjs +0 -135
- package/dist/chunk-EWBKSMPG.cjs +0 -13
- package/dist/chunk-EWBKSMPG.cjs.map +0 -1
- package/dist/chunk-GLWPRM33.mjs +0 -13
- package/dist/chunk-GWSTVITN.mjs +0 -572
- package/dist/chunk-H3Z37RYU.cjs +0 -15
- package/dist/chunk-H3Z37RYU.cjs.map +0 -1
- package/dist/chunk-HCC4FJTD.cjs +0 -97
- package/dist/chunk-HCC4FJTD.cjs.map +0 -1
- package/dist/chunk-J6EHBYSV.mjs +0 -97
- package/dist/chunk-JA4DHMTG.mjs +0 -15
- package/dist/chunk-KL6YZ5VR.mjs +0 -63
- package/dist/chunk-MILSHCKW.cjs +0 -168
- package/dist/chunk-MILSHCKW.cjs.map +0 -1
- package/dist/chunk-MKS6W5NI.mjs +0 -403
- package/dist/chunk-MXWPP6MS.cjs +0 -572
- package/dist/chunk-MXWPP6MS.cjs.map +0 -1
- package/dist/chunk-OWUI3VPI.mjs +0 -169
- package/dist/chunk-PBCE7JTE.mjs +0 -36
- package/dist/chunk-QISQSMCV.cjs +0 -1843
- package/dist/chunk-QISQSMCV.cjs.map +0 -1
- package/dist/chunk-SYWYIMY7.mjs +0 -4694
- package/dist/chunk-SYWYIMY7.mjs.map +0 -1
- package/dist/chunk-TDW5SPXR.cjs +0 -244
- package/dist/chunk-TDW5SPXR.cjs.map +0 -1
- package/dist/chunk-TGHG6Q3C.cjs +0 -403
- package/dist/chunk-TGHG6Q3C.cjs.map +0 -1
- package/dist/chunk-WAFQFAI7.mjs +0 -130
- package/dist/chunk-WEULAXBE.mjs +0 -168
- package/dist/chunk-ZCEFC2TK.mjs +0 -244
- package/dist/chunk-ZV7DCQQY.mjs +0 -1843
- package/dist/chunk-ZV7DCQQY.mjs.map +0 -1
package/dist/actions/exports.cjs
CHANGED
|
@@ -1,919 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var _chunkA7P3JVU7cjs = require('../chunk-A7P3JVU7.cjs');
|
|
90
|
-
require('../chunk-MXWPP6MS.cjs');
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
var _chunk2LL77B3Tcjs = require('../chunk-2LL77B3T.cjs');
|
|
96
|
-
require('../chunk-TDW5SPXR.cjs');
|
|
97
|
-
require('../chunk-A4FPM7U3.cjs');
|
|
98
|
-
require('../chunk-4HDIUUSV.cjs');
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var _chunk7ONKBHXYcjs = require('../chunk-7ONKBHXY.cjs');
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var _chunk3LXVARBJcjs = require('../chunk-3LXVARBJ.cjs');
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var _chunkHCC4FJTDcjs = require('../chunk-HCC4FJTD.cjs');
|
|
114
|
-
require('../chunk-QISQSMCV.cjs');
|
|
115
|
-
|
|
116
|
-
// src/actions/bend/getMaxDeposit.ts
|
|
117
|
-
var _viem = require('viem');
|
|
118
|
-
var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');
|
|
119
|
-
async function getMaxDeposit({
|
|
120
|
-
vaultAddress,
|
|
121
|
-
publicClient
|
|
122
|
-
}) {
|
|
123
|
-
const maxDeposit = await publicClient.readContract({
|
|
124
|
-
address: vaultAddress,
|
|
125
|
-
abi: _metaMorphoV11.metaMorphoV11Abi,
|
|
126
|
-
functionName: "maxDeposit",
|
|
127
|
-
args: [vaultAddress]
|
|
128
|
-
});
|
|
129
|
-
return _viem.formatEther.call(void 0, maxDeposit);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// src/actions/dex/getPoolWithState.ts
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
var _berancersdk = require('@berachain-foundation/berancer-sdk');
|
|
136
|
-
var getPoolState = (apiPool) => {
|
|
137
|
-
return {
|
|
138
|
-
type: _berancersdk.mapPoolType.call(void 0, apiPool.type),
|
|
139
|
-
protocolVersion: apiPool.protocolVersion,
|
|
140
|
-
tokens: apiPool.tokens.map(
|
|
141
|
-
(pt) => ({
|
|
142
|
-
...pt,
|
|
143
|
-
address: pt.address
|
|
144
|
-
})
|
|
145
|
-
),
|
|
146
|
-
id: apiPool.id,
|
|
147
|
-
address: apiPool.address
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// src/actions/dex/getVaultPausedState.ts
|
|
152
|
-
var _vault = require('@berachain/abis/bex/vault');
|
|
153
|
-
async function getVaultPausedState({
|
|
154
|
-
publicClient,
|
|
155
|
-
...args
|
|
156
|
-
}) {
|
|
157
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
158
|
-
const vaultPausedState = await publicClient.readContract({
|
|
159
|
-
address: config.bex.vault,
|
|
160
|
-
abi: _vault.vaultAbi,
|
|
161
|
-
functionName: "getPausedState"
|
|
162
|
-
});
|
|
163
|
-
return vaultPausedState[0];
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// src/actions/governance/getDecodedFunctionData.ts
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
var _internal = require('@berachain/config/internal');
|
|
175
|
-
var _beraChef = require('@berachain/abis/pol/rewards/beraChef');
|
|
176
|
-
var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');
|
|
177
|
-
function isProxyABI(abi) {
|
|
178
|
-
return abi.some(
|
|
179
|
-
(item) => item.name === "implementation" || item.name === "proxyType" || item.type === "constructor" && _optionalChain([item, 'access', _ => _.inputs, 'optionalAccess', _2 => _2[0], 'optionalAccess', _3 => _3.name]) === "implementation"
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
async function _getAbi({
|
|
183
|
-
contractAddress,
|
|
184
|
-
chainId,
|
|
185
|
-
publicClient
|
|
186
|
-
}) {
|
|
187
|
-
const url = `https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${contractAddress}&apikey=${_internal.appConfig.apiKeys.private.etherscan}&chainId=${chainId}`;
|
|
188
|
-
const response = await fetch(url);
|
|
189
|
-
if (!response.ok) {
|
|
190
|
-
throw new Error(`Failed to fetch ABI: ${response.statusText}`);
|
|
191
|
-
}
|
|
192
|
-
const data = await response.json();
|
|
193
|
-
if (data.status === "0") throw new Error(data.result);
|
|
194
|
-
const abi = JSON.parse(data.result);
|
|
195
|
-
if (!isProxyABI(abi)) return abi;
|
|
196
|
-
const implementationResult = await publicClient.getStorageAt({
|
|
197
|
-
address: contractAddress,
|
|
198
|
-
// bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).
|
|
199
|
-
slot: "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"
|
|
200
|
-
});
|
|
201
|
-
if (!implementationResult || _viem.trim.call(void 0, implementationResult) === "0x00")
|
|
202
|
-
return abi;
|
|
203
|
-
const implementationAddress = _viem.pad.call(void 0, _viem.trim.call(void 0, implementationResult), { size: 20 });
|
|
204
|
-
return _getAbi({
|
|
205
|
-
contractAddress: implementationAddress,
|
|
206
|
-
chainId,
|
|
207
|
-
publicClient
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
async function _getAbiForCallData({
|
|
211
|
-
address,
|
|
212
|
-
callData,
|
|
213
|
-
knownAbi,
|
|
214
|
-
chainId,
|
|
215
|
-
publicClient
|
|
216
|
-
}) {
|
|
217
|
-
try {
|
|
218
|
-
if (_viem.decodeFunctionData.call(void 0, { data: callData, abi: knownAbi })) {
|
|
219
|
-
return knownAbi;
|
|
220
|
-
}
|
|
221
|
-
} catch (e2) {
|
|
222
|
-
}
|
|
223
|
-
try {
|
|
224
|
-
const abi = await _getAbi({
|
|
225
|
-
contractAddress: address,
|
|
226
|
-
chainId,
|
|
227
|
-
publicClient
|
|
228
|
-
});
|
|
229
|
-
return abi;
|
|
230
|
-
} catch (e3) {
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
function _decodeCallData(callData, abi) {
|
|
234
|
-
try {
|
|
235
|
-
return _viem.decodeFunctionData.call(void 0, { data: callData, abi });
|
|
236
|
-
} catch (e4) {
|
|
237
|
-
return void 0;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
function _findAbiItem(abi, functionName) {
|
|
241
|
-
return abi.find(
|
|
242
|
-
(a) => a.type === "function" && a.name === functionName
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
function _getFunctionSignature(abiItem) {
|
|
246
|
-
if (!abiItem) return;
|
|
247
|
-
try {
|
|
248
|
-
return _viem.toFunctionSignature.call(void 0, abiItem);
|
|
249
|
-
} catch (error) {
|
|
250
|
-
console.error(error);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
async function getDecodedFunctionData({
|
|
254
|
-
address,
|
|
255
|
-
callData,
|
|
256
|
-
chainId = _internal.defaultChainId,
|
|
257
|
-
publicClient
|
|
258
|
-
}) {
|
|
259
|
-
const knownAbi = [..._beraChef.beraChefAbi, ..._rewardVault.rewardVaultAbi, ..._viem.erc20Abi];
|
|
260
|
-
const abi = await _getAbiForCallData({
|
|
261
|
-
address,
|
|
262
|
-
callData,
|
|
263
|
-
knownAbi,
|
|
264
|
-
chainId,
|
|
265
|
-
publicClient
|
|
266
|
-
});
|
|
267
|
-
const decodedData = _decodeCallData(callData, abi);
|
|
268
|
-
if (!abi || !decodedData) {
|
|
269
|
-
return { args: [] };
|
|
270
|
-
}
|
|
271
|
-
const abiItem = _findAbiItem(abi, decodedData.functionName);
|
|
272
|
-
const functionSignature = _getFunctionSignature(abiItem);
|
|
273
|
-
return {
|
|
274
|
-
abiItem,
|
|
275
|
-
functionSignature,
|
|
276
|
-
functionName: decodedData.functionName,
|
|
277
|
-
args: decodedData.args
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// src/actions/honey/getHoneyFees.ts
|
|
282
|
-
|
|
283
|
-
var _honeyFactory = require('@berachain/abis/honey/honeyFactory');
|
|
284
|
-
async function getHoneyFees({
|
|
285
|
-
client,
|
|
286
|
-
collateralList,
|
|
287
|
-
...args
|
|
288
|
-
}) {
|
|
289
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
290
|
-
try {
|
|
291
|
-
const promiseList = {
|
|
292
|
-
mint: [],
|
|
293
|
-
redeem: []
|
|
294
|
-
};
|
|
295
|
-
for (const coll of collateralList) {
|
|
296
|
-
promiseList.mint.push(
|
|
297
|
-
client.readContract({
|
|
298
|
-
address: config.honey.factory,
|
|
299
|
-
abi: _honeyFactory.honeyFactoryAbi,
|
|
300
|
-
functionName: "mintRates",
|
|
301
|
-
args: [coll.address]
|
|
302
|
-
})
|
|
303
|
-
);
|
|
304
|
-
promiseList.redeem.push(
|
|
305
|
-
client.readContract({
|
|
306
|
-
address: config.honey.factory,
|
|
307
|
-
abi: _honeyFactory.honeyFactoryAbi,
|
|
308
|
-
functionName: "redeemRates",
|
|
309
|
-
args: [coll.address]
|
|
310
|
-
})
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
const [mintRates, redeemRates, collateralWeights] = await Promise.all([
|
|
314
|
-
Promise.all(promiseList.mint),
|
|
315
|
-
Promise.all(promiseList.redeem),
|
|
316
|
-
// fetch the collateral weights, needed to calculate the weighted basket rates
|
|
317
|
-
client.readContract({
|
|
318
|
-
address: config.honey.factory,
|
|
319
|
-
abi: _honeyFactory.honeyFactoryAbi,
|
|
320
|
-
functionName: "getWeights"
|
|
321
|
-
})
|
|
322
|
-
]);
|
|
323
|
-
return collateralList.reduce(
|
|
324
|
-
(acc, coll) => {
|
|
325
|
-
const collIdx = collateralList.indexOf(coll);
|
|
326
|
-
acc.single[coll.address] = {
|
|
327
|
-
mintFee: 1 - +_viem.formatUnits.call(void 0, mintRates[collIdx], 18),
|
|
328
|
-
redeemFee: 1 - +_viem.formatUnits.call(void 0, redeemRates[collIdx], 18)
|
|
329
|
-
};
|
|
330
|
-
acc.basket.mintFee += acc.single[coll.address].mintFee * +_viem.formatUnits.call(void 0, collateralWeights[collIdx], 18);
|
|
331
|
-
acc.basket.redeemFee += acc.single[coll.address].redeemFee * +_viem.formatUnits.call(void 0, collateralWeights[collIdx], 18);
|
|
332
|
-
return acc;
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
single: {},
|
|
336
|
-
basket: { mintFee: 0, redeemFee: 0 }
|
|
337
|
-
}
|
|
338
|
-
);
|
|
339
|
-
} catch (e) {
|
|
340
|
-
console.log(e);
|
|
341
|
-
throw e;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// src/actions/honey/getHoneyPausedState.ts
|
|
346
|
-
var _honey = require('@berachain/abis/honey/honey');
|
|
347
|
-
async function getHoneyPausedState({
|
|
348
|
-
client,
|
|
349
|
-
...args
|
|
350
|
-
}) {
|
|
351
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
352
|
-
const honeyAddress = config.honey.token;
|
|
353
|
-
const honeyPausedState = await client.readContract({
|
|
354
|
-
address: honeyAddress,
|
|
355
|
-
abi: _honey.honeyAbi,
|
|
356
|
-
functionName: "paused"
|
|
357
|
-
});
|
|
358
|
-
return honeyPausedState;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
// src/actions/honey/getHoneyPythPriceOracle.ts
|
|
362
|
-
var _rootPriceOracle = require('@berachain/abis/extras/rootPriceOracle');
|
|
363
|
-
async function getHoneyPythOracle({
|
|
364
|
-
pythOracle,
|
|
365
|
-
publicClient
|
|
366
|
-
}) {
|
|
367
|
-
return publicClient.readContract({
|
|
368
|
-
address: pythOracle,
|
|
369
|
-
abi: _rootPriceOracle.rootPriceOracleAbi,
|
|
370
|
-
functionName: "pythOracle"
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// src/actions/honey/getHoneyRootPriceOracle.ts
|
|
375
|
-
|
|
376
|
-
async function getHoneyRootPriceOracle({
|
|
377
|
-
publicClient,
|
|
378
|
-
factory,
|
|
379
|
-
...args
|
|
380
|
-
}) {
|
|
381
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
382
|
-
return publicClient.readContract({
|
|
383
|
-
address: _nullishCoalesce(factory, () => ( config.honey.factory)),
|
|
384
|
-
abi: _honeyFactory.honeyFactoryAbi,
|
|
385
|
-
functionName: "priceOracle"
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// src/actions/pol/getBlockTime.ts
|
|
390
|
-
async function getBlockTime({
|
|
391
|
-
defaultBlockTime,
|
|
392
|
-
publicClient,
|
|
393
|
-
blocksSpan,
|
|
394
|
-
...args
|
|
395
|
-
}) {
|
|
396
|
-
_chunk7ONKBHXYcjs.assertPublicClient.call(void 0, publicClient);
|
|
397
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
398
|
-
const blockTime = _nullishCoalesce(defaultBlockTime, () => ( config.averageBlockTime));
|
|
399
|
-
const span = _nullishCoalesce(blocksSpan, () => ( Math.floor(_chunk3LXVARBJcjs.hoursInSeconds.call(void 0, 1) / blockTime)));
|
|
400
|
-
const currentBlock = await _optionalChain([publicClient, 'optionalAccess', _4 => _4.getBlock, 'call', _5 => _5({ blockTag: "latest" })]);
|
|
401
|
-
const oldestBlock = await _optionalChain([publicClient, 'optionalAccess', _6 => _6.getBlock, 'call', _7 => _7({
|
|
402
|
-
blockNumber: currentBlock.number - BigInt(span)
|
|
403
|
-
})]);
|
|
404
|
-
return (
|
|
405
|
-
// we need to use current timestamp as the latest block might not have been minted (chain halted)
|
|
406
|
-
(_chunk3LXVARBJcjs.msToSeconds.call(void 0, Date.now()) - Number(_optionalChain([oldestBlock, 'optionalAccess', _8 => _8.timestamp]))) / (Number(_optionalChain([currentBlock, 'optionalAccess', _9 => _9.number])) - Number(_optionalChain([oldestBlock, 'optionalAccess', _10 => _10.number])))
|
|
407
|
-
);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// src/actions/pol/getLSTStakeConfig.ts
|
|
411
|
-
var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');
|
|
412
|
-
async function getLSTStakeConfig({
|
|
413
|
-
tokenList,
|
|
414
|
-
publicClient,
|
|
415
|
-
lstStakingVaults,
|
|
416
|
-
...args
|
|
417
|
-
}) {
|
|
418
|
-
_chunk7ONKBHXYcjs.assertPublicClient.call(void 0, publicClient);
|
|
419
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, {
|
|
420
|
-
...args,
|
|
421
|
-
chainId: _nullishCoalesce(_optionalChain([publicClient, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.id]), () => ( args.chainId))
|
|
422
|
-
});
|
|
423
|
-
const lstStakingTokens = tokenList.filter(
|
|
424
|
-
(token) => lstStakingVaults.includes(token.address)
|
|
425
|
-
);
|
|
426
|
-
if (lstStakingTokens.length === 0) {
|
|
427
|
-
return [];
|
|
428
|
-
}
|
|
429
|
-
const assets = await Promise.all(
|
|
430
|
-
lstStakingTokens.map(async (stakingToken) => {
|
|
431
|
-
const assetTokenAddress = await publicClient.readContract({
|
|
432
|
-
address: stakingToken.address,
|
|
433
|
-
abi: _lstStakerVault.lstStakerVaultAbi,
|
|
434
|
-
functionName: "asset"
|
|
435
|
-
});
|
|
436
|
-
return { assetTokenAddress, stakingToken };
|
|
437
|
-
})
|
|
438
|
-
);
|
|
439
|
-
return assets.reduce(
|
|
440
|
-
(acc, { assetTokenAddress, stakingToken }) => {
|
|
441
|
-
const assetToken = tokenList.find(
|
|
442
|
-
(token) => _chunkHCC4FJTDcjs.isToken.call(void 0, token, assetTokenAddress)
|
|
443
|
-
);
|
|
444
|
-
if (!assetToken) return acc;
|
|
445
|
-
acc.push({
|
|
446
|
-
id: stakingToken.address,
|
|
447
|
-
receiptToken: stakingToken,
|
|
448
|
-
inputTokens: [assetToken]
|
|
449
|
-
});
|
|
450
|
-
return acc;
|
|
451
|
-
},
|
|
452
|
-
[]
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// src/actions/pol/getRewardVaultDurationConstants.ts
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
// src/actions/pol/getRewardVaultBeaconImplementation.ts
|
|
460
|
-
var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');
|
|
461
|
-
|
|
462
|
-
// src/abi/utils/upgradableBeacon.ts
|
|
463
|
-
var upgradableBeaconAbi = [
|
|
464
|
-
{
|
|
465
|
-
inputs: [
|
|
466
|
-
{ internalType: "address", name: "initialOwner", type: "address" },
|
|
467
|
-
{
|
|
468
|
-
internalType: "address",
|
|
469
|
-
name: "initialImplementation",
|
|
470
|
-
type: "address"
|
|
471
|
-
}
|
|
472
|
-
],
|
|
473
|
-
stateMutability: "payable",
|
|
474
|
-
type: "constructor"
|
|
475
|
-
},
|
|
476
|
-
{ inputs: [], name: "NewImplementationHasNoCode", type: "error" },
|
|
477
|
-
{ inputs: [], name: "NewOwnerIsZeroAddress", type: "error" },
|
|
478
|
-
{ inputs: [], name: "Unauthorized", type: "error" },
|
|
479
|
-
{
|
|
480
|
-
anonymous: false,
|
|
481
|
-
inputs: [
|
|
482
|
-
{
|
|
483
|
-
indexed: true,
|
|
484
|
-
internalType: "address",
|
|
485
|
-
name: "oldOwner",
|
|
486
|
-
type: "address"
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
indexed: true,
|
|
490
|
-
internalType: "address",
|
|
491
|
-
name: "newOwner",
|
|
492
|
-
type: "address"
|
|
493
|
-
}
|
|
494
|
-
],
|
|
495
|
-
name: "OwnershipTransferred",
|
|
496
|
-
type: "event"
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
anonymous: false,
|
|
500
|
-
inputs: [
|
|
501
|
-
{
|
|
502
|
-
indexed: true,
|
|
503
|
-
internalType: "address",
|
|
504
|
-
name: "implementation",
|
|
505
|
-
type: "address"
|
|
506
|
-
}
|
|
507
|
-
],
|
|
508
|
-
name: "Upgraded",
|
|
509
|
-
type: "event"
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
inputs: [],
|
|
513
|
-
name: "implementation",
|
|
514
|
-
outputs: [{ internalType: "address", name: "result", type: "address" }],
|
|
515
|
-
stateMutability: "view",
|
|
516
|
-
type: "function"
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
inputs: [],
|
|
520
|
-
name: "owner",
|
|
521
|
-
outputs: [{ internalType: "address", name: "result", type: "address" }],
|
|
522
|
-
stateMutability: "view",
|
|
523
|
-
type: "function"
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
inputs: [],
|
|
527
|
-
name: "renounceOwnership",
|
|
528
|
-
outputs: [],
|
|
529
|
-
stateMutability: "nonpayable",
|
|
530
|
-
type: "function"
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
|
|
534
|
-
name: "transferOwnership",
|
|
535
|
-
outputs: [],
|
|
536
|
-
stateMutability: "nonpayable",
|
|
537
|
-
type: "function"
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
inputs: [
|
|
541
|
-
{ internalType: "address", name: "newImplementation", type: "address" }
|
|
542
|
-
],
|
|
543
|
-
name: "upgradeTo",
|
|
544
|
-
outputs: [],
|
|
545
|
-
stateMutability: "nonpayable",
|
|
546
|
-
type: "function"
|
|
547
|
-
}
|
|
548
|
-
];
|
|
549
|
-
|
|
550
|
-
// src/actions/pol/getRewardVaultBeaconImplementation.ts
|
|
551
|
-
async function getRewardVaultBeaconImplementation({
|
|
552
|
-
publicClient,
|
|
553
|
-
...args
|
|
554
|
-
}) {
|
|
555
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
556
|
-
const factoryAddress = config.pol.factory;
|
|
557
|
-
_chunk7ONKBHXYcjs.assertDefined.call(void 0, publicClient, "publicClient");
|
|
558
|
-
_chunk7ONKBHXYcjs.assertAddress.call(void 0, config.pol.factory, "factoryAddress");
|
|
559
|
-
const beacon = await publicClient.readContract({
|
|
560
|
-
address: factoryAddress,
|
|
561
|
-
abi: _rewardVaultFactory.rewardVaultFactoryAbi,
|
|
562
|
-
functionName: "beacon"
|
|
563
|
-
});
|
|
564
|
-
return publicClient.readContract({
|
|
565
|
-
address: beacon,
|
|
566
|
-
abi: upgradableBeaconAbi,
|
|
567
|
-
functionName: "implementation"
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
// src/actions/pol/getRewardVaultDurationConstants.ts
|
|
572
|
-
async function getRewardVaultDurationConstants({
|
|
573
|
-
publicClient,
|
|
574
|
-
...baseArgs
|
|
575
|
-
}) {
|
|
576
|
-
_chunk7ONKBHXYcjs.assertPublicClient.call(void 0, publicClient);
|
|
577
|
-
const beaconImplementation = await getRewardVaultBeaconImplementation({
|
|
578
|
-
publicClient,
|
|
579
|
-
...baseArgs
|
|
580
|
-
});
|
|
581
|
-
const [minRewardDuration, maxRewardDuration] = await Promise.all([
|
|
582
|
-
publicClient.readContract({
|
|
583
|
-
address: beaconImplementation,
|
|
584
|
-
abi: _rewardVault.rewardVaultAbi,
|
|
585
|
-
functionName: "MIN_REWARD_DURATION"
|
|
586
|
-
}),
|
|
587
|
-
publicClient.readContract({
|
|
588
|
-
address: beaconImplementation,
|
|
589
|
-
abi: _rewardVault.rewardVaultAbi,
|
|
590
|
-
functionName: "MAX_REWARD_DURATION"
|
|
591
|
-
})
|
|
592
|
-
]);
|
|
593
|
-
return {
|
|
594
|
-
minRewardDuration: Number(minRewardDuration),
|
|
595
|
-
maxRewardDuration: Number(maxRewardDuration)
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
// src/actions/pol/getRewardVaultFromToken.ts
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
async function getRewardVaultFromToken({
|
|
603
|
-
tokenAddress,
|
|
604
|
-
publicClient,
|
|
605
|
-
factoryAddress,
|
|
606
|
-
...args
|
|
607
|
-
}) {
|
|
608
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
609
|
-
const vaultAddress = await publicClient.readContract({
|
|
610
|
-
address: _nullishCoalesce(factoryAddress, () => ( config.pol.factory)),
|
|
611
|
-
abi: _rewardVaultFactory.rewardVaultFactoryAbi,
|
|
612
|
-
functionName: "getVault",
|
|
613
|
-
args: [tokenAddress]
|
|
614
|
-
});
|
|
615
|
-
if (vaultAddress === _viem.zeroAddress) {
|
|
616
|
-
return null;
|
|
617
|
-
}
|
|
618
|
-
return vaultAddress;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
// src/actions/pyth/getHoneyPythFeeds.ts
|
|
622
|
-
var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');
|
|
623
|
-
async function getHoneyPythFeeds({
|
|
624
|
-
tokenList,
|
|
625
|
-
publicClient,
|
|
626
|
-
...args
|
|
627
|
-
}) {
|
|
628
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
629
|
-
try {
|
|
630
|
-
const priceFeedIds = await Promise.all(
|
|
631
|
-
tokenList.map(
|
|
632
|
-
(token) => publicClient.readContract({
|
|
633
|
-
address: config.honey.pythOracle,
|
|
634
|
-
abi: _pythPriceOracle.pythPriceOracleAbi,
|
|
635
|
-
functionName: "feeds",
|
|
636
|
-
args: [token]
|
|
637
|
-
})
|
|
638
|
-
)
|
|
639
|
-
);
|
|
640
|
-
return tokenList.reduce(
|
|
641
|
-
(acc, token, index) => ({
|
|
642
|
-
...acc,
|
|
643
|
-
[token]: priceFeedIds[index]
|
|
644
|
-
}),
|
|
645
|
-
{}
|
|
646
|
-
);
|
|
647
|
-
} catch (e) {
|
|
648
|
-
console.error("getPythPriceFeedId", e);
|
|
649
|
-
throw e;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// src/actions/tokens/getTokens.ts
|
|
654
|
-
async function getTokens({
|
|
655
|
-
url,
|
|
656
|
-
...args
|
|
657
|
-
} = {}) {
|
|
658
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
659
|
-
const tokenList = await _chunk3LXVARBJcjs.beraFetchJson.call(void 0, {
|
|
660
|
-
url: _nullishCoalesce(url, () => ( config.lists.tokenList)),
|
|
661
|
-
type: "rest",
|
|
662
|
-
name: "GitHub"
|
|
663
|
-
});
|
|
664
|
-
return _nullishCoalesce(tokenList.tokens, () => ( []));
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
// src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts
|
|
668
|
-
var _bgt = require('@berachain/abis/pol/bgt');
|
|
669
|
-
|
|
670
|
-
async function getActiveBoostAndCommissionChangeDelay({
|
|
671
|
-
publicClient,
|
|
672
|
-
ui,
|
|
673
|
-
...args
|
|
674
|
-
}) {
|
|
675
|
-
const { config } = _chunkHCC4FJTDcjs.parseBaseArgs.call(void 0, args);
|
|
676
|
-
const [
|
|
677
|
-
maxCommissionRate,
|
|
678
|
-
commissionChangeDelay,
|
|
679
|
-
rewardAllocationBlockDelay,
|
|
680
|
-
maxWeightPerVault,
|
|
681
|
-
maxNumWeightsPerRewardAllocation,
|
|
682
|
-
dropBoostDelay,
|
|
683
|
-
activateBoostDelay,
|
|
684
|
-
rewardAllocationInactivityBlockSpan
|
|
685
|
-
] = await Promise.all([
|
|
686
|
-
publicClient.readContract({
|
|
687
|
-
address: config.pol.beraChef,
|
|
688
|
-
abi: _beraChef.beraChefAbi,
|
|
689
|
-
functionName: "MAX_COMMISSION_RATE"
|
|
690
|
-
}),
|
|
691
|
-
publicClient.readContract({
|
|
692
|
-
address: config.pol.beraChef,
|
|
693
|
-
abi: _beraChef.beraChefAbi,
|
|
694
|
-
functionName: "commissionChangeDelay"
|
|
695
|
-
}),
|
|
696
|
-
publicClient.readContract({
|
|
697
|
-
address: config.pol.beraChef,
|
|
698
|
-
abi: _beraChef.beraChefAbi,
|
|
699
|
-
functionName: "rewardAllocationBlockDelay"
|
|
700
|
-
}),
|
|
701
|
-
publicClient.readContract({
|
|
702
|
-
address: config.pol.beraChef,
|
|
703
|
-
abi: _beraChef.beraChefAbi,
|
|
704
|
-
functionName: "maxWeightPerVault"
|
|
705
|
-
}),
|
|
706
|
-
publicClient.readContract({
|
|
707
|
-
address: config.pol.beraChef,
|
|
708
|
-
abi: _beraChef.beraChefAbi,
|
|
709
|
-
functionName: "maxNumWeightsPerRewardAllocation"
|
|
710
|
-
}),
|
|
711
|
-
publicClient.readContract({
|
|
712
|
-
address: config.tokens.bgt,
|
|
713
|
-
abi: _bgt.bgtAbi,
|
|
714
|
-
functionName: "dropBoostDelay"
|
|
715
|
-
}),
|
|
716
|
-
publicClient.readContract({
|
|
717
|
-
address: config.tokens.bgt,
|
|
718
|
-
abi: _bgt.bgtAbi,
|
|
719
|
-
functionName: "activateBoostDelay"
|
|
720
|
-
}),
|
|
721
|
-
publicClient.readContract({
|
|
722
|
-
address: config.pol.beraChef,
|
|
723
|
-
abi: _beraChef.beraChefAbi,
|
|
724
|
-
functionName: "rewardAllocationInactivityBlockSpan"
|
|
725
|
-
})
|
|
726
|
-
]);
|
|
727
|
-
return {
|
|
728
|
-
maxCommissionRate: Number(maxCommissionRate) / 1e4,
|
|
729
|
-
boostDelay: Number(activateBoostDelay),
|
|
730
|
-
unboostDelay: Number(dropBoostDelay),
|
|
731
|
-
commissionChangeDelay: Number(commissionChangeDelay),
|
|
732
|
-
rewardAllocationBlockDelay: Number(rewardAllocationBlockDelay),
|
|
733
|
-
maxWeightPerVault: Number(maxWeightPerVault) / 1e4,
|
|
734
|
-
maxNumWeightsPerRewardAllocation: Number(maxNumWeightsPerRewardAllocation),
|
|
735
|
-
rewardAllocationInactivityBlockSpan: Number(
|
|
736
|
-
rewardAllocationInactivityBlockSpan
|
|
737
|
-
),
|
|
738
|
-
ui
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
// src/actions/validators/utils/aggregateValidatorIncentives.ts
|
|
743
|
-
function aggregateValidatorIncentives({
|
|
744
|
-
rewardAllocationWeights,
|
|
745
|
-
activeOnly = true
|
|
746
|
-
}) {
|
|
747
|
-
const map = rewardAllocationWeights.filter((x) => _optionalChain([x, 'optionalAccess', _13 => _13.receivingVault])).reduce((acc, rv) => {
|
|
748
|
-
for (const incentive of _nullishCoalesce(_optionalChain([rv, 'access', _14 => _14.receivingVault, 'optionalAccess', _15 => _15.activeIncentives]), () => ( []))) {
|
|
749
|
-
if (activeOnly && incentive.remainingAmount === "0") {
|
|
750
|
-
continue;
|
|
751
|
-
}
|
|
752
|
-
const incentiveRate = new (0, _chunk3LXVARBJcjs.bignumber_js_default)(incentive.incentiveRate).times(
|
|
753
|
-
rv.percentage
|
|
754
|
-
);
|
|
755
|
-
const incentiveRateUsd = new (0, _chunk3LXVARBJcjs.bignumber_js_default)(
|
|
756
|
-
incentive.incentiveRateUsd
|
|
757
|
-
).times(rv.percentage);
|
|
758
|
-
const token = incentive.token.address.toLowerCase();
|
|
759
|
-
const existing = acc.get(token);
|
|
760
|
-
if (existing) {
|
|
761
|
-
acc.set(token, {
|
|
762
|
-
...existing,
|
|
763
|
-
incentiveRate: new (0, _chunk3LXVARBJcjs.bignumber_js_default)(existing.incentiveRate).plus(incentiveRate).toString(),
|
|
764
|
-
incentiveRateUsd: new (0, _chunk3LXVARBJcjs.bignumber_js_default)(existing.incentiveRateUsd).plus(incentiveRateUsd).toString(),
|
|
765
|
-
remainingAmount: new (0, _chunk3LXVARBJcjs.bignumber_js_default)(existing.remainingAmount).plus(incentive.remainingAmount).toString(),
|
|
766
|
-
remainingAmountUsd: new (0, _chunk3LXVARBJcjs.bignumber_js_default)(existing.remainingAmountUsd).plus(incentive.remainingAmountUsd).toString()
|
|
767
|
-
});
|
|
768
|
-
} else {
|
|
769
|
-
acc.set(token, {
|
|
770
|
-
...incentive,
|
|
771
|
-
tokenAddress: incentive.token.address,
|
|
772
|
-
token: incentive.token,
|
|
773
|
-
incentiveRate: incentiveRate.toString(),
|
|
774
|
-
incentiveRateUsd: incentiveRateUsd.toString(),
|
|
775
|
-
remainingAmount: incentive.remainingAmount
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
return acc;
|
|
780
|
-
}, /* @__PURE__ */ new Map());
|
|
781
|
-
return Array.from(map.values());
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
// src/actions/validators/utils/getValidatorBoostApy.ts
|
|
785
|
-
function getValidatorReturnPerBgt(validator) {
|
|
786
|
-
return _optionalChain([validator, 'optionalAccess', _16 => _16.rewardAllocationWeights, 'optionalAccess', _17 => _17.reduce, 'call', _18 => _18((acc, ab) => {
|
|
787
|
-
if (!ab) return acc;
|
|
788
|
-
const totalIncentiveValue = _nullishCoalesce(_optionalChain([ab, 'access', _19 => _19.receivingVault, 'optionalAccess', _20 => _20.activeIncentives, 'access', _21 => _21.filter, 'call', _22 => _22((inc) => Number(inc.remainingAmount) > 0), 'access', _23 => _23.reduce, 'call', _24 => _24((totalIncentiveValue2, currIncentive) => {
|
|
789
|
-
const tokenPrice = Number(currIncentive.remainingAmountUsd) / Number(currIncentive.remainingAmount);
|
|
790
|
-
return totalIncentiveValue2 + Number(currIncentive.incentiveRate) * tokenPrice;
|
|
791
|
-
}, 0)]), () => ( 0));
|
|
792
|
-
return acc + totalIncentiveValue * ab.percentage;
|
|
793
|
-
}, 0)]);
|
|
794
|
-
}
|
|
795
|
-
function getValidatorBoostApy({
|
|
796
|
-
validator,
|
|
797
|
-
bgtPrice
|
|
798
|
-
}) {
|
|
799
|
-
const validatorActiveBoostAmount = Number(
|
|
800
|
-
_nullishCoalesce(_optionalChain([validator, 'access', _25 => _25.dynamicData, 'optionalAccess', _26 => _26.activeBoostAmount]), () => ( 0))
|
|
801
|
-
);
|
|
802
|
-
const returnPerBgt = getValidatorReturnPerBgt(validator);
|
|
803
|
-
if (!returnPerBgt || !validatorActiveBoostAmount) {
|
|
804
|
-
return 0;
|
|
805
|
-
}
|
|
806
|
-
const boostApy = returnPerBgt * Number(_nullishCoalesce(_optionalChain([validator, 'access', _27 => _27.dynamicData, 'optionalAccess', _28 => _28.lastDayDistributedBGTAmount]), () => ( 0))) * 365 / (validatorActiveBoostAmount * bgtPrice);
|
|
807
|
-
return boostApy;
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
exports.BalancerApi = _chunkA7P3JVU7cjs.BalancerApi; exports.BaseAggregator = _chunkA7P3JVU7cjs.BaseAggregator; exports.BeraApolloClient = _chunkA7P3JVU7cjs.BeraApolloClient; exports.HoneyPreviewMethod = _chunkA7P3JVU7cjs.HoneyPreviewMethod; exports.MOCKED_PROPOSAL_STATUSES = _chunkA7P3JVU7cjs.MOCKED_PROPOSAL_STATUSES; exports.RewardVaultDistributionMode = _chunkA7P3JVU7cjs.RewardVaultDistributionMode; exports.aggregateValidatorIncentives = aggregateValidatorIncentives; exports.beraWriteContract = _chunkA7P3JVU7cjs.beraWriteContract; exports.checkProposalField = _chunkA7P3JVU7cjs.checkProposalField; exports.computeActualStatus = _chunkA7P3JVU7cjs.computeActualStatus; exports.formatValidatorRewardAllocation = _chunkA7P3JVU7cjs.formatValidatorRewardAllocation; exports.getActiveBoostAndCommissionChangeDelay = getActiveBoostAndCommissionChangeDelay; exports.getAllPools = _chunkA7P3JVU7cjs.getAllPools; exports.getAllProposals = _chunkA7P3JVU7cjs.getAllProposals; exports.getAllValidators = _chunkA7P3JVU7cjs.getAllValidators; exports.getAllowances = _chunkA7P3JVU7cjs.getAllowances; exports.getApiEnrichedAllocation = _chunkA7P3JVU7cjs.getApiEnrichedAllocation; exports.getApiPool = _chunkA7P3JVU7cjs.getApiPool; exports.getApiValidator = _chunkA7P3JVU7cjs.getApiValidator; exports.getApolloClient = _chunkA7P3JVU7cjs.getApolloClient; exports.getBalanceCall = _chunk2LL77B3Tcjs.getBalanceCall; exports.getBgtAprSimulation = _chunkA7P3JVU7cjs.getBgtAprSimulation; exports.getBlockTime = getBlockTime; exports.getBlockTimestamp = _chunkA7P3JVU7cjs.getBlockTimestamp; exports.getBodyErrors = _chunkA7P3JVU7cjs.getBodyErrors; exports.getChartData = _chunkA7P3JVU7cjs.getChartData; exports.getCollateralWeights = _chunkA7P3JVU7cjs.getCollateralWeights; exports.getConvertToAssets = _chunkA7P3JVU7cjs.getConvertToAssets; exports.getDailyValidatorBlockStats = _chunkA7P3JVU7cjs.getDailyValidatorBlockStats; exports.getDecodedFunctionData = getDecodedFunctionData; exports.getDefaultRewardAllocation = _chunkA7P3JVU7cjs.getDefaultRewardAllocation; exports.getEarnedStakedBeraVault = _chunkA7P3JVU7cjs.getEarnedStakedBeraVault; exports.getEnsoClient = _chunk2LL77B3Tcjs.getEnsoClient; exports.getGlobalCapLimit = _chunkA7P3JVU7cjs.getGlobalCapLimit; exports.getGlobalData = _chunkA7P3JVU7cjs.getGlobalData; exports.getGlobalLiquidityAndSwapVolume = _chunkA7P3JVU7cjs.getGlobalLiquidityAndSwapVolume; exports.getHoneyCollaterals = _chunkA7P3JVU7cjs.getHoneyCollaterals; exports.getHoneyFees = getHoneyFees; exports.getHoneyGlobalData = _chunkA7P3JVU7cjs.getHoneyGlobalData; exports.getHoneyPausedState = getHoneyPausedState; exports.getHoneyPreview = _chunkA7P3JVU7cjs.getHoneyPreview; exports.getHoneyPythFeeds = getHoneyPythFeeds; exports.getHoneyPythOracle = getHoneyPythOracle; exports.getHoneyRootPriceOracle = getHoneyRootPriceOracle; exports.getHoneyVaultsBalance = _chunkA7P3JVU7cjs.getHoneyVaultsBalance; exports.getIncentiveFeeClaimStats = _chunkA7P3JVU7cjs.getIncentiveFeeClaimStats; exports.getLSTStakeConfig = getLSTStakeConfig; exports.getMarkets = _chunkA7P3JVU7cjs.getMarkets; exports.getMaxDeposit = getMaxDeposit; exports.getOnChainPool = _chunkA7P3JVU7cjs.getOnChainPool; exports.getPoolEvents = _chunkA7P3JVU7cjs.getPoolEvents; exports.getPoolHistoricalData = _chunkA7P3JVU7cjs.getPoolHistoricalData; exports.getPoolPausedState = _chunkA7P3JVU7cjs.getPoolPausedState; exports.getPoolState = getPoolState; exports.getProposalDetails = _chunkA7P3JVU7cjs.getProposalDetails; exports.getProposalFromTx = _chunkA7P3JVU7cjs.getProposalFromTx; exports.getProposalVotes = _chunkA7P3JVU7cjs.getProposalVotes; exports.getPythLatestPrices = _chunkA7P3JVU7cjs.getPythLatestPrices; exports.getPythUpdateFee = _chunkA7P3JVU7cjs.getPythUpdateFee; exports.getRelativeCapLimit = _chunkA7P3JVU7cjs.getRelativeCapLimit; exports.getRewardProofsByValidator = _chunkA7P3JVU7cjs.getRewardProofsByValidator; exports.getRewardTokenToBeraRate = _chunkA7P3JVU7cjs.getRewardTokenToBeraRate; exports.getRewardVault = _chunkA7P3JVU7cjs.getRewardVault; exports.getRewardVaultDurationConstants = getRewardVaultDurationConstants; exports.getRewardVaultFromToken = getRewardVaultFromToken; exports.getRewardVaultIncentives = _chunkA7P3JVU7cjs.getRewardVaultIncentives; exports.getRewardVaultRewards = _chunkA7P3JVU7cjs.getRewardVaultRewards; exports.getRewardVaultStakingToken = _chunkA7P3JVU7cjs.getRewardVaultStakingToken; exports.getRewardVaults = _chunkA7P3JVU7cjs.getRewardVaults; exports.getSWBeraVaultMetadata = _chunkA7P3JVU7cjs.getSWBeraVaultMetadata; exports.getSWBeraWithdrawal = _chunkA7P3JVU7cjs.getSWBeraWithdrawal; exports.getStakeWithdrawalCooldown = _chunkA7P3JVU7cjs.getStakeWithdrawalCooldown; exports.getStakedBeraAPR = _chunkA7P3JVU7cjs.getStakedBeraAPR; exports.getStakedBeraSnapshots = _chunkA7P3JVU7cjs.getStakedBeraSnapshots; exports.getStakingPoolBatch = _chunkA7P3JVU7cjs.getStakingPoolBatch; exports.getSwapPayload = _chunkA7P3JVU7cjs.getSwapPayload; exports.getTokenCurrentPrices = _chunkA7P3JVU7cjs.getTokenCurrentPrices; exports.getTokenInformation = _chunkA7P3JVU7cjs.getTokenInformation; exports.getTokens = getTokens; exports.getTotalStakedAmount = _chunkA7P3JVU7cjs.getTotalStakedAmount; exports.getUserActiveValidators = _chunkA7P3JVU7cjs.getUserActiveValidators; exports.getUserBoostsOnValidator = _chunkA7P3JVU7cjs.getUserBoostsOnValidator; exports.getUserClaimableIncentives = _chunkA7P3JVU7cjs.getUserClaimableIncentives; exports.getUserStakingPositions = _chunkA7P3JVU7cjs.getUserStakingPositions; exports.getUserVaultInfo = _chunkA7P3JVU7cjs.getUserVaultInfo; exports.getUserVaults = _chunkA7P3JVU7cjs.getUserVaults; exports.getUserVaultsReward = _chunkA7P3JVU7cjs.getUserVaultsReward; exports.getValidatorAnalytics = _chunkA7P3JVU7cjs.getValidatorAnalytics; exports.getValidatorBoostApy = getValidatorBoostApy; exports.getValidatorCommission = _chunkA7P3JVU7cjs.getValidatorCommission; exports.getValidatorEstimatedBgtPerYear = _chunkA7P3JVU7cjs.getValidatorEstimatedBgtPerYear; exports.getValidatorOperatorAddress = _chunkA7P3JVU7cjs.getValidatorOperatorAddress; exports.getValidatorQueuedCommission = _chunkA7P3JVU7cjs.getValidatorQueuedCommission; exports.getValidatorQueuedOperatorAddress = _chunkA7P3JVU7cjs.getValidatorQueuedOperatorAddress; exports.getValidatorQueuedRewardAllocation = _chunkA7P3JVU7cjs.getValidatorQueuedRewardAllocation; exports.getValidatorReturnPerBgt = getValidatorReturnPerBgt; exports.getValidatorRewardAllocation = _chunkA7P3JVU7cjs.getValidatorRewardAllocation; exports.getVaultHistory = _chunkA7P3JVU7cjs.getVaultHistory; exports.getVaultPausedState = getVaultPausedState; exports.getVaultValidators = _chunkA7P3JVU7cjs.getVaultValidators; exports.getWalletBalances = _chunk2LL77B3Tcjs.getWalletBalances; exports.gql = _chunkA7P3JVU7cjs.gql; exports.isBadCollateralAsset = _chunkA7P3JVU7cjs.isBadCollateralAsset; exports.isBasketModeEnabled = _chunkA7P3JVU7cjs.isBasketModeEnabled; exports.isDefaultRewardAllocation = _chunkA7P3JVU7cjs.isDefaultRewardAllocation; exports.isImpersonateAccount = _chunkA7P3JVU7cjs.isImpersonateAccount; exports.isSameRewardAllocation = _chunkA7P3JVU7cjs.isSameRewardAllocation; exports.parseProposalBody = _chunkA7P3JVU7cjs.parseProposalBody;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkMGGPHKA2cjs = require('../chunk-MGGPHKA2.cjs');require('../chunk-OUD27MU7.cjs');var _chunkUFIM7WQ4cjs = require('../chunk-UFIM7WQ4.cjs');require('../chunk-OIYXOKTT.cjs');require('../chunk-WRFDB3QJ.cjs');var _chunkKT6L4K4Kcjs = require('../chunk-KT6L4K4K.cjs');var _chunkZYXVUXFQcjs = require('../chunk-ZYXVUXFQ.cjs');require('../chunk-DTBJO6VT.cjs');var _chunkQFLDL4UVcjs = require('../chunk-QFLDL4UV.cjs');require('../chunk-53TSJM6P.cjs');var _viem = require('viem');var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');async function _t({vaultAddress:e,publicClient:t}){let r=await t.readContract({address:e,abi:_metaMorphoV11.metaMorphoV11Abi,functionName:"maxDeposit",args:[e]});return _viem.formatEther.call(void 0, r)}var _berancersdk = require('@berachain-foundation/berancer-sdk');var Gt=e=>({type:_berancersdk.mapPoolType.call(void 0, e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});var _vault = require('@berachain/abis/bex/vault');async function zt({publicClient:e,...t}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t);return(await e.readContract({address:r.bex.vault,abi:_vault.vaultAbi,functionName:"getPausedState"}))[0]}var _internal = require('@berachain/config/internal');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');function L(e){return e.some(t=>{let r=t;return r.name==="implementation"||r.name==="proxyType"||r.type==="constructor"&&_optionalChain([r, 'access', _2 => _2.inputs, 'optionalAccess', _3 => _3[0], 'optionalAccess', _4 => _4.name])==="implementation"})}async function F({contractAddress:e,chainId:t,publicClient:r}){let o=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${e}&apikey=${_internal.appConfig.apiKeys.private.etherscan}&chainId=${t}`,n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch ABI: ${n.statusText}`);let a=await n.json();if(a.status==="0")throw new Error(a.result);let m=JSON.parse(a.result);if(!L(m))return m;let i=await r.getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!i||_viem.trim.call(void 0, i)==="0x00")return m;let s=_viem.pad.call(void 0, _viem.trim.call(void 0, i),{size:20});return F({contractAddress:s,chainId:t,publicClient:r})}async function q({address:e,callData:t,knownAbi:r,chainId:o,publicClient:n}){try{if(_viem.decodeFunctionData.call(void 0, {data:t,abi:r}))return r}catch (e2){}return F({contractAddress:e,chainId:o,publicClient:n}).catch(()=>{})}function z(e,t){try{return _viem.decodeFunctionData.call(void 0, {data:e,abi:t})}catch (e3){return}}function X(e,t){return e.find(r=>r.type==="function"&&r.name===t)}function j(e){if(e)try{return _viem.toFunctionSignature.call(void 0, e)}catch(t){console.error(t)}}async function Yt({address:e,callData:t,chainId:r=_internal.defaultChainId,publicClient:o}){let n=[..._beraChef.beraChefAbi,..._rewardVault.rewardVaultAbi,..._viem.erc20Abi],a=await q({address:e,callData:t,knownAbi:n,chainId:r,publicClient:o}),m=z(t,a);if(!a||!m)return{args:[]};let i=X(a,m.functionName),s=j(i);return{abiItem:i,functionSignature:s,functionName:m.functionName,args:m.args}}var _honeyFactory = require('@berachain/abis/honey/honeyFactory');async function nr({client:e,collateralList:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r);try{let n={mint:[],redeem:[]};for(let s of t)n.mint.push(e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"mintRates",args:[s.address]})),n.redeem.push(e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"redeemRates",args:[s.address]}));let[a,m,i]=await Promise.all([Promise.all(n.mint),Promise.all(n.redeem),e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"getWeights"})]);return t.reduce((s,c)=>{let p=t.indexOf(c);return s.single[c.address]={mintFee:1-+_viem.formatUnits.call(void 0, a[p],18),redeemFee:1-+_viem.formatUnits.call(void 0, m[p],18)},s.basket.mintFee+=s.single[c.address].mintFee*+_viem.formatUnits.call(void 0, i[p],18),s.basket.redeemFee+=s.single[c.address].redeemFee*+_viem.formatUnits.call(void 0, i[p],18),s},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(n){throw console.log(n),n}}var _honey = require('@berachain/abis/honey/honey');async function mr({client:e,...t}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t),o=r.honey.token;return await e.readContract({address:o,abi:_honey.honeyAbi,functionName:"paused"})}var _rootPriceOracle = require('@berachain/abis/extras/rootPriceOracle');async function pr({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:_rootPriceOracle.rootPriceOracleAbi,functionName:"pythOracle"})}async function gr({publicClient:e,factory:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r);return e.readContract({address:_nullishCoalesce(t, () => (o.honey.factory)),abi:_honeyFactory.honeyFactoryAbi,functionName:"priceOracle"})}async function hr({defaultBlockTime:e,publicClient:t,blocksSpan:r,...o}){_chunkQFLDL4UVcjs.c.call(void 0, t);let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, o),a=_nullishCoalesce(e, () => (n.averageBlockTime)),m=_nullishCoalesce(r, () => (Math.floor(_chunkKT6L4K4Kcjs.q.call(void 0, 1)/a))),i=await _optionalChain([t, 'optionalAccess', _5 => _5.getBlock, 'call', _6 => _6({blockTag:"latest"})]),s=await _optionalChain([t, 'optionalAccess', _7 => _7.getBlock, 'call', _8 => _8({blockNumber:i.number-BigInt(m)})]);return(_chunkKT6L4K4Kcjs.l.call(void 0, Date.now())-Number(_optionalChain([s, 'optionalAccess', _9 => _9.timestamp])))/(Number(_optionalChain([i, 'optionalAccess', _10 => _10.number]))-Number(_optionalChain([s, 'optionalAccess', _11 => _11.number])))}var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');async function Fr({tokenList:e,publicClient:t,lstStakingVaults:r,...o}){_chunkQFLDL4UVcjs.c.call(void 0, t);let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, {...o,chainId:_nullishCoalesce(_optionalChain([t, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]), () => (o.chainId))}),a=e.filter(i=>r.includes(i.address));return a.length===0?[]:(await Promise.all(a.map(async i=>({assetTokenAddress:await t.readContract({address:i.address,abi:_lstStakerVault.lstStakerVaultAbi,functionName:"asset"}),stakingToken:i})))).reduce((i,{assetTokenAddress:s,stakingToken:c})=>{let p=e.find(y=>_chunkZYXVUXFQcjs.e.call(void 0, y,s));return p&&i.push({id:c.address,receiptToken:c,inputTokens:[p]}),i},[])}var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');var N=[{inputs:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"address",name:"initialImplementation",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"NewImplementationHasNoCode",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"}];async function S({publicClient:e,...t}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t),o=r.pol.factory;_chunkQFLDL4UVcjs.b.call(void 0, e,"publicClient"),_chunkQFLDL4UVcjs.d.call(void 0, r.pol.factory,"factoryAddress");let n=await e.readContract({address:o,abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"beacon"});return e.readContract({address:n,abi:N,functionName:"implementation"})}async function Wr({publicClient:e,...t}){_chunkQFLDL4UVcjs.c.call(void 0, e);let r=await S({publicClient:e,...t}),[o,n]=await Promise.all([e.readContract({address:r,abi:_rewardVault.rewardVaultAbi,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:r,abi:_rewardVault.rewardVaultAbi,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(o),maxRewardDuration:Number(n)}}async function Er({tokenAddress:e,publicClient:t,factoryAddress:r,...o}){let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, o),a=await t.readContract({address:_nullishCoalesce(r, () => (n.pol.factory)),abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"getVault",args:[e]});return a===_viem.zeroAddress?null:a}var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');async function qr({tokenList:e,publicClient:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r);try{let n=await Promise.all(e.map(a=>t.readContract({address:o.honey.pythOracle,abi:_pythPriceOracle.pythPriceOracleAbi,functionName:"feeds",args:[a]})));return e.reduce((a,m,i)=>({...a,[m]:n[i]}),{})}catch(n){throw console.error("getPythPriceFeedId",n),n}}async function Kr({url:e,...t}={}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t);return await _asyncNullishCoalesce((await _chunkKT6L4K4Kcjs.d.call(void 0, {url:_nullishCoalesce(e, () => (r.lists.tokenList)),type:"rest",name:"GitHub"})).tokens, async () => ([]))}var _bgt = require('@berachain/abis/pol/bgt');async function to({publicClient:e,ui:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r),[n,a,m,i,s,c,p,y]=await Promise.all([e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"commissionChangeDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxWeightPerVault"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:o.tokens.bgt,abi:_bgt.bgtAbi,functionName:"dropBoostDelay"}),e.readContract({address:o.tokens.bgt,abi:_bgt.bgtAbi,functionName:"activateBoostDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(n)/1e4,boostDelay:Number(p),unboostDelay:Number(c),commissionChangeDelay:Number(a),rewardAllocationBlockDelay:Number(m),maxWeightPerVault:Number(i)/1e4,maxNumWeightsPerRewardAllocation:Number(s),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function no({rewardAllocationWeights:e,activeOnly:t=!0}){let r=e.filter(o=>_optionalChain([o, 'optionalAccess', _14 => _14.receivingVault])).reduce((o,n)=>{for(let a of _nullishCoalesce(_optionalChain([n, 'access', _15 => _15.receivingVault, 'optionalAccess', _16 => _16.activeIncentives]), () => ([]))){if(t&&a.remainingAmount==="0")continue;let m=new (0, _chunkKT6L4K4Kcjs.a)(a.incentiveRate).times(n.percentage),i=new (0, _chunkKT6L4K4Kcjs.a)(a.incentiveRateUsd).times(n.percentage),s=a.token.address.toLowerCase(),c=o.get(s);c?o.set(s,{...c,incentiveRate:new (0, _chunkKT6L4K4Kcjs.a)(c.incentiveRate).plus(m).toString(),incentiveRateUsd:new (0, _chunkKT6L4K4Kcjs.a)(c.incentiveRateUsd).plus(i).toString(),remainingAmount:new (0, _chunkKT6L4K4Kcjs.a)(c.remainingAmount).plus(a.remainingAmount).toString(),remainingAmountUsd:new (0, _chunkKT6L4K4Kcjs.a)(c.remainingAmountUsd).plus(a.remainingAmountUsd).toString()}):o.set(s,{...a,tokenAddress:a.token.address,token:a.token,incentiveRate:m.toString(),incentiveRateUsd:i.toString(),remainingAmount:a.remainingAmount})}return o},new Map);return Array.from(r.values())}function ne(e){return _optionalChain([e, 'optionalAccess', _17 => _17.rewardAllocationWeights, 'optionalAccess', _18 => _18.reduce, 'call', _19 => _19((t,r)=>{if(!r)return t;let o=_nullishCoalesce(_optionalChain([r, 'access', _20 => _20.receivingVault, 'optionalAccess', _21 => _21.activeIncentives, 'access', _22 => _22.filter, 'call', _23 => _23(n=>Number(n.remainingAmount)>0), 'access', _24 => _24.reduce, 'call', _25 => _25((n,a)=>{let m=Number(a.remainingAmountUsd)/Number(a.remainingAmount);return n+Number(a.incentiveRate)*m},0)]), () => (0));return t+o*r.percentage},0)])}function io({validator:e,bgtPrice:t}){let r=Number(_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.dynamicData, 'optionalAccess', _27 => _27.activeBoostAmount]), () => (0))),o=ne(e);return!o||!r?0:o*Number(_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.dynamicData, 'optionalAccess', _29 => _29.lastDayDistributedBGTAmount]), () => (0)))*365/(r*t)}exports.BalancerApi = _chunkMGGPHKA2cjs.f; exports.BaseAggregator = _chunkMGGPHKA2cjs.e; exports.BeraApolloClient = _chunkMGGPHKA2cjs.b; exports.HoneyPreviewMethod = _chunkMGGPHKA2cjs.D; exports.MOCKED_PROPOSAL_STATUSES = _chunkMGGPHKA2cjs.o; exports.RewardVaultDistributionMode = _chunkMGGPHKA2cjs.M; exports.aggregateValidatorIncentives = no; exports.beraWriteContract = _chunkMGGPHKA2cjs.ma; exports.checkProposalField = _chunkMGGPHKA2cjs.n; exports.computeActualStatus = _chunkMGGPHKA2cjs.p; exports.formatValidatorRewardAllocation = _chunkMGGPHKA2cjs.ra; exports.getActiveBoostAndCommissionChangeDelay = to; exports.getAllPools = _chunkMGGPHKA2cjs.g; exports.getAllProposals = _chunkMGGPHKA2cjs.q; exports.getAllValidators = _chunkMGGPHKA2cjs.na; exports.getAllowances = _chunkMGGPHKA2cjs.ka; exports.getApiEnrichedAllocation = _chunkMGGPHKA2cjs.oa; exports.getApiPool = _chunkMGGPHKA2cjs.h; exports.getApiValidator = _chunkMGGPHKA2cjs.pa; exports.getApolloClient = _chunkMGGPHKA2cjs.c; exports.getBalanceCall = _chunkUFIM7WQ4cjs.b; exports.getBgtAprSimulation = _chunkMGGPHKA2cjs.O; exports.getBlockTime = hr; exports.getBlockTimestamp = _chunkMGGPHKA2cjs.L; exports.getBodyErrors = _chunkMGGPHKA2cjs.r; exports.getChartData = _chunkMGGPHKA2cjs.w; exports.getCollateralWeights = _chunkMGGPHKA2cjs.x; exports.getConvertToAssets = _chunkMGGPHKA2cjs.a; exports.getDailyValidatorBlockStats = _chunkMGGPHKA2cjs.qa; exports.getDecodedFunctionData = Yt; exports.getDefaultRewardAllocation = _chunkMGGPHKA2cjs.va; exports.getEarnedStakedBeraVault = _chunkMGGPHKA2cjs.P; exports.getEnsoClient = _chunkUFIM7WQ4cjs.a; exports.getGlobalCapLimit = _chunkMGGPHKA2cjs.B; exports.getGlobalData = _chunkMGGPHKA2cjs.R; exports.getGlobalLiquidityAndSwapVolume = _chunkMGGPHKA2cjs.i; exports.getHoneyCollaterals = _chunkMGGPHKA2cjs.z; exports.getHoneyFees = nr; exports.getHoneyGlobalData = _chunkMGGPHKA2cjs.C; exports.getHoneyPausedState = mr; exports.getHoneyPreview = _chunkMGGPHKA2cjs.E; exports.getHoneyPythFeeds = qr; exports.getHoneyPythOracle = pr; exports.getHoneyRootPriceOracle = gr; exports.getHoneyVaultsBalance = _chunkMGGPHKA2cjs.F; exports.getIncentiveFeeClaimStats = _chunkMGGPHKA2cjs.S; exports.getLSTStakeConfig = Fr; exports.getMarkets = _chunkMGGPHKA2cjs.T; exports.getMaxDeposit = _t; exports.getOnChainPool = _chunkMGGPHKA2cjs.k; exports.getPoolEvents = _chunkMGGPHKA2cjs.l; exports.getPoolHistoricalData = _chunkMGGPHKA2cjs.m; exports.getPoolPausedState = _chunkMGGPHKA2cjs.j; exports.getPoolState = Gt; exports.getProposalDetails = _chunkMGGPHKA2cjs.s; exports.getProposalFromTx = _chunkMGGPHKA2cjs.u; exports.getProposalVotes = _chunkMGGPHKA2cjs.v; exports.getPythLatestPrices = _chunkMGGPHKA2cjs.G; exports.getPythUpdateFee = _chunkMGGPHKA2cjs.I; exports.getRelativeCapLimit = _chunkMGGPHKA2cjs.H; exports.getRewardProofsByValidator = _chunkMGGPHKA2cjs.U; exports.getRewardTokenToBeraRate = _chunkMGGPHKA2cjs.V; exports.getRewardVault = _chunkMGGPHKA2cjs.W; exports.getRewardVaultDurationConstants = Wr; exports.getRewardVaultFromToken = Er; exports.getRewardVaultIncentives = _chunkMGGPHKA2cjs.X; exports.getRewardVaultRewards = _chunkMGGPHKA2cjs.N; exports.getRewardVaultStakingToken = _chunkMGGPHKA2cjs.Y; exports.getRewardVaults = _chunkMGGPHKA2cjs.Q; exports.getSWBeraVaultMetadata = _chunkMGGPHKA2cjs.aa; exports.getSWBeraWithdrawal = _chunkMGGPHKA2cjs.ba; exports.getStakeWithdrawalCooldown = _chunkMGGPHKA2cjs.$; exports.getStakedBeraAPR = _chunkMGGPHKA2cjs.Z; exports.getStakedBeraSnapshots = _chunkMGGPHKA2cjs._; exports.getStakingPoolBatch = _chunkMGGPHKA2cjs.wa; exports.getSwapPayload = _chunkMGGPHKA2cjs.J; exports.getTokenCurrentPrices = _chunkMGGPHKA2cjs.ja; exports.getTokenInformation = _chunkMGGPHKA2cjs.y; exports.getTokens = Kr; exports.getTotalStakedAmount = _chunkMGGPHKA2cjs.ca; exports.getUserActiveValidators = _chunkMGGPHKA2cjs.ya; exports.getUserBoostsOnValidator = _chunkMGGPHKA2cjs.xa; exports.getUserClaimableIncentives = _chunkMGGPHKA2cjs.da; exports.getUserStakingPositions = _chunkMGGPHKA2cjs.za; exports.getUserVaultInfo = _chunkMGGPHKA2cjs.fa; exports.getUserVaults = _chunkMGGPHKA2cjs.ga; exports.getUserVaultsReward = _chunkMGGPHKA2cjs.ea; exports.getValidatorAnalytics = _chunkMGGPHKA2cjs.Aa; exports.getValidatorBoostApy = io; exports.getValidatorCommission = _chunkMGGPHKA2cjs.Ba; exports.getValidatorEstimatedBgtPerYear = _chunkMGGPHKA2cjs.Ca; exports.getValidatorOperatorAddress = _chunkMGGPHKA2cjs.Da; exports.getValidatorQueuedCommission = _chunkMGGPHKA2cjs.Ea; exports.getValidatorQueuedOperatorAddress = _chunkMGGPHKA2cjs.Fa; exports.getValidatorQueuedRewardAllocation = _chunkMGGPHKA2cjs.Ga; exports.getValidatorReturnPerBgt = ne; exports.getValidatorRewardAllocation = _chunkMGGPHKA2cjs.ta; exports.getVaultHistory = _chunkMGGPHKA2cjs.ha; exports.getVaultPausedState = zt; exports.getVaultValidators = _chunkMGGPHKA2cjs.ia; exports.getWalletBalances = _chunkUFIM7WQ4cjs.c; exports.gql = _chunkMGGPHKA2cjs.d; exports.isBadCollateralAsset = _chunkMGGPHKA2cjs.A; exports.isBasketModeEnabled = _chunkMGGPHKA2cjs.K; exports.isDefaultRewardAllocation = _chunkMGGPHKA2cjs.ua; exports.isImpersonateAccount = _chunkMGGPHKA2cjs.la; exports.isSameRewardAllocation = _chunkMGGPHKA2cjs.sa; exports.parseProposalBody = _chunkMGGPHKA2cjs.t;
|
|
919
2
|
//# sourceMappingURL=exports.cjs.map
|