ExecuteMsg
ExecuteMsg
Next, let’s look at the ExecuteMsg, which defines all the actions users can perform with the contract. The structure remains almost the same, but we add an attribute as we did for our instantiation message:
Just like with #[andr_instantiate] for initialization, the #[andr_exec] attribute is a custom Andromeda macro that adds all the base execute messages that are available for all ADOs and is handled here:
This inclusion is already found in the template by default.
As explained in the Getting Started section, we use an ExecuteContext struct to be able to handle AMP messages. This information is passed to a ctx variable that we use. For example let us take a look at our Propose message from the cw3 version and compare it to the ADO version:
The ctx contains the deps,env, and info and can be used as a parameter instead. In our excecute_propose function we include:
This will assign the values back to deps, info, and env from our ctx and we can work with them normally. As you can see from the ADO version, the rest of the logic remained the same as the CW3 version.
Alternatively, we could access these variables through our ctx
like so:
Other than that, the rest of the logic for execute messages remains the same as any other CosmWasm smart contract.
Last updated
Was this helpful?