testing

package
v0.0.0-...-96587e2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCaptureInstantiateFnCodeID uint64 = 0

DefaultCaptureInstantiateFnCodeID value used for building the contract address

Variables

This section is empty.

Functions

func CaptureCreateFn

func CaptureCreateFn() (func(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *wasmtypes.AccessConfig) (codeID uint64, err error), *[]CapturedCreateCalls)

CaptureCreateFn records all calls in the returned slice

func CaptureExecuteFn

func CaptureExecuteFn() (func(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error), *[]CapturedExecuteCalls)

CaptureExecuteFn records all calls in the returned slice

func CaptureInstantiateFn

func CaptureInstantiateFn(codeIDs ...uint64) (func(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins) (sdk.AccAddress, []byte, error), *[]CapturedInstantiateCalls)

CaptureInstantiateFn records all calls in the returned slice

func CapturePinCodeFn

func CapturePinCodeFn() (func(ctx sdk.Context, codeID uint64) error, *[]uint64)

Types

type CapturedCreateCalls

type CapturedCreateCalls struct {
	Creator           sdk.AccAddress
	WasmCode          []byte
	InstantiateAccess *wasmtypes.AccessConfig
}

type CapturedExecuteCalls

type CapturedExecuteCalls struct {
	ContractAddress sdk.AccAddress
	Caller          sdk.AccAddress
	Msg             []byte
	Coins           sdk.Coins
}

type CapturedInstantiateCalls

type CapturedInstantiateCalls struct {
	CodeID         uint64
	Creator, Admin sdk.AccAddress
	InitMsg        []byte
	Label          string
	Deposit        sdk.Coins
}

type ContractOpsKeeperMock

type ContractOpsKeeperMock struct {
	CreateFn                   func(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *wasmtypes.AccessConfig) (codeID uint64, checksum []byte, err error)
	InstantiateFn              func(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins) (sdk.AccAddress, []byte, error)
	Instantiate2Fn             func(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins, salt []byte, fixMsg bool) (sdk.AccAddress, []byte, error)
	ExecuteFn                  func(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error)
	MigrateFn                  func(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte) ([]byte, error)
	UpdateContractAdminFn      func(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newAdmin sdk.AccAddress) error
	ClearContractAdminFn       func(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress) error
	PinCodeFn                  func(ctx sdk.Context, codeID uint64) error
	UnpinCodeFn                func(ctx sdk.Context, codeID uint64) error
	SetContractInfoExtensionFn func(ctx sdk.Context, contract sdk.AccAddress, extra wasmtypes.ContractInfoExtension) error
	SudoFn                     func(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
	SetAccessConfigFn          func(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, config wasmtypes.AccessConfig) error
}

ContractOpsKeeperMock implements wasmtypes.ContractOpsKeeper for testing purpose

func (ContractOpsKeeperMock) ClearContractAdmin

func (m ContractOpsKeeperMock) ClearContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress) error

func (ContractOpsKeeperMock) Create

func (m ContractOpsKeeperMock) Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *wasmtypes.AccessConfig) (codeID uint64, checksum []byte, err error)

func (ContractOpsKeeperMock) Execute

func (m ContractOpsKeeperMock) Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error)

func (ContractOpsKeeperMock) Instantiate

func (m ContractOpsKeeperMock) Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins) (sdk.AccAddress, []byte, error)

func (ContractOpsKeeperMock) Instantiate2

func (m ContractOpsKeeperMock) Instantiate2(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins, salt []byte, fixMsg bool) (sdk.AccAddress, []byte, error)

func (ContractOpsKeeperMock) Migrate

func (m ContractOpsKeeperMock) Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte) ([]byte, error)

func (ContractOpsKeeperMock) PinCode

func (m ContractOpsKeeperMock) PinCode(ctx sdk.Context, codeID uint64) error

func (ContractOpsKeeperMock) SetAccessConfig

func (m ContractOpsKeeperMock) SetAccessConfig(ctx sdk.Context, codeID uint64, caller sdk.AccAddress, config wasmtypes.AccessConfig) error

func (ContractOpsKeeperMock) SetContractInfoExtension

func (m ContractOpsKeeperMock) SetContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra wasmtypes.ContractInfoExtension) error

func (ContractOpsKeeperMock) Sudo

func (m ContractOpsKeeperMock) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)

func (ContractOpsKeeperMock) UnpinCode

func (m ContractOpsKeeperMock) UnpinCode(ctx sdk.Context, codeID uint64) error

func (ContractOpsKeeperMock) UpdateContractAdmin

func (m ContractOpsKeeperMock) UpdateContractAdmin(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newAdmin sdk.AccAddress) error

Jump to

Keyboard shortcuts

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