Function is_contract

Source
pub fn is_contract(account: &Address) -> bool
Expand description

Checks whether addr is a contract.

§Notes

If addr references a precompile address, the return value will be true.

The function caller_is_origin performs better when checking whether your contract is being called by a contract or an account. It performs better for this case as it does not require any storage lookups.

§Errors

If the returned value cannot be properly decoded.