From 2d2a24fc311b4853f9a952b0eb1ed2a8d18eae29 Mon Sep 17 00:00:00 2001 From: Dristpunk Date: Tue, 28 Nov 2023 18:02:36 +0300 Subject: [PATCH] fix: add vm.etch to mock contract --- solidity/test/unit/Greeter.t.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/solidity/test/unit/Greeter.t.sol b/solidity/test/unit/Greeter.t.sol index 9182b8b3..9a5a6bc6 100644 --- a/solidity/test/unit/Greeter.t.sol +++ b/solidity/test/unit/Greeter.t.sol @@ -7,12 +7,14 @@ import {Greeter, IGreeter} from 'contracts/Greeter.sol'; abstract contract Base is Test { address internal _owner = makeAddr('owner'); + IERC20 internal _token = IERC20(makeAddr('token')); string internal _initialGreeting = 'hola'; bytes32 internal _emptyString = keccak256(bytes('')); Greeter internal _greeter; function setUp() public virtual { + vm.etch(address(_token), new bytes(0x1)); // etch bytecode to avoid address collision problems vm.prank(_owner); _greeter = new Greeter(_initialGreeting, _token); }