Execute

Execute pretty much does what it says on the tin: It executes some routine in your contract after a remote (either another contract or some client) sent a message.

This function is called when some wants you to, for example, increment a counter or add a user to a lottery. Anything that might modify the state of the contract.

Definition

contract.rs
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn execute(
    deps: DepsMut,
    env: Env,
    info: MessageInfo,
    msg: ExecuteMsg,
) -> StdResult<Response> {
  // Increment some counter, register a user, spread liberty for super earth!
  Ok(Response::new())
}