common/types: add StringToAddress (used in mainnet genesis definition)

This commit is contained in:
Luke Williams 2019-05-16 17:41:52 +02:00
parent 7defef6387
commit 16fc5d0b52

View file

@ -175,6 +175,10 @@ func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }
// If s is larger than len(h), s will be cropped from the left.
func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
// StringToAddress returns Address with byte values of s.
// If s is larger than len(h), s will be cropped from the left.
func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) }
// IsHexAddress verifies whether a string can represent a valid hex-encoded
// Ethereum address or not.
func IsHexAddress(s string) bool {