Documentation ¶
Index ¶
- Constants
- func ContextWithContractRuntimeInfo(ctx context.Context, runtimeInfo ContractRuntimeInfo) context.Context
- func KeyContractCallResult(txID crosstypes.TxID, txIndex crosstypes.TxIndex) []byte
- func KeyPrefixBytes(prefix uint8) []byte
- func SetupContractContext(ctx sdk.Context, runtimeInfo ContractRuntimeInfo) sdk.Context
- type CommitMode
- type CommitStoreI
- type ContractHandleDecorator
- type ContractHandleDecorators
- type ContractHandler
- type ContractModule
- type ContractRuntimeInfo
- type ErrContractCall
- type ExternalContractCaller
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 ¶
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 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)
func NewContractHandler ¶
func NewContractHandler(h ContractHandler, decs ...ContractHandleDecorator) ContractHandler
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
type ExternalContractCaller ¶
type ExternalContractCaller interface {
Call(ctx sdk.Context, xcc xcctypes.XCC, callInfo txtypes.ContractCallInfo, signers []authtypes.Account) []byte
}
func NewExternalContractCaller ¶
func NewExternalContractCaller() ExternalContractCaller
Click to show internal directories.
Click to hide internal directories.