-
Notifications
You must be signed in to change notification settings - Fork 17
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
230951b
commit faa36ed
Showing
8 changed files
with
5,096 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,3 +76,4 @@ zkout | |
example/contracts/artifacts | ||
example/contracts/cache | ||
example/contracts/node_modules | ||
example/scripts/dist |
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,8 @@ | ||
# NEED 0x prefix | ||
PRIVATE_KEY= | ||
|
||
CHAIN_ID=84532 | ||
RPC_URL="https://sepolia.base.org" | ||
SIGNER=0x69bec2dd161d6bbcc91ec32aa44d9333ebc864c0 # Signer for the dkim oracle on IC (Don't change this) | ||
ETHERSCAN_API_KEY= | ||
# CHAIN_NAME="base_sepolia" |
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,102 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
|
||
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; | ||
import "@zk-email/ether-email-auth-contracts/src/utils/Verifier.sol"; | ||
import "@zk-email/ether-email-auth-contracts/src/utils/Groth16Verifier.sol"; | ||
import "@zk-email/ether-email-auth-contracts/src/utils/ECDSAOwnedDKIMRegistry.sol"; | ||
import "@zk-email/ether-email-auth-contracts/src/EmailAuth.sol"; | ||
import "../src/EmitEmailCommand.sol"; | ||
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
contract Deploy is Script { | ||
using ECDSA for *; | ||
|
||
ECDSAOwnedDKIMRegistry dkimImpl; | ||
ECDSAOwnedDKIMRegistry dkim; | ||
Verifier verifierImpl; | ||
Verifier verifier; | ||
EmailAuth emailAuthImpl; | ||
EmitEmailCommand emitEmailCommand; | ||
|
||
function run() external { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
if (deployerPrivateKey == 0) { | ||
console.log("PRIVATE_KEY env var not set"); | ||
return; | ||
} | ||
address signer = vm.envAddress("SIGNER"); | ||
if (signer == address(0)) { | ||
console.log("SIGNER env var not set"); | ||
return; | ||
} | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
address initialOwner = vm.addr(deployerPrivateKey); | ||
console.log("Initial owner: %s", vm.toString(initialOwner)); | ||
// Deploy ECDSA DKIM registry | ||
{ | ||
dkimImpl = new ECDSAOwnedDKIMRegistry(); | ||
console.log( | ||
"ECDSAOwnedDKIMRegistry implementation deployed at: %s", | ||
address(dkimImpl) | ||
); | ||
ERC1967Proxy dkimProxy = new ERC1967Proxy( | ||
address(dkimImpl), | ||
abi.encodeCall(dkimImpl.initialize, (initialOwner, signer)) | ||
); | ||
dkim = ECDSAOwnedDKIMRegistry(address(dkimProxy)); | ||
console.log( | ||
"ECDSAOwnedDKIMRegistry deployed at: %s", | ||
address(dkim) | ||
); | ||
vm.setEnv("ECDSA_DKIM", vm.toString(address(dkim))); | ||
} | ||
|
||
// Deploy Verifier | ||
{ | ||
verifierImpl = new Verifier(); | ||
console.log( | ||
"Verifier implementation deployed at: %s", | ||
address(verifierImpl) | ||
); | ||
Groth16Verifier groth16Verifier = new Groth16Verifier(); | ||
ERC1967Proxy verifierProxy = new ERC1967Proxy( | ||
address(verifierImpl), | ||
abi.encodeCall( | ||
verifierImpl.initialize, | ||
(initialOwner, address(groth16Verifier)) | ||
) | ||
); | ||
verifier = Verifier(address(verifierProxy)); | ||
console.log("Verifier deployed at: %s", address(verifier)); | ||
vm.setEnv("VERIFIER", vm.toString(address(verifier))); | ||
} | ||
|
||
// Deploy EmailAuth Implementation | ||
{ | ||
emailAuthImpl = new EmailAuth(); | ||
console.log( | ||
"EmailAuth implementation deployed at: %s", | ||
address(emailAuthImpl) | ||
); | ||
vm.setEnv("EMAIL_AUTH_IMPL", vm.toString(address(emailAuthImpl))); | ||
} | ||
|
||
// Deploy EmitEmailCommand | ||
{ | ||
emitEmailCommand = new EmitEmailCommand( | ||
address(verifier), | ||
address(dkim), | ||
address(emailAuthImpl) | ||
); | ||
console.log( | ||
"EmitEmailCommand deployed at: %s", | ||
address(emitEmailCommand) | ||
); | ||
} | ||
vm.stopBroadcast(); | ||
} | ||
} |
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
Empty file.
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,32 @@ | ||
{ | ||
"include": [ | ||
"src/**/*" | ||
], | ||
"compilerOptions": { | ||
"target": "es2020", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"baseUrl": "./src", | ||
"outDir": "dist", | ||
"lib": [ | ||
"dom", | ||
"dom.iterable", | ||
"esnext" | ||
], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "react-jsx", | ||
"typeRoots": [ | ||
"./node_modules/@types" | ||
], | ||
"incremental": true | ||
} | ||
} |
Oops, something went wrong.