tags | ||
---|---|---|
|
import { Callout } from "nextra/components";
This is one of the most fundamental entrypoints. This entrypoint is called once during the contract
lifecycle.
It essentially is there to initialise the state of your contract (for example, initialising a
counter in storage, etc.).
You can imagine it as the constructor of your contract.
Note that this function is called for *each instance* of your contract that you decide to create, not one time ever.Your contract is the *constructor*, and you can have *multiple instances* of the same contract.
Each time an instance is createDefineEnv, the constructor is called.
Contracts are **not** singletons.
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn instantiate(
_deps: DepsMut,
_env: Env,
_info: MessageInfo,
_msg: InstantiateMsg,
) -> StdResult<Response> {
// TODO: Initialise storage, send out metrics, do mischief
Ok(Response::new())
}