aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorVoR0220 <rj@erisindustries.com>2016-12-05 06:11:03 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-12-19 20:11:11 +0800
commit471990f771b6ce2c4f4645479df51b25666f9e0a (patch)
tree3adf6e9600fcaa3a942b6c61686669ec5a61396c /accounts
parent2dcf75a722f193ef5528f5af8fb4fd7c5824fded (diff)
downloadgo-tangerine-471990f771b6ce2c4f4645479df51b25666f9e0a.tar
go-tangerine-471990f771b6ce2c4f4645479df51b25666f9e0a.tar.gz
go-tangerine-471990f771b6ce2c4f4645479df51b25666f9e0a.tar.bz2
go-tangerine-471990f771b6ce2c4f4645479df51b25666f9e0a.tar.lz
go-tangerine-471990f771b6ce2c4f4645479df51b25666f9e0a.tar.xz
go-tangerine-471990f771b6ce2c4f4645479df51b25666f9e0a.tar.zst
go-tangerine-471990f771b6ce2c4f4645479df51b25666f9e0a.zip
accounts/abi: prepare ABI to handle fixed point types
Signed-off-by: VoR0220 <rj@erisindustries.com>
Diffstat (limited to 'accounts')
-rw-r--r--accounts/abi/type.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/accounts/abi/type.go b/accounts/abi/type.go
index 39b843f81..db51f07b8 100644
--- a/accounts/abi/type.go
+++ b/accounts/abi/type.go
@@ -33,7 +33,7 @@ const (
FixedBytesTy
BytesTy
HashTy
- RealTy
+ FixedPointTy
)
// Type is the reflection of the supported argument type
@@ -46,6 +46,7 @@ type Type struct {
Kind reflect.Kind
Type reflect.Type
Size int
+ DecimalSize int // Determines the length of the binary coded decimal in fixed point types.
T byte // Our own type checking
stringKind string // holds the unparsed string for deriving signatures
@@ -57,16 +58,16 @@ var (
// Types can be in the format of:
//
// Input = Type [ "[" [ Number ] "]" ] Name .
- // Type = [ "u" ] "int" [ Number ] .
+ // Type = [ "u" ] "int" [ Number ] [ x ] [ Number ].
//
// Examples:
//
- // string int uint real
+ // string int uint fixed
// string32 int8 uint8 uint[]
- // address int256 uint256 real[2]
+ // address int256 uint256 fixed128x128[2]
fullTypeRegex = regexp.MustCompile("([a-zA-Z0-9]+)(\\[([0-9]*)?\\])?")
// typeRegex parses the abi sub types
- typeRegex = regexp.MustCompile("([a-zA-Z]+)([0-9]*)?")
+ typeRegex = regexp.MustCompile("([a-zA-Z]+)([0-9]*)?x?([0-9]*)?")
)
// NewType creates a new reflection type of abi type given in t.