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] - true if the caller is external, false otherwise.

Examples

use std::auth::caller_is_external;

fn foo() {
    if caller_is_external() {
        log("Caller is external.")
    } else {
        log("Caller is a contract.")
    }
}