Skip to content

Commit

Permalink
Merge pull request #591 from zama-ai/fhevm-core-contracts
Browse files Browse the repository at this point in the history
feat: fixes etherscan verification
  • Loading branch information
jatZama authored Oct 25, 2024
2 parents b9a0860 + c121bbc commit 0aa5c69
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
10 changes: 8 additions & 2 deletions launch-fhevm-sepolia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ npx hardhat clean
PRIVATE_KEY_FHEVM_DEPLOYER=$(grep PRIVATE_KEY_FHEVM_DEPLOYER .env | cut -d '"' -f 2)
NUM_KMS_SIGNERS=$(grep NUM_KMS_SIGNERS .env | cut -d '"' -f 2)

rm -rf fhevmTemp/
mkdir -p fhevmTemp
cp -L -r node_modules/fhevm-core-contracts fhevmTemp/
cp -L -r node_modules/fhevm-core-contracts/ fhevmTemp/
npx hardhat compile:specific --contract fhevmTemp
npx hardhat compile:specific --contract lib
npx hardhat compile:specific --contract gateway
Expand All @@ -23,4 +24,9 @@ npx hardhat task:launchFhevm --skip-get-coin true --use-address true --network s

echo "Waiting 2 minutes before contract verification... Please wait..."
sleep 120 # makes sure that contracts bytescode propagates on Etherscan, otherwise contracts verification might fail in next step
npx hardhat task:verifyContracts --network sepolia
npx hardhat task:verifyACL --network sepolia
npx hardhat task:verifyTFHEExecutor --network sepolia
npx hardhat task:verifyKMSVerifier --network sepolia
npx hardhat task:verifyInputVerifier --network sepolia
npx hardhat task:verifyFHEPayment --network sepolia
npx hardhat task:verifyGatewayContract --network sepolia
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fhevm",
"description": "A Solidity library for interacting with the Zama Blockchain",
"version": "0.5.8",
"version": "0.6.0-0",
"engines": {
"node": ">=20.0.0"
},
Expand Down
12 changes: 11 additions & 1 deletion tasks/etherscanVerify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import dotenv from 'dotenv';
import fs from 'fs';
import { task } from 'hardhat/config';

task('task:verifyContracts').setAction(async function (taskArguments, { upgrades, run }) {
task('task:verifyACL').setAction(async function (taskArguments, { upgrades, run }) {
const parsedEnvACL = dotenv.parse(fs.readFileSync('node_modules/fhevm-core-contracts/addresses/.env.acl'));
const proxyACLAddress = parsedEnvACL.ACL_CONTRACT_ADDRESS;
const implementationACLAddress = await upgrades.erc1967.getImplementationAddress(proxyACLAddress);
Expand All @@ -14,7 +14,9 @@ task('task:verifyContracts').setAction(async function (taskArguments, { upgrades
address: proxyACLAddress,
constructorArguments: [],
});
});

task('task:verifyTFHEExecutor').setAction(async function (taskArguments, { upgrades, run }) {
const parsedEnvTFHEExecutor = dotenv.parse(fs.readFileSync('node_modules/fhevm-core-contracts/addresses/.env.exec'));
const proxyTFHEExecutorAddress = parsedEnvTFHEExecutor.TFHE_EXECUTOR_CONTRACT_ADDRESS;
const implementationTFHEExecutorAddress = await upgrades.erc1967.getImplementationAddress(proxyTFHEExecutorAddress);
Expand All @@ -26,7 +28,9 @@ task('task:verifyContracts').setAction(async function (taskArguments, { upgrades
address: proxyTFHEExecutorAddress,
constructorArguments: [],
});
});

task('task:verifyKMSVerifier').setAction(async function (taskArguments, { upgrades, run }) {
const parsedEnvKMSVerifier = dotenv.parse(
fs.readFileSync('node_modules/fhevm-core-contracts/addresses/.env.kmsverifier'),
);
Expand All @@ -40,7 +44,9 @@ task('task:verifyContracts').setAction(async function (taskArguments, { upgrades
address: proxyKMSVerifier,
constructorArguments: [],
});
});

task('task:verifyInputVerifier').setAction(async function (taskArguments, { upgrades, run }) {
const parsedEnvInputVerifier = dotenv.parse(
fs.readFileSync('node_modules/fhevm-core-contracts/addresses/.env.inputverifier'),
);
Expand All @@ -54,7 +60,9 @@ task('task:verifyContracts').setAction(async function (taskArguments, { upgrades
address: proxyInputVerifier,
constructorArguments: [],
});
});

task('task:verifyFHEPayment').setAction(async function (taskArguments, { upgrades, run }) {
const parsedEnvFHEPayment = dotenv.parse(
fs.readFileSync('node_modules/fhevm-core-contracts/addresses/.env.fhepayment'),
);
Expand All @@ -68,7 +76,9 @@ task('task:verifyContracts').setAction(async function (taskArguments, { upgrades
address: proxyFHEPayment,
constructorArguments: [],
});
});

task('task:verifyGatewayContract').setAction(async function (taskArguments, { upgrades, run }) {
const parsedEnvGateway = dotenv.parse(fs.readFileSync('gateway/.env.gateway'));
const proxyGateway = parsedEnvGateway.GATEWAY_CONTRACT_PREDEPLOY_ADDRESS;
const implementationGatewayAddress = await upgrades.erc1967.getImplementationAddress(proxyGateway);
Expand Down

0 comments on commit 0aa5c69

Please sign in to comment.