types

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 9 Imported by: 9

Documentation

Index

Constants

View Source
const (
	KeyContractCallResultPrefix uint8 = iota
)
View Source
const (
	ModuleName = "cross-contract"
)

Variables

This section is empty.

Functions

func ContextWithContractRuntimeInfo

func ContextWithContractRuntimeInfo(ctx context.Context, runtimeInfo ContractRuntimeInfo) context.Context

ContextWithContractRuntimeInfo returns a context with an updated ContractRuntimeInfo

func KeyContractCallResult

func KeyContractCallResult(txID crosstypes.TxID, txIndex crosstypes.TxIndex) []byte

func KeyPrefixBytes

func KeyPrefixBytes(prefix uint8) []byte

KeyPrefixBytes return the key prefix bytes from a URL string format

func SetupContractContext

func SetupContractContext(ctx sdk.Context, runtimeInfo ContractRuntimeInfo) sdk.Context

Types

type CommitMode

type CommitMode = uint8

CommitMode indicates the type of the commit. It is used to tell the underlying store that manages the state. It is also expected to be set correctly by the transaction processor.

const (
	// UnspecifiedMode indicates that nothing is specified.
	UnspecifiedMode CommitMode = iota + 1

	// BaseMode expects store operations to be committed in a single local transaction.
	// However, depending on the implementation of the store may need to prevent conflicts with concurrent transactions.
	BasicMode

	// AtomicMode expects store operations to be committed in cross-chain transaction.
	AtomicMode
)

func CommitModeFromContext

func CommitModeFromContext(ctx context.Context) CommitMode

CommitModeFromContext returns the CommitMode from context

type CommitStoreI

type CommitStoreI interface {
	Precommit(ctx sdk.Context, id []byte) error
	Abort(ctx sdk.Context, id []byte) error
	Commit(ctx sdk.Context, id []byte) error
	CommitImmediately(ctx sdk.Context)
}

CommitStoreI defines the expected commit store in ContractManager

type ContractHandleDecorator

type ContractHandleDecorator interface {
	Handle(ctx context.Context, callInfo txtypes.ContractCallInfo) (newCtx context.Context, err error)
}

type ContractHandleDecorators

type ContractHandleDecorators []ContractHandleDecorator

func (ContractHandleDecorators) Handle

func (decs ContractHandleDecorators) Handle(ctx context.Context, callInfo txtypes.ContractCallInfo) (newCtx context.Context, err error)

type ContractHandler

type ContractHandler func(ctx context.Context, signers []authtypes.Account, callInfo txtypes.ContractCallInfo) (*txtypes.ContractCallResult, error)

type ContractModule

type ContractModule interface {
	OnContractCall(ctx context.Context, signers []authtypes.Account, callInfo txtypes.ContractCallInfo) (*txtypes.ContractCallResult, error)
}

type ContractRuntimeInfo

type ContractRuntimeInfo struct {
	CommitMode           CommitMode
	ExternalCallResolver txtypes.CallResolver
}

func ContractRuntimeFromContext

func ContractRuntimeFromContext(ctx context.Context) ContractRuntimeInfo

ContractRuntimeFromContext returns the ContractRuntimeInfo from context

type ErrContractCall

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

ErrContractCall is raised when the caller is failed to call the contract

func NewErrContractCall

func NewErrContractCall(err error) ErrContractCall

NewErrContractCall creates a new instance of ErrContractCall

func (ErrContractCall) Error

func (e ErrContractCall) Error() string

Error implements error.Error

type ExternalContractCaller

type ExternalContractCaller interface {
	Call(ctx sdk.Context, xcc xcctypes.XCC, callInfo txtypes.ContractCallInfo, signers []authtypes.Account) []byte
}

func NewExternalContractCaller

func NewExternalContractCaller() ExternalContractCaller

Jump to

Keyboard shortcuts

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