diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-11-20 20:45:37 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-11-25 19:23:29 +0800 |
commit | a0bf2ea7e732b114518c3d8c66db337e0a7932f1 (patch) | |
tree | 27a17d5772f47ce80ce80c4de80bd77928c544e9 /accounts/abi/type.go | |
parent | b0fb48c389460193d9fc0a5118d79ff6dec48ce0 (diff) | |
download | go-tangerine-a0bf2ea7e732b114518c3d8c66db337e0a7932f1.tar.gz go-tangerine-a0bf2ea7e732b114518c3d8c66db337e0a7932f1.tar.zst go-tangerine-a0bf2ea7e732b114518c3d8c66db337e0a7932f1.zip |
accounts/abi: added output parsing & added call mechanism
Added calling mechanism and return value parsing
Diffstat (limited to 'accounts/abi/type.go')
-rw-r--r-- | accounts/abi/type.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/accounts/abi/type.go b/accounts/abi/type.go index 16d7491e7..8f0238fc9 100644 --- a/accounts/abi/type.go +++ b/accounts/abi/type.go @@ -31,6 +31,7 @@ const ( BoolTy SliceTy AddressTy + HashTy RealTy ) @@ -121,7 +122,7 @@ func NewType(t string) (typ Type, err error) { typ.Kind = reflect.Invalid case "address": typ.Kind = reflect.Slice - typ.Type = byte_ts + typ.Type = address_t typ.Size = 20 typ.T = AddressTy case "string": @@ -130,6 +131,11 @@ func NewType(t string) (typ Type, err error) { if vsize > 0 { typ.Size = 32 } + case "hash": + typ.Kind = reflect.Slice + typ.Size = 32 + typ.Type = hash_t + typ.T = HashTy case "bytes": typ.Kind = reflect.Slice typ.Type = byte_ts @@ -206,9 +212,9 @@ func (t Type) pack(v interface{}) ([]byte, error) { } case reflect.Array: if v, ok := value.Interface().(common.Address); ok { - return t.pack(v[:]) + return common.LeftPadBytes(v[:], 32), nil } else if v, ok := value.Interface().(common.Hash); ok { - return t.pack(v[:]) + return v[:], nil } } |