Skip to content

Instantly share code, notes, and snippets.

@dabit3
Created June 26, 2022 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dabit3/bcd6632400878266c792a41627964ea6 to your computer and use it in GitHub Desktop.
Save dabit3/bcd6632400878266c792a41627964ea6 to your computer and use it in GitHub Desktop.
Testing calling another contract with Foundry / Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import 'src/Call.sol';
contract AuctionTest is Test {
Call callContract;
TestCall tCallContract;
function setUp() public {
tCallContract = new TestCall();
callContract = new Call();
}
function testCall() public {
vm.expectCall(
address(tCallContract),
abi.encodeWithSignature("foo(string, uint256)", "call foo", 123)
);
callContract.callFoo(address(tCallContract));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment