diff options
author | RJ <rj@erisindustries.com> | 2017-01-05 18:46:44 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-01-05 18:46:44 +0800 |
commit | 2126d8148806b6d8597d6a1c761080e9dc98d745 (patch) | |
tree | 82f83bff1c99701b1664120ef269d2ec9aae16d9 /accounts/abi/type.go | |
parent | 06b381d1c9dd8e47d7862c0846352a0023e53ed0 (diff) | |
download | go-tangerine-2126d8148806b6d8597d6a1c761080e9dc98d745.tar.gz go-tangerine-2126d8148806b6d8597d6a1c761080e9dc98d745.tar.zst go-tangerine-2126d8148806b6d8597d6a1c761080e9dc98d745.zip |
accounts/abi: add support for function types (#3405)
Diffstat (limited to 'accounts/abi/type.go')
-rw-r--r-- | accounts/abi/type.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/accounts/abi/type.go b/accounts/abi/type.go index 32089ce69..7af7ff386 100644 --- a/accounts/abi/type.go +++ b/accounts/abi/type.go @@ -34,6 +34,7 @@ const ( BytesTy HashTy FixedpointTy + FunctionTy ) // Type is the reflection of the supported argument type @@ -148,6 +149,12 @@ func NewType(t string) (typ Type, err error) { typ.T = FixedBytesTy typ.SliceSize = varSize } + case "function": + sliceType, _ := NewType("uint8") + typ.Elem = &sliceType + typ.IsArray = true + typ.T = FunctionTy + typ.SliceSize = 24 default: return Type{}, fmt.Errorf("unsupported arg type: %s", t) } @@ -168,7 +175,7 @@ func (t Type) pack(v reflect.Value) ([]byte, error) { return nil, err } - if (t.IsSlice || t.IsArray) && t.T != BytesTy && t.T != FixedBytesTy { + if (t.IsSlice || t.IsArray) && t.T != BytesTy && t.T != FixedBytesTy && t.T != FunctionTy { var packed []byte for i := 0; i < v.Len(); i++ { |