Versions in this module Expand all Collapse all v0 v0.16.1 Apr 4, 2017 Changes in this version + const GasBaseOp + const GasEcRecover + const GasGetAccount + const GasIdentityBase + const GasIdentityWord + const GasRipemd160Base + const GasRipemd160Word + const GasSha256Base + const GasSha256Word + const GasSha3 + const GasStackOp + const GasStorageUpdate + var ErrCallStackOverflow = errors.New("Call stack overflow") + var ErrCallStackUnderflow = errors.New("Call stack underflow") + var ErrCodeOutOfBounds = errors.New("Code out of bounds") + var ErrDataStackOverflow = errors.New("Data stack overflow") + var ErrDataStackUnderflow = errors.New("Data stack underflow") + var ErrInputOutOfBounds = errors.New("Input out of bounds") + var ErrInsufficientBalance = errors.New("Insufficient balance") + var ErrInsufficientGas = errors.New("Insufficient gas") + var ErrInvalidContract = errors.New("Invalid contract") + var ErrInvalidJumpDest = errors.New("Invalid jump dest") + var ErrMemoryOutOfBounds = errors.New("Memory out of bounds") + var ErrNativeContractCodeCopy = errors.New("Tried to copy native contract code") + var ErrUnknownAddress = errors.New("Unknown address") + func HasPermission(appState AppState, acc *Account, perm ptypes.PermFlag) bool + func RegisterNativeContract(addr Word256, fn NativeContract) bool + func RegisteredNativeContract(addr Word256) bool + func S256(x *big.Int) *big.Int + func SNativeContracts() map[string]*SNativeContractDescription + func SetDebug(d bool) + func U256(x *big.Int) *big.Int + func ValidPermN(n ptypes.PermFlag) bool + type Account struct + Address Word256 + Balance int64 + Code []byte + Nonce int64 + Other interface{} + Permissions ptypes.AccountPermissions + func (acc *Account) String() string + type AppState interface + CreateAccount func(*Account) *Account + GetAccount func(addr Word256) *Account + GetStorage func(Word256, Word256) Word256 + RemoveAccount func(*Account) + SetStorage func(Word256, Word256, Word256) + UpdateAccount func(*Account) + type Debug bool + func (d Debug) Printf(s string, a ...interface{}) + type ErrInvalidPermission struct + Address Word256 + SNative string + func (e ErrInvalidPermission) Error() string + type ErrPermission struct + func (err ErrPermission) Error() string + type FakeAppState struct + func (fas *FakeAppState) CreateAccount(creator *Account) *Account + func (fas *FakeAppState) GetAccount(addr Word256) *Account + func (fas *FakeAppState) GetStorage(addr Word256, key Word256) Word256 + func (fas *FakeAppState) RemoveAccount(account *Account) + func (fas *FakeAppState) SetStorage(addr Word256, key Word256, value Word256) + func (fas *FakeAppState) UpdateAccount(account *Account) + type NativeContract func(appState AppState, caller *Account, input []byte, gas *int64) (output []byte, err error) + type Params struct + BlockHash Word256 + BlockHeight int64 + BlockTime int64 + GasLimit int64 + type SNativeContractDescription struct + Comment string + Name string + func NewSNativeContract(comment, name string, functions ...*SNativeFunctionDescription) *SNativeContractDescription + func (contract *SNativeContractDescription) Address() abi.Address + func (contract *SNativeContractDescription) AddressBytes() []byte + func (contract *SNativeContractDescription) AddressWord256() Word256 + func (contract *SNativeContractDescription) Dispatch(appState AppState, caller *Account, args []byte, gas *int64) (output []byte, err error) + func (contract *SNativeContractDescription) FunctionByID(id abi.FunctionSelector) (*SNativeFunctionDescription, error) + func (contract *SNativeContractDescription) FunctionByName(name string) (*SNativeFunctionDescription, error) + func (contract *SNativeContractDescription) Functions() []*SNativeFunctionDescription + type SNativeFunctionDescription struct + Args []abi.Arg + Comment string + F NativeContract + Name string + PermFlag ptypes.PermFlag + Return abi.Return + func (function *SNativeFunctionDescription) ID() abi.FunctionSelector + func (function *SNativeFunctionDescription) NArgs() int + func (function *SNativeFunctionDescription) Signature() string + type Stack struct + func NewStack(capacity int, gas *int64, err *error) *Stack + func (st *Stack) Dup(n int) + func (st *Stack) Len() int + func (st *Stack) Peek() Word256 + func (st *Stack) Pop() Word256 + func (st *Stack) Pop64() int64 + func (st *Stack) PopBytes() []byte + func (st *Stack) Print(n int) + func (st *Stack) Push(d Word256) + func (st *Stack) Push64(i int64) + func (st *Stack) PushBytes(bz []byte) + func (st *Stack) Swap(n int) + type VM struct + func NewVM(appState AppState, params Params, origin Word256, txid []byte) *VM + func (vm *VM) Call(caller, callee *Account, code, input []byte, value int64, gas *int64) (output []byte, err error) + func (vm *VM) DelegateCall(caller, callee *Account, code, input []byte, value int64, gas *int64) (output []byte, err error) + func (vm *VM) SetFireable(evc events.Fireable)