-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathstatus.go
More file actions
592 lines (524 loc) · 19.6 KB
/
status.go
File metadata and controls
592 lines (524 loc) · 19.6 KB
1
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
package node
import (
"bytes"
"context"
"fmt"
"math/big"
"time"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/rocket-pool/smartnode/bindings/dao/trustednode"
"github.com/rocket-pool/smartnode/bindings/minipool"
"github.com/rocket-pool/smartnode/bindings/network"
"github.com/rocket-pool/smartnode/bindings/node"
"github.com/rocket-pool/smartnode/bindings/rocketpool"
"github.com/rocket-pool/smartnode/bindings/settings/protocol"
tnsettings "github.com/rocket-pool/smartnode/bindings/settings/trustednode"
"github.com/rocket-pool/smartnode/bindings/tokens"
"github.com/rocket-pool/smartnode/bindings/types"
"github.com/rocket-pool/smartnode/bindings/utils/eth"
"github.com/urfave/cli"
"golang.org/x/sync/errgroup"
mp "github.com/rocket-pool/smartnode/rocketpool/api/minipool"
"github.com/rocket-pool/smartnode/rocketpool/api/pdao"
"github.com/rocket-pool/smartnode/shared/services"
"github.com/rocket-pool/smartnode/shared/services/beacon"
"github.com/rocket-pool/smartnode/shared/types/api"
cfgtypes "github.com/rocket-pool/smartnode/shared/types/config"
rputils "github.com/rocket-pool/smartnode/shared/utils/rp"
)
func getStatus(c *cli.Context) (*api.NodeStatusResponse, error) {
// Get services
if err := services.RequireNodeWallet(c); err != nil {
return nil, err
}
if err := services.RequireRocketStorage(c); err != nil {
return nil, err
}
if err := services.RequireBeaconClientSynced(c); err != nil {
return nil, err
}
cfg, err := services.GetConfig(c)
if err != nil {
return nil, err
}
w, err := services.GetWallet(c)
if err != nil {
return nil, err
}
rp, err := services.GetRocketPool(c)
if err != nil {
return nil, err
}
bc, err := services.GetBeaconClient(c)
if err != nil {
return nil, err
}
reg, err := services.GetRocketSignerRegistry(c)
if err != nil {
return nil, err
}
if reg == nil {
return nil, fmt.Errorf("Error getting the signer registry on network [%v].", cfg.Smartnode.Network.Value.(cfgtypes.Network))
}
// Response
response := api.NodeStatusResponse{}
response.PenalizedMinipools = map[common.Address]uint64{}
response.NodeRPLLocked = big.NewInt(0)
// Get the legacy MinipoolQueue contract address
legacyMinipoolQueueAddress := cfg.Smartnode.GetV110MinipoolQueueAddress()
// Get node account
nodeAccount, err := w.GetNodeAccount()
if err != nil {
return nil, err
}
response.AccountAddress = nodeAccount.Address
response.AccountAddressFormatted = formatResolvedAddress(c, response.AccountAddress)
// Sync
var wg errgroup.Group
wg.Go(func() error {
mpDetails, err := mp.GetNodeMinipoolDetails(rp, bc, nodeAccount.Address, &legacyMinipoolQueueAddress)
if err == nil {
response.Minipools = mpDetails
}
return err
})
wg.Go(func() error {
delegate, err := rp.GetContract("rocketMinipoolDelegate", nil)
if err != nil {
return fmt.Errorf("Error getting latest minipool delegate contract: %w", err)
}
response.LatestDelegate = *delegate.Address
return err
})
// Get node trusted status
wg.Go(func() error {
trusted, err := trustednode.GetMemberExists(rp, nodeAccount.Address, nil)
if err == nil {
response.Trusted = trusted
}
return err
})
// Get node details
wg.Go(func() error {
details, err := node.GetNodeDetails(rp, nodeAccount.Address, true, nil)
if err == nil {
response.Registered = details.Exists
response.PrimaryWithdrawalAddress = details.PrimaryWithdrawalAddress
response.PrimaryWithdrawalAddressFormatted = formatResolvedAddress(c, response.PrimaryWithdrawalAddress)
response.PendingPrimaryWithdrawalAddress = details.PendingPrimaryWithdrawalAddress
response.PendingPrimaryWithdrawalAddressFormatted = formatResolvedAddress(c, response.PendingPrimaryWithdrawalAddress)
response.IsRPLWithdrawalAddressSet = details.IsRPLWithdrawalAddressSet
response.RPLWithdrawalAddress = details.RPLWithdrawalAddress
response.RPLWithdrawalAddressFormatted = formatResolvedAddress(c, response.RPLWithdrawalAddress)
response.PendingRPLWithdrawalAddress = details.PendingRPLWithdrawalAddress
response.PendingRPLWithdrawalAddressFormatted = formatResolvedAddress(c, response.PendingRPLWithdrawalAddress)
response.TimezoneLocation = details.TimezoneLocation
}
return err
})
// Check whether RPL locking is allowed for the node
wg.Go(func() error {
var err error
response.IsRPLLockingAllowed, err = node.GetRPLLockedAllowed(rp, nodeAccount.Address, nil)
return err
})
// Get the node's locked RPL
wg.Go(func() error {
var err error
response.NodeRPLLocked, err = node.GetNodeRPLLocked(rp, nodeAccount.Address, nil)
return err
})
// Check if Voting is Initialized
wg.Go(func() error {
var err error
response.IsVotingInitialized, err = network.GetVotingInitialized(rp, nodeAccount.Address, nil)
return err
})
// Get the node onchain voting delegate
wg.Go(func() error {
var err error
response.OnchainVotingDelegate, err = network.GetCurrentVotingDelegate(rp, nodeAccount.Address, nil)
if err == nil {
response.OnchainVotingDelegateFormatted = formatResolvedAddress(c, response.OnchainVotingDelegate)
}
return err
})
// Get node account balances
wg.Go(func() error {
var err error
response.AccountBalances, err = tokens.GetBalances(rp, nodeAccount.Address, nil)
return err
})
// Get staking details
wg.Go(func() error {
var err error
response.RplStake, err = node.GetNodeRPLStake(rp, nodeAccount.Address, nil)
return err
})
wg.Go(func() error {
var err error
response.EffectiveRplStake, err = node.GetNodeEffectiveRPLStake(rp, nodeAccount.Address, nil)
return err
})
wg.Go(func() error {
var err error
response.MinimumRplStake, err = node.GetNodeMinimumRPLStake(rp, nodeAccount.Address, nil)
return err
})
wg.Go(func() error {
var err error
response.MaximumRplStake, err = node.GetNodeMaximumRPLStake(rp, nodeAccount.Address, nil)
return err
})
wg.Go(func() error {
var err error
response.MaximumStakeFraction, err = protocol.GetMaximumPerMinipoolStake(rp, nil)
return err
})
wg.Go(func() error {
var err error
response.EthMatched, response.EthMatchedLimit, response.PendingMatchAmount, err = rputils.CheckCollateral(rp, nodeAccount.Address, nil)
return err
})
wg.Go(func() error {
var err error
response.CreditBalance, err = node.GetNodeDepositCredit(rp, nodeAccount.Address, nil)
return err
})
// Get active and past votes from Snapshot, but treat errors as non-Fatal
if reg != nil {
wg.Go(func() error {
var err error
r := &response.SnapshotResponse
if cfg.Smartnode.GetRocketSignerRegistryAddress() != "" {
response.SignallingAddress, err = reg.NodeToSigner(&bind.CallOpts{}, nodeAccount.Address)
if err != nil {
r.Error = err.Error()
return nil
}
blankAddress := common.Address{}
if response.SignallingAddress != blankAddress {
response.SignallingAddressFormatted = formatResolvedAddress(c, response.SignallingAddress)
}
votedProposals, err := pdao.GetSnapshotVotedProposals(cfg.Smartnode.GetSnapshotApiDomain(), cfg.Smartnode.GetSnapshotID(), nodeAccount.Address, response.SignallingAddress)
if err != nil {
r.Error = err.Error()
return nil
}
r.ProposalVotes = votedProposals.Data.Votes
}
snapshotResponse, err := pdao.GetSnapshotProposals(cfg.Smartnode.GetSnapshotApiDomain(), cfg.Smartnode.GetSnapshotID(), "active")
if err != nil {
r.Error = err.Error()
return nil
}
r.ActiveSnapshotProposals = snapshotResponse.Data.Proposals
return nil
})
}
// Get node minipool counts
wg.Go(func() error {
details, err := getNodeMinipoolCountDetails(rp, nodeAccount.Address)
if err == nil {
response.MinipoolCounts.Total = len(details)
for _, mpDetails := range details {
if mpDetails.Penalties > 0 {
response.PenalizedMinipools[mpDetails.Address] = mpDetails.Penalties
}
if mpDetails.Finalised {
response.MinipoolCounts.Finalised++
} else {
switch mpDetails.Status {
case types.Initialized:
response.MinipoolCounts.Initialized++
case types.Prelaunch:
response.MinipoolCounts.Prelaunch++
case types.Staking:
response.MinipoolCounts.Staking++
case types.Withdrawable:
response.MinipoolCounts.Withdrawable++
case types.Dissolved:
response.MinipoolCounts.Dissolved++
}
if mpDetails.RefundAvailable {
response.MinipoolCounts.RefundAvailable++
}
if mpDetails.WithdrawalAvailable {
response.MinipoolCounts.WithdrawalAvailable++
}
if mpDetails.CloseAvailable {
response.MinipoolCounts.CloseAvailable++
}
}
}
}
return err
})
wg.Go(func() error {
var err error
response.IsFeeDistributorInitialized, err = node.GetFeeDistributorInitialized(rp, nodeAccount.Address, nil)
return err
})
wg.Go(func() error {
var err error
feeRecipientInfo, err := rputils.GetFeeRecipientInfoWithoutState(rp, bc, nodeAccount.Address, nil)
if err == nil {
response.FeeRecipientInfo = *feeRecipientInfo
response.FeeDistributorBalance, err = rp.Client.BalanceAt(context.Background(), feeRecipientInfo.FeeDistributorAddress, nil)
}
return err
})
// Wait for data
if err := wg.Wait(); err != nil {
return nil, err
}
// Get withdrawal address balances
if !bytes.Equal(nodeAccount.Address.Bytes(), response.PrimaryWithdrawalAddress.Bytes()) {
withdrawalBalances, err := tokens.GetBalances(rp, response.PrimaryWithdrawalAddress, nil)
if err != nil {
return nil, err
}
response.PrimaryWithdrawalBalances = withdrawalBalances
}
if !bytes.Equal(nodeAccount.Address.Bytes(), response.RPLWithdrawalAddress.Bytes()) &&
!bytes.Equal(response.PrimaryWithdrawalAddress.Bytes(), response.RPLWithdrawalAddress.Bytes()) {
withdrawalBalances, err := tokens.GetBalances(rp, response.RPLWithdrawalAddress, nil)
if err != nil {
return nil, err
}
response.RPLWithdrawalBalances = withdrawalBalances
}
creditAndBalance, err := node.GetNodeCreditAndBalance(rp, nodeAccount.Address, nil)
if err != nil {
return nil, err
}
response.CreditAndEthOnBehalfBalance = creditAndBalance
usableCreditAndBalance, err := node.GetNodeUsableCreditAndBalance(rp, nodeAccount.Address, nil)
if err != nil {
return nil, err
}
response.UsableCreditAndEthOnBehalfBalance = usableCreditAndBalance
ethBalance, err := node.GetNodeEthBalance(rp, nodeAccount.Address, nil)
if err != nil {
return nil, err
}
response.EthOnBehalfBalance = ethBalance
// Get the collateral ratio
rplPrice, err := network.GetRPLPrice(rp, nil)
if err != nil {
return nil, err
}
activeMinipools := response.MinipoolCounts.Total - response.MinipoolCounts.Finalised
if activeMinipools > 0 {
var wg2 errgroup.Group
var minStakeFraction *big.Int
var maxStakeFraction *big.Int
wg2.Go(func() error {
var err error
minStakeFraction, err = protocol.GetMinimumPerMinipoolStakeRaw(rp, nil)
return err
})
wg2.Go(func() error {
var err error
maxStakeFraction, err = protocol.GetMaximumPerMinipoolStakeRaw(rp, nil)
return err
})
// Wait for data
if err := wg2.Wait(); err != nil {
return nil, err
}
// Calculate the *real* minimum, including the pending bond reductions
trueMinimumStake := big.NewInt(0).Add(response.EthMatched, response.PendingMatchAmount)
trueMinimumStake.Mul(trueMinimumStake, minStakeFraction)
trueMinimumStake.Div(trueMinimumStake, rplPrice)
// Calculate the *real* maximum, including the pending bond reductions
trueMaximumStake := eth.EthToWei(32)
trueMaximumStake.Mul(trueMaximumStake, big.NewInt(int64(activeMinipools)))
trueMaximumStake.Sub(trueMaximumStake, response.EthMatched)
trueMaximumStake.Sub(trueMaximumStake, response.PendingMatchAmount) // (32 * activeMinipools - ethMatched - pendingMatch)
trueMaximumStake.Mul(trueMaximumStake, maxStakeFraction)
trueMaximumStake.Div(trueMaximumStake, rplPrice)
response.MinimumRplStake = trueMinimumStake
response.MaximumRplStake = trueMaximumStake
if response.EffectiveRplStake.Cmp(trueMinimumStake) < 0 {
response.EffectiveRplStake.SetUint64(0)
} else if response.EffectiveRplStake.Cmp(trueMaximumStake) > 0 {
response.EffectiveRplStake.Set(trueMaximumStake)
}
response.BondedCollateralRatio = eth.WeiToEth(rplPrice) * eth.WeiToEth(response.RplStake) / (float64(activeMinipools)*32.0 - eth.WeiToEth(response.EthMatched) - eth.WeiToEth(response.PendingMatchAmount))
response.BorrowedCollateralRatio = eth.WeiToEth(rplPrice) * eth.WeiToEth(response.RplStake) / (eth.WeiToEth(response.EthMatched) + eth.WeiToEth(response.PendingMatchAmount))
// Calculate the "eligible" info (ignoring pending bond reductions) based on the Beacon Chain
_, _, pendingEligibleBorrowedEth, pendingEligibleBondedEth, err := getTrueBorrowAndBondAmounts(rp, bc, nodeAccount.Address)
if err != nil {
return nil, fmt.Errorf("error calculating eligible borrowed and bonded amounts: %w", err)
}
// Calculate the "eligible real" minimum based on the Beacon Chain, including pending bond reductions
pendingTrueMinimumStake := big.NewInt(0).Mul(pendingEligibleBorrowedEth, minStakeFraction)
pendingTrueMinimumStake.Div(pendingTrueMinimumStake, rplPrice)
// Calculate the "eligible real" maximum based on the Beacon Chain, including the pending bond reductions
pendingTrueMaximumStake := big.NewInt(0).Mul(pendingEligibleBondedEth, maxStakeFraction)
pendingTrueMaximumStake.Div(pendingTrueMaximumStake, rplPrice)
response.PendingMinimumRplStake = pendingTrueMinimumStake
response.PendingMaximumRplStake = pendingTrueMaximumStake
response.PendingEffectiveRplStake = big.NewInt(0).Set(response.RplStake)
if response.PendingEffectiveRplStake.Cmp(pendingTrueMinimumStake) < 0 {
response.PendingEffectiveRplStake.SetUint64(0)
} else if response.PendingEffectiveRplStake.Cmp(pendingTrueMaximumStake) > 0 {
response.PendingEffectiveRplStake.Set(pendingTrueMaximumStake)
}
pendingEligibleBondedEthFloat := eth.WeiToEth(pendingEligibleBondedEth)
if pendingEligibleBondedEthFloat == 0 {
response.PendingBondedCollateralRatio = 0
} else {
response.PendingBondedCollateralRatio = eth.WeiToEth(rplPrice) * eth.WeiToEth(response.RplStake) / pendingEligibleBondedEthFloat
}
pendingEligibleBorrowedEthFloat := eth.WeiToEth(pendingEligibleBorrowedEth)
if pendingEligibleBorrowedEthFloat == 0 {
response.PendingBorrowedCollateralRatio = 0
} else {
response.PendingBorrowedCollateralRatio = eth.WeiToEth(rplPrice) * eth.WeiToEth(response.RplStake) / pendingEligibleBorrowedEthFloat
}
} else {
response.BorrowedCollateralRatio = -1
response.BondedCollateralRatio = -1
response.PendingEffectiveRplStake = big.NewInt(0)
response.PendingMinimumRplStake = big.NewInt(0)
response.PendingMaximumRplStake = big.NewInt(0)
response.PendingBondedCollateralRatio = -1
response.PendingBorrowedCollateralRatio = -1
}
// Return response
return &response, nil
}
// Calculate the true borrowed and bonded ETH amounts for a node based on the Beacon status of the minipools
func getTrueBorrowAndBondAmounts(rp *rocketpool.RocketPool, bc beacon.Client, nodeAddress common.Address) (*big.Int, *big.Int, *big.Int, *big.Int, error) {
mpDetails, err := minipool.GetNodeMinipools(rp, nodeAddress, nil)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("error loading minipool details: %w", err)
}
beaconHead, err := bc.GetBeaconHead()
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("error getting beacon head: %w", err)
}
pubkeys := make([]types.ValidatorPubkey, len(mpDetails))
nodeDeposits := make([]*big.Int, len(mpDetails))
userDeposits := make([]*big.Int, len(mpDetails))
pendingNodeDeposits := make([]*big.Int, len(mpDetails))
pendingUserDeposits := make([]*big.Int, len(mpDetails))
latestBlockHeader, err := rp.Client.HeaderByNumber(context.Background(), nil)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("error getting latest block header: %w", err)
}
blockTime := time.Unix(int64(latestBlockHeader.Time), 0)
var reductionWindowStart uint64
var reductionWindowLength uint64
// Data
var wg1 errgroup.Group
wg1.Go(func() error {
var err error
reductionWindowStart, err = tnsettings.GetBondReductionWindowStart(rp, nil)
return err
})
wg1.Go(func() error {
var err error
reductionWindowLength, err = tnsettings.GetBondReductionWindowLength(rp, nil)
return err
})
// Wait for data
if err = wg1.Wait(); err != nil {
return nil, nil, nil, nil, err
}
reductionWindowEnd := time.Duration(reductionWindowStart+reductionWindowLength) * time.Second
// Data
var wg errgroup.Group
zeroTime := time.Unix(0, 0)
for i, mpd := range mpDetails {
if !mpd.Exists {
nodeDeposits[i] = big.NewInt(0)
userDeposits[i] = big.NewInt(0)
pendingNodeDeposits[i] = big.NewInt(0)
pendingUserDeposits[i] = big.NewInt(0)
continue
}
i := i
address := mpd.Address
pubkeys[i] = mpd.Pubkey
wg.Go(func() error {
mp, err := minipool.NewMinipool(rp, address, nil)
if err != nil {
return fmt.Errorf("error making binding for minipool %s: %w", address.Hex(), err)
}
nodeDeposit, err := mp.GetNodeDepositBalance(nil)
if err != nil {
return fmt.Errorf("error getting node deposit for minipool %s: %w", address.Hex(), err)
}
nodeDeposits[i] = nodeDeposit
userDeposit, err := mp.GetUserDepositBalance(nil)
if err != nil {
return fmt.Errorf("error getting user deposit for minipool %s: %w", address.Hex(), err)
}
userDeposits[i] = userDeposit
reduceBondTime, err := minipool.GetReduceBondTime(rp, address, nil)
if err != nil {
return fmt.Errorf("error getting bond reduction time for minipool %s: %w", address.Hex(), err)
}
reduceBondCancelled, err := minipool.GetReduceBondCancelled(rp, address, nil)
if err != nil {
return fmt.Errorf("error getting bond reduction cancel status for minipool %s: %w", address.Hex(), err)
}
// Ignore minipools that don't have a bond reduction pending
timeSinceReductionStart := blockTime.Sub(reduceBondTime)
if reduceBondTime == zeroTime ||
reduceBondCancelled ||
timeSinceReductionStart > reductionWindowEnd {
pendingNodeDeposits[i] = nodeDeposit
pendingUserDeposits[i] = userDeposit
return nil
}
// Get the new (pending) bond
newBond, err := minipool.GetReduceBondValue(rp, address, nil)
if err != nil {
return fmt.Errorf("error getting pending bond reduced balance for minipool %s: %w", address.Hex(), err)
}
pendingNodeDeposits[i] = newBond
// New user deposit = old + delta
pendingUserDeposits[i] = big.NewInt(0).Sub(nodeDeposit, newBond)
pendingUserDeposits[i].Add(pendingUserDeposits[i], userDeposit)
return nil
})
}
// Wait for data
if err = wg.Wait(); err != nil {
return nil, nil, nil, nil, err
}
statuses, err := bc.GetValidatorStatuses(pubkeys, nil)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("error loading validator statuses: %w", err)
}
eligibleBorrowedEth := big.NewInt(0)
eligibleBondedEth := big.NewInt(0)
pendingEligibleBorrowedEth := big.NewInt(0)
pendingEligibleBondedEth := big.NewInt(0)
for i, pubkey := range pubkeys {
status, exists := statuses[pubkey]
if !exists {
// Validator doesn't exist on Beacon yet
continue
}
if status.ActivationEpoch > beaconHead.Epoch {
// Validator hasn't activated yet
continue
}
if status.ExitEpoch <= beaconHead.Epoch {
// Validator exited
continue
}
// It's eligible, so add up the borrowed and bonded amounts
eligibleBorrowedEth.Add(eligibleBorrowedEth, userDeposits[i])
eligibleBondedEth.Add(eligibleBondedEth, nodeDeposits[i])
pendingEligibleBorrowedEth.Add(pendingEligibleBorrowedEth, pendingUserDeposits[i])
pendingEligibleBondedEth.Add(pendingEligibleBondedEth, pendingNodeDeposits[i])
}
return eligibleBorrowedEth, eligibleBondedEth, pendingEligibleBorrowedEth, pendingEligibleBondedEth, nil
}