@@ -65,17 +65,18 @@ In the first two lines, we see the usage of two macros:
6565 point collision.
6666
6767- [ ` contract ` ] ( ../macros/contract ) - Parses every method inside the ` impl ` block marked with the
68- ` [sv::msg(...)] ` attribute and create proper messages and utilities like helpers for
69- [ ` MultiTest ` ] ( ../../cw-multi-test ) .
68+ [ ` [sv::msg(...)] ` ] ( ../attributes/msg ) attribute and create proper messages and utilities like
69+ helpers for [ ` MultiTest ` ] ( ../../cw-multi-test ) .
7070
71- This simple example also has the ` sv::msg(...) ` attributes. Sylvia macros distinguish the if message
72- should be generated from the marked method and of what type.
71+ This simple example also has the [ ` sv::msg(...) ` ] ( ../attributes/msg ) attributes. Sylvia macros
72+ distinguish the if message should be generated from the marked method and of what type.
7373
7474CosmWasm contract requires the ` instantiate ` message, and it is mandatory to specify it for the
75- ` contract ` macro. We have to provide it with the proper context type:
75+ [ ` contract ` ] ( ../macros/contract ) macro. We have to provide it with the proper context type:
7676[ ` InstantiateCtx ` ] ( https://docs.rs/sylvia/latest/sylvia/types/struct.InstantiateCtx.html ) . Another
77- mandatory method is the ` new ` , as contract fields are out of scope for the ` contract ` macro, and
78- otherwise we wouldn't be able to create the contract object in message dispatching.
77+ mandatory method is the ` new ` , as contract fields are out of scope for the
78+ [ ` contract ` ] ( ../macros/contract ) macro, and otherwise we wouldn't be able to create the contract
79+ object in message dispatching.
7980
8081Context gives us access to the blockchain state, information about our contract, and the sender of
8182the message. We return the
@@ -85,16 +86,16 @@ standard CosmWasm error
8586[ ` Response ` ] ( https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.Response.html ) .
8687
8788The template contract also contains a query and an exec messages. Each type of message in CosmWasm
88- supports different contexts. F.e. the
89- [ ` QueryCtx ` ] ( https://docs.rs/sylvia/latest/sylvia/types/struct.QueryCtx.html ) exposes to the user an
89+ supports different contexts. F.e. the [ ` QueryCtx ` ] ( ../types/context ) exposes to the user an
9090immutable [ ` Deps ` ] ( https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.Deps.html ) as by design,
91- queries should never mutate the state. This is not the case for the
92- [ ` ExecCtx ` ] ( https://docs.rs/sylvia/latest/sylvia/types/struct.ExecCtx.html ) and ` InstantiateCtx `
93- which exposes the [ ` DepsMut ` ] ( https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.DepsMut.html ) .
91+ queries should never mutate the state. This is not the case for the [ ` ExecCtx ` ] ( ../types/context )
92+ and ` InstantiateCtx ` which exposes the
93+ [ ` DepsMut ` ] ( https://docs.rs/cosmwasm-std/latest/cosmwasm_std/struct.DepsMut.html ) .
9494
9595Fell free expanding the macro now and seeing what Sylvia generates. It might be overwhelming, as
9696there will be a lot of things generated that seem not relevant to our code, so for the bare minimum,
97- check the ` InstantiateMsg ` and its ` impl ` block.
97+ check the [ ` InstantiateMsg ` ] ( ../macros/generated-types/message-types#contract-messages ) and its
98+ ` impl ` block.
9899
99100Sylvia doesn't generate anything magical, but regular CosmWasm contract types customized based on
100101the provided methods and attributes. This means that the Sylvia contract is fully interoperational
0 commit comments