Skip to content

Commit

Permalink
🍭 Fix DOMAIN_SEPARATOR with tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
KimlikDAO-bot committed Mar 29, 2024
1 parent e9a1010 commit f09182e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/KDAO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ contract KDAO is IERC20Permit, IERC20Snapshot3, IDistroStage {
// )
// );
bytes32 public constant override DOMAIN_SEPARATOR =
0xd3b6088e7d58a5742b419d3f22999e21c76cce42f96b85b3fdc54662eb2d445c;
0x0742280c2111a9ede9d221d5e615e8f338de5cb757c1ea643d37a78c1517327e;

// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
Expand Down
19 changes: 19 additions & 0 deletions test/KDAOTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ contract KDAOTest is Test {
vm.stopPrank();
}

function testTypeHashes() external view {
assertEq(
kdao.PERMIT_TYPEHASH(),
keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")
);
assertEq(
kdao.DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes("KDAO")),
keccak256(bytes("1")),
0x144,
KDAO_ADDR
)
)
);
}

function testDAOAuthentication() public {
vm.expectRevert();
kdao.mintTo((uint256(1) << 160) | uint160(vm.addr(1)));
Expand Down

0 comments on commit f09182e

Please sign in to comment.