Skip to content

Commit

Permalink
faucet: code improve
Browse files Browse the repository at this point in the history
Co-authored-by: Matus Kysel <MatusKysel@users.noreply.github.com>
  • Loading branch information
zzzckck and MatusKysel committed Sep 4, 2024
1 parent 3e121e7 commit 5663e52
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/faucet/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ var (
var websiteTmpl string

func weiToEtherStringFx(wei *big.Int, prec int) string {
f, _ := new(big.Float).Quo(new(big.Float).SetInt(wei), big.NewFloat(params.Ether)).Float64()
return strconv.FormatFloat(f, 'f', prec, 64)
etherValue := new(big.Float).Quo(new(big.Float).SetInt(wei), big.NewFloat(params.Ether))
// Format the big.Float directly to a string with the specified precision
return etherValue.Text('f', prec)
}

func main() {
Expand Down

0 comments on commit 5663e52

Please sign in to comment.