Skip to content

Commit

Permalink
fix: initial amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
Alok committed Apr 22, 2024
1 parent d17bc3a commit a1be18e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/apiserver/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (s *Service) configureDashboard() error {
}
currentAmount, ok := big.NewInt(0).SetString(existing.TotalAmount, 10)
if !ok {
return errors.New("failed to parse total amount")
currentAmount = big.NewInt(0)
}
currentAmount = big.NewInt(0).Add(currentAmount, big.NewInt(0).SetUint64(cmt.Amount))
existing.TotalAmount = currentAmount.String()
Expand Down Expand Up @@ -234,7 +234,7 @@ func (s *Service) configureDashboard() error {
}
currentRewards, ok := big.NewInt(0).SetString(existing.Rewards, 10)
if !ok {
return errors.New("failed to parse rewards")
currentRewards = big.NewInt(0)
}
currentRewards = big.NewInt(0).Add(currentRewards, upd.Amount)
existing.Rewards = currentRewards.String()
Expand All @@ -248,7 +248,7 @@ func (s *Service) configureDashboard() error {
if b.Bidder == upd.Bidder.Hex() {
currentSettled, ok := big.NewInt(0).SetString(b.Settled, 10)
if !ok {
return errors.New("failed to parse settled")
currentSettled = big.NewInt(0)
}
currentSettled = big.NewInt(0).Add(currentSettled, upd.Amount)
b.Settled = currentSettled.String()
Expand Down Expand Up @@ -314,7 +314,7 @@ func (s *Service) configureDashboard() error {
if b.Bidder == upd.Bidder.Hex() {
currentReturned, ok := big.NewInt(0).SetString(b.Refunds, 10)
if !ok {
return errors.New("failed to parse used")
currentReturned = big.NewInt(0)
}
currentReturned = big.NewInt(0).Add(currentReturned, upd.Amount)
b.Refunds = currentReturned.String()
Expand Down

0 comments on commit a1be18e

Please sign in to comment.