contracts

package
v1.5.34 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AsyncChildFunction = "transferToThirdParty"
	AsyncChildData     = " there"
	ExpectedClosure    = []byte{4, 5, 6}
)

test variables

View Source
var (
	TestStorageValue1 = []byte{1, 2, 3, 4}
	TestStorageValue2 = []byte{1, 2, 3}
	TestStorageValue3 = []byte{1, 2}
	TestStorageValue4 = []byte{1}
)

test variables

View Source
var AsyncGroupsConfig = [][]string{
	{"reserveHousingGroup", "reserveMotel"},
}

AsyncGroupsConfig defines the groups and async calls generated by the mock smart contract method below

View Source
var TransferAndExecuteFuncName = "transferAndExecute"

TransferAndExecuteFuncName -

View Source
var TransferAndExecuteReturnData = []byte{1, 2, 3}

TransferAndExecuteReturnData -

Functions

func BackTransfer_ChildCallback added in v1.5.8

func BackTransfer_ChildCallback(instanceMock *mock.InstanceMock, config interface{})

BackTransfer_ChildCallback is an exposed mock contract method

func BackTransfer_ChildMakesAsync added in v1.5.8

func BackTransfer_ChildMakesAsync(instanceMock *mock.InstanceMock, config interface{})

BackTransfer_ChildMakesAsync is an exposed mock contract method

func BackTransfer_ParentCallsChild added in v1.5.8

func BackTransfer_ParentCallsChild(instanceMock *mock.InstanceMock, config interface{})

BackTransfer_ParentCallsChild is an exposed mock contract method

func CallBackMultiChildMock

func CallBackMultiChildMock(instanceMock *mock.InstanceMock, config interface{})

CallBackMultiChildMock is an exposed mock contract method

func CallBackMultiContractParentMock

func CallBackMultiContractParentMock(instanceMock *mock.InstanceMock, config interface{})

CallBackMultiContractParentMock is an exposed mock contract method

func CallBackMultiGroupsMock

func CallBackMultiGroupsMock(instanceMock *mock.InstanceMock, config interface{})

CallBackMultiGroupsMock is an exposed mock contract method

func CallBackParentBuiltinMock

func CallBackParentBuiltinMock(instanceMock *mock.InstanceMock, config interface{})

CallBackParentBuiltinMock is an exposed mock contract method

func CallBackParentMock

func CallBackParentMock(instanceMock *mock.InstanceMock, config interface{})

CallBackParentMock is an exposed mock contract method

func CallBackRecursiveChildMock

func CallBackRecursiveChildMock(instanceMock *mock.InstanceMock, config interface{})

CallBackRecursiveChildMock is an exposed mock contract method

func CallBackRecursiveParentMock

func CallBackRecursiveParentMock(instanceMock *mock.InstanceMock, config interface{})

CallBackRecursiveParentMock is an exposed mock contract method

func CallbackMockMethodThatCouldFail

func CallbackMockMethodThatCouldFail(instanceMock *mock.InstanceMock, config interface{})

CallbackMockMethodThatCouldFail -

func CallbackWithOnSameContext

func CallbackWithOnSameContext(instanceMock *mock.InstanceMock, _ interface{})

CallbackWithOnSameContext is an exposed mock contract method

func ChildAsyncMultiGroupsMock

func ChildAsyncMultiGroupsMock(instanceMock *mock.InstanceMock, config interface{})

ChildAsyncMultiGroupsMock is an exposed mock contract method

func ChildSetStorageMock

func ChildSetStorageMock(instanceMock *mock.InstanceMock, _ interface{})

ChildSetStorageMock is an exposed mock contract method

func DeployContractFromSourceMock

func DeployContractFromSourceMock(instanceMock *mock.InstanceMock, _ interface{})

DeployContractFromSourceMock -

func ESDTTransferToParentAndNewAsyncFromCallbackMock

func ESDTTransferToParentAndNewAsyncFromCallbackMock(instanceMock *mock.InstanceMock, config interface{})

ESDTTransferToParentAndNewAsyncFromCallbackMock is an exposed mock contract method

func ESDTTransferToParentCallbackWillFail

func ESDTTransferToParentCallbackWillFail(instanceMock *mock.InstanceMock, config interface{})

ESDTTransferToParentCallbackWillFail is an exposed mock contract method

func ESDTTransferToParentMock

func ESDTTransferToParentMock(instanceMock *mock.InstanceMock, config interface{})

ESDTTransferToParentMock is an exposed mock contract method

func ESDTTransferToParentMockNoReturnData added in v1.5.4

func ESDTTransferToParentMockNoReturnData(instanceMock *mock.InstanceMock, config interface{})

func ESDTTransferToParentWrongESDTArgsNumberMock

func ESDTTransferToParentWrongESDTArgsNumberMock(instanceMock *mock.InstanceMock, config interface{})

ESDTTransferToParentWrongESDTArgsNumberMock is an exposed mock contract method

func ExecESDTTransferAndAsyncCallChild

func ExecESDTTransferAndAsyncCallChild(instanceMock *mock.InstanceMock, config interface{})

ExecESDTTransferAndAsyncCallChild is an exposed mock contract method

func ExecESDTTransferAndCallChild

func ExecESDTTransferAndCallChild(instanceMock *mock.InstanceMock, config interface{})

ExecESDTTransferAndCallChild is an exposed mock contract method

func ExecESDTTransferWithAPICall

func ExecESDTTransferWithAPICall(instanceMock *mock.InstanceMock, config interface{})

ExecESDTTransferWithAPICall is an exposed mock contract method

func ExecOnDestCtxParentMock

func ExecOnDestCtxParentMock(instanceMock *mock.InstanceMock, config interface{})

ExecOnDestCtxParentMock is an exposed mock contract method

func ExecOnDestCtxSingleCallParentMock

func ExecOnDestCtxSingleCallParentMock(instanceMock *mock.InstanceMock, config interface{})

ExecOnDestCtxSingleCallParentMock is an exposed mock contract method

func ExecOnSameCtxParentMock

func ExecOnSameCtxParentMock(instanceMock *mock.InstanceMock, config interface{})

ExecOnSameCtxParentMock is an exposed mock contract method

func ExecuteOnDestContextInMockContracts

func ExecuteOnDestContextInMockContracts(host vmhost.VMHost, input *vmcommon.ContractCallInput) int32

ExecuteOnDestContextInMockContracts - calls the corresponding method in VM hooks

func ExecuteOnSameContextInMockContracts

func ExecuteOnSameContextInMockContracts(host vmhost.VMHost, input *vmcommon.ContractCallInput) int32

ExecuteOnSameContextInMockContracts - calls the corresponding method in VM hooks

func ExecutedOnSameContextByCallback

func ExecutedOnSameContextByCallback(instanceMock *mock.InstanceMock, _ interface{})

ExecutedOnSameContextByCallback is an exposed mock contract method

func FailChildAndBurnESDTMock

func FailChildAndBurnESDTMock(instanceMock *mock.InstanceMock, _ interface{})

FailChildAndBurnESDTMock is an exposed mock contract method

func FailChildMock

func FailChildMock(instanceMock *mock.InstanceMock, _ interface{})

FailChildMock is an exposed mock contract method

func ForwardAsyncCallMultiChildMock

func ForwardAsyncCallMultiChildMock(instanceMock *mock.InstanceMock, config interface{})

ForwardAsyncCallMultiChildMock is an exposed mock contract method

func ForwardAsyncCallMultiContractParentMock

func ForwardAsyncCallMultiContractParentMock(instanceMock *mock.InstanceMock, config interface{})

ForwardAsyncCallMultiContractParentMock is an exposed mock contract method

func ForwardAsyncCallMultiGroupsMock

func ForwardAsyncCallMultiGroupsMock(instanceMock *mock.InstanceMock, config interface{})

ForwardAsyncCallMultiGroupsMock is an exposed mock contract method

func ForwardAsyncCallParentBuiltinMock

func ForwardAsyncCallParentBuiltinMock(instanceMock *mock.InstanceMock, config interface{})

ForwardAsyncCallParentBuiltinMock is an exposed mock contract method

func ForwardAsyncCallRecursiveParentMock

func ForwardAsyncCallRecursiveParentMock(instanceMock *mock.InstanceMock, config interface{})

ForwardAsyncCallRecursiveParentMock is an exposed mock contract method

func GasMismatchAsyncCallChildMock

func GasMismatchAsyncCallChildMock(instanceMock *mock.InstanceMock, _ interface{})

GasMismatchAsyncCallChildMock is an exposed mock contract method

func GasMismatchAsyncCallParentMock

func GasMismatchAsyncCallParentMock(instanceMock *mock.InstanceMock, _ interface{})

GasMismatchAsyncCallParentMock is an exposed mock contract method

func GasMismatchCallBackParentMock

func GasMismatchCallBackParentMock(instanceMock *mock.InstanceMock, _ interface{})

GasMismatchCallBackParentMock is an exposed mock contract method

func GetChildAddressForTransfer

func GetChildAddressForTransfer(transfer int) []byte

GetChildAddressForTransfer -

func InitFunctionMock

func InitFunctionMock(instanceMock *mock.InstanceMock, config interface{})

InitFunctionMock is the exposed init function

func InitMockMethod

func InitMockMethod(instanceMock *mock.InstanceMock, config interface{})

InitMockMethod -

func LoadStore

func LoadStore(instanceMock *mock.InstanceMock, _ interface{})

LoadStore is an exposed mock contract method

func LoadStoreFromAddress

func LoadStoreFromAddress(instanceMock *mock.InstanceMock, _ interface{})

LoadStoreFromAddress is an exposed mock contract method

func LocalCallAnotherContract added in v1.5.7

func LocalCallAnotherContract(exposedFunctionName string, recipientAddress []byte, functionToCall string) func(instanceMock *mock.InstanceMock, config interface{})

LocalCallAnotherContract is an exposed mock contract method

func ParentSetStorageMock

func ParentSetStorageMock(instanceMock *mock.InstanceMock, config interface{})

ParentSetStorageMock is an exposed mock contract method

func PerformAsyncCallParentMock

func PerformAsyncCallParentMock(instanceMock *mock.InstanceMock, config interface{})

PerformAsyncCallParentMock is an exposed mock contract method

func RecursiveAsyncCallRecursiveChildMock

func RecursiveAsyncCallRecursiveChildMock(instanceMock *mock.InstanceMock, config interface{})

RecursiveAsyncCallRecursiveChildMock is an exposed mock contract method

func RegisterAsyncCallToChild

func RegisterAsyncCallToChild(host vmhost.VMHost, config interface{}, arguments [][]byte) error

RegisterAsyncCallToChild is resued also in some tests before async context serialization

func ReportOriginalCaller

func ReportOriginalCaller(instanceMock *mock.InstanceMock, config interface{})

ReportOriginalCaller is an exposed mock contract method

func SetStore

func SetStore(instanceMock *mock.InstanceMock, _ interface{})

SetStore is an exposed mock contract method

func SimpleCallbackMock

func SimpleCallbackMock(instanceMock *mock.InstanceMock, config interface{})

SimpleCallbackMock is an exposed mock contract method

func SimpleChildSetStorageMock

func SimpleChildSetStorageMock(instanceMock *mock.InstanceMock, config interface{})

SimpleChildSetStorageMock is an exposed mock contract method

func TransferAndExecute

func TransferAndExecute(instanceMock *mock.InstanceMock, config interface{})

TransferAndExecute is an exposed mock contract method

func TransferEGLDToParent added in v1.5.7

func TransferEGLDToParent(instanceMock *mock.InstanceMock, config interface{})

func TransferToAsyncParentOnCallbackChildMock

func TransferToAsyncParentOnCallbackChildMock(instanceMock *mock.InstanceMock, config interface{})

TransferToAsyncParentOnCallbackChildMock -

func TransferToThirdPartyAsyncChildMock

func TransferToThirdPartyAsyncChildMock(instanceMock *mock.InstanceMock, config interface{})

TransferToThirdPartyAsyncChildMock is an exposed mock contract method

func UpdateContractFromSourceMock

func UpdateContractFromSourceMock(instanceMock *mock.InstanceMock, _ interface{})

UpdateContractFromSourceMock -

func UpgradeFunctionMock

func UpgradeFunctionMock(instanceMock *mock.InstanceMock, config interface{})

InitFunctionMock is the exposed upgrade function

func UpgradeMockMethod added in v1.5.19

func UpgradeMockMethod(instanceMock *mock.InstanceMock, config interface{})

UpgradeMockMethod -

func WasteGasChildMock

func WasteGasChildMock(instanceMock *mock.InstanceMock, config interface{})

WasteGasChildMock is an exposed mock contract method

func WasteGasParentMock

func WasteGasParentMock(instanceMock *mock.InstanceMock, config interface{})

WasteGasParentMock is an exposed mock contract method

Types

type AsyncBuiltInCallTestConfig

type AsyncBuiltInCallTestConfig struct {
	AsyncCallBaseTestConfig
	TransferFromChildToParent int64
}

AsyncBuiltInCallTestConfig is configuration for async call tests of builtin functions

type AsyncCallBaseTestConfig

type AsyncCallBaseTestConfig struct {
	GasProvided       uint64
	GasUsedByParent   uint64
	GasUsedByChild    uint64
	GasUsedByCallback uint64
	GasLockCost       uint64

	TransferFromParentToChild int64

	ParentBalance int64
	ChildBalance  int64
}

AsyncCallBaseTestConfig is base configuration for async call tests

type AsyncCallMultiChildTestConfig

type AsyncCallMultiChildTestConfig struct {
	AsyncCallBaseTestConfig
	ChildCalls int
}

AsyncCallMultiChildTestConfig is configuration for recursivemultiple children async call tests

type AsyncCallRecursiveTestConfig

type AsyncCallRecursiveTestConfig struct {
	AsyncCallBaseTestConfig
	RecursiveChildCalls int
}

AsyncCallRecursiveTestConfig is configuration for recursive async call tests

type AsyncCallTestConfig

type AsyncCallTestConfig struct {
	AsyncCallBaseTestConfig
	TransferToThirdParty         int64
	TransferToVault              int64
	ESDTTokensToTransfer         uint64
	CallbackESDTTokensToTransfer uint64
}

AsyncCallTestConfig is configuration for async call tests

func (AsyncCallTestConfig) GetGasUsedByChild

func (config AsyncCallTestConfig) GetGasUsedByChild() uint64

GetGasUsedByChild - getter for GasUsedByChild

type CallbackTestConfig

type CallbackTestConfig interface {
	CallbackFails() bool
}

CallbackTestConfig -

type DirectCallGasTestConfig

type DirectCallGasTestConfig struct {
	GasUsedByParent      uint64
	GasUsedByChild       uint64
	GasProvided          uint64
	GasProvidedToChild   uint64
	ParentBalance        int64
	ChildBalance         int64
	ESDTTokensToTransfer uint64
}

DirectCallGasTestConfig is configuration for direct call tests

func (DirectCallGasTestConfig) GetGasUsedByChild

func (config DirectCallGasTestConfig) GetGasUsedByChild() uint64

GetGasUsedByChild - getter for GasUsedByChild

type GasTestConfig

type GasTestConfig interface {
	GetGasUsedByChild() uint64
}

GasTestConfig interface for gas tests configs

type TransferAndExecuteTestConfig

type TransferAndExecuteTestConfig struct {
	DirectCallGasTestConfig
	TransferFromParentToChild int64
	GasTransferToChild        uint64
}

TransferAndExecuteTestConfig is configuration for transfer and execute tests

Jump to

Keyboard shortcuts

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