Documentation
¶
Index ¶
- Variables
- func EncodeCallData(sig Signature, dat func(*Builder) *Builder) []byte
- func PrettyHex(xs []byte) string
- type Builder
- func (d *Builder) Address(a common.Address) *Builder
- func (d *Builder) BigInt(ret *big.Int) *Builder
- func (d *Builder) BigUint(a *uint256.Int) *Builder
- func (d *Builder) Bool(b bool) *Builder
- func (d *Builder) Bytes(s []byte) *Builder
- func (d *Builder) DString(s string) *Builder
- func (d *Builder) EnterArray(t TypeName, l int) *Builder
- func (d *Builder) EnterDynamicArray() *Builder
- func (d *Builder) EnterGroup(l int, w bool) *Builder
- func (d *Builder) EnterTuple() *Builder
- func (d *Builder) Exit() *Builder
- func (d *Builder) Finish(prefix ...[]byte) []byte
- func (d *Builder) FixedBytes(l int, s []byte) *Builder
- func (d *Builder) Int(i int) *Builder
- func (d *Builder) Mem() Memory
- func (d *Builder) PadRight(xs []byte) *Builder
- func (d *Builder) Uint(i uint) *Builder
- func (d *Builder) Uint16(i uint16) *Builder
- func (d *Builder) Uint256(a *uint256.Int) *Builder
- func (d *Builder) Uint8(i uint8) *Builder
- func (d *Builder) Word(xs []byte) *Builder
- type Call
- type Decoder
- func (d *Decoder) Address() (common.Address, error)
- func (d *Decoder) BigInt() (*big.Int, error)
- func (d *Decoder) Bool() (bool, error)
- func (d *Decoder) Bytes() ([]byte, error)
- func (d *Decoder) DString() (string, error)
- func (d *Decoder) Dynamic() (*Decoder, error)
- func (d *Decoder) DynamicLength() (*Decoder, int, error)
- func (d *Decoder) Int() (int, error)
- func (d *Decoder) Peek(o []byte) (int, error)
- func (d *Decoder) PeekUint256() (*uint256.Int, error)
- func (d *Decoder) PeekWord() (o [32]byte, err error)
- func (d *Decoder) Read(o []byte) (int, error)
- func (d *Decoder) ReadN(n int) ([]byte, error)
- func (d *Decoder) ReadNPadRight32(n int) ([]byte, error)
- func (d *Decoder) ReadWord() (o [32]byte, err error)
- func (d *Decoder) Remaining() []byte
- func (d *Decoder) Seek(offset int64, whence int) (int64, error)
- func (d *Decoder) Uint() (uint, error)
- func (d *Decoder) Uint16() (uint16, error)
- func (d *Decoder) Uint256() (*uint256.Int, error)
- func (d *Decoder) Uint8() (uint8, error)
- type Memory
- type Signature
- type TypeName
- func (t TypeName) IsDynamic() bool
- func (t TypeName) IsFixedSlice() bool
- func (t TypeName) IsNumber() bool
- func (t TypeName) IsSimple() bool
- func (t TypeName) IsSlice() bool
- func (t TypeName) IsTuple() bool
- func (t TypeName) IsUnsigned() bool
- func (t TypeName) TupleArgs() []TypeName
- func (t TypeName) UnSlice() (TypeName, int)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MaxUint256 is the maximum value that can be represented by a uint256. MaxUint256 = new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 256), common.Big1) // MaxInt256 is the maximum value that can be represented by a int256. MaxInt256 = new(big.Int).Sub(new(big.Int).Lsh(common.Big1, 255), common.Big1) )
Functions ¶
Types ¶
type Builder ¶
type Builder struct { NewMem func() Memory // contains filtered or unexported fields }
Builder is used to encode ethereum abi
func (*Builder) EnterArray ¶
fixed size array TODO: write in a type + size compliance check later
func (*Builder) EnterDynamicArray ¶
length unspecified array
func (*Builder) EnterGroup ¶
l = 0 is variable length dynamic l = -1 is tuple (static) * # doesnt matter as long as negative l > 0 is length specified array (dynamic elements) l < 0 is length specified array (static elements)
func (*Builder) Finish ¶
finish closes all children, and returns the result slice
func (*Builder) Mem ¶
get the memory object, uses default memory impl by default
func (*Builder) PadRight ¶
generic builder writer methods
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
type Memory ¶
type Memory interface { // returns the full data Data() []byte // increments the cursor by input, returns new cursor Pos(int) int // insert bytes to a location in memory, appending if needed Insert(loc int, data []byte) // replacing bytes at a location in memory, growing the slice if needed Put(loc int, data []byte) }
Memory is the underlying store for decoder data
type Signature ¶
type Signature string
represents the string that is hashed for things like function signature and event signatures
type TypeName ¶
type TypeName string
represents a valid evm abi type.
const ( UINT TypeName = "uint256" UINT8 TypeName = "uint8" UINT16 TypeName = "uint16" UINT24 TypeName = "uint24" UINT32 TypeName = "uint32" UINT40 TypeName = "uint40" UINT48 TypeName = "uint48" UINT56 TypeName = "uint56" UINT64 TypeName = "uint64" UINT72 TypeName = "uint72" UINT80 TypeName = "uint80" UINT88 TypeName = "uint88" UINT96 TypeName = "uint96" UINT104 TypeName = "uint104" UINT112 TypeName = "uint112" UINT120 TypeName = "uint120" UINT128 TypeName = "uint128" UINT136 TypeName = "uint136" UINT144 TypeName = "uint144" UINT152 TypeName = "uint152" UINT160 TypeName = "uint160" UINT168 TypeName = "uint168" UINT176 TypeName = "uint176" UINT184 TypeName = "uint184" UINT192 TypeName = "uint192" UINT200 TypeName = "uint200" UINT208 TypeName = "uint208" UINT216 TypeName = "uint216" UINT224 TypeName = "uint224" UINT232 TypeName = "uint232" UINT240 TypeName = "uint240" UINT248 TypeName = "uint248" UINT256 TypeName = "uint256" INT TypeName = "int256" INT8 TypeName = "int8" INT16 TypeName = "int16" INT24 TypeName = "int24" INT32 TypeName = "int32" INT40 TypeName = "int40" INT48 TypeName = "int48" INT56 TypeName = "int56" INT64 TypeName = "int64" INT72 TypeName = "int72" INT80 TypeName = "int80" INT88 TypeName = "int88" INT96 TypeName = "int96" INT104 TypeName = "int104" INT112 TypeName = "int112" INT120 TypeName = "int120" INT128 TypeName = "int128" INT136 TypeName = "int136" INT144 TypeName = "int144" INT152 TypeName = "int152" INT160 TypeName = "int160" INT168 TypeName = "int168" INT176 TypeName = "int176" INT184 TypeName = "int184" INT192 TypeName = "int192" INT200 TypeName = "int200" INT208 TypeName = "int208" INT216 TypeName = "int216" INT224 TypeName = "int224" INT232 TypeName = "int232" INT240 TypeName = "int240" INT248 TypeName = "int248" INT256 TypeName = "int256" )
const ( BYTES TypeName = "bytes" BYTES1 TypeName = "bytes1" BYTES2 TypeName = "bytes2" BYTES3 TypeName = "bytes3" BYTES4 TypeName = "bytes4" BYTES5 TypeName = "bytes5" BYTES6 TypeName = "bytes6" BYTES7 TypeName = "bytes7" BYTES8 TypeName = "bytes8" BYTES9 TypeName = "bytes9" BYTES10 TypeName = "bytes10" BYTES11 TypeName = "bytes11" BYTES12 TypeName = "bytes12" BYTES13 TypeName = "bytes13" BYTES14 TypeName = "bytes14" BYTES15 TypeName = "bytes15" BYTES16 TypeName = "bytes16" BYTES17 TypeName = "bytes17" BYTES18 TypeName = "bytes18" BYTES19 TypeName = "bytes19" BYTES20 TypeName = "bytes20" BYTES21 TypeName = "bytes21" BYTES22 TypeName = "bytes22" BYTES23 TypeName = "bytes23" BYTES24 TypeName = "bytes24" BYTES25 TypeName = "bytes25" BYTES26 TypeName = "bytes26" BYTES27 TypeName = "bytes27" BYTES28 TypeName = "bytes28" BYTES29 TypeName = "bytes29" BYTES30 TypeName = "bytes30" BYTES31 TypeName = "bytes31" BYTES32 TypeName = "bytes32" )
Click to show internal directories.
Click to hide internal directories.