Skip to content

Commit

Permalink
Merge pull request #23 from yoomee1313/correct-kairos-burnt-amount
Browse files Browse the repository at this point in the history
api: set kairos testnet burnt amount correctly for totalSupply api
  • Loading branch information
yoomee1313 authored Jun 28, 2024
2 parents cf91044 + f1b34a5 commit 400def5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions reward/supply_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"errors"
"fmt"
"math/big"
"strings"
"sync"
"sync/atomic"

Expand Down Expand Up @@ -212,11 +213,17 @@ func (sm *supplyManager) GetRebalanceBurn(num uint64, forkNum *big.Int, addr com
result := struct { // See system.rebalanceResult struct
Burnt *big.Int `json:"burnt"`
}{}
if err := json.Unmarshal([]byte(memo), &result); err != nil {
// 4. memo is malformed
return nil, errNoRebalanceBurn(err)
}

if sm.chain.Config().ChainID.Uint64() == 1001 && strings.HasPrefix(memo, "before") {
// correctly set burnt amount for kairos testnet
result.Burnt = new(big.Int)
result.Burnt.SetString("-3704329462904320084000000000", 10)
} else {
if err := json.Unmarshal([]byte(memo), &result); err != nil {
// memo is malformed
return nil, errNoRebalanceBurn(err)
}
}
// 2. found the memo
sm.memoCache.Add(addr, result.Burnt)
return result.Burnt, nil
Expand Down

0 comments on commit 400def5

Please sign in to comment.