Crate cosmwasm_std[][src]

Modules

Macros

This macro generates the boilerplate required to call into the contract-specific logic from the entry-points to the Wasm module.

This macro is very similar to the create_entry_points macro, except it also requires the migrate method:

Structs

A human readable address.

An key value pair that is used in the context of event attributes in logs

Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.

A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0

An empty struct that serves as a placeholder in different places, such as contracts that don’t set a custom message.

A full Cosmos SDK event as documented in https://docs.cosmos.network/v0.42/core/events.html.

HumanAddrDeprecated

Additional information from MsgInstantiateContract and MsgExecuteContract, which is passed along with the contract execution message into the instantiate and execute entry points.

Holds all external dependencies of the contract. Designed to allow easy dependency injection at runtime. This cannot be copied or cloned since it would behave differently for mock storages and a bridge storage in the VM.

The result object returned to reply. We always get the ID from the submessage back and then must handle success and error cases ourselves.

A response of a contract entry point, such as instantiate, execute or migrate.

A submessage that will guarantee a reply call on success or error, depending on the reply_on setting. If you do not need to process the result, use regular messages instead.

The information we get back from a successful sub-call, with full sdk events

A point in time in nanosecond precision.

A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.

A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.

Enums

The message types of the bank module.

This is the final result type that is created and serialized in a contract for every init/execute/migrate call. The VM then deserializes this type to distinguish between successful and failed executions.

Use this to define when the contract gets a response callback. If you only need it for errors or success you can select just those in order to save gas.

Structured error type for init, execute and query.

SystemError is used for errors inside the VM and is API friendly (i.e. serializable).

This is the outer result type returned by a querier to the contract.

The message types of the wasm module.

Traits

Api are callbacks to system functions implemented outside of the wasm modules. Currently it just supports address conversion but we could add eg. crypto functions here.

A trait that is required to avoid conflicts with other query types like BankQuery and WasmQuery in generic implementations. You need to implement it in your custom query type.

A fraction p/q with integers p and q.

Storage provides read and write access to a persistent storage. If you only want to provide read access, provide &Storage

Functions

Creates a new Attribute. Attribute::new is an alias for this.

A shorthand constructor for Coin

A shortcut constructor for a set of one denomination of coins

has_coins returns true if the list of coins has at least the required amount

Shortcut helper as the construction of WasmMsg::Instantiate can be quite verbose in contract code

Shortcut helper as the construction of WasmMsg::Instantiate can be quite verbose in contract code.

Type Definitions

KVDeprecated

KV is a Key-Value pair, returned from our iterators

A Key-Value pair, returned from our iterators

A short-hand alias for the two-level query result (1. accessing the contract, 2. executing query in the contract)

The return type for init, execute and query. Since the error type cannot be serialized to JSON, this is only available within the contract and its unit tests.

Attribute Macros

This attribute macro generates the boilerplate required to call into the contract-specific logic from the entry-points to the Wasm module.