Temporarily switched to using common.Address in tests

This commit is contained in:
Paul Berg 2018-10-24 03:16:35 +01:00 committed by Martin Holst Swende
parent 0484d96325
commit e92a59b875
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
2 changed files with 8 additions and 8 deletions

View file

@ -61,7 +61,7 @@ type EIP712Domain struct {
Name string `json:"name"` Name string `json:"name"`
Version string `json:"version"` Version string `json:"version"`
ChainId *big.Int `json:"chainId"` ChainId *big.Int `json:"chainId"`
VerifyingContract string `json:"verifyingContract"` VerifyingContract common.Address `json:"verifyingContract"`
Salt hexutil.Bytes `json:"salt"` Salt hexutil.Bytes `json:"salt"`
} }
@ -358,14 +358,14 @@ func (typedData *TypedData) EncodeData(primaryType string, data map[string]inter
switch encType { switch encType {
case "address": case "address":
primitiveEncType = "address" primitiveEncType = "uint160"
bytesValue := []byte{} bytesValue := []byte{}
for i := 0; i < 12; i++ { for i := 0; i < 12; i++ {
bytesValue = append(bytesValue, 0) bytesValue = append(bytesValue, 0)
} }
foo := common.BytesToAddress([]byte(encValue.(string))) //foo := common.BytesToAddress([]byte(encValue.(string)))
fmt.Println(foo) //fmt.Println(foo)
for _, _byte := range common.BytesToAddress([]byte(encValue.(string))) { for _, _byte := range encValue.(common.Address) {
bytesValue = append(bytesValue, _byte) bytesValue = append(bytesValue, _byte)
} }
primitiveEncValue = bytesValue primitiveEncValue = bytesValue

View file

@ -76,18 +76,18 @@ var domainStandard = EIP712Domain{
"Ether Mail", "Ether Mail",
"1", "1",
big.NewInt(1), big.NewInt(1),
"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", common.HexToAddress("0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"),
nil, nil,
} }
var dataStandard = map[string]interface{}{ var dataStandard = map[string]interface{}{
"from": map[string]interface{}{ "from": map[string]interface{}{
"name": "Cow", "name": "Cow",
"wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826", "wallet": common.HexToAddress("0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"),
}, },
"to": map[string]interface{}{ "to": map[string]interface{}{
"name": "Bob", "name": "Bob",
"wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB", "wallet": common.HexToAddress("0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"),
}, },
"contents": "Hello, Bob!", "contents": "Hello, Bob!",
} }