all: cleanup imports (#524)
This commit is contained in:
+2
-2
@@ -5,7 +5,7 @@ import (
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
ethcrypto "github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -23,7 +23,7 @@ var (
|
||||
func ProtoAccount() authtypes.AccountI {
|
||||
return &EthAccount{
|
||||
BaseAccount: &authtypes.BaseAccount{},
|
||||
CodeHash: common.BytesToHash(ethcrypto.Keccak256(nil)).String(),
|
||||
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -3,24 +3,23 @@ package types
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
ethcmn "github.com/ethereum/go-ethereum/common"
|
||||
|
||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
// IsEmptyHash returns true if the hash corresponds to an empty ethereum hex hash.
|
||||
func IsEmptyHash(hash string) bool {
|
||||
return bytes.Equal(ethcmn.HexToHash(hash).Bytes(), ethcmn.Hash{}.Bytes())
|
||||
return bytes.Equal(common.HexToHash(hash).Bytes(), common.Hash{}.Bytes())
|
||||
}
|
||||
|
||||
// IsZeroAddress returns true if the address corresponds to an empty ethereum hex address.
|
||||
func IsZeroAddress(address string) bool {
|
||||
return bytes.Equal(ethcmn.HexToAddress(address).Bytes(), ethcmn.Address{}.Bytes())
|
||||
return bytes.Equal(common.HexToAddress(address).Bytes(), common.Address{}.Bytes())
|
||||
}
|
||||
|
||||
// ValidateAddress returns an error if the provided string is either not a hex formatted string address
|
||||
func ValidateAddress(address string) error {
|
||||
if !ethcmn.IsHexAddress(address) {
|
||||
if !common.IsHexAddress(address) {
|
||||
return sdkerrors.Wrapf(
|
||||
sdkerrors.ErrInvalidAddress, "address '%s' is not a valid ethereum hex address",
|
||||
address,
|
||||
|
||||
@@ -3,9 +3,8 @@ package types
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
ethcmn "github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
func TestIsEmptyHash(t *testing.T) {
|
||||
@@ -18,11 +17,11 @@ func TestIsEmptyHash(t *testing.T) {
|
||||
"empty string", "", true,
|
||||
},
|
||||
{
|
||||
"zero hash", ethcmn.Hash{}.String(), true,
|
||||
"zero hash", common.Hash{}.String(), true,
|
||||
},
|
||||
|
||||
{
|
||||
"non-empty hash", ethcmn.BytesToHash([]byte{1, 2, 3, 4}).String(), false,
|
||||
"non-empty hash", common.BytesToHash([]byte{1, 2, 3, 4}).String(), false,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -41,11 +40,11 @@ func TestIsZeroAddress(t *testing.T) {
|
||||
"empty string", "", true,
|
||||
},
|
||||
{
|
||||
"zero address", ethcmn.Address{}.String(), true,
|
||||
"zero address", common.Address{}.String(), true,
|
||||
},
|
||||
|
||||
{
|
||||
"non-empty address", ethcmn.BytesToAddress([]byte{1, 2, 3, 4}).String(), false,
|
||||
"non-empty address", common.BytesToAddress([]byte{1, 2, 3, 4}).String(), false,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user