Expand description
Imports normally needed in integration tests, grouped together.
Re-exports§
pub use crate::api::DebugApi;
pub use crate::api::DebugHandle;
pub use crate::api::StaticApi;
pub use crate::bech32;
pub use crate::scenario::model::Account;
pub use crate::scenario::model::AddressValue;
pub use crate::scenario::model::BytesValue;
pub use crate::scenario::model::CheckAccount;
pub use crate::scenario::model::CheckStateStep;
pub use crate::scenario::model::ScCallStep;
pub use crate::scenario::model::ScDeployStep;
pub use crate::scenario::model::ScQueryStep;
pub use crate::scenario::model::Scenario;
pub use crate::scenario::model::SetStateStep;
pub use crate::scenario::model::TransferStep;
pub use crate::scenario::model::TxESDT;
pub use crate::scenario::model::TxExpect;
pub use crate::scenario::model::TypedResponse;
pub use crate::scenario::model::TypedScDeploy;
pub use crate::scenario::ScenarioRunner;
pub use crate::ScenarioTxRun;
pub use crate::num_bigint;
pub use crate::whitebox_legacy::*;
Modules§
Macros§
- Converts usize to NonZeroUsize or returns SCError.
- Allows us to write Solidity style
require!(<condition>, <error_msg>)
and avoid if statements.
Structs§
- An Address is just a H256 with a different name. Has a different ABI name than H256.
- Helper structure for providing arguments to all SC call functions other than async_call_raw. It keeps argument lengths separately from the argument data itself. Argument data is concatenated into a single byte buffer.
- Adapter from the API to the TopDecodeInput trait. Allows objects to be deserialized directly from the API as arguments.
- Some info to display in endpoint argument deserialization error messages, to help users identify the faulty argument. Generated automatically. Current version uses argument names, but in principle it could be changed to argument index to save some bytes from the wasm output.
- A vector with a fixed capacity.
- Async
Call Promises Deprecated Will be renamed toAsyncCall
andAsyncCall
toAsyncCallLegacy
when the promises end up on the mainnet. - Holding back-transfer data, as retrieved from the VM.
- Wraps and address, and presents it as a bech32 expression wherever possible.
- A bi-directional map, from values to ids and viceversa. The mapper is based on UnorderedSetMapper, reason why the remove is done by swap_remove
- A pointer type that uniquely owns a heap allocation of type
T
. - Simple wrapper around a boxed byte slice, but with a lot of optimized methods for manipulating it. The focus is on reducing code size rather improving speed.
- Consumes a vector of
BoxedBytes
and deserializes from the vector one by one. - Object that encodes full async callback data.
- Similar object to
CallbackClosure
, but only used for deserializing from storage the callback data with the old async call mechanism. - Helps the callback macro expansion to perform callback name matching more efficiently. The current implementation hashes by callback name length, but in principle further optimizations are possible.
- Contains code for a deploy or upgrade.
- Handlers that return nothing.
- Zero-sized constant number of decimals.
- Contract
Call NoPayment Deprecated Holds metadata for calling another contract, without payments. - Contract
Call With AnyPayment Deprecated Holds data for calling another contract, with any type of payment: none, EGLD, Multi-ESDT. - Contract
Call With Egld Deprecated Holds data for calling another contract, with EGLD payment only. - Contract
Call With Egld OrSingle Esdt Deprecated Holds data for calling another contract, with a single payment, either EGLD or a single ESDT token. - Contract
Call With Multi Esdt Deprecated - Contract
Deploy Deprecated - Bundles a representation of a contract with the contract proxy, so that it can be easily called in the context of a blockchain mock.
- Holds deploy data: code, code metadata, and arguments.
- Indicates the system SC address, which is the same on any MultiversX blockchain.
- Proxy for the ESDT system smart contract.
- Method container of the ESDT system smart contract proxy.
- ESDT
System Smart Contract Proxy Deprecated Proxy for the ESDT system smart contract. Unlike other contract proxies, this one has a fixed address, so the proxy object doesn’t really contain any data, it is more of a placeholder. - Indicates the EGLD payment in a transaction.
- Specialized type for handling either EGLD or ESDT token identifiers.
- Thin wrapper around EgldOrEsdtTokenPayment, which has different I/O behaviour:
- Similar to
EgldOrEsdtTokenPayment
, but only contains references. - Empty structure with an empty bytes representation. Equivalent to
false
,0
or[u8; 0]
, but more explicit. - Thin wrapper around EsdtTokenPayment, which has different I/O behaviour:
- The version of
EsdtTokenPayment
that contains referrences instead of owned fields. - Verifies that transaction result error matches the given one.
- Verifies that transaction result message matches the given one.
- Verifies that transaction result status matches the given one.
- Verifies that transaction result matches the given value.
- Indicates the source of a “deploy from source” or “upgrade from source”.
- Encodes a function call on the blockchain, composed of a function name and its encoded arguments.
- Indicates that all remaining gas should be sent to a transaction.
- Type that holds 32 bytes of data. Data is kept on the heap to keep wasm size low and avoid copies.
- Structure that allows taking a variable number of arguments, but does nothing with them, not even deserialization.
- A byte buffer managed by an external API.
- Basic implementation of a ManagedBuffer builder, no caching.
- A ManagedBuffer builder implementation that caches data to the static cache locally in the contract.
- Nested decode buffer based on a managed buffer. Uses the load/copy slice API to extract pieces of the managed buffer for deserialization.
- A wrapper over a ManagedBuffer with different decode properties. It reads until the end of the buffer.
- A list of items that lives inside a managed buffer. Items can be either stored there in full (e.g.
u32
), or just via handle (e.g.BigUint<M>
). - Fixed-point decimal numbers that accept either a constant or variable number of decimals.
- Fixed-point decimal numbers that accept either a constant or variable number of decimals.
- A byte buffer managed by an external API.
- A very efficient optional managed type.
- A very efficient reference to a managed type, with copy semantics.
- A very efficient mutable reference to a managed type.
- Smart contract error that can concatenate multiple message pieces. The message is kept as a managed buffer in the VM.
- A list of items that lives inside a managed buffer. Items can be either stored there in full (e.g.
u32
), or just via handle (e.g.BigUint<M>
). - Empty ManagedVecItem.
- The main ManagedVecItemPayload implementation. Uses an array in its implementation.
- A multi-value container, that keeps raw values as ManagedBuffer It allows encoding and decoding of multi-values.
- A multi-value container, that keeps raw values as ManagedBuffer, and which encodes and decodes its length explicitly.
- Iterator for
MultiValueEncoded
andMultiValueEncodedCounted
. - Argument or result that is made up of the argument count, followed by the arguments themselves. Think of it as a
VarArgs
preceded by the count. UnlikeMultiValueManagedVec
it deserializes eagerly. - Structure that allows taking a variable number of arguments or returning a variable number of results in a smart contract endpoint.
- Iterator that can give us a range of NonZeroUsize.
- Transaction marker, which indicates that a transaction should never have any payment added to it.
- Contains no data.
- Simply passes a value to the result.
- Temporary value used for any kind of templates.
- Temporary value used for any kind of templates.
- A simple queue struct that is able to push and pop without moving elements. New items are pushed at the end, just like for a regular Vec. When popping, instead of performing a regular Vec remove that would shift items, a start index is moved up 1 position. When serializing, items before the start index are ignored.
- A queue with owned nodes.
- Indicates that back-transfers will be returned.
- Indicates that back-transfers will be returned.
- Indicates that back-transfers will be returned.
- Indicates that back-transfers will be returned.
- Indicates that the newly deployed address will be returned after a deploy.
- Indicates that a
Result
will be returned, either with the handled result, according to the nested result handlers, or with an error in case of a failed transaction. - Indicates that the error status will be returned.
- Indicates that the newly deployed address will be returned after a deploy.
- Indicates that the newly deployed address will be returned after a deploy.
- Indicates that the newly deployed address will be returned after a deploy as a ManagedAddress.
- Indicates that the raw result data will be returned.
- Indicates that result will be returned.
- Indicates that result will be returned.
- Indicates that the unmanaged version of the result will be returned.
- Indicates that the error status will be returned.
- A big signed integer type.
- A big unsigned integer type.
- Environment for executing transactions.
- The actual data required to run a scenario locally. This is the minimal environment needed to run txs.
- A facade for contracts tests.
- Intermediary type for deserializing the result of an endpoint that returns a
SingleValueMapper
. - Manages a single serializable item in storage.
- A special type of array that initially holds the values from 0 to N If array[i] == i, then the default value (0) is stored instead
- Contains a smart contract execution error message.
- A UTF-8–encoded, growable string.
- Encodes a dummy address, to be used for tests.
- Syntactic sugar for quickly writing ESDT transfers in tests.
- Encodes a dummy SC address, to be used for tests.
- Encodes a dummy address, to be used for tests.
- Indicates that transaction should be sent to the caller (the sender of the current transaction).
- Indicates that transaction should be sent to itself.
- Specialized type for handling token identifiers. It wraps a BoxedBytes with the full ASCII name of the token. EGLD is stored as an empty name.
- Represents property arguments to be sent to the system SC.
- Universal representation of a blockchain transaction.
- The transaction environment used in calls launched from a SC.
- Typed
Function Call Deprecated Old attempt at grouping FunctionCall + OriginalTypeMarker. - Holds the values from 1 to N with as little storage interaction as possible If Mapper[i] = i, then it stores nothing, i.e. “0” If Mapper[i] is equal to another value, then it stores the value
- Holds deploy data: code, code metadata, and arguments.
- Proxy describing the user builtin function signatures.
- Very widely used mapper, that manages the users of a smart contract. It holds a bi-directional map, from addresses to ids and viceversa. This is so we can easily iterate over all users, using their ids. Also holds the user count in sync. This is also necessary for iteration.
- A contiguous growable array type, written as
Vec<T>
, short for ‘vector’. - Manages a list of items of the same type. Saves each of the items under a separate key in storage. To produce each individual key, it concatenates the main key with a serialized 4-byte index. Indexes start from 1, instead of 0. (We avoid 0-value indexes to prevent confusion between an uninitialized variable and zero.) It also stores the count separately, at what would be index 0. The count is always kept in sync automatically.
- Wraps a contract that is supposed to be used in whitebox tests.
- A non-iterable whitelist mapper. Very efficient for storing a whitelist, as each item requires only one storage key. If you need to iterate over the keys, use UnorderedSetMapper or SetMapper instead.
- Defines a lambda function to be called on the newly deployed address, after a deploy.
- Defines a lambda function to be called on the raw result of the transaction.
- Wraps a closure that handles a
TxResponse
object. - Defines a lambda function to be called on the decoded result.
- Defines a lambda function to be called on the decoded result.
Enums§
- Used internally between the
callback
andcallback_selector
methods. It is likely to be removed in the future. - Encodes any type of payment, which either:
- The version of
EgldOrMultiEsdtPayment
that contains referrences instead of owned fields. - Message hash type for the
verifyCustomSecp256k1
CryptoApi function - Standard way of signalling that an operation was interrupted early, before running out of gas. An endpoint that performs a longer operation can check from time to time if it is running low on gas and can decide to save its state and exit, so that it can continue the same operation later.
- A smart contract argument or result that can be missing.
- SCResult
Deprecated Default way to optionally return an error from a smart contract endpoint.
Constants§
Traits§
- The addition operator
+
. - The addition assignment operator
+=
. - Describes a value can also have a custom representation in a mandos scenario.
- Models an argument tree of the form
(arg1, (arg2, ... (argn, ())))
, used for retrieving endpoint arguments. - The bitwise AND operator
&
. - The bitwise AND assignment operator
&=
. - The bitwise OR operator
|
. - The bitwise OR assignment operator
|=
. - The bitwise XOR operator
^
. - The bitwise XOR assignment operator
^=
. - Interface to be used by the actual smart contract code.
- Defines a contract call object, which is the basis for all calls to other contracts.
- Contract
Call Base Deprecated Converts into a legacy contract call. - Implemented by all decimal types usable in
ManagedDecimal
. - The division operator
/
. - The division assignment operator
/=
. - Used when merging is done through an external SC call. Generally, these only need to have the same token ID, with different nonces.
- Defines conversion of a type to its multi-value representation.
- Commonalities between all managed types.
- Types that implement this trait can be items inside a
ManagedVec
. All these types need a payload, i.e a representation that gets stored in the underlying managed buffer. Not all data needs to be stored as payload, for instance for most managed types the payload is just the handle, whereas the mai ndata is kept by the VM. - Syntactic sugar, that allows us to more easily represent composite payloads as nested tuples.
- Describes the binary represetnation of a ManagedVecItem.
- Describes concatantion of smaller payloads into a larger one.
- Used for types that can be merged locally.
- The multiplication operator
*
. - The multiplication assignment operator
*=
. - Trait that allows zero-copy read of value-references from slices in LE format.
- Trait that allows zero-copy write of value-references to slices in LE format.
- Trait that is automatically implemented for all types that are allowed as proxy inputs.
- Indicates how result processing will undergo for an ensemble of result handlers.
- Result handler list item.
- Indicates how result processing will undergo for one specific result handler.
- Used when registering a contract for debugging.
- The remainder operator
%
. - The remainder assignment operator
%=
. - Any type that implements this trait can be used to signal errors when returning from a SC endpoint.
- Designates a tx environment suitable for running scenarios locally.
- Provides a
run
method for transactions and steps. - The left shift operator
<<
. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ << _
, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha << b
anda.shl(b)
are one and the same from an evaluation standpoint, they are different when it comes to type inference. - The left shift assignment operator
<<=
. - The right shift operator
>>
. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ >> _
, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha >> b
anda.shr(b)
are one and the same from an evaluation standpoint, they are different when it comes to type inference. - The right shift assignment operator
>>=
. - The subtraction operator
-
. - The subtraction assignment operator
-=
. - Trait that allows zero-copy read of values from an underlying API in big endian format.
- Marks the data field of a transaction in
Tx
. - Indicates that given result handler is empty, i.e. doesn’t cause any side effects and returns nothing.
- Marks the sender of any transaction.
- Marks the non-empty sender of a transaction.
- All typed that populate the gas field of a transaction need to implement this trait.
- Marker trait that indicates that payment field contains no payment.
- Describes a payment that is part of a transaction.
- Marks a payment object that only contains EGLD or nothing at all.
- Indicates that a payment object contains a multi-ESDT payment.
- Defines a proxy object for a smart contract.
- Marks a general result handler, to be used in the transaction unified syntax.
- Marks the recipient of any transaction.
- Marks the non-empty recipient of a transaction.
- Implemented for all types that can end up in the ABI:
Functions§
- Calls both the fast exit and the regular dep-decode, compares that the outputs are equal, then returns the result. To be used in serialization tests.
- Calls both the fast exit and the regular dep-encode, compares that the outputs are equal, then returns the result. To be used in serialization tests.
- Calls both the fast exit and the regular top-decode, compares that the outputs are equal, then returns the result. To be used in serialization tests.
- Calls both the fast exit and the regular top-encode, compares that the outputs are equal, then returns the result. To be used in serialization tests.
- Calls nested decode and panics if an encoding error occurs. Do not use in smart contracts!
- Calls nested encode and panics if an encoding error occurs. Do not use in smart contracts!
- Used for loading all regular endpoint arguments. A call to this gets generated for all endpoints and callbacks.
- Currently used for the callback closure. No distinction there for single values.
- Used by the ManagedVecItem derive.
- Used by the ManagedVecItem derive.
- Syntactical sugar to help macros to generate code easier. Unlike calling
CallbackClosure::<SA, R>::new
, here types can be inferred from the context. - Syntactical sugar to help macros to generate code easier. Unlike calling
ContractDeploy::<SA>::new
, here types can be inferred from the context. - This is safe because adding 1 to a positive number makes it greater than one.
- This is safe because 1 != 0.
- This is safe because adding a non-zero number with a positive one yields a non-zero number.
- ser_
deser_ ok Deprecated backwards compatibility only, will remove in next major release - Calls top encode and panics if an encoding error occurs. Do not use in smart contracts!
Type Aliases§
- Async
Call Deprecated Kept as alias for backwards compatibility. - Esdt
Token Payment Multi Arg Deprecated - Ignore
VarArgs Deprecated Structure that allows taking a variable number of arguments, but does nothing with them, not even deserialization. - The specific
Tx
type produces by the issue operations of the ESDTSystemSCProxy. - Managed
Buffer Cached Builder Deprecated - Managed
Counted Multi Result Vec Deprecated - Managed
Counted VarArgs Deprecated - Managed
Multi Result Vec Deprecated - Managed
Multi Result VecEager Deprecated - Managed
VarArgs Deprecated - Managed
VarArgs Eager Deprecated - Multi
Arg2 Deprecated - Multi
Arg3 Deprecated - Multi
Arg4 Deprecated - Multi
Arg5 Deprecated - Multi
Arg6 Deprecated - Multi
Arg7 Deprecated - Multi
Arg8 Deprecated - Multi
Arg9 Deprecated - Multi
Arg10 Deprecated - Multi
Arg11 Deprecated - Multi
Arg12 Deprecated - Multi
Arg13 Deprecated - Multi
Arg14 Deprecated - Multi
Arg15 Deprecated - Multi
Arg16 Deprecated - Multi
ArgVec Deprecated Structure that allows taking a variable number of arguments or returning a variable number of results in a smart contract endpoint. - Alias for a list of payments of EGLD or ESDT tokens.
- Alias for a list of payments.
- Multi
Result2 Deprecated - Multi
Result3 Deprecated - Multi
Result4 Deprecated - Multi
Result5 Deprecated - Multi
Result6 Deprecated - Multi
Result7 Deprecated - Multi
Result8 Deprecated - Multi
Result9 Deprecated - Multi
Result10 Deprecated - Multi
Result11 Deprecated - Multi
Result12 Deprecated - Multi
Result13 Deprecated - Multi
Result14 Deprecated - Multi
Result15 Deprecated - Multi
Result16 Deprecated - Multi
Result Vec Deprecated Used for returning a variable number of results from an endpoint, it is synonymous withMultiResult
. - Decimals are represented as usize. This type is also used as variable decimals.
- Optional
Arg Deprecated A smart contract argument or result that can be missing. - Optional
Result Deprecated It is just an alias forOptionalArg
. In general we useOptionalArg
for arguments andOptionalResult
for results, but it is the same implementation for both. - Alias for a
Tx
generated from a proxy, in an endpoint. - Alias for a
Tx
generated from a proxy, ininit
. - Alias for a
Tx
generated from a proxy, inupgrade
. - Alias for a
Tx
generated from a proxy, in an endpoint. - Alias for a
Tx
generated from a proxy, ininit
. - Alias for a
Tx
generated from a proxy, inupgrade
. - VarArgs
Deprecated Used for taking a variable number of arguments in an endpoint, it is synonymous withMultiResultVec
/MultiArgVec
.