Documentation ¶
Index ¶
- Variables
- func CallContract(ps Process, addr, entry Reader, argb Reader) int
- func ECRecover(ps Process, h, v, r, s Reader, ret Writer) int
- func ECRecoverAddress(ps Process, h, v, r, s Reader, ret Writer) int
- func GetArg(ps Process, idx, offset int, buf Writer) int
- func GetSender(ps Process, w Writer) int
- func Log(ps Process, msg Reader) int
- func Read(ps Process, id, offset int, buf Writer) int
- func ReadState(ps Process, key Reader, offset int, buf Writer) int
- func SetResponse(ps Process, val Reader) int
- func WriteState(ps Process, key, val Reader) int
- type Args
- type Contract
- type ContractManager
- func (cm *ContractManager) DeployContract(ctx types.Context, tx *transaction.ContractDeployTx) (common.Address, error)
- func (cm *ContractManager) GetContract(ctx types.Context, addr common.Address) (*Contract, error)
- func (cm *ContractManager) SaveContract(ctx types.Context, addr common.Address, c *Contract) error
- type ContractMapper
- type Env
- type EnvManager
- type Process
- type Reader
- type Resolver
- type Result
- type VM
- type VMProvider
- type ValueTable
- type Writer
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrContractNotFound = errors.New("contract not found")
)
Functions ¶
func SetResponse ¶
func WriteState ¶
Types ¶
type Args ¶
type Args struct {
// contains filtered or unexported fields
}
func DeserializeArgs ¶
DeserializeArgs returns args bytes format is <elem_num: 4byte>|<elem1_size: 4byte>|<elem1_data>|<elem2_size: 4byte>|<elem2_data>|...
func NewArgsFromStrings ¶
func (*Args) PushString ¶
type Contract ¶
func TxToContract ¶
func TxToContract(tx *transaction.ContractDeployTx) *Contract
type ContractManager ¶
type ContractManager struct {
// contains filtered or unexported fields
}
func NewContractManager ¶
func NewContractManager(mp ContractMapper) *ContractManager
func (*ContractManager) DeployContract ¶
func (cm *ContractManager) DeployContract(ctx types.Context, tx *transaction.ContractDeployTx) (common.Address, error)
func (*ContractManager) GetContract ¶
func (*ContractManager) SaveContract ¶
type ContractMapper ¶
type ContractMapper interface { Put(ctx types.Context, addr common.Address, c *Contract) Get(ctx types.Context, addr common.Address) (*Contract, error) }
func NewContractMapper ¶
func NewContractMapper(storeKey types.StoreKey) ContractMapper
type Env ¶
type Env struct { Context sdk.Context Logger logger.Logger Sender common.Address Args Args EnvManager *EnvManager Contract *Contract VMProvider VMProvider DB *db.VersionedDB // contains filtered or unexported fields }
func (*Env) GetReponse ¶
func (*Env) SetResponse ¶
type EnvManager ¶
type EnvManager struct {
// contains filtered or unexported fields
}
func NewEnvManager ¶
func NewEnvManager(key sdk.StoreKey, cm ContractMapper) *EnvManager
type Process ¶
type Process interface { Logger() logger.Logger Sender() common.Address Args() Args State() db.StateDB SetResponse([]byte) Call(addr common.Address, entry []byte, args Args) (int, error) Read(id int) ([]byte, error) ValueTable() ValueTable }
func NewProcess ¶
func NewProcess(vm *exec.VirtualMachine, env *Env, logger logger.Logger, vt ValueTable) Process
NewProcess create a new process
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func (*Resolver) ResolveFunc ¶
func (r *Resolver) ResolveFunc(module, field string) exec.FunctionImport
ResolveFunc defines a set of import functions that may be called within a WebAssembly module.
func (*Resolver) ResolveGlobal ¶
ResolveGlobal defines a set of global variables for use within a WebAssembly module.
type VMProvider ¶
type ValueTable ¶
ValueTable manages values that external contract returns.
Click to show internal directories.
Click to hide internal directories.