Function std::auth::caller_is_external
pub fn caller_is_external() -> bool Expand description
Returns true if the caller is external (i.e. a script).
Otherwise, if the caller is a contract, returns false.
Additional Information
For more information refer to the VM Instruction Set.
Returns
- [bool] -
trueif the caller is external,falseotherwise.
Examples
use std::auth::caller_is_external;
fn foo() {
if caller_is_external() {
log("Caller is external.")
} else {
log("Caller is a contract.")
}
}