Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: set kairos testnet burnt amount correctly for totalSupply api #23

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading