enumwith all the valid message types and reject all messages that don’t follow the usage pattern dictated in that enum; this enum is conventionally called
ExecuteMsgand is usually in a file called
ExecuteMsgis passed to the function. Let’s look at an example.
Incrementmessage, it calls the function
try_increment, otherwise, if the message is the
Resetmessage, it calls the function
try_resetwith the count.
env. Let’s look at those more closely.
envcontains all the information about the environment the contract is running in, but what does that mean exactly? On Secret Network the properties available in the Env struct are as follows:
height), the current time as a unix timestamp (
time) and the chain id (
chain_id) such as secret-4 or pulsar-2.
Statestruct as its type, this means that when reading and writing data from the storage, the singleton automatically serializes or deserializes the State struct. The update method is a shorthand that will load the data, perform the specified action, and store the result in the storage, which makes for a very intuitive experience.