diff --git a/common/types.go b/common/types.go index 6a7be73c98..ebcbcbf2fa 100644 --- a/common/types.go +++ b/common/types.go @@ -30,11 +30,11 @@ import ( const ( HashLength = 32 AddressLength = 20 - BlockSigners = "0x0000000000000000000000000000000000000089" - MasternodeVotingSMC = "0x0000000000000000000000000000000000000088" - RandomizeSMC = "0x0000000000000000000000000000000000000090" - FoudationAddr = "0x0000000000000000000000000000000000000068" - TeamAddr = "0x0000000000000000000000000000000000000099" + MasternodeVotingSMC = "xdc0000000000000000000000000000000000000088" + BlockSigners = "xdc0000000000000000000000000000000000000089" + RandomizeSMC = "xdc0000000000000000000000000000000000000090" + FoudationAddr = "xdc0000000000000000000000000000000000000068" + TeamAddr = "xdc0000000000000000000000000000000000000099" VoteMethod = "0x6dd7d8ea" UnvoteMethod = "0x02aa9be2" ProposeMethod = "0x01267951" @@ -50,11 +50,6 @@ var ( // Hash represents the 32 byte Keccak256 hash of arbitrary data. type Hash [HashLength]byte -type Vote struct { - Masternode Address - Voter Address -} - func BytesToHash(b []byte) Hash { var h Hash h.SetBytes(b) @@ -165,6 +160,9 @@ func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) } // IsHexAddress verifies whether a string can represent a valid hex-encoded // Ethereum address or not. func IsHexAddress(s string) bool { + if hasXDCPrefix(s) { + s = s[3:] + } if hasHexPrefix(s) { s = s[2:] } @@ -196,7 +194,7 @@ func (a Address) Hex() string { result[i] -= 32 } } - return "0x" + string(result) + return "xdc" + string(result) } // String implements the stringer interface and is used also by the logger. @@ -230,7 +228,7 @@ func (a *Address) Set(other Address) { // MarshalText returns the hex representation of a. func (a Address) MarshalText() ([]byte, error) { - return hexutil.Bytes(a[:]).MarshalText() + return hexutil.Bytes(a[:]).MarshalXDCText() } // UnmarshalText parses a hash in hex syntax.