Skip to content

Commit

Permalink
feat: add CallerMode enum and vm.readCallers cheat code (foundry-…
Browse files Browse the repository at this point in the history
…rs#400)

* feat: added CallerMode enum and readCallers cheat code

* chore: name parameters

---------

Co-authored-by: Matt Solomon <[email protected]>
  • Loading branch information
xeno097 and mds1 authored Jun 8, 2023
1 parent b00f504 commit 66bf4e2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Vm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ pragma experimental ABIEncoderV2;
// 3. Otherwise you're `pure`.

interface VmSafe {
enum CallerMode {
None,
Broadcast,
RecurrentBroadcast,
Prank,
RecurrentPrank
}

struct Log {
bytes32[] topics;
bytes data;
Expand Down Expand Up @@ -380,6 +388,8 @@ interface Vm is VmSafe {
function startPrank(address msgSender, address txOrigin) external;
// Resets subsequent calls' msg.sender to be `address(this)`
function stopPrank() external;
// Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification
function readCallers() external returns (CallerMode callerMode, address msgSender, address txOrigin);
// Sets an address' balance
function deal(address account, uint256 newBalance) external;
// Sets an address' code
Expand Down

0 comments on commit 66bf4e2

Please sign in to comment.