Skip to main content
Helpful?

MockContract

Git Source - Generated with forge doc

Inherits: Proxy

Mock contract that tracks the number of calls to various functions by selector

allows for proxying to an implementation contract if real logic or return values are needed

State Variables

calls

mapping(bytes32 => uint256) public calls;

callParams

mapping(bytes32 => mapping(bytes => uint256)) public callParams;

impl

If set, delegatecall to implementation after tracking call

address internal impl;

Functions

timesCalledSelector

function timesCalledSelector(bytes32 selector) public view returns (uint256);

timesCalled

function timesCalled(string calldata fnSig) public view returns (uint256);

calledWithSelector

function calledWithSelector(bytes32 selector, bytes calldata params) public view returns (bool);

calledWith

function calledWith(string calldata fnSig, bytes calldata params) public view returns (bool);

_implementation

exposes implementation contract address

function _implementation() internal view override returns (address);

setImplementation

function setImplementation(address _impl) external;

_beforeFallback

Captures calls by selector

function _beforeFallback() internal;

_fallback

function _fallback() internal override;

receive

receive() external payable;
Helpful?