aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/numbers.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-03-15 21:06:12 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-03-15 21:10:39 +0800
commitfe45210c552f5de2ec6293817dc0363a34d0ebfb (patch)
tree261ca0a2ec9582f7d9b7d2d3758cf13bf506a5e8 /accounts/abi/numbers.go
parente189fb839c688b418b43ad6533111c246c109a93 (diff)
downloaddexon-fe45210c552f5de2ec6293817dc0363a34d0ebfb.tar
dexon-fe45210c552f5de2ec6293817dc0363a34d0ebfb.tar.gz
dexon-fe45210c552f5de2ec6293817dc0363a34d0ebfb.tar.bz2
dexon-fe45210c552f5de2ec6293817dc0363a34d0ebfb.tar.lz
dexon-fe45210c552f5de2ec6293817dc0363a34d0ebfb.tar.xz
dexon-fe45210c552f5de2ec6293817dc0363a34d0ebfb.tar.zst
dexon-fe45210c552f5de2ec6293817dc0363a34d0ebfb.zip
accounts/abi: Fixed bytes input accept []byte and variable input support
Fixed up `[]byte` slice support such that `function print(bytes input)` accepts `[]byte` as input and treats it as 1 element rather than a slice of multiple elements. Added support for variable length input parameters like `bytes` and `strings`.
Diffstat (limited to 'accounts/abi/numbers.go')
-rw-r--r--accounts/abi/numbers.go58
1 files changed, 30 insertions, 28 deletions
diff --git a/accounts/abi/numbers.go b/accounts/abi/numbers.go
index c37cd5f68..02609d567 100644
--- a/accounts/abi/numbers.go
+++ b/accounts/abi/numbers.go
@@ -23,36 +23,38 @@ import (
"github.com/ethereum/go-ethereum/common"
)
-var big_t = reflect.TypeOf(&big.Int{})
-var ubig_t = reflect.TypeOf(&big.Int{})
-var byte_t = reflect.TypeOf(byte(0))
-var byte_ts = reflect.TypeOf([]byte(nil))
-var uint_t = reflect.TypeOf(uint(0))
-var uint8_t = reflect.TypeOf(uint8(0))
-var uint16_t = reflect.TypeOf(uint16(0))
-var uint32_t = reflect.TypeOf(uint32(0))
-var uint64_t = reflect.TypeOf(uint64(0))
-var int_t = reflect.TypeOf(int(0))
-var int8_t = reflect.TypeOf(int8(0))
-var int16_t = reflect.TypeOf(int16(0))
-var int32_t = reflect.TypeOf(int32(0))
-var int64_t = reflect.TypeOf(int64(0))
-var hash_t = reflect.TypeOf(common.Hash{})
-var address_t = reflect.TypeOf(common.Address{})
+var (
+ big_t = reflect.TypeOf(&big.Int{})
+ ubig_t = reflect.TypeOf(&big.Int{})
+ byte_t = reflect.TypeOf(byte(0))
+ byte_ts = reflect.TypeOf([]byte(nil))
+ uint_t = reflect.TypeOf(uint(0))
+ uint8_t = reflect.TypeOf(uint8(0))
+ uint16_t = reflect.TypeOf(uint16(0))
+ uint32_t = reflect.TypeOf(uint32(0))
+ uint64_t = reflect.TypeOf(uint64(0))
+ int_t = reflect.TypeOf(int(0))
+ int8_t = reflect.TypeOf(int8(0))
+ int16_t = reflect.TypeOf(int16(0))
+ int32_t = reflect.TypeOf(int32(0))
+ int64_t = reflect.TypeOf(int64(0))
+ hash_t = reflect.TypeOf(common.Hash{})
+ address_t = reflect.TypeOf(common.Address{})
-var uint_ts = reflect.TypeOf([]uint(nil))
-var uint8_ts = reflect.TypeOf([]uint8(nil))
-var uint16_ts = reflect.TypeOf([]uint16(nil))
-var uint32_ts = reflect.TypeOf([]uint32(nil))
-var uint64_ts = reflect.TypeOf([]uint64(nil))
-var ubig_ts = reflect.TypeOf([]*big.Int(nil))
+ uint_ts = reflect.TypeOf([]uint(nil))
+ uint8_ts = reflect.TypeOf([]uint8(nil))
+ uint16_ts = reflect.TypeOf([]uint16(nil))
+ uint32_ts = reflect.TypeOf([]uint32(nil))
+ uint64_ts = reflect.TypeOf([]uint64(nil))
+ ubig_ts = reflect.TypeOf([]*big.Int(nil))
-var int_ts = reflect.TypeOf([]int(nil))
-var int8_ts = reflect.TypeOf([]int8(nil))
-var int16_ts = reflect.TypeOf([]int16(nil))
-var int32_ts = reflect.TypeOf([]int32(nil))
-var int64_ts = reflect.TypeOf([]int64(nil))
-var big_ts = reflect.TypeOf([]*big.Int(nil))
+ int_ts = reflect.TypeOf([]int(nil))
+ int8_ts = reflect.TypeOf([]int8(nil))
+ int16_ts = reflect.TypeOf([]int16(nil))
+ int32_ts = reflect.TypeOf([]int32(nil))
+ int64_ts = reflect.TypeOf([]int64(nil))
+ big_ts = reflect.TypeOf([]*big.Int(nil))
+)
// U256 will ensure unsigned 256bit on big nums
func U256(n *big.Int) []byte {