Cargo Features

[dependencies]
cosmwasm-std = { version = "2.0.2", default-features = false, features = ["abort", "std", "iterator", "staking", "stargate", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0"] }
default = abort, iterator, std

These default features are set whenever cosmwasm-std is added without default-features = false somewhere in the dependency tree.

abort default

Affects imports::handle_panic, panic::install_panic_handler

std default

This feature can be used in the future to provide support for no_std environments,
but disabling it will not provide any benefit at the moment. Even with this feature disabled,
we currently require an std environment.
You probably want to keep this enabled for now to avoid possible breaking changes later.

Enables std of serde and serde-json-wasm

iterator default

iterator allows us to iterate over all DB items in a given range optional as some merkle stores (like tries) don't support this given Ethereum 1.0, 2.0, Substrate, and other major projects use Tries we keep this optional, to allow possible future integration (or different Cosmos Backends)

Affects memory::get_optional_region_address, traits::Storage.range, traits::Storage.range_keys, traits::Storage.range_values

staking

staking exposes bindings to a required staking moudle in the runtime, via new CosmosMsg types, and new QueryRequest types. This should only be enabled on contracts that require these types, so other contracts can be used on systems with eg. PoA consensus

Affects cosmos_msg::StakingMsg, cosmos_msg::DistributionMsg, mock::MockQuerier.staking, mock::StakingQuerier

stargate

stargate enables stargate-dependent messages and queries, like raw protobuf messages as well as ibc-related functionality

Affects exports::do_ibc_channel_open, exports::do_ibc_channel_connect, exports::do_ibc_channel_close, exports::do_ibc_packet_receive, exports::do_ibc_packet_ack, exports::do_ibc_packet_timeout, cosmos_msg::GovMsg, cosmos_msg::VoteOption, mock::mock_ibc_channel, mock::mock_ibc_channel_open_init, mock::mock_ibc_channel_open_try, mock::mock_ibc_channel_connect_ack, mock::mock_ibc_channel_connect_confirm, mock::mock_ibc_channel_close_init, mock::mock_ibc_channel_close_confirm, mock::mock_ibc_packet_recv, mock::mock_ibc_packet_ack, mock::mock_ibc_packet_timeout, mock::MockQuerier.ibc, mock::IbcQuerier

cosmwasm_1_1 cosmwasm_1_2?

This feature makes BankQuery::Supply available for the contract to call, but requires the host blockchain to run CosmWasm 1.1.0 or higher.

cosmwasm_1_2 cosmwasm_1_3? = cosmwasm_1_1

This feature makes GovMsg::VoteWeighted available for the contract to call, but requires the host blockchain to run CosmWasm 1.2.0 or higher.

Affects cosmos_msg::WeightedVoteOption

cosmwasm_1_3 cosmwasm_1_4? = cosmwasm_1_2

This feature makes BankQuery::DenomMetadata available for the contract to call, but requires the host blockchain to run CosmWasm 1.3.0 or higher.

Affects mock::MockQuerier.distribution, mock::DistributionQuerier

cosmwasm_1_4 cosmwasm_2_0? = cosmwasm_1_3

Together with the iterator feature this enables additional imports for more efficient iteration over DB keys or values. It also makes DistributionQuery::{DelegationRewards, DelegationTotalRewards, DelegatorValidators} available for the contract to call. It requires the host blockchain to run CosmWasm 1.4.0 or higher.

cosmwasm_2_0 = cosmwasm_1_4

This enables functionality that is only available on 2.0 chains. It adds CosmosMsg::Any, replacing CosmosMsg::Stargate. It also adds QueryRequest::Grpc.