aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/type.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-12-08 06:24:41 +0800
committerFelix Lange <fjl@twurst.com>2015-12-08 06:24:41 +0800
commit38ff815485ce908f7430ff91fd39f0335cd35968 (patch)
treeafc09a4673eb6fa7b2c4c59f4210f884f8c61d53 /accounts/abi/type.go
parent659d6b9b7cc876660581482e876b6b8ceb6360c2 (diff)
parenta0bf2ea7e732b114518c3d8c66db337e0a7932f1 (diff)
downloadgo-tangerine-38ff815485ce908f7430ff91fd39f0335cd35968.tar
go-tangerine-38ff815485ce908f7430ff91fd39f0335cd35968.tar.gz
go-tangerine-38ff815485ce908f7430ff91fd39f0335cd35968.tar.bz2
go-tangerine-38ff815485ce908f7430ff91fd39f0335cd35968.tar.lz
go-tangerine-38ff815485ce908f7430ff91fd39f0335cd35968.tar.xz
go-tangerine-38ff815485ce908f7430ff91fd39f0335cd35968.tar.zst
go-tangerine-38ff815485ce908f7430ff91fd39f0335cd35968.zip
Merge pull request #2003 from obscuren/abi-calling
accounts/abi: added output parsing & added call mechanism
Diffstat (limited to 'accounts/abi/type.go')
-rw-r--r--accounts/abi/type.go12
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
}
}