cosmwasm-zero-to-hero icon indicating copy to clipboard operation
cosmwasm-zero-to-hero copied to clipboard

Why do we always pass env around?

Open llllllluc opened this issue 2 years ago • 1 comments

env is always passed from execute and query to the specific execute / query functions, but barely used. Can we just skip passing env?

llllllluc avatar Oct 20 '22 05:10 llllllluc

We can not skip passing it. Because you have to comply with the interface. env includes:

pub struct Env { 
    pub block: BlockInfo, 
    pub transaction: Option<TransactionInfo>, 
    pub contract: ContractInfo,
}

If you wish, you can use them in your smart contract.

0fatih avatar Oct 23 '22 15:10 0fatih