Versions in this module Expand all Collapse all v0 v0.0.1 Nov 6, 2024 Changes in this version + var DCDTNonceKeyPrefix = []byte(core.ProtectedKeyPrefix + core.DCDTNFTLatestNonceIdentifier) + var DCDTRoleKeyPrefix = []byte(core.ProtectedKeyPrefix + core.DCDTRoleIdentifier + core.DCDTKeyIdentifier) + var DCDTTokenKeyPrefix = []byte(core.ProtectedKeyPrefix + core.DCDTKeyIdentifier) + var ErrBuiltinFuncWrapperNotInitialized = errors.New("builtin function not found or container not initialized") + var ErrInsufficientFunds = errors.New("insufficient funds") + var ErrInvalidAddressLength = errors.New("invalid address length") + var ErrMarshallingProto = errors.New("can not serialize the object") + var ErrNegativeValue = errors.New("negative value") + var ErrOperationNotPermitted = errors.New("operation not permitted") + var ErrTrieHandlingNotImplemented = errors.New("trie handling not implemented") + var ErrUnmarshallingProto = errors.New("obj does not implement proto.Message") + var WorldMarshalizer = &GogoProtoMarshalizer + func GenerateMockAddress(creatorAddress []byte, creatorNonce uint64) []byte + func GetTokenNameFromKey(key []byte) []byte + func IsDCDTKey(key []byte) bool + func IsNonceKey(key []byte) bool + func IsRoleKey(key []byte) bool + func IsTokenKey(key []byte) bool + func MakeLastNonceKey(tokenName []byte) []byte + func MakeTokenKey(tokenName []byte, nonce uint64) []byte + func MakeTokenRolesKey(tokenName []byte) []byte + type Account struct + Address []byte + AsyncCallData string + Balance *big.Int + BalanceDelta *big.Int + Code []byte + CodeHash []byte + CodeMetadata []byte + DeveloperReward *big.Int + Exists bool + IsSmartContract bool + Nonce uint64 + OwnerAddress []byte + RootHash []byte + ShardID uint32 + Storage map[string][]byte + Username []byte + func (a *Account) AccountDataHandler() vmcommon.AccountDataHandler + func (a *Account) AddToBalance(value *big.Int) error + func (a *Account) AddToDeveloperReward(value *big.Int) + func (a *Account) AddressBytes() []byte + func (a *Account) ChangeOwnerAddress(sender []byte, newAddress []byte) error + func (a *Account) ClaimDeveloperRewards(sender []byte) (*big.Int, error) + func (a *Account) ClearDataCaches() + func (a *Account) Clone() *Account + func (a *Account) DirtyData() map[string][]byte + func (a *Account) GetBalance() *big.Int + func (a *Account) GetCode() []byte + func (a *Account) GetCodeHash() []byte + func (a *Account) GetCodeMetadata() []byte + func (a *Account) GetDeveloperReward() *big.Int + func (a *Account) GetFullMockDCDTData() (map[string]*MockDCDTData, error) + func (a *Account) GetNonce() uint64 + func (a *Account) GetOwnerAddress() []byte + func (a *Account) GetRootHash() []byte + func (a *Account) GetTokenBalance(tokenKey []byte) (*big.Int, error) + func (a *Account) GetTokenBalanceByName(tokenName string) (*big.Int, error) + func (a *Account) GetTokenData(tokenKey []byte) (*dcdt.DCDigitalToken, error) + func (a *Account) GetTokenKeys() [][]byte + func (a *Account) GetTokenRoles(tokenName []byte) ([][]byte, error) + func (a *Account) GetUserName() []byte + func (a *Account) IncreaseNonce(nonce uint64) + func (a *Account) IsInterfaceNil() bool + func (a *Account) MigrateDataTrieLeaves(_ vmcommon.ArgsMigrateDataTrieLeaves) error + func (a *Account) RetrieveValue(key []byte) ([]byte, uint32, error) + func (a *Account) SaveKeyValue(key []byte, value []byte) error + func (a *Account) SetBalance(balance int64) + func (a *Account) SetCode(code []byte) + func (a *Account) SetCodeAndMetadata(code []byte, codeMetadata *vmcommon.CodeMetadata) + func (a *Account) SetCodeHash(hash []byte) + func (a *Account) SetCodeMetadata(codeMetadata []byte) + func (a *Account) SetLastNonce(tokenName []byte, lastNonce uint64) error + func (a *Account) SetLastNonces(lastNonces map[string]uint64) error + func (a *Account) SetOwnerAddress(address []byte) + func (a *Account) SetRootHash(hash []byte) + func (a *Account) SetTokenBalance(tokenKey []byte, balance *big.Int) error + func (a *Account) SetTokenData(tokenKey []byte, tokenData *dcdt.DCDigitalToken) error + func (a *Account) SetTokenRoles(tokenName []byte, roles [][]byte) error + func (a *Account) SetTokenRolesAsStrings(tokenName []byte, rolesAsStrings []string) error + func (a *Account) SetUserName(userName []byte) + func (a *Account) StorageValue(key string) []byte + func (a *Account) SubFromBalance(value *big.Int) error + type AccountMap map[string]*Account + func NewAccountMap() AccountMap + func (am AccountMap) Clone() AccountMap + func (am AccountMap) CreateAccount(address []byte) *Account + func (am AccountMap) CreateSmartContractAccount(owner []byte, address []byte, code []byte) *Account + func (am AccountMap) DeleteAccount(address []byte) + func (am AccountMap) GetAccount(address []byte) *Account + func (am AccountMap) LoadAccountStorageFrom(otherAM AccountMap) error + func (am AccountMap) PutAccount(account *Account) + func (am AccountMap) PutAccounts(accounts []*Account) + type BlockInfo struct + BlockEpoch uint32 + BlockNonce uint64 + BlockRound uint64 + BlockTimestamp uint64 + RandomSeed *[48]byte + type BuiltinFunctionsWrapper struct + Container vmcommon.BuiltInFunctionContainer + MapDNSAddresses map[string]struct{} + Marshalizer vmcommon.Marshalizer + World *MockWorld + func NewBuiltinFunctionsWrapper(world *MockWorld, gasMap config.GasScheduleMap) (*BuiltinFunctionsWrapper, error) + func (bf *BuiltinFunctionsWrapper) GetBuiltinFunctionNames() vmcommon.FunctionNames + func (bf *BuiltinFunctionsWrapper) GetTokenBalance(address []byte, tokenKey []byte) (*big.Int, error) + func (bf *BuiltinFunctionsWrapper) GetTokenData(address []byte, tokenKey []byte) (*dcdt.DCDigitalToken, error) + func (bf *BuiltinFunctionsWrapper) PerformDirectDCDTTransfer(sender []byte, receiver []byte, token []byte, nonce uint64, value *big.Int, ...) (uint64, error) + func (bf *BuiltinFunctionsWrapper) ProcessBuiltInFunction(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error) + func (bf *BuiltinFunctionsWrapper) SetTokenBalance(address []byte, tokenKey []byte, balance *big.Int) error + func (bf *BuiltinFunctionsWrapper) SetTokenData(address []byte, tokenKey []byte, tokenData *dcdt.DCDigitalToken) error + type EpochNotifierStub struct + CurrentEpochCalled func() uint32 + RegisterNotifyHandlerCalled func(handler vmcommon.EpochSubscriberHandler) + func (ens *EpochNotifierStub) IsInterfaceNil() bool + func (ens *EpochNotifierStub) RegisterNotifyHandler(handler vmcommon.EpochSubscriberHandler) + type GogoProtoMarshalizer struct + func (x *GogoProtoMarshalizer) IsInterfaceNil() bool + func (x *GogoProtoMarshalizer) Marshal(obj interface{}) ([]byte, error) + func (x *GogoProtoMarshalizer) Unmarshal(obj interface{}, buff []byte) error + type GogoProtoObj interface + type MockAccountsAdapter struct + Snapshots []AccountMap + World *MockWorld + func NewMockAccountsAdapter(world *MockWorld) *MockAccountsAdapter + func (m *MockAccountsAdapter) Close() error + func (m *MockAccountsAdapter) Commit() ([]byte, error) + func (m *MockAccountsAdapter) GetCode(codeHash []byte) []byte + func (m *MockAccountsAdapter) GetExistingAccount(address []byte) (vmcommon.AccountHandler, error) + func (m *MockAccountsAdapter) GetNumCheckpoints() uint32 + func (m *MockAccountsAdapter) IsInterfaceNil() bool + func (m *MockAccountsAdapter) IsPruningEnabled() bool + func (m *MockAccountsAdapter) JournalLen() int + func (m *MockAccountsAdapter) LoadAccount(address []byte) (vmcommon.AccountHandler, error) + func (m *MockAccountsAdapter) RecreateTrie(_ []byte) error + func (m *MockAccountsAdapter) RemoveAccount(address []byte) error + func (m *MockAccountsAdapter) RevertToSnapshot(snapshotIndex int) error + func (m *MockAccountsAdapter) RootHash() ([]byte, error) + func (m *MockAccountsAdapter) SaveAccount(account vmcommon.AccountHandler) error + func (m *MockAccountsAdapter) SetStateCheckpoint(_ []byte) + func (m *MockAccountsAdapter) SnapshotState(_ []byte) + type MockDCDTData struct + Instances []*dcdt.DCDigitalToken + LastNonce uint64 + Roles [][]byte + TokenIdentifier []byte + type MockGuardedAccountHandler struct + func NewMockGuardedAccountHandler() *MockGuardedAccountHandler + func (mah *MockGuardedAccountHandler) CleanOtherThanActive(_ vmcommon.UserAccountHandler) + func (mah *MockGuardedAccountHandler) GetActiveGuardian(_ vmcommon.UserAccountHandler) ([]byte, error) + func (mah *MockGuardedAccountHandler) IsInterfaceNil() bool + func (mah *MockGuardedAccountHandler) SetGuardian(_ vmcommon.UserAccountHandler, _ []byte, _ []byte, _ []byte) error + type MockWorld struct + AccountsAdapter vmcommon.AccountsAdapter + AcctMap AccountMap + Blockhashes [][]byte + BuiltinFuncs *BuiltinFunctionsWrapper + CompiledCode map[string][]byte + CurrentBlockInfo *BlockInfo + Err error + GuardedAccountHandler vmcommon.GuardedAccountHandler + LastCreatedContractAddress []byte + NewAddressMocks []*NewAddressMock + PreviousBlockInfo *BlockInfo + SelfShardID uint32 + StateRootHash []byte + func NewMockWorld() *MockWorld + func (b *MockWorld) Clear() + func (b *MockWorld) ClearCompiledCodes() + func (b *MockWorld) CommitChanges() error + func (b *MockWorld) CommunicationIdentifier(destShardID uint32) string + func (b *MockWorld) ComputeId(address []byte) uint32 + func (b *MockWorld) CreateStateBackup() + func (b *MockWorld) CurrentEpoch() uint32 + func (b *MockWorld) CurrentNonce() uint64 + func (b *MockWorld) CurrentRandomSeed() []byte + func (b *MockWorld) CurrentRound() uint64 + func (b *MockWorld) CurrentTimeStamp() uint64 + func (b *MockWorld) ExecuteSmartContractCallOnOtherVM(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error) + func (b *MockWorld) GetAllState(accountAddress []byte) (map[string][]byte, error) + func (b *MockWorld) GetBlockhash(nonce uint64) ([]byte, error) + func (b *MockWorld) GetBuiltinFunctionNames() vmcommon.FunctionNames + func (b *MockWorld) GetCode(acc vmcommon.UserAccountHandler) []byte + func (b *MockWorld) GetCompiledCode(codeHash []byte) (bool, []byte) + func (b *MockWorld) GetDCDTToken(address []byte, tokenName []byte, nonce uint64) (*dcdt.DCDigitalToken, error) + func (b *MockWorld) GetShardOfAddress(address []byte) uint32 + func (b *MockWorld) GetSnapshot() int + func (b *MockWorld) GetStateRootHash() []byte + func (b *MockWorld) GetStorageData(accountAddress []byte, key []byte) ([]byte, uint32, error) + func (b *MockWorld) GetUserAccount(address []byte) (vmcommon.UserAccountHandler, error) + func (b *MockWorld) InitBuiltinFunctions(gasMap config.GasScheduleMap) error + func (b *MockWorld) IsInterfaceNil() bool + func (b *MockWorld) IsLimitedTransfer(_ []byte) bool + func (b *MockWorld) IsPaused(_ []byte) bool + func (b *MockWorld) IsPayable(_, address []byte) (bool, error) + func (b *MockWorld) IsSmartContract(address []byte) bool + func (b *MockWorld) LastEpoch() uint32 + func (b *MockWorld) LastNonce() uint64 + func (b *MockWorld) LastRandomSeed() []byte + func (b *MockWorld) LastRound() uint64 + func (b *MockWorld) LastTimeStamp() uint64 + func (b *MockWorld) NewAddress(creatorAddress []byte, creatorNonce uint64, _ []byte) ([]byte, error) + func (b *MockWorld) NumberOfShards() uint32 + func (b *MockWorld) ProcessBuiltInFunction(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error) + func (b *MockWorld) RevertToSnapshot(snapshot int) error + func (b *MockWorld) RollbackChanges() error + func (b *MockWorld) SameShard(firstAddress []byte, secondAddress []byte) bool + func (b *MockWorld) SaveCompiledCode(codeHash []byte, code []byte) + func (b *MockWorld) SelfId() uint32 + func (b *MockWorld) SetCurrentBlockHash(blockHash []byte) + func (b *MockWorld) UpdateAccountFromOutputAccount(modAcct *vmcommon.OutputAccount) + func (b *MockWorld) UpdateAccounts(outputAccounts map[string]*vmcommon.OutputAccount, accountsToDelete [][]byte) error + func (b *MockWorld) UpdateBalance(address []byte, newBalance *big.Int) error + func (b *MockWorld) UpdateBalanceWithDelta(address []byte, balanceDelta *big.Int) error + func (b *MockWorld) UpdateWorldStateBefore(fromAddr []byte, gasLimit uint64, gasPrice uint64) error + type NewAddressMock struct + CreatorAddress []byte + CreatorNonce uint64 + NewAddress []byte