handler

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2018 License: Apache-2.0 Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

*

  • Copyright 2017 Intel Corporation *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.
  • ------------------------------------------------------------------------------

Index

Constants

This section is empty.

Variables

View Source
var TxnHandlers = map[SethTransaction_TransactionType]TransactionHandler{
	SethTransaction_CREATE_EXTERNAL_ACCOUNT: CreateExternalAccount,
	SethTransaction_CREATE_CONTRACT_ACCOUNT: CreateContractAccount,
	SethTransaction_MESSAGE_CALL:            MessageCall,
	SethTransaction_SET_PERMISSIONS:         SetPermissions,
}

Functions

func StringToWord256

func StringToWord256(s string) (binary.Word256, error)

Types

type BurrowEVMHandler

type BurrowEVMHandler struct{}

func NewBurrowEVMHandler

func NewBurrowEVMHandler() *BurrowEVMHandler

func (*BurrowEVMHandler) Apply

func (self *BurrowEVMHandler) Apply(request *processor_pb2.TpProcessRequest, context *processor.Context) error

func (*BurrowEVMHandler) FamilyName

func (self *BurrowEVMHandler) FamilyName() string

func (*BurrowEVMHandler) FamilyVersions

func (self *BurrowEVMHandler) FamilyVersions() []string

func (*BurrowEVMHandler) Namespaces

func (self *BurrowEVMHandler) Namespaces() []string

type HandlerResult

type HandlerResult struct {
	GasUsed     uint64
	ReturnValue []byte
	NewAccount  acm.Account
	Error       error
}

func CreateContractAccount

func CreateContractAccount(wrapper *SethTransaction, sender *EvmAddr, sapps *SawtoothAppState) HandlerResult

func CreateExternalAccount

func CreateExternalAccount(wrapper *SethTransaction, sender *EvmAddr, sapps *SawtoothAppState) HandlerResult

func MessageCall

func MessageCall(wrapper *SethTransaction, sender *EvmAddr, sapps *SawtoothAppState) HandlerResult

func SetPermissions

func SetPermissions(wrapper *SethTransaction, sender *EvmAddr, sapps *SawtoothAppState) HandlerResult

type SawtoothAppState

type SawtoothAppState struct {
	// contains filtered or unexported fields
}

SawtoothAppState implements the interface used by the Burrow EVM to access global state

func NewSawtoothAppState

func NewSawtoothAppState(state *processor.Context) *SawtoothAppState

func (*SawtoothAppState) CreateAccount

func (s *SawtoothAppState) CreateAccount(creator *acm.MutableAccount) acm.Account

CreateAccount creates a new Contract Account using the given existing account to generate a new address. panics if the given account doesn't exist or the address of the newly created account conflicts with an existing account.

func (*SawtoothAppState) GetAccount

func (s *SawtoothAppState) GetAccount(addr crypto.Address) (acm.Account, error)

GetAccount retrieves an existing account with the given address. Returns nil if the account doesn't exist.

func (*SawtoothAppState) GetBlockHash

func (s *SawtoothAppState) GetBlockHash(blockNumber int64) (binary.Word256, error)

func (*SawtoothAppState) GetStorage

func (s *SawtoothAppState) GetStorage(address crypto.Address, key binary.Word256) (binary.Word256, error)

GetStorage gets the 256 bit value stored with the given key in the given account, returns zero if the key does not exist.

func (*SawtoothAppState) RemoveAccount

func (s *SawtoothAppState) RemoveAccount(acct crypto.Address) error

RemoveAccount removes the account and associated storage from global state and panics if it doesn't exist.

func (*SawtoothAppState) SetStorage

func (s *SawtoothAppState) SetStorage(address crypto.Address, key, value binary.Word256) error

func (*SawtoothAppState) UpdateAccount

func (s *SawtoothAppState) UpdateAccount(acct acm.Account) error

UpdateAccount updates the account in state. Creates the account if it doesn't exist yet.

type SawtoothEventFireable

type SawtoothEventFireable struct {
	// contains filtered or unexported fields
}

func NewSawtoothEventFireable

func NewSawtoothEventFireable(context *processor.Context) *SawtoothEventFireable

func (*SawtoothEventFireable) Call

func (evc *SawtoothEventFireable) Call(call *exec.CallEvent, exception *errors.Exception)

func (*SawtoothEventFireable) Log

func (evc *SawtoothEventFireable) Log(log *exec.LogEvent)

type StateManager

type StateManager struct {
	// contains filtered or unexported fields
}

StateManager simplifies accessing EVM related data stored in state

func NewStateManager

func NewStateManager(state *processor.Context) *StateManager

func (*StateManager) DelEntry

func (mgr *StateManager) DelEntry(vmAddress *EvmAddr) error

DelEntry removes the given entry from state. An error is returned if the entry does not exist.

func (*StateManager) GetEntry

func (mgr *StateManager) GetEntry(vmAddress *EvmAddr) (*EvmEntry, error)

GetEntry retrieve the entry from state at the given address. If the entry does not exist, nil is returned.

func (*StateManager) MustGetEntry

func (mgr *StateManager) MustGetEntry(vmAddress *EvmAddr) *EvmEntry

MustGetEntry wraps GetEntry and panics if the entry does not exist of there is an error.

func (*StateManager) MustSetEntry

func (mgr *StateManager) MustSetEntry(vmAddress *EvmAddr, entry *EvmEntry)

MustSetEntry wraps set entry and panics if there is an error.

func (*StateManager) NewEntry

func (mgr *StateManager) NewEntry(vmAddress *EvmAddr) (*EvmEntry, error)

NewEntry creates a new entry in state. If an entry already exists at the given address or the entry cannot be created, an error is returned.

func (*StateManager) SetEntry

func (mgr *StateManager) SetEntry(vmAddress *EvmAddr, entry *EvmEntry) error

SetEntry writes the entry to the given address. Returns an error if it fails to set the address.

type TransactionHandler

type TransactionHandler func(*SethTransaction, *common.EvmAddr, *SawtoothAppState) HandlerResult

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL