aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/type.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-02-09 20:57:00 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2016-02-11 17:16:38 +0800
commitecc876cec0b4c70bfa5ff9939ac86715bf9579de (patch)
tree54538afc6ccd8f0ff7eb1a35e0caf54920f11046 /accounts/abi/type.go
parent856b9e9c500dae60ed84e75d9577b2deb504558e (diff)
downloadgo-tangerine-ecc876cec0b4c70bfa5ff9939ac86715bf9579de.tar.gz
go-tangerine-ecc876cec0b4c70bfa5ff9939ac86715bf9579de.tar.zst
go-tangerine-ecc876cec0b4c70bfa5ff9939ac86715bf9579de.zip
accounts/abi: fixed return tuple and string, bytes return type parsing
Removed old unmarshalling of return types: `abi.Call(...).([]byte)`. This is now replaced by a new syntax: ``` var a []byte err := abi.Call(&a, ...) ``` It also addresses a few issues with Bytes and Strings and can also handle both fixed and arbitrary sized byte slices, including strings.
Diffstat (limited to 'accounts/abi/type.go')
-rw-r--r--accounts/abi/type.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/accounts/abi/type.go b/accounts/abi/type.go
index 32f761ef0..6fb2950ba 100644
--- a/accounts/abi/type.go
+++ b/accounts/abi/type.go
@@ -29,8 +29,11 @@ const (
IntTy byte = iota
UintTy
BoolTy
+ StringTy
SliceTy
AddressTy
+ FixedBytesTy
+ BytesTy
HashTy
RealTy
)
@@ -118,6 +121,7 @@ func NewType(t string) (typ Type, err error) {
typ.T = UintTy
case "bool":
typ.Kind = reflect.Bool
+ typ.T = BoolTy
case "real": // TODO
typ.Kind = reflect.Invalid
case "address":
@@ -128,6 +132,7 @@ func NewType(t string) (typ Type, err error) {
case "string":
typ.Kind = reflect.String
typ.Size = -1
+ typ.T = StringTy
if vsize > 0 {
typ.Size = 32
}
@@ -140,6 +145,11 @@ func NewType(t string) (typ Type, err error) {
typ.Kind = reflect.Slice
typ.Type = byte_ts
typ.Size = vsize
+ if vsize == 0 {
+ typ.T = BytesTy
+ } else {
+ typ.T = FixedBytesTy
+ }
default:
return Type{}, fmt.Errorf("unsupported arg type: %s", t)
}