Skip to content

Make execute entry point optional #829

@webmaster128

Description

@webmaster128

It is encouraged to have an execute entry point but there are contracts that don't need one. We have some of those contracts here as development contracts. Those are exotic use case, but still they exist.

burner

#[entry_point]
pub fn execute(
    _deps: DepsMut,
    _env: Env,
    _info: MessageInfo,
    _msg: ExecuteMsg,
) -> StdResult<Response> {
    Err(StdError::generic_err(
        "You can only use this contract for migrations",
    ))
}

crypto-verify

#[entry_point]
pub fn execute(
    _deps: DepsMut,
    _env: Env,
    _info: MessageInfo,
    _msg: ExecuteMsg,
) -> StdResult<Response> {
    Ok(Response::default())
}

The two example s already show a dilemma: is an execution with an arbitrary message a no-op (success) or an error?

There is no reason execute must always exist. Just like query, it can be encouraged but optional.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions