@exodus/ethereum-api 8.34.2 → 8.34.4
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/CHANGELOG.md +20 -0
- package/package.json +3 -3
- package/src/create-asset.js +1 -2
- package/src/custom-fees.js +40 -10
- package/src/fee-utils.js +17 -3
- package/src/gas-estimation.js +11 -6
- package/src/get-fee-async.js +0 -14
- package/src/get-fee.js +29 -35
- package/src/index.js +2 -0
- package/src/staking/ethereum/api.js +1 -0
- package/src/staking/ethereum/service.js +116 -92
- package/src/staking/matic/matic-staking.md +53 -0
- package/src/staking/matic/service.js +189 -102
- package/src/staking/utils/index.js +26 -60
- package/src/tx-send/get-fee-info.js +34 -9
- package/src/tx-send/tx-send.js +41 -30
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { estimateGasLimit } from '../../gas-estimation.js'
|
|
2
2
|
import { createWatchTx as defaultCreateWatch } from '../../watch-tx.js'
|
|
3
3
|
import { stakingProviderClientFactory } from '../staking-provider-client.js'
|
|
4
|
-
import { amountToCurrency,
|
|
4
|
+
import { amountToCurrency, DISABLE_BALANCE_CHECKS, resolveFeeData } from '../utils/index.js'
|
|
5
5
|
import { EthereumStaking } from './api.js'
|
|
6
6
|
|
|
7
7
|
const WETH9_ADDRESS = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
|
|
@@ -18,39 +18,38 @@ const SLOT_ACTIVATION_PROXIMITY_ETH = '1.0'
|
|
|
18
18
|
// ratio commonly fall under this limit.
|
|
19
19
|
const MINIMUM_DELEGATION_GAS_LIMIT = 180_000
|
|
20
20
|
|
|
21
|
-
// Use a custom `maxPriorityFeePerGas` so we can
|
|
22
|
-
// respect the default EIP-1559 relationship:
|
|
23
|
-
// maxFeePerGas = baseFeePerGas + maxPriorityFeePerGas.
|
|
24
|
-
//
|
|
25
|
-
// Currently, the backend will return an excessive
|
|
26
|
-
// `tipGasPrice` which hinders the configuration ofrational
|
|
27
|
-
// inclusion incentives when defined using remote config.
|
|
28
|
-
const MAX_PRIORITY_FEE_PER_GAS = '0.06 Gwei' // semi-urgent
|
|
29
|
-
|
|
30
21
|
const EXTRA_GAS_LIMIT = 20_000 // extra gas Limit to prevent tx failing if something change on pool state (till tx is in mempool)
|
|
31
22
|
|
|
32
|
-
const DISABLE_BALANCE_CHECKS = '0x0'
|
|
33
|
-
|
|
34
23
|
export function createEthereumStakingService({
|
|
35
24
|
asset,
|
|
36
25
|
assetClientInterface,
|
|
37
26
|
createWatchTx = defaultCreateWatch,
|
|
27
|
+
stakingProvider = stakingProviderClientFactory(),
|
|
38
28
|
}) {
|
|
39
|
-
const staking = new EthereumStaking(asset)
|
|
40
|
-
const stakingProvider = stakingProviderClientFactory()
|
|
29
|
+
const staking = new EthereumStaking(asset, undefined, asset.server)
|
|
41
30
|
const minAmount = staking.minAmount
|
|
42
31
|
|
|
43
|
-
async
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
const getTransactionProps = async ({ feeData, walletAccount }) => {
|
|
33
|
+
let address
|
|
34
|
+
;[address, feeData] = await Promise.all([
|
|
35
|
+
assetClientInterface.getReceiveAddress({
|
|
36
|
+
assetName: asset.name,
|
|
37
|
+
walletAccount,
|
|
38
|
+
}),
|
|
39
|
+
resolveFeeData({ asset, assetClientInterface, feeData }),
|
|
40
|
+
])
|
|
41
|
+
|
|
48
42
|
const delegatorAddress = address.toLowerCase()
|
|
43
|
+
return { delegatorAddress, feeData }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function delegate({ walletAccount, amount, feeData } = Object.create(null)) {
|
|
49
47
|
amount = amountToCurrency({ asset, amount })
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
let delegatorAddress
|
|
50
|
+
;({ feeData, delegatorAddress } = await getTransactionProps({ feeData, walletAccount }))
|
|
51
|
+
|
|
52
|
+
const { to, data } = await staking.stake({ amount })
|
|
54
53
|
|
|
55
54
|
console.log(
|
|
56
55
|
`delegator address ${delegatorAddress} staking ${amount.toDefaultString({
|
|
@@ -58,12 +57,14 @@ export function createEthereumStakingService({
|
|
|
58
57
|
})}`
|
|
59
58
|
)
|
|
60
59
|
|
|
61
|
-
const { gasPrice, gasLimit, tipGasPrice } = await estimateTxFee(
|
|
62
|
-
delegatorAddress,
|
|
60
|
+
const { gasPrice, gasLimit, tipGasPrice } = await estimateTxFee({
|
|
61
|
+
from: delegatorAddress,
|
|
63
62
|
to,
|
|
64
63
|
amount,
|
|
65
|
-
data
|
|
66
|
-
|
|
64
|
+
txInput: data,
|
|
65
|
+
feeData,
|
|
66
|
+
})
|
|
67
|
+
|
|
67
68
|
const txId = await prepareAndSendTx({
|
|
68
69
|
asset,
|
|
69
70
|
walletAccount,
|
|
@@ -73,6 +74,7 @@ export function createEthereumStakingService({
|
|
|
73
74
|
gasPrice,
|
|
74
75
|
gasLimit,
|
|
75
76
|
tipGasPrice,
|
|
77
|
+
feeData,
|
|
76
78
|
})
|
|
77
79
|
|
|
78
80
|
// Goerli is not supported
|
|
@@ -92,32 +94,36 @@ export function createEthereumStakingService({
|
|
|
92
94
|
resquestedAmount,
|
|
93
95
|
pendingAmount,
|
|
94
96
|
minAmount,
|
|
97
|
+
feeData,
|
|
95
98
|
}) {
|
|
96
99
|
const leftOver = pendingAmount.sub(resquestedAmount)
|
|
97
100
|
|
|
98
|
-
if (leftOver.isPositive && leftOver.lt(minAmount))
|
|
101
|
+
if (leftOver.isPositive && leftOver.lt(minAmount))
|
|
99
102
|
throw new Error(`Pending balance less than min stake amount ${minAmount}`)
|
|
100
|
-
}
|
|
101
103
|
|
|
102
104
|
const inactiveAmountToUnstake = pendingAmount.lte(resquestedAmount)
|
|
103
105
|
? pendingAmount
|
|
104
106
|
: resquestedAmount
|
|
107
|
+
|
|
108
|
+
feeData = await resolveFeeData({ asset, assetClientInterface, feeData })
|
|
109
|
+
|
|
105
110
|
const { to, data } = await staking.unstakePending({
|
|
106
111
|
address: delegatorAddress,
|
|
107
112
|
amount: inactiveAmountToUnstake,
|
|
108
113
|
})
|
|
109
114
|
|
|
110
|
-
const { fee, gasLimit, gasPrice, tipGasPrice } = await estimateTxFee(
|
|
111
|
-
delegatorAddress,
|
|
115
|
+
const { fee, gasLimit, gasPrice, tipGasPrice } = await estimateTxFee({
|
|
116
|
+
from: delegatorAddress,
|
|
112
117
|
to,
|
|
113
|
-
null,
|
|
114
|
-
data
|
|
115
|
-
|
|
118
|
+
amount: null,
|
|
119
|
+
txInput: data,
|
|
120
|
+
feeData,
|
|
121
|
+
})
|
|
116
122
|
|
|
117
123
|
return { to, txData: data, gasLimit, gasPrice, tipGasPrice, fee }
|
|
118
124
|
}
|
|
119
125
|
|
|
120
|
-
async function getUndelegateData({ delegatorAddress, resquestedAmount, pendingAmount }) {
|
|
126
|
+
async function getUndelegateData({ delegatorAddress, resquestedAmount, pendingAmount, feeData }) {
|
|
121
127
|
const canUnstake = resquestedAmount.gt(pendingAmount)
|
|
122
128
|
|
|
123
129
|
if (!canUnstake) {
|
|
@@ -126,17 +132,21 @@ export function createEthereumStakingService({
|
|
|
126
132
|
}
|
|
127
133
|
|
|
128
134
|
const activeAmountToUnstake = resquestedAmount.sub(pendingAmount)
|
|
135
|
+
|
|
136
|
+
feeData = await resolveFeeData({ asset, assetClientInterface, feeData })
|
|
137
|
+
|
|
129
138
|
const { to, data } = await staking.unstake({
|
|
130
139
|
address: delegatorAddress,
|
|
131
140
|
amount: activeAmountToUnstake,
|
|
132
141
|
})
|
|
133
142
|
|
|
134
|
-
const { fee, gasLimit, gasPrice, tipGasPrice } = await estimateTxFee(
|
|
135
|
-
delegatorAddress,
|
|
143
|
+
const { fee, gasLimit, gasPrice, tipGasPrice } = await estimateTxFee({
|
|
144
|
+
from: delegatorAddress,
|
|
136
145
|
to,
|
|
137
|
-
null,
|
|
138
|
-
data
|
|
139
|
-
|
|
146
|
+
amount: null,
|
|
147
|
+
txInput: data,
|
|
148
|
+
feeData,
|
|
149
|
+
})
|
|
140
150
|
|
|
141
151
|
return { to, txData: data, gasLimit, gasPrice, tipGasPrice, fee }
|
|
142
152
|
}
|
|
@@ -146,12 +156,10 @@ export function createEthereumStakingService({
|
|
|
146
156
|
* Fee estimation depends on the executed txs. Can be both.
|
|
147
157
|
* @returns total undelegete fee
|
|
148
158
|
*/
|
|
149
|
-
async function estimateUndelegate({ walletAccount, amount: resquestedAmount }) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
})
|
|
154
|
-
const delegatorAddress = address.toLowerCase()
|
|
159
|
+
async function estimateUndelegate({ walletAccount, amount: resquestedAmount, feeData }) {
|
|
160
|
+
let delegatorAddress
|
|
161
|
+
;({ feeData, delegatorAddress } = await getTransactionProps({ feeData, walletAccount }))
|
|
162
|
+
|
|
155
163
|
const pendingAmount = await staking.pendingBalanceOf(delegatorAddress)
|
|
156
164
|
|
|
157
165
|
let undelegatePendingFee = asset.currency.ZERO
|
|
@@ -164,6 +172,7 @@ export function createEthereumStakingService({
|
|
|
164
172
|
resquestedAmount,
|
|
165
173
|
pendingAmount,
|
|
166
174
|
minAmount,
|
|
175
|
+
feeData,
|
|
167
176
|
})
|
|
168
177
|
undelegatePendingFee = fee
|
|
169
178
|
} catch (err) {
|
|
@@ -177,12 +186,15 @@ export function createEthereumStakingService({
|
|
|
177
186
|
resquestedAmount,
|
|
178
187
|
pendingAmount,
|
|
179
188
|
minAmount,
|
|
189
|
+
feeData,
|
|
180
190
|
})
|
|
181
191
|
|
|
182
192
|
return undelegatePendingFee.add(undelegateFee)
|
|
183
193
|
}
|
|
184
194
|
|
|
185
|
-
async function undelegate(
|
|
195
|
+
async function undelegate(
|
|
196
|
+
{ walletAccount, amount, feeData, waitForConfirmation = true } = Object.create(null)
|
|
197
|
+
) {
|
|
186
198
|
/*
|
|
187
199
|
unstakePending balance (not yet in validator) + unstake balance (in validator)
|
|
188
200
|
1. give priority to unstakePending (based on the amount)
|
|
@@ -190,11 +202,9 @@ export function createEthereumStakingService({
|
|
|
190
202
|
*/
|
|
191
203
|
const resquestedAmount = amountToCurrency({ asset, amount })
|
|
192
204
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
})
|
|
197
|
-
const delegatorAddress = address.toLowerCase()
|
|
205
|
+
let delegatorAddress
|
|
206
|
+
;({ feeData, delegatorAddress } = await getTransactionProps({ feeData, walletAccount }))
|
|
207
|
+
|
|
198
208
|
const pendingAmount = await staking.pendingBalanceOf(delegatorAddress)
|
|
199
209
|
|
|
200
210
|
console.log(
|
|
@@ -210,14 +220,24 @@ export function createEthereumStakingService({
|
|
|
210
220
|
resquestedAmount,
|
|
211
221
|
pendingAmount,
|
|
212
222
|
minAmount,
|
|
223
|
+
feeData,
|
|
213
224
|
})
|
|
214
225
|
|
|
215
226
|
txId = await prepareAndSendTx({
|
|
216
227
|
asset,
|
|
217
228
|
walletAccount,
|
|
218
|
-
waitForConfirmation
|
|
229
|
+
waitForConfirmation,
|
|
219
230
|
...undelegatePendingData,
|
|
231
|
+
feeData,
|
|
220
232
|
})
|
|
233
|
+
|
|
234
|
+
// If we are waiting for confirmation, then sufficient time
|
|
235
|
+
// will have elapsed for us to re-estimate `feeData`.
|
|
236
|
+
//
|
|
237
|
+
// NOTE: This will invalidate previous transaction fee estimates!
|
|
238
|
+
if (waitForConfirmation) {
|
|
239
|
+
feeData = await assetClientInterface.getFeeData({ assetName: asset.name })
|
|
240
|
+
}
|
|
221
241
|
}
|
|
222
242
|
|
|
223
243
|
// may need also to unstake
|
|
@@ -225,6 +245,7 @@ export function createEthereumStakingService({
|
|
|
225
245
|
delegatorAddress,
|
|
226
246
|
resquestedAmount,
|
|
227
247
|
pendingAmount,
|
|
248
|
+
feeData,
|
|
228
249
|
})
|
|
229
250
|
|
|
230
251
|
if (undelegateData.fee) {
|
|
@@ -232,6 +253,7 @@ export function createEthereumStakingService({
|
|
|
232
253
|
asset,
|
|
233
254
|
walletAccount,
|
|
234
255
|
...undelegateData,
|
|
256
|
+
feeData,
|
|
235
257
|
})
|
|
236
258
|
}
|
|
237
259
|
|
|
@@ -247,26 +269,24 @@ export function createEthereumStakingService({
|
|
|
247
269
|
return txId
|
|
248
270
|
}
|
|
249
271
|
|
|
250
|
-
async function claimUndelegatedBalance({ walletAccount } = Object.create(null)) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
assetName: asset.name,
|
|
254
|
-
walletAccount,
|
|
255
|
-
})
|
|
256
|
-
const delegatorAddress = address.toLowerCase()
|
|
272
|
+
async function claimUndelegatedBalance({ walletAccount, feeData } = Object.create(null)) {
|
|
273
|
+
let delegatorAddress
|
|
274
|
+
;({ feeData, delegatorAddress } = await getTransactionProps({ feeData, walletAccount }))
|
|
257
275
|
|
|
258
276
|
const withdrawRequest = await staking.claimWithdrawRequest({
|
|
259
277
|
address: delegatorAddress,
|
|
260
278
|
})
|
|
279
|
+
|
|
261
280
|
if (withdrawRequest) {
|
|
262
281
|
const { to, data } = withdrawRequest
|
|
263
282
|
|
|
264
|
-
const { gasLimit, gasPrice, tipGasPrice } = await estimateTxFee(
|
|
265
|
-
delegatorAddress,
|
|
283
|
+
const { gasLimit, gasPrice, tipGasPrice } = await estimateTxFee({
|
|
284
|
+
from: delegatorAddress,
|
|
266
285
|
to,
|
|
267
|
-
null,
|
|
268
|
-
data
|
|
269
|
-
|
|
286
|
+
amount: null,
|
|
287
|
+
txInput: data,
|
|
288
|
+
feeData,
|
|
289
|
+
})
|
|
270
290
|
return prepareAndSendTx({
|
|
271
291
|
asset,
|
|
272
292
|
walletAccount,
|
|
@@ -275,24 +295,21 @@ export function createEthereumStakingService({
|
|
|
275
295
|
gasLimit,
|
|
276
296
|
gasPrice,
|
|
277
297
|
tipGasPrice,
|
|
298
|
+
feeData,
|
|
278
299
|
})
|
|
279
300
|
}
|
|
280
301
|
}
|
|
281
302
|
|
|
282
|
-
async function estimateDelegateOperation({ walletAccount, operation, args }) {
|
|
303
|
+
async function estimateDelegateOperation({ walletAccount, operation, args, feeData }) {
|
|
283
304
|
const requestedAmount = args.amount
|
|
284
305
|
? amountToCurrency({ asset, amount: args.amount })
|
|
285
306
|
: asset.currency.ZERO
|
|
286
307
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
308
|
+
let delegatorAddress
|
|
309
|
+
;({ delegatorAddress, feeData } = await getTransactionProps({ feeData, walletAccount }))
|
|
290
310
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
walletAccount,
|
|
294
|
-
})
|
|
295
|
-
const delegatorAddress = address.toLowerCase()
|
|
311
|
+
if (operation === 'undelegate')
|
|
312
|
+
return estimateUndelegate({ walletAccount, amount: requestedAmount, feeData })
|
|
296
313
|
|
|
297
314
|
const NAMING_MAP = {
|
|
298
315
|
delegate: 'stake',
|
|
@@ -302,14 +319,18 @@ export function createEthereumStakingService({
|
|
|
302
319
|
|
|
303
320
|
const delegateOperation = staking[NAMING_MAP[operation]].bind(staking)
|
|
304
321
|
|
|
305
|
-
if (!delegateOperation)
|
|
306
|
-
throw new Error('Invalid staking operation')
|
|
307
|
-
}
|
|
322
|
+
if (!delegateOperation) throw new Error('Invalid staking operation')
|
|
308
323
|
|
|
309
324
|
const { amount, data } = await delegateOperation({ ...args, amount: requestedAmount })
|
|
310
325
|
|
|
311
326
|
const { fee } = await (operation === 'claimUndelegatedBalance'
|
|
312
|
-
? estimateTxFee(
|
|
327
|
+
? estimateTxFee({
|
|
328
|
+
from: delegatorAddress,
|
|
329
|
+
to: staking.accountingAddress,
|
|
330
|
+
amount,
|
|
331
|
+
txInput: data,
|
|
332
|
+
feeData,
|
|
333
|
+
})
|
|
313
334
|
: // The `gasUsed` of a delegation transaction can vary
|
|
314
335
|
// significantly depending upon whether it will result
|
|
315
336
|
// in the activation of new slots (i.e. validator creation).
|
|
@@ -323,17 +344,18 @@ export function createEthereumStakingService({
|
|
|
323
344
|
// 2. Originate the transaction from the WETH contract,
|
|
324
345
|
// which guarantees deep native ether liquidity which
|
|
325
346
|
// exceeds any rational user deposit.
|
|
326
|
-
estimateTxFee(
|
|
327
|
-
WETH9_ADDRESS,
|
|
328
|
-
staking.poolAddress,
|
|
329
|
-
amount.add(asset.currency.defaultUnit(SLOT_ACTIVATION_PROXIMITY_ETH)),
|
|
330
|
-
data
|
|
331
|
-
|
|
347
|
+
estimateTxFee({
|
|
348
|
+
from: WETH9_ADDRESS,
|
|
349
|
+
to: staking.poolAddress,
|
|
350
|
+
amount: amount.add(asset.currency.defaultUnit(SLOT_ACTIVATION_PROXIMITY_ETH)),
|
|
351
|
+
txInput: data,
|
|
352
|
+
feeData,
|
|
353
|
+
}))
|
|
332
354
|
|
|
333
355
|
return fee
|
|
334
356
|
}
|
|
335
357
|
|
|
336
|
-
async function estimateTxFee(from, to, amount, txInput) {
|
|
358
|
+
async function estimateTxFee({ from, to, amount, txInput, feeData }) {
|
|
337
359
|
amount = amount || asset.currency.ZERO
|
|
338
360
|
from = from.toLowerCase()
|
|
339
361
|
|
|
@@ -356,18 +378,14 @@ export function createEthereumStakingService({
|
|
|
356
378
|
EthereumStaking.isDelegationTransactonCalldata(txInput) ? MINIMUM_DELEGATION_GAS_LIMIT : 0
|
|
357
379
|
)
|
|
358
380
|
|
|
359
|
-
const
|
|
360
|
-
amount,
|
|
381
|
+
const getFeeResult = await asset.api.getFee({
|
|
361
382
|
asset,
|
|
362
|
-
|
|
363
|
-
maxPriorityFeePerGas: MAX_PRIORITY_FEE_PER_GAS,
|
|
383
|
+
feeData,
|
|
364
384
|
gasLimit,
|
|
385
|
+
amount,
|
|
365
386
|
})
|
|
366
387
|
|
|
367
|
-
return {
|
|
368
|
-
...feeData,
|
|
369
|
-
gasLimit,
|
|
370
|
-
}
|
|
388
|
+
return { ...getFeeResult, gasLimit }
|
|
371
389
|
}
|
|
372
390
|
|
|
373
391
|
/** Returns the minimum possible amount that can be staked. */
|
|
@@ -379,9 +397,12 @@ export function createEthereumStakingService({
|
|
|
379
397
|
async function getDelegateSelectAllAmount({
|
|
380
398
|
walletAccount,
|
|
381
399
|
spendableForStaking = asset.currency.ZERO,
|
|
400
|
+
feeData,
|
|
382
401
|
}) {
|
|
383
402
|
const minAmount = getMinAmount()
|
|
384
403
|
|
|
404
|
+
;({ feeData } = await getTransactionProps({ feeData, walletAccount }))
|
|
405
|
+
|
|
385
406
|
// If the caller hasn't specified a value of `spendableForStaking`
|
|
386
407
|
// which satisfies the minimum amount, then we'll coerce this value
|
|
387
408
|
// up to the minimum amount so we can at least provide a rational
|
|
@@ -399,6 +420,7 @@ export function createEthereumStakingService({
|
|
|
399
420
|
args: {
|
|
400
421
|
amount: spendableForStaking,
|
|
401
422
|
},
|
|
423
|
+
feeData,
|
|
402
424
|
})
|
|
403
425
|
|
|
404
426
|
// If the `spendableForStaking` is insufficient to cover both the
|
|
@@ -430,6 +452,7 @@ export function createEthereumStakingService({
|
|
|
430
452
|
gasLimit,
|
|
431
453
|
tipGasPrice,
|
|
432
454
|
waitForConfirmation = false,
|
|
455
|
+
feeData,
|
|
433
456
|
} = Object.create(null)
|
|
434
457
|
) {
|
|
435
458
|
const sendTxArgs = {
|
|
@@ -446,6 +469,7 @@ export function createEthereumStakingService({
|
|
|
446
469
|
// HACK: Override the `tipGasPrice` to use a custom `maxPriorityFeePerGas`.
|
|
447
470
|
tipGasPrice,
|
|
448
471
|
},
|
|
472
|
+
feeData,
|
|
449
473
|
}
|
|
450
474
|
|
|
451
475
|
const { txId } = await asset.baseAsset.api.sendTx(sendTxArgs)
|
|
@@ -13,6 +13,59 @@ Stakers are divided into `validators`, `delegators`, and watchers (for fraud rep
|
|
|
13
13
|
|
|
14
14
|
`StakeManager` is the main contract for handling validator related activities like checkPoint signature verification, reward distribution, and stake management. Since the contract is using NFT ID as a source of ownership, change of ownership and signer won't affect anything in the system. [see](https://wiki.polygon.technology/docs/pos/contracts/stakingmanager).
|
|
15
15
|
|
|
16
|
+
#### Storage Layout
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
| Name | Type | Slot | Offset | Bytes | Value | Hex Value | Contract |
|
|
20
|
+
|-----------------------------|------------------------------------------------------------|------|--------|-------|--------------------------------------------------|--------------------------------------------------------------------|--------------------------------------------------------------|
|
|
21
|
+
| locked | bool | 0 | 0 | 1 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
22
|
+
| governance | contract IGovernance | 0 | 1 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
23
|
+
| _owner | address | 1 | 0 | 20 | 289681683732047618769883796824487869827960101094 | 0x00000000000000000000000032bdc6a4e8c654df65503cbb0edc82b4ce9158e6 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
24
|
+
| rootChain | address | 2 | 0 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
25
|
+
| token | contract IERC20 | 3 | 0 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
26
|
+
| registry | address | 4 | 0 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
27
|
+
| logger | contract StakingInfo | 5 | 0 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
28
|
+
| NFTContract | contract StakingNFT | 6 | 0 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
29
|
+
| validatorShareFactory | contract ValidatorShareFactory | 7 | 0 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
30
|
+
| WITHDRAWAL_DELAY | uint256 | 8 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
31
|
+
| currentEpoch | uint256 | 9 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
32
|
+
| dynasty | uint256 | 10 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
33
|
+
| CHECKPOINT_REWARD | uint256 | 11 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
34
|
+
| minDeposit | uint256 | 12 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
35
|
+
| minHeimdallFee | uint256 | 13 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
36
|
+
| checkPointBlockInterval | uint256 | 14 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
37
|
+
| signerUpdateLimit | uint256 | 15 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
38
|
+
| validatorThreshold | uint256 | 16 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
39
|
+
| totalStaked | uint256 | 17 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
40
|
+
| NFTCounter | uint256 | 18 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
41
|
+
| totalRewards | uint256 | 19 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
42
|
+
| totalRewardsLiquidated | uint256 | 20 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
43
|
+
| auctionPeriod | uint256 | 21 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
44
|
+
| proposerBonus | uint256 | 22 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
45
|
+
| accountStateRoot | bytes32 | 23 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
46
|
+
| replacementCoolDown | uint256 | 24 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
47
|
+
| delegationEnabled | bool | 25 | 0 | 1 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
48
|
+
| validators | mapping(uint256 => struct StakeManagerStorage.Validator) | 26 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
49
|
+
| signerToValidator | mapping(address => uint256) | 27 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
50
|
+
| validatorState | struct StakeManagerStorage.State | 28 | 0 | 64 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
51
|
+
| validatorStateChanges | mapping(uint256 => struct StakeManagerStorage.StateChange) | 30 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
52
|
+
| userFeeExit | mapping(address => uint256) | 31 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
53
|
+
| validatorAuction | mapping(uint256 => struct StakeManagerStorage.Auction) | 32 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
54
|
+
| latestSignerUpdateEpoch | mapping(uint256 => uint256) | 33 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
55
|
+
| totalHeimdallFee | uint256 | 34 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
56
|
+
| inited | bool | 35 | 0 | 1 | 1 | 0x0000000000000000000000000000000000000000000000000000000000000001 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
57
|
+
| eventsHub | address | 35 | 1 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
58
|
+
| rewardPerStake | uint256 | 36 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
59
|
+
| extensionCode | address | 37 | 0 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
60
|
+
| signers | address[] | 38 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
61
|
+
| prevBlockInterval | uint256 | 39 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
62
|
+
| rewardDecreasePerCheckpoint | uint256 | 40 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
63
|
+
| maxRewardedCheckpoints | uint256 | 41 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
64
|
+
| checkpointRewardDelta | uint256 | 42 | 0 | 32 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
65
|
+
| tokenMatic | contract IERC20 | 43 | 0 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
66
|
+
| migration | contract IPolygonMigration | 44 | 0 | 20 | 0 | 0x0000000000000000000000000000000000000000000000000000000000000000 | contracts/staking/stakeManager/StakeManager.sol:StakeManager |
|
|
67
|
+
```
|
|
68
|
+
|
|
16
69
|
### ValidatorShare contract
|
|
17
70
|
|
|
18
71
|
For delegation staking each validator has its own deployed **contract**, this contract has the logic to `stake/unstake` as delegators, but it also acts as an `ERC20`, this `ERC20` token is what we know as the shares token. Shares token are calculated based on the total amount staked in the contract, varying from time to time
|