fix(wallet)_: fix crash on cbridge fee calculation

This commit is contained in:
Ivan Belyakov 2024-05-17 15:01:48 +02:00 committed by IvanBelyakoff
parent 4a1a29b6a5
commit 16171c9dc8
1 changed files with 8 additions and 2 deletions

View File

@ -184,8 +184,14 @@ func (s *CBridge) CalculateFees(from, to *params.Network, token *token.Token, am
if err != nil {
return nil, nil, err
}
baseFee, _ := new(big.Int).SetString(amt.BaseFee, 10)
percFee, _ := new(big.Int).SetString(amt.PercFee, 10)
baseFee, ok := new(big.Int).SetString(amt.BaseFee, 10)
if !ok {
return nil, nil, errors.New("failed to parse base fee")
}
percFee, ok := new(big.Int).SetString(amt.PercFee, 10)
if !ok {
return nil, nil, errors.New("failed to parse percentage fee")
}
return big.NewInt(0), new(big.Int).Add(baseFee, percFee), nil
}