Documentation ¶
Index ¶
- Variables
- func ArrayToStr(a Array) string
- func FromWei(wei, unit *big.Int) (*big.Int, error)
- func GetArrayElems(a Array) []interface{}
- func GetIterableMapElems(m IterableMap) map[string]interface{}
- func IterableMapToStr(m IterableMap) string
- func SliceToStr(s Slice) string
- func VariableToStr(v StateVariable) string
- type Array
- type BasicArray
- func (a *BasicArray) CopyFrom(src Array, dstFrom, srcFrom, srcTo int)
- func (a *BasicArray) Del(index int)
- func (a *BasicArray) ElemType() reflect.Type
- func (a *BasicArray) Get(index int, val interface{})
- func (a *BasicArray) Len() int
- func (a *BasicArray) Name() string
- func (a *BasicArray) Set(index int, val interface{})
- type BasicIterableMap
- func (im *BasicIterableMap) Contains(key interface{}) bool
- func (im *BasicIterableMap) Del(key interface{})
- func (im *BasicIterableMap) Get(key interface{}, val interface{}) (ok bool)
- func (im *BasicIterableMap) GetKVType() (key, val reflect.Type)
- func (im *BasicIterableMap) Index(i int, key, val interface{})
- func (im *BasicIterableMap) Len() int
- func (im *BasicIterableMap) Name() string
- func (im *BasicIterableMap) Range(fn func(key, val interface{}) bool)
- func (im *BasicIterableMap) Set(key, val interface{})
- type BasicMap
- type BasicSlice
- func (s *BasicSlice) Append(vals ...interface{})
- func (s *BasicSlice) Cap() int
- func (s *BasicSlice) CopyFrom(src Array, dstFrom, srcFrom, srcTo int)
- func (s *BasicSlice) Del(index int)
- func (s *BasicSlice) ElemType() reflect.Type
- func (s *BasicSlice) Get(index int, val interface{})
- func (s *BasicSlice) Len() int
- func (s *BasicSlice) Name() string
- func (s *BasicSlice) Pop(val interface{})
- func (s *BasicSlice) Set(index int, val interface{})
- type BasicStateVariable
- func (sv *BasicStateVariable) Addr() common.Hash
- func (sv *BasicStateVariable) CopyFrom(src StateVariable)
- func (sv *BasicStateVariable) Del()
- func (sv *BasicStateVariable) Get(val interface{}) bool
- func (sv *BasicStateVariable) IsAssigned() bool
- func (sv *BasicStateVariable) Name() string
- func (sv *BasicStateVariable) Set(val interface{})
- func (sv *BasicStateVariable) Type() reflect.Type
- type ContractState
- type IterableMap
- type Map
- type Slice
- type StateVariable
- type TypeFactory
- func (t *TypeFactory) GetArray(name string, length int, typ reflect.Type) Array
- func (t *TypeFactory) GetIterableMap(name string, keyType, valType reflect.Type) IterableMap
- func (t *TypeFactory) GetMap(name string, keyType, valType reflect.Type) Map
- func (t *TypeFactory) GetSlice(name string, length, cap int, typ reflect.Type) Slice
- func (t *TypeFactory) GetVariable(name string, typ reflect.Type) StateVariable
- func (t *TypeFactory) NewArray(name string, length int, typ reflect.Type) Array
- func (t *TypeFactory) NewFloat64(name string, initialVal float64) StateVariable
- func (t *TypeFactory) NewInt(name string, initialVal int) StateVariable
- func (t *TypeFactory) NewIterableMap(name string, keyType, valType reflect.Type) IterableMap
- func (t *TypeFactory) NewMap(name string, keyType, valType reflect.Type) Map
- func (t *TypeFactory) NewSlice(name string, length, cap int, typ reflect.Type) Slice
- func (t *TypeFactory) NewString(name, initialVal string) StateVariable
- func (t *TypeFactory) NewStringArray(name string, length int, initialData []string) Array
- func (t *TypeFactory) NewStringSlice(name string, length, cap int, initialData []string) Slice
- func (t *TypeFactory) NewUint(name string, initialVal uint) StateVariable
- func (t *TypeFactory) NewVariable(name string, initialVal interface{}) StateVariable
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Token Wei *big.Int = big.NewInt(1) Kwei *big.Int = new(big.Int).Mul(Wei, big.NewInt(1000)) Mwei *big.Int = new(big.Int).Mul(Kwei, big.NewInt(1000)) Gwei *big.Int = new(big.Int).Mul(Mwei, big.NewInt(1000)) Microether *big.Int = new(big.Int).Mul(Gwei, big.NewInt(1000)) Milliether *big.Int = new(big.Int).Mul(Microether, big.NewInt(1000)) Ether *big.Int = new(big.Int).Mul(Milliether, big.NewInt(1000)) Kether *big.Int = new(big.Int).Mul(Ether, big.NewInt(1000)) Mether *big.Int = new(big.Int).Mul(Kether, big.NewInt(1000)) Gether *big.Int = new(big.Int).Mul(Mether, big.NewInt(1000)) )
View Source
var ( // Basic Type StringType = reflect.TypeOf("") IntType = reflect.TypeOf(int(0)) Int8Type = reflect.TypeOf(int8(0)) Int16Type = reflect.TypeOf(int16(0)) Int32Type = reflect.TypeOf(int32(0)) Int64Type = reflect.TypeOf(int64(0)) UintType = reflect.TypeOf(uint(0)) Uint8Type = reflect.TypeOf(uint8(0)) Uint16Type = reflect.TypeOf(uint16(0)) Uint32Type = reflect.TypeOf(uint32(0)) Uint64Type = reflect.TypeOf(uint64(0)) Float32Type = reflect.TypeOf(float32(0)) Float64Type = reflect.TypeOf(float64(0)) BoolType = reflect.TypeOf(false) BytesType = reflect.TypeOf([]byte{}) )
View Source
var ( // Complex Type AddressType = reflect.TypeOf(common.Address{}) BigIntType = reflect.TypeOf(big.Int{}) )
View Source
var (
ErrIndexOutOfRange = errors.New("index out of range")
)
Functions ¶
func ArrayToStr ¶
func GetArrayElems ¶
func GetArrayElems(a Array) []interface{}
func GetIterableMapElems ¶
func GetIterableMapElems(m IterableMap) map[string]interface{}
func IterableMapToStr ¶
func IterableMapToStr(m IterableMap) string
func SliceToStr ¶
func VariableToStr ¶
func VariableToStr(v StateVariable) string
Types ¶
type Array ¶
type Array interface { // Get get val from index, val must // be pointer Get(index int, val interface{}) Set(index int, val interface{}) // Del deletes element in index, and // move all elements after index move forward by one position Del(index int) Len() int CopyFrom(src Array, dstFrom, srcFrom, srcTo int) // ElemType returns element type of the array ElemType() reflect.Type // Range(fn func(index int, val interface{}) bool) // Name returns the name of array Name() string }
Array represents a simple array.
type BasicArray ¶
type BasicArray struct {
// contains filtered or unexported fields
}
func GetBasicArray ¶
func GetBasicArray(state *ContractState, name string, typ reflect.Type) (*BasicArray, error)
func NewBasicArray ¶
func NewBasicArray(state *ContractState, name string, len int, typ reflect.Type) (*BasicArray, error)
func (*BasicArray) CopyFrom ¶
func (a *BasicArray) CopyFrom(src Array, dstFrom, srcFrom, srcTo int)
func (*BasicArray) Del ¶
func (a *BasicArray) Del(index int)
func (*BasicArray) ElemType ¶
func (a *BasicArray) ElemType() reflect.Type
func (*BasicArray) Get ¶
func (a *BasicArray) Get(index int, val interface{})
func (*BasicArray) Len ¶
func (a *BasicArray) Len() int
func (*BasicArray) Name ¶
func (a *BasicArray) Name() string
func (*BasicArray) Set ¶
func (a *BasicArray) Set(index int, val interface{})
type BasicIterableMap ¶
type BasicIterableMap struct {
// contains filtered or unexported fields
}
func GetBasicIterableMap ¶
func GetBasicIterableMap(state *ContractState, name string, keyType, valType reflect.Type) (*BasicIterableMap, error)
func NewBasicIterableMap ¶
func NewBasicIterableMap(state *ContractState, name string, keyType, valType reflect.Type) (*BasicIterableMap, error)
func (*BasicIterableMap) Contains ¶
func (im *BasicIterableMap) Contains(key interface{}) bool
func (*BasicIterableMap) Del ¶
func (im *BasicIterableMap) Del(key interface{})
func (*BasicIterableMap) Get ¶
func (im *BasicIterableMap) Get(key interface{}, val interface{}) (ok bool)
func (*BasicIterableMap) GetKVType ¶
func (im *BasicIterableMap) GetKVType() (key, val reflect.Type)
func (*BasicIterableMap) Index ¶
func (im *BasicIterableMap) Index(i int, key, val interface{})
func (*BasicIterableMap) Len ¶
func (im *BasicIterableMap) Len() int
func (*BasicIterableMap) Name ¶
func (im *BasicIterableMap) Name() string
func (*BasicIterableMap) Range ¶
func (im *BasicIterableMap) Range(fn func(key, val interface{}) bool)
func (*BasicIterableMap) Set ¶
func (im *BasicIterableMap) Set(key, val interface{})
type BasicMap ¶
type BasicMap struct {
// contains filtered or unexported fields
}
func GetBasicMap ¶
func NewBasicMap ¶
type BasicSlice ¶
type BasicSlice struct {
// contains filtered or unexported fields
}
func GetBasicSlice ¶
func GetBasicSlice(state *ContractState, name string, typ reflect.Type) (*BasicSlice, error)
func NewBasicSlice ¶
func NewBasicSlice(state *ContractState, name string, len, cap int, typ reflect.Type) (*BasicSlice, error)
func (*BasicSlice) Append ¶
func (s *BasicSlice) Append(vals ...interface{})
func (*BasicSlice) Cap ¶
func (s *BasicSlice) Cap() int
func (*BasicSlice) CopyFrom ¶
func (s *BasicSlice) CopyFrom(src Array, dstFrom, srcFrom, srcTo int)
func (*BasicSlice) Del ¶
func (s *BasicSlice) Del(index int)
func (*BasicSlice) ElemType ¶
func (s *BasicSlice) ElemType() reflect.Type
func (*BasicSlice) Get ¶
func (s *BasicSlice) Get(index int, val interface{})
func (*BasicSlice) Len ¶
func (s *BasicSlice) Len() int
func (*BasicSlice) Name ¶
func (s *BasicSlice) Name() string
func (*BasicSlice) Pop ¶
func (s *BasicSlice) Pop(val interface{})
func (*BasicSlice) Set ¶
func (s *BasicSlice) Set(index int, val interface{})
type BasicStateVariable ¶
type BasicStateVariable struct {
// contains filtered or unexported fields
}
func GetBasicStateVariable ¶
func GetBasicStateVariable(state *ContractState, variableName string, typ reflect.Type) (*BasicStateVariable, error)
func NewBasicStateVariable ¶
func NewBasicStateVariable(state *ContractState, variableName string, initialVal interface{}) (*BasicStateVariable, error)
func (*BasicStateVariable) Addr ¶
func (sv *BasicStateVariable) Addr() common.Hash
func (*BasicStateVariable) CopyFrom ¶
func (sv *BasicStateVariable) CopyFrom(src StateVariable)
func (*BasicStateVariable) Del ¶
func (sv *BasicStateVariable) Del()
func (*BasicStateVariable) Get ¶
func (sv *BasicStateVariable) Get(val interface{}) bool
func (*BasicStateVariable) IsAssigned ¶
func (sv *BasicStateVariable) IsAssigned() bool
func (*BasicStateVariable) Name ¶
func (sv *BasicStateVariable) Name() string
func (*BasicStateVariable) Set ¶
func (sv *BasicStateVariable) Set(val interface{})
func (*BasicStateVariable) Type ¶
func (sv *BasicStateVariable) Type() reflect.Type
type ContractState ¶
type ContractState struct {
// contains filtered or unexported fields
}
func NewContractState ¶
func NewContractState(db vm.StateDB, addr common.Address) *ContractState
func (*ContractState) Delete ¶
func (s *ContractState) Delete(hash common.Hash)
type IterableMap ¶
type IterableMap interface { Map // Len returns the number of elems Len() int // Index get key and val by index i, // key and val must be pointer Index(i int, key, val interface{}) // Range iterate all key-value pair, it // will stop if fn returns false Range(fn func(key, val interface{}) bool) }
IterableMap represents a iterable mapping
type Map ¶
type Map interface { // Get val from key, val must be pointer, // returns false if element not exsit. Get(key interface{}, val interface{}) (ok bool) Set(key, val interface{}) Contains(key interface{}) bool Del(key interface{}) // GetKVType returns key-value pair type GetKVType() (key, val reflect.Type) // Name returns the name of map Name() string }
Map represents key-value pair mapping
type Slice ¶
type Slice interface { Array // Cap returns capacity of the Slice Cap() int // Append append elements in the tail of the slice Append(vals ...interface{}) // Pop remove elements in the tail of the slice Pop(val interface{}) }
Slice represents a slice like slice in golang
type StateVariable ¶
type StateVariable interface { // Del delete this state variable Del() // Set set state variable as val Set(val interface{}) // Get get state variable, val must be pointer. // The value of state variable will store into val. // Return true if the initial value has been assigned. Get(val interface{}) bool // CopyFrom copy the value of src into // this state variable CopyFrom(src StateVariable) // Type returns type of this state variable Type() reflect.Type // IsAssigned returns true if the initial value // has been assigned. IsAssigned() bool // Addr returns the location of this state variable Addr() common.Hash // Name returns the name of state varialbe Name() string }
StateVariable represents global variable and stores in chain db
type TypeFactory ¶
type TypeFactory struct {
// contains filtered or unexported fields
}
func NewTypeFactory ¶
func (*TypeFactory) GetIterableMap ¶
func (t *TypeFactory) GetIterableMap(name string, keyType, valType reflect.Type) IterableMap
func (*TypeFactory) GetMap ¶
func (t *TypeFactory) GetMap(name string, keyType, valType reflect.Type) Map
func (*TypeFactory) GetVariable ¶
func (t *TypeFactory) GetVariable(name string, typ reflect.Type) StateVariable
func (*TypeFactory) NewFloat64 ¶
func (t *TypeFactory) NewFloat64(name string, initialVal float64) StateVariable
func (*TypeFactory) NewInt ¶
func (t *TypeFactory) NewInt(name string, initialVal int) StateVariable
func (*TypeFactory) NewIterableMap ¶
func (t *TypeFactory) NewIterableMap(name string, keyType, valType reflect.Type) IterableMap
func (*TypeFactory) NewMap ¶
func (t *TypeFactory) NewMap(name string, keyType, valType reflect.Type) Map
func (*TypeFactory) NewString ¶
func (t *TypeFactory) NewString(name, initialVal string) StateVariable
func (*TypeFactory) NewStringArray ¶
func (t *TypeFactory) NewStringArray(name string, length int, initialData []string) Array
func (*TypeFactory) NewStringSlice ¶
func (t *TypeFactory) NewStringSlice(name string, length, cap int, initialData []string) Slice
func (*TypeFactory) NewUint ¶
func (t *TypeFactory) NewUint(name string, initialVal uint) StateVariable
func (*TypeFactory) NewVariable ¶
func (t *TypeFactory) NewVariable(name string, initialVal interface{}) StateVariable
Click to show internal directories.
Click to hide internal directories.