mock

package
v1.5.16 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: GPL-3.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAddressLength = errors.New("invalid address length")

ErrInvalidAddressLength indicates an incorrect length given for an address.

View Source
var ErrOperationNotPermitted = errors.New("operation not permitted")

ErrOperationNotPermitted indicates an operation rejected due to insufficient permissions.

Functions

func NewMultiShardsCoordinatorMock

func NewMultiShardsCoordinatorMock(nrShard uint32) *multipleShardsCoordinatorMock

NewMultiShardsCoordinatorMock -

func NewMultipleShardsCoordinatorMock

func NewMultipleShardsCoordinatorMock() *multipleShardsCoordinatorMock

NewMultipleShardsCoordinatorMock -

Types

type Account

type Account struct {
	Address         []byte
	Nonce           uint64
	Balance         *big.Int
	Storage         map[string][]byte
	RootHash        []byte
	Code            []byte
	CodeHash        []byte
	CodeMetadata    []byte
	OwnerAddress    []byte
	Username        []byte
	DeveloperReward *big.Int
}

Account holds the account info

func NewUserAccount

func NewUserAccount(address []byte) *Account

func (*Account) AccountDataHandler

func (a *Account) AccountDataHandler() vmcommon.AccountDataHandler

AccountDataHandler -

func (*Account) AddToBalance

func (a *Account) AddToBalance(value *big.Int) error

AddToBalance -

func (*Account) AddToDeveloperReward

func (a *Account) AddToDeveloperReward(value *big.Int)

AddToDeveloperReward -

func (*Account) AddressBytes

func (a *Account) AddressBytes() []byte

AddressBytes -

func (*Account) ChangeOwnerAddress

func (a *Account) ChangeOwnerAddress(sender []byte, newAddress []byte) error

ChangeOwnerAddress -

func (*Account) ClaimDeveloperRewards

func (a *Account) ClaimDeveloperRewards(sender []byte) (*big.Int, error)

ClaimDeveloperRewards -

func (*Account) ClearDataCaches

func (a *Account) ClearDataCaches()

ClearDataCaches -

func (*Account) Clone

func (a *Account) Clone() *Account

Clone -

func (*Account) DirtyData

func (a *Account) DirtyData() map[string][]byte

DirtyData -

func (*Account) GetBalance

func (a *Account) GetBalance() *big.Int

GetBalance -

func (*Account) GetCode

func (a *Account) GetCode() []byte

GetCode -

func (*Account) GetCodeHash

func (a *Account) GetCodeHash() []byte

GetCodeHash -

func (*Account) GetCodeMetadata

func (a *Account) GetCodeMetadata() []byte

GetCodeMetadata -

func (*Account) GetDeveloperReward

func (a *Account) GetDeveloperReward() *big.Int

GetDeveloperReward -

func (*Account) GetNonce

func (a *Account) GetNonce() uint64

GetNonce -

func (*Account) GetOwnerAddress

func (a *Account) GetOwnerAddress() []byte

GetOwnerAddress -

func (*Account) GetRootHash

func (a *Account) GetRootHash() []byte

GetRootHash -

func (*Account) GetUserName

func (a *Account) GetUserName() []byte

GetUserName -

func (*Account) IncreaseNonce

func (a *Account) IncreaseNonce(nonce uint64)

IncreaseNonce -

func (*Account) IsInterfaceNil

func (a *Account) IsInterfaceNil() bool

IsInterfaceNil -

func (*Account) MigrateDataTrieLeaves added in v1.4.6

func (a *Account) MigrateDataTrieLeaves(args vmcommon.ArgsMigrateDataTrieLeaves) error

MigrateDataTrieLeaves -

func (*Account) RetrieveValue

func (a *Account) RetrieveValue(key []byte) ([]byte, uint32, error)

RetrieveValue -

func (*Account) SaveKeyValue

func (a *Account) SaveKeyValue(key []byte, value []byte) error

SaveKeyValue -

func (*Account) SetBalance

func (a *Account) SetBalance(balance int64)

SetBalance -

func (*Account) SetCode

func (a *Account) SetCode(code []byte)

SetCode -

func (*Account) SetCodeAndMetadata

func (a *Account) SetCodeAndMetadata(code []byte, codeMetadata *vmcommon.CodeMetadata)

SetCodeAndMetadata changes the account code, as well as all fields depending on it: CodeHash, IsSmartContract, CodeMetadata. The code metadata must be given explicitly.

func (*Account) SetCodeHash

func (a *Account) SetCodeHash(hash []byte)

SetCodeHash -

func (*Account) SetCodeMetadata

func (a *Account) SetCodeMetadata(codeMetadata []byte)

SetCodeMetadata -

func (*Account) SetOwnerAddress

func (a *Account) SetOwnerAddress(address []byte)

SetOwnerAddress -

func (*Account) SetRootHash

func (a *Account) SetRootHash(hash []byte)

SetRootHash -

func (*Account) SetUserName

func (a *Account) SetUserName(userName []byte)

SetUserName -

func (*Account) StorageValue

func (a *Account) StorageValue(key string) []byte

StorageValue yields the storage value for key, default 0

func (*Account) SubFromBalance

func (a *Account) SubFromBalance(value *big.Int) error

SubFromBalance -

type AccountWrapMock

type AccountWrapMock struct {
	MockValue int

	SetNonceWithJournalCalled    func(nonce uint64) error    `json:"-"`
	SetCodeHashWithJournalCalled func(codeHash []byte) error `json:"-"`
	SetCodeWithJournalCalled     func(codeHash []byte) error `json:"-"`
	RetrieveValueCalled          func(key []byte) ([]byte, uint32, error)
	// contains filtered or unexported fields
}

AccountWrapMock -

func NewAccountWrapMock

func NewAccountWrapMock(adr []byte) *AccountWrapMock

NewAccountWrapMock -

func (*AccountWrapMock) AccountDataHandler

func (awm *AccountWrapMock) AccountDataHandler() vmcommon.AccountDataHandler

AccountDataHandler -

func (*AccountWrapMock) AddToBalance

func (awm *AccountWrapMock) AddToBalance(_ *big.Int) error

AddToBalance -

func (*AccountWrapMock) AddToDeveloperReward

func (awm *AccountWrapMock) AddToDeveloperReward(_ *big.Int)

AddToDeveloperReward -

func (*AccountWrapMock) AddressBytes

func (awm *AccountWrapMock) AddressBytes() []byte

AddressBytes -

func (*AccountWrapMock) ChangeOwnerAddress

func (awm *AccountWrapMock) ChangeOwnerAddress([]byte, []byte) error

ChangeOwnerAddress -

func (*AccountWrapMock) ClaimDeveloperRewards

func (awm *AccountWrapMock) ClaimDeveloperRewards([]byte) (*big.Int, error)

ClaimDeveloperRewards -

func (*AccountWrapMock) ClearDataCaches

func (awm *AccountWrapMock) ClearDataCaches()

ClearDataCaches -

func (*AccountWrapMock) DirtyData

func (awm *AccountWrapMock) DirtyData() map[string][]byte

DirtyData -

func (*AccountWrapMock) GetBalance

func (awm *AccountWrapMock) GetBalance() *big.Int

GetBalance -

func (*AccountWrapMock) GetCodeHash

func (awm *AccountWrapMock) GetCodeHash() []byte

GetCodeHash -

func (*AccountWrapMock) GetCodeMetadata

func (awm *AccountWrapMock) GetCodeMetadata() []byte

GetCodeMetadata -

func (*AccountWrapMock) GetDeveloperReward

func (awm *AccountWrapMock) GetDeveloperReward() *big.Int

GetDeveloperReward -

func (*AccountWrapMock) GetNonce

func (awm *AccountWrapMock) GetNonce() uint64

GetNonce -

func (*AccountWrapMock) GetOwnerAddress

func (awm *AccountWrapMock) GetOwnerAddress() []byte

GetOwnerAddress -

func (*AccountWrapMock) GetRootHash

func (awm *AccountWrapMock) GetRootHash() []byte

GetRootHash -

func (*AccountWrapMock) GetUserName

func (awm *AccountWrapMock) GetUserName() []byte

GetUserName -

func (*AccountWrapMock) HasNewCode

func (awm *AccountWrapMock) HasNewCode() bool

HasNewCode -

func (*AccountWrapMock) IncreaseNonce

func (awm *AccountWrapMock) IncreaseNonce(val uint64)

IncreaseNonce -

func (*AccountWrapMock) IsInterfaceNil

func (awm *AccountWrapMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*AccountWrapMock) MigrateDataTrieLeaves added in v1.4.6

func (awm *AccountWrapMock) MigrateDataTrieLeaves(_ vmcommon.ArgsMigrateDataTrieLeaves) error

MigrateDataTrieLeaves -

func (*AccountWrapMock) RetrieveValue

func (awm *AccountWrapMock) RetrieveValue(key []byte) ([]byte, uint32, error)

RetrieveValue -

func (*AccountWrapMock) SaveKeyValue

func (awm *AccountWrapMock) SaveKeyValue(key []byte, value []byte) error

SaveKeyValue -

func (*AccountWrapMock) SetCode

func (awm *AccountWrapMock) SetCode(code []byte)

SetCode -

func (*AccountWrapMock) SetCodeHash

func (awm *AccountWrapMock) SetCodeHash(codeHash []byte)

SetCodeHash -

func (*AccountWrapMock) SetCodeMetadata

func (awm *AccountWrapMock) SetCodeMetadata(codeMetadata []byte)

SetCodeMetadata -

func (*AccountWrapMock) SetOwnerAddress

func (awm *AccountWrapMock) SetOwnerAddress([]byte)

SetOwnerAddress -

func (*AccountWrapMock) SetRootHash

func (awm *AccountWrapMock) SetRootHash(rootHash []byte)

SetRootHash -

func (*AccountWrapMock) SetUserName

func (awm *AccountWrapMock) SetUserName(_ []byte)

SetUserName -

func (*AccountWrapMock) SubFromBalance

func (awm *AccountWrapMock) SubFromBalance(_ *big.Int) error

SubFromBalance -

type AccountsStub

type AccountsStub struct {
	GetExistingAccountCalled func(address []byte) (vmcommon.AccountHandler, error)
	LoadAccountCalled        func(address []byte) (vmcommon.AccountHandler, error)
	SaveAccountCalled        func(account vmcommon.AccountHandler) error
	RemoveAccountCalled      func(address []byte) error
	CommitCalled             func() ([]byte, error)
	JournalLenCalled         func() int
	RevertToSnapshotCalled   func(snapshot int) error
	RootHashCalled           func() ([]byte, error)
	RecreateTrieCalled       func(rootHash []byte) error
	SnapshotStateCalled      func(rootHash []byte)
	SetStateCheckpointCalled func(rootHash []byte)
	IsPruningEnabledCalled   func() bool
	GetCodeCalled            func([]byte) []byte
}

AccountsStub -

func (*AccountsStub) Commit

func (as *AccountsStub) Commit() ([]byte, error)

Commit -

func (*AccountsStub) GetCode

func (as *AccountsStub) GetCode(codeHash []byte) []byte

GetCode -

func (*AccountsStub) GetExistingAccount

func (as *AccountsStub) GetExistingAccount(address []byte) (vmcommon.AccountHandler, error)

GetExistingAccount -

func (*AccountsStub) IsInterfaceNil

func (as *AccountsStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*AccountsStub) IsPruningEnabled

func (as *AccountsStub) IsPruningEnabled() bool

IsPruningEnabled -

func (*AccountsStub) JournalLen

func (as *AccountsStub) JournalLen() int

JournalLen -

func (*AccountsStub) LoadAccount

func (as *AccountsStub) LoadAccount(address []byte) (vmcommon.AccountHandler, error)

LoadAccount -

func (*AccountsStub) RemoveAccount

func (as *AccountsStub) RemoveAccount(address []byte) error

RemoveAccount -

func (*AccountsStub) RevertToSnapshot

func (as *AccountsStub) RevertToSnapshot(snapshot int) error

RevertToSnapshot -

func (*AccountsStub) RootHash

func (as *AccountsStub) RootHash() ([]byte, error)

RootHash -

func (*AccountsStub) SaveAccount

func (as *AccountsStub) SaveAccount(account vmcommon.AccountHandler) error

SaveAccount -

func (*AccountsStub) SetStateCheckpoint

func (as *AccountsStub) SetStateCheckpoint(rootHash []byte, _ context.Context)

SetStateCheckpoint -

func (*AccountsStub) SnapshotState

func (as *AccountsStub) SnapshotState(rootHash []byte, _ context.Context)

SnapshotState -

type BlockChainEpochHookStub added in v1.3.38

type BlockChainEpochHookStub struct {
	CurrentEpochCalled func() uint32
}

BlockChainEpochHookStub -

func (*BlockChainEpochHookStub) CurrentEpoch added in v1.3.38

func (b *BlockChainEpochHookStub) CurrentEpoch() uint32

CurrentEpoch -

func (*BlockChainEpochHookStub) IsInterfaceNil added in v1.3.38

func (b *BlockChainEpochHookStub) IsInterfaceNil() bool

IsInterfaceNil -

type BlockDataHandlerStub added in v1.5.13

type BlockDataHandlerStub struct {
	CurrentRoundCalled func() uint64
}

BlockDataHandlerStub -

func (*BlockDataHandlerStub) CurrentRound added in v1.5.13

func (b *BlockDataHandlerStub) CurrentRound() uint64

CurrentRound -

func (*BlockDataHandlerStub) IsInterfaceNil added in v1.5.13

func (b *BlockDataHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type BlockchainDataProviderStub added in v1.5.13

type BlockchainDataProviderStub struct {
	SetBlockDataHandlerCalled func(handler vmcommon.BlockchainDataHook) error
	CurrentRoundCalled        func() uint64
}

BlockchainDataProviderStub -

func (*BlockchainDataProviderStub) CurrentRound added in v1.5.13

func (w *BlockchainDataProviderStub) CurrentRound() uint64

CurrentRound -

func (*BlockchainDataProviderStub) IsInterfaceNil added in v1.5.13

func (w *BlockchainDataProviderStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*BlockchainDataProviderStub) SetBlockchainHook added in v1.5.13

func (w *BlockchainDataProviderStub) SetBlockchainHook(handler vmcommon.BlockchainDataHook) error

SetBlockchainHook -

type BuiltInFunctionStub

type BuiltInFunctionStub struct {
	ProcessBuiltinFunctionCalled func(acntSnd, acntDst vmcommon.UserAccountHandler, vmInput *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)
	SetNewGasConfigCalled        func(gasCost *vmcommon.GasCost)
	IsActiveCalled               func() bool
	SetBlockchainHookCalled      func(blockchainHook vmcommon.BlockchainDataHook) error
	CurrentRoundCalled           func() uint64
}

BuiltInFunctionStub -

func (*BuiltInFunctionStub) CurrentRound added in v1.5.13

func (b *BuiltInFunctionStub) CurrentRound() uint64

CurrentRound -

func (*BuiltInFunctionStub) IsActive

func (b *BuiltInFunctionStub) IsActive() bool

IsActive -

func (*BuiltInFunctionStub) IsInterfaceNil

func (b *BuiltInFunctionStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*BuiltInFunctionStub) ProcessBuiltinFunction

func (b *BuiltInFunctionStub) ProcessBuiltinFunction(acntSnd, acntDst vmcommon.UserAccountHandler, vmInput *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)

ProcessBuiltinFunction -

func (*BuiltInFunctionStub) SetBlockchainHook added in v1.5.13

func (b *BuiltInFunctionStub) SetBlockchainHook(blockchainHook vmcommon.BlockchainDataHook) error

SetBlockchainHook -

func (*BuiltInFunctionStub) SetNewGasConfig

func (b *BuiltInFunctionStub) SetNewGasConfig(gasCost *vmcommon.GasCost)

SetNewGasConfig -

type DataTrieTrackerStub

type DataTrieTrackerStub struct {
	ClearDataCachesCalled       func()
	DirtyDataCalled             func() map[string][]byte
	RetrieveValueCalled         func(key []byte) ([]byte, uint32, error)
	SaveKeyValueCalled          func(key []byte, value []byte) error
	MigrateDataTrieLeavesCalled func(args vmcommon.ArgsMigrateDataTrieLeaves) error
}

DataTrieTrackerStub -

func (*DataTrieTrackerStub) ClearDataCaches

func (dtts *DataTrieTrackerStub) ClearDataCaches()

ClearDataCaches -

func (*DataTrieTrackerStub) DirtyData

func (dtts *DataTrieTrackerStub) DirtyData() map[string][]byte

DirtyData -

func (*DataTrieTrackerStub) IsInterfaceNil

func (dtts *DataTrieTrackerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*DataTrieTrackerStub) MigrateDataTrieLeaves added in v1.4.6

func (dtts *DataTrieTrackerStub) MigrateDataTrieLeaves(args vmcommon.ArgsMigrateDataTrieLeaves) error

MigrateDataTrieLeaves -

func (*DataTrieTrackerStub) RetrieveValue

func (dtts *DataTrieTrackerStub) RetrieveValue(key []byte) ([]byte, uint32, error)

RetrieveValue -

func (*DataTrieTrackerStub) SaveKeyValue

func (dtts *DataTrieTrackerStub) SaveKeyValue(key []byte, value []byte) error

SaveKeyValue -

type ESDTNFTStorageHandlerStub

type ESDTNFTStorageHandlerStub struct {
	SaveESDTNFTTokenCalled                                    func(senderAddress []byte, acnt vmcommon.UserAccountHandler, esdtTokenKey []byte, nonce uint64, esdtData *esdt.ESDigitalToken, saveArgs vmcommon.NftSaveArgs) ([]byte, error)
	GetESDTNFTTokenOnSenderCalled                             func(acnt vmcommon.UserAccountHandler, esdtTokenKey []byte, nonce uint64) (*esdt.ESDigitalToken, error)
	GetESDTNFTTokenOnDestinationCalled                        func(acnt vmcommon.UserAccountHandler, esdtTokenKey []byte, nonce uint64) (*esdt.ESDigitalToken, bool, error)
	GetESDTNFTTokenOnDestinationWithCustomSystemAccountCalled func(accnt vmcommon.UserAccountHandler, esdtTokenKey []byte, nonce uint64, systemAccount vmcommon.UserAccountHandler) (*esdt.ESDigitalToken, bool, error)
	WasAlreadySentToDestinationShardAndUpdateStateCalled      func(tickerID []byte, nonce uint64, dstAddress []byte) (bool, error)
	SaveNFTMetaDataCalled                                     func(tx data.TransactionHandler) error
	AddToLiquiditySystemAccCalled                             func(esdtTokenKey []byte, tokenType uint32, nonce uint64, transferValue *big.Int, keepMetadataOnZeroLiquidity bool) error
	GetMetaDataFromSystemAccountCalled                        func([]byte, uint64) (*esdt.ESDigitalToken, error)
	SaveMetaDataToSystemAccountCalled                         func(tokenKey []byte, nonce uint64, esdtData *esdt.ESDigitalToken) error
}

ESDTNFTStorageHandlerStub -

func (*ESDTNFTStorageHandlerStub) AddToLiquiditySystemAcc

func (stub *ESDTNFTStorageHandlerStub) AddToLiquiditySystemAcc(esdtTokenKey []byte, tokenType uint32, nonce uint64, transferValue *big.Int, keepMetadataOnZeroLiquidity bool) error

AddToLiquiditySystemAcc -

func (*ESDTNFTStorageHandlerStub) GetESDTNFTTokenOnDestination

func (stub *ESDTNFTStorageHandlerStub) GetESDTNFTTokenOnDestination(acnt vmcommon.UserAccountHandler, esdtTokenKey []byte, nonce uint64) (*esdt.ESDigitalToken, bool, error)

GetESDTNFTTokenOnDestination -

func (*ESDTNFTStorageHandlerStub) GetESDTNFTTokenOnDestinationWithCustomSystemAccount

func (stub *ESDTNFTStorageHandlerStub) GetESDTNFTTokenOnDestinationWithCustomSystemAccount(accnt vmcommon.UserAccountHandler, esdtTokenKey []byte, nonce uint64, systemAccount vmcommon.UserAccountHandler) (*esdt.ESDigitalToken, bool, error)

GetESDTNFTTokenOnDestinationWithCustomSystemAccount -

func (*ESDTNFTStorageHandlerStub) GetESDTNFTTokenOnSender

func (stub *ESDTNFTStorageHandlerStub) GetESDTNFTTokenOnSender(acnt vmcommon.UserAccountHandler, esdtTokenKey []byte, nonce uint64) (*esdt.ESDigitalToken, error)

GetESDTNFTTokenOnSender -

func (*ESDTNFTStorageHandlerStub) GetMetaDataFromSystemAccount added in v1.5.13

func (stub *ESDTNFTStorageHandlerStub) GetMetaDataFromSystemAccount(key []byte, nonce uint64) (*esdt.ESDigitalToken, error)

GetMetaDataFromSystemAccount -

func (*ESDTNFTStorageHandlerStub) IsInterfaceNil

func (stub *ESDTNFTStorageHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ESDTNFTStorageHandlerStub) SaveESDTNFTToken

func (stub *ESDTNFTStorageHandlerStub) SaveESDTNFTToken(senderAddress []byte, acnt vmcommon.UserAccountHandler, esdtTokenKey []byte, nonce uint64, esdtData *esdt.ESDigitalToken, saveArgs vmcommon.NftSaveArgs) ([]byte, error)

SaveESDTNFTToken -

func (*ESDTNFTStorageHandlerStub) SaveMetaDataToSystemAccount added in v1.5.13

func (stub *ESDTNFTStorageHandlerStub) SaveMetaDataToSystemAccount(tokenKey []byte, nonce uint64, esdtData *esdt.ESDigitalToken) error

SaveMetaDataToSystemAccount -

func (*ESDTNFTStorageHandlerStub) SaveNFTMetaData added in v1.5.13

func (stub *ESDTNFTStorageHandlerStub) SaveNFTMetaData(tx data.TransactionHandler) error

SaveNFTMetaData -

func (*ESDTNFTStorageHandlerStub) WasAlreadySentToDestinationShardAndUpdateState

func (stub *ESDTNFTStorageHandlerStub) WasAlreadySentToDestinationShardAndUpdateState(tickerID []byte, nonce uint64, dstAddress []byte) (bool, error)

WasAlreadySentToDestinationShardAndUpdateState -

type ESDTRoleHandlerStub

type ESDTRoleHandlerStub struct {
	CheckAllowedToExecuteCalled func(account vmcommon.UserAccountHandler, tokenID []byte, action []byte) error
}

ESDTRoleHandlerStub -

func (*ESDTRoleHandlerStub) CheckAllowedToExecute

func (e *ESDTRoleHandlerStub) CheckAllowedToExecute(account vmcommon.UserAccountHandler, tokenID []byte, action []byte) error

CheckAllowedToExecute -

func (*ESDTRoleHandlerStub) IsInterfaceNil

func (e *ESDTRoleHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

type EnableEpochsHandlerStub

type EnableEpochsHandlerStub struct {
	IsFlagDefinedCalled        func(flag core.EnableEpochFlag) bool
	IsFlagEnabledCalled        func(flag core.EnableEpochFlag) bool
	IsFlagEnabledInEpochCalled func(flag core.EnableEpochFlag, epoch uint32) bool
	GetActivationEpochCalled   func(flag core.EnableEpochFlag) uint32
}

EnableEpochsHandlerStub -

func (*EnableEpochsHandlerStub) GetActivationEpoch added in v1.5.6

func (stub *EnableEpochsHandlerStub) GetActivationEpoch(flag core.EnableEpochFlag) uint32

GetActivationEpoch -

func (*EnableEpochsHandlerStub) IsFlagDefined added in v1.5.6

func (stub *EnableEpochsHandlerStub) IsFlagDefined(flag core.EnableEpochFlag) bool

IsFlagDefined -

func (*EnableEpochsHandlerStub) IsFlagEnabled added in v1.5.6

func (stub *EnableEpochsHandlerStub) IsFlagEnabled(flag core.EnableEpochFlag) bool

IsFlagEnabled -

func (*EnableEpochsHandlerStub) IsFlagEnabledInEpoch added in v1.5.6

func (stub *EnableEpochsHandlerStub) IsFlagEnabledInEpoch(flag core.EnableEpochFlag, epoch uint32) bool

IsFlagEnabledInEpoch -

func (*EnableEpochsHandlerStub) IsInterfaceNil

func (stub *EnableEpochsHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

type GlobalSettingsHandlerStub

type GlobalSettingsHandlerStub struct {
	IsPausedCalled                              func(token []byte) bool
	IsLimiterTransferCalled                     func(token []byte) bool
	IsBurnForAllCalled                          func(token []byte) bool
	IsSenderOrDestinationWithTransferRoleCalled func(sender, destionation, tokenID []byte) bool
	GetTokenTypeCalled                          func(esdtTokenKey []byte) (uint32, error)
	SetTokenTypeCalled                          func(esdtTokenKey []byte, tokenType uint32) error
}

GlobalSettingsHandlerStub -

func (*GlobalSettingsHandlerStub) GetTokenType added in v1.5.13

func (p *GlobalSettingsHandlerStub) GetTokenType(esdtTokenKey []byte) (uint32, error)

GetTokenType -

func (*GlobalSettingsHandlerStub) IsBurnForAll

func (p *GlobalSettingsHandlerStub) IsBurnForAll(token []byte) bool

IsBurnForAll -

func (*GlobalSettingsHandlerStub) IsInterfaceNil

func (p *GlobalSettingsHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*GlobalSettingsHandlerStub) IsLimitedTransfer

func (p *GlobalSettingsHandlerStub) IsLimitedTransfer(token []byte) bool

IsLimitedTransfer -

func (*GlobalSettingsHandlerStub) IsPaused

func (p *GlobalSettingsHandlerStub) IsPaused(token []byte) bool

IsPaused -

func (*GlobalSettingsHandlerStub) IsSenderOrDestinationWithTransferRole

func (p *GlobalSettingsHandlerStub) IsSenderOrDestinationWithTransferRole(sender, destination, tokenID []byte) bool

IsSenderOrDestinationWithTransferRole -

func (*GlobalSettingsHandlerStub) SetTokenType added in v1.5.13

func (p *GlobalSettingsHandlerStub) SetTokenType(esdtTokenKey []byte, tokenType uint32) error

SetTokenType -

type GuardedAccountHandlerStub added in v1.3.38

type GuardedAccountHandlerStub struct {
	GetActiveGuardianCalled    func(handler vmcommon.UserAccountHandler) ([]byte, error)
	SetGuardianCalled          func(uah vmcommon.UserAccountHandler, guardianAddress []byte, txGuardianAddress []byte, guardianServiceUID []byte) error
	CleanOtherThanActiveCalled func(uah vmcommon.UserAccountHandler)
}

GuardedAccountHandlerStub -

func (*GuardedAccountHandlerStub) CleanOtherThanActive added in v1.3.38

func (gahs *GuardedAccountHandlerStub) CleanOtherThanActive(uah vmcommon.UserAccountHandler)

CleanOtherThanActive -

func (*GuardedAccountHandlerStub) GetActiveGuardian added in v1.3.38

func (gahs *GuardedAccountHandlerStub) GetActiveGuardian(handler vmcommon.UserAccountHandler) ([]byte, error)

GetActiveGuardian -

func (*GuardedAccountHandlerStub) IsInterfaceNil added in v1.3.38

func (gahs *GuardedAccountHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*GuardedAccountHandlerStub) SetGuardian added in v1.3.38

func (gahs *GuardedAccountHandlerStub) SetGuardian(uah vmcommon.UserAccountHandler, guardianAddress []byte, txGuardianAddress []byte, guardianServiceUID []byte) error

SetGuardian -

type MarshalizerMock

type MarshalizerMock struct {
	Fail bool
}

MarshalizerMock that will be used for testing

func (*MarshalizerMock) IsInterfaceNil

func (mm *MarshalizerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MarshalizerMock) Marshal

func (mm *MarshalizerMock) Marshal(obj interface{}) ([]byte, error)

Marshal converts the input object in a slice of bytes

func (*MarshalizerMock) Unmarshal

func (mm *MarshalizerMock) Unmarshal(obj interface{}, buff []byte) error

Unmarshal applies the serialized values over an instantiated object

type PayableHandlerStub

type PayableHandlerStub struct {
	IsPayableCalled              func(address []byte) (bool, error)
	CheckPayableCalled           func(vmInput *vmcommon.ContractCallInput, dstAddress []byte, minArgs int) error
	DetermineIsSCCallAfterCalled func(vmInput *vmcommon.ContractCallInput, dstAddress []byte, mintArgs int) bool
}

PayableHandlerStub -

func (*PayableHandlerStub) CheckPayable

func (p *PayableHandlerStub) CheckPayable(vmInput *vmcommon.ContractCallInput, dstAddress []byte, minArgs int) error

CheckPayable -

func (*PayableHandlerStub) DetermineIsSCCallAfter

func (p *PayableHandlerStub) DetermineIsSCCallAfter(vmInput *vmcommon.ContractCallInput, dstAddress []byte, minArgs int) bool

DetermineIsSCCallAfter -

func (*PayableHandlerStub) IsInterfaceNil

func (p *PayableHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*PayableHandlerStub) IsPayable

func (p *PayableHandlerStub) IsPayable(_, address []byte) (bool, error)

IsPayable -

type ShardCoordinatorStub

type ShardCoordinatorStub struct {
	NumberOfShardsCalled          func() uint32
	ComputeIdCalled               func(address []byte) uint32
	SelfIdCalled                  func() uint32
	SameShardCalled               func(firstAddress, secondAddress []byte) bool
	CommunicationIdentifierCalled func(destShardID uint32) string
}

ShardCoordinatorStub -

func (*ShardCoordinatorStub) CommunicationIdentifier

func (coordinator *ShardCoordinatorStub) CommunicationIdentifier(destShardID uint32) string

CommunicationIdentifier -

func (*ShardCoordinatorStub) ComputeId

func (coordinator *ShardCoordinatorStub) ComputeId(address []byte) uint32

ComputeId -

func (*ShardCoordinatorStub) IsInterfaceNil

func (coordinator *ShardCoordinatorStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ShardCoordinatorStub) NumberOfShards

func (coordinator *ShardCoordinatorStub) NumberOfShards() uint32

NumberOfShards -

func (*ShardCoordinatorStub) SameShard

func (coordinator *ShardCoordinatorStub) SameShard(firstAddress, secondAddress []byte) bool

SameShard -

func (*ShardCoordinatorStub) SelfId

func (coordinator *ShardCoordinatorStub) SelfId() uint32

SelfId -

type UserAccountStub

type UserAccountStub struct {
	Address                  []byte
	AddToBalanceCalled       func(value *big.Int) error
	AccountDataHandlerCalled func() vmcommon.AccountDataHandler
	SetCodeMetaDataCalled    func(codeMetaData []byte)
	GetCodeMetaDataCalled    func() []byte
}

UserAccountStub -

func (*UserAccountStub) AccountDataHandler

func (u *UserAccountStub) AccountDataHandler() vmcommon.AccountDataHandler

AccountDataHandler -

func (*UserAccountStub) AddToBalance

func (u *UserAccountStub) AddToBalance(value *big.Int) error

AddToBalance -

func (*UserAccountStub) AddToDeveloperReward

func (u *UserAccountStub) AddToDeveloperReward(_ *big.Int)

AddToDeveloperReward -

func (*UserAccountStub) AddressBytes

func (u *UserAccountStub) AddressBytes() []byte

AddressBytes -

func (*UserAccountStub) ChangeOwnerAddress

func (u *UserAccountStub) ChangeOwnerAddress([]byte, []byte) error

ChangeOwnerAddress -

func (*UserAccountStub) ClaimDeveloperRewards

func (u *UserAccountStub) ClaimDeveloperRewards([]byte) (*big.Int, error)

ClaimDeveloperRewards -

func (*UserAccountStub) GetBalance

func (u *UserAccountStub) GetBalance() *big.Int

GetBalance -

func (*UserAccountStub) GetCodeHash

func (u *UserAccountStub) GetCodeHash() []byte

GetCodeHash -

func (*UserAccountStub) GetCodeMetadata

func (u *UserAccountStub) GetCodeMetadata() []byte

GetCodeMetadata -

func (*UserAccountStub) GetDeveloperReward

func (u *UserAccountStub) GetDeveloperReward() *big.Int

GetDeveloperReward -

func (*UserAccountStub) GetNonce

func (u *UserAccountStub) GetNonce() uint64

GetNonce -

func (*UserAccountStub) GetOwnerAddress

func (u *UserAccountStub) GetOwnerAddress() []byte

GetOwnerAddress -

func (*UserAccountStub) GetRootHash

func (u *UserAccountStub) GetRootHash() []byte

GetRootHash -

func (*UserAccountStub) GetUserName

func (u *UserAccountStub) GetUserName() []byte

GetUserName -

func (*UserAccountStub) HasNewCode

func (u *UserAccountStub) HasNewCode() bool

HasNewCode -

func (*UserAccountStub) IncreaseNonce

func (u *UserAccountStub) IncreaseNonce(_ uint64)

IncreaseNonce -

func (*UserAccountStub) IsInterfaceNil

func (u *UserAccountStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*UserAccountStub) SetCode

func (u *UserAccountStub) SetCode(_ []byte)

SetCode -

func (*UserAccountStub) SetCodeHash

func (u *UserAccountStub) SetCodeHash(_ []byte)

SetCodeHash -

func (*UserAccountStub) SetCodeMetadata

func (u *UserAccountStub) SetCodeMetadata(codeMetaData []byte)

SetCodeMetadata -

func (*UserAccountStub) SetOwnerAddress

func (u *UserAccountStub) SetOwnerAddress([]byte)

SetOwnerAddress -

func (*UserAccountStub) SetRootHash

func (u *UserAccountStub) SetRootHash(_ []byte)

SetRootHash -

func (*UserAccountStub) SetUserName

func (u *UserAccountStub) SetUserName(_ []byte)

SetUserName -

func (*UserAccountStub) SubFromBalance

func (u *UserAccountStub) SubFromBalance(_ *big.Int) error

SubFromBalance -

Jump to

Keyboard shortcuts

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