From 756c110ddc3c96c596a52bce43553477a19ee3aa Mon Sep 17 00:00:00 2001 From: Lucas Manuel Date: Thu, 3 Mar 2022 19:41:57 -0600 Subject: [PATCH] feat: Update ERC20Permit test for inheritance (#18) * feat: update ERC20Permit test for inheritance * feat: add comment --- contracts/test/ERC20Permit.t.sol | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/contracts/test/ERC20Permit.t.sol b/contracts/test/ERC20Permit.t.sol index 7641dca..6c638bb 100644 --- a/contracts/test/ERC20Permit.t.sol +++ b/contracts/test/ERC20Permit.t.sol @@ -9,7 +9,7 @@ import { ERC20PermitUser } from "./accounts/ERC20User.sol"; import { MockERC20Permit } from "./mocks/MockERC20.sol"; -import { Vm } from "./utils/Vm.sol"; +import { Vm } from "./utils/Vm.sol"; import { InvariantTest } from "./utils/InvariantTest.sol"; import { ERC20Test, MockERC20 } from "./ERC20.t.sol"; @@ -41,9 +41,7 @@ contract ERC20PermitTest is DSTest { uint256 constant WAD = 10 ** 18; - function setUp() external { - vm = Vm(address(bytes20(uint160(uint256(keccak256("hevm cheat code")))))); - + function setUp() public virtual { owner = vm.addr(skOwner); spender = vm.addr(skSpender); @@ -56,7 +54,8 @@ contract ERC20PermitTest is DSTest { assertEq(token.PERMIT_TYPEHASH(), keccak256("Permit(address owner,address spender,uint256 amount,uint256 nonce,uint256 deadline)")); } - function test_domainSeparator() external { + // NOTE: Virtual so inheriting tests can override with different DOMAIN_SEPARATORs because of different addresses + function test_domainSeparator() external virtual { assertEq(token.DOMAIN_SEPARATOR(), 0x06c0ee43424d25534e5af6b6af862333b542f6583ff9948b8299442926099eec); }