HumanAddr
has been deprecated in favour of simply String
. It never added any significant safety bonus over String
and was just a marker type. The new type Addr
was created to hold validated addresses. Those can be created via Addr::unchecked
, Api::addr_validate
, Api::addr_humanize
and JSON deserialization. In order to maintain type safety, deserialization into Addr
must only be done from trusted sources like a contract's state or a query response. User inputs must be deserialized into String
.deps.api.human_address(&CanonicalAddr)
=> deps.api.addr_humanize(&str)
deps.api.canonical_address(&HumanAddr)
=> deps.api.addr_canonicalize(&str)
#[cfg_attr(not(feature = "library"), entry_point)]
to your contract.rs as follows:init
Env
split into Env
and MessageInfo
InitResponse
and InitResult
deprecated, please use Response
init
to instantiate
handle
Env
split into Env
and MessageInfo
HandleResponse
and HandleResult
deprecated, please use Response
handle
to execute
query
Env
addedmigrate
Env
split into Env
and MessageInfo
MigrateResponse
and MigrateResult
deprecated, please use Response
Response
can no longer be built using a struct literal. Please use Response::new
as well as relevant builder-style setters to set the data.MsgInstantiate
as sub-messages with ReplyOn::Success
option like https://github.com/terraswap/terraswap/blob/7cf47f5e811fe0c4643a7cd09500702c1e7f3a6b/contracts/terraswap_factory/src/contract.rs#L128-L142.Extern
to Deps
, and radically simplify the init/handle/migrate/query
entrypoints. Rather than &mut Extern<S, A, Q>
, use DepsMut
. And instead of &Extern<S, A, Q>
, use Deps
. If you ever pass eg. foo<A: Api>(api: A)
around, you must now use dynamic trait pointers: foo(api: &dyn Api)
. Here is the quick search-replace guide on how to fix contract.rs:singleton
and bucket
. But if you want more advanced storage access, you can use cw-storage-plus
with following migration steps.cowmasm_storage::Singleton
-> cw_stroage_plus::Item
read_*
and store_*
functionsItem
as following (must prepend the length of key)cosmwasm_storage::Bucket
-> cw_storage_plus::Map
read_*
and store_*
functionsMap
as followingmock_querier
has to remove one to_binary
from its raw query response.