fn read_callers(state: &Cheatcodes, default_sender: &Address) -> Result
Expand description
Reads the current caller information and returns the current CallerMode, msg.sender
and
tx.origin
.
Depending on the current caller mode, one of the following results will be returned:
-
If there is an active prank:
- caller_mode will be equal to:
- CallerMode::Prank if the prank has been set with
vm.prank(..)
. - CallerMode::RecurrentPrank if the prank has been set with
vm.startPrank(..)
.
- CallerMode::Prank if the prank has been set with
msg.sender
will be equal to the address set for the prank.tx.origin
will be equal to the default sender address unless an alternative one has been set when configuring the prank.
- caller_mode will be equal to:
-
If there is an active broadcast:
- caller_mode will be equal to:
- CallerMode::Broadcast if the broadcast has been set with
vm.broadcast(..)
. - CallerMode::RecurrentBroadcast if the broadcast has been set with
vm.startBroadcast(..)
.
- CallerMode::Broadcast if the broadcast has been set with
msg.sender
andtx.origin
will be equal to the address provided when setting the broadcast.
- caller_mode will be equal to:
-
If no caller modification is active:
- caller_mode will be equal to CallerMode::None,
msg.sender
andtx.origin
will be equal to the default sender address.