diff --git a/test/ProposalUtils.sol b/test/ProposalUtils.sol index 9e4f7a0..993d4cd 100644 --- a/test/ProposalUtils.sol +++ b/test/ProposalUtils.sol @@ -4,6 +4,8 @@ pragma experimental ABIEncoderV2; import { Test } from "@forge-std/Test.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { ERC20Permit } from "torn-token/contracts/ERC20Permit.sol"; +import { console2 } from "@forge-std/console2.sol"; import { Mock } from "./Mock.sol"; import { Proposal, IGovernance } from "@interfaces/IGovernance.sol"; @@ -53,12 +55,15 @@ contract ProposalUtils is Mock, Parameters, Test { function retrieveAndLockBalance(uint256 privateKey, address voter, uint256 amount) internal { uint256 lockTimestamp = block.timestamp + PROPOSAL_DURATION; + uint256 accountNonce = ERC20Permit(_tokenAddress).nonces(voter); + + console2.log("Account nonce: %s", accountNonce); bytes32 messageHash = keccak256( abi.encodePacked( PERMIT_FUNC_SELECTOR, EIP712_DOMAIN, - keccak256(abi.encode(PERMIT_TYPEHASH, voter, _governanceAddress, amount, 0, lockTimestamp)) + keccak256(abi.encode(PERMIT_TYPEHASH, voter, _governanceAddress, amount, accountNonce, lockTimestamp)) ) );