-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7932920
commit 18b94f3
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import { AppStorage, LibAppStorage } from "../shared/AppStorage.sol"; | ||
|
||
contract InitPermit { | ||
function init() external { | ||
uint256 initId = 2; // Using ID 2 since InitializationTest1 used ID 1 | ||
|
||
AppStorage storage s = LibAppStorage.diamondStorage(); | ||
require(!s.initComplete[initId], "Initialization already complete"); | ||
|
||
// Initialize the domain separator and chain id | ||
s.initialChainId = block.chainid; | ||
s.initialDomainSeparator = _computeDomainSeparator(); | ||
|
||
s.initComplete[initId] = true; | ||
} | ||
|
||
function _computeDomainSeparator() internal view returns (bytes32) { | ||
return keccak256( | ||
abi.encode( | ||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), | ||
keccak256(bytes("Naym")), // name | ||
keccak256(bytes("1")), // version | ||
block.chainid, | ||
address(this) | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters