0g-chain/precompiles/common/utils.go

19 lines
430 B
Go
Raw Permalink Normal View History

2024-10-24 13:23:45 +00:00
package common
import (
"math/big"
"strings"
"cosmossdk.io/math"
"github.com/ethereum/go-ethereum/common"
)
func ToLowerHexWithoutPrefix(addr common.Address) string {
return strings.ToLower(addr.Hex()[2:])
}
// BigIntToLegacyDec converts a uint number (18 decimals) to math.LegacyDec (18 decimals)
func BigIntToLegacyDec(x *big.Int) math.LegacyDec {
return math.LegacyNewDecFromBigIntWithPrec(x, math.LegacyPrecision)
}