diff --git a/hardhat.config.ts b/hardhat.config.ts index 422cdbe7..632deaa8 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -56,6 +56,7 @@ const forkUrl = { goerliStaging: NETWORKS_RPC_URL[EthereumNetwork.goerli], mumbaiStaging: NETWORKS_RPC_URL[PolygonNetwork.mumbai], gnosis: NETWORKS_RPC_URL[GnosisNetwork.gnosis], + customNetwork: process.env.RPC_URL, }; const forking = FORK @@ -126,6 +127,17 @@ const config: HardhatUserConfig = { mumbaiStaging: getCommonNetworkConfig(PolygonNetwork.mumbai, 80001), goerliTestnet: getCommonNetworkConfig(EthereumNetwork.goerli, 5), mumbaiTestnet: getCommonNetworkConfig(PolygonNetwork.mumbai, 80001), + customNetwork: { + url: process.env.RPC_URL ?? '', + hardfork: HARDFORK, + chainId: parseInt(process.env.CHAIN_ID ?? '31337'), + accounts: { + mnemonic: MNEMONIC, + path: MNEMONIC_PATH, + initialIndex: 0, + count: 20, + }, + }, gnosis: getCommonNetworkConfig(GnosisNetwork.gnosis, 100), local: { url: `http://${LOCAL_HOSTNAME}:${LOCAL_PORT}`, diff --git a/tasks/deploy-tasks/full/6-deploy-sismo-addresses-provider.task.ts b/tasks/deploy-tasks/full/6-deploy-sismo-addresses-provider.task.ts index 9aa97228..c1f096c9 100644 --- a/tasks/deploy-tasks/full/6-deploy-sismo-addresses-provider.task.ts +++ b/tasks/deploy-tasks/full/6-deploy-sismo-addresses-provider.task.ts @@ -1,7 +1,7 @@ import { task } from 'hardhat/config'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { DeployOptions } from '../utils'; -import { deploymentsConfig } from '../deployments-config'; +import { SISMO_ADDRESSES_PROVIDER_CONTRACT_ADDRESS } from '../deployments-config'; import { DeployedSismoAddressesProvider } from 'tasks/deploy-tasks/unit/core/deploy-sismo-addresses-provider.task'; import { AddressesProvider } from 'types'; @@ -9,11 +9,26 @@ export interface Deployed6 { sismoAddressesProvider: AddressesProvider; } +export const addressesProviderConfiguration = { + deployOptions: { + manualConfirm: process.env.MANUAL_CONFIRM === 'true', + log: true, + behindProxy: true, + proxyAdmin: process.env.PROXY_ADMIN, + }, + sismoAddressesProvider: { + address: SISMO_ADDRESSES_PROVIDER_CONTRACT_ADDRESS, + owner: process.env.SISMO_ADDRESSES_PROVIDER_OWNER, + }, +}; + async function deploymentAction( { options }: { options: DeployOptions }, hre: HardhatRuntimeEnvironment ): Promise { - const config = deploymentsConfig[process.env.FORK_NETWORK ?? hre.network.name]; + // ZK Badges are deprecated, we only use SismoAddressesProvider for Sismo Connect + const config = addressesProviderConfiguration; + options = { ...config.deployOptions, ...options }; if (options.manualConfirm || options.log) { @@ -23,13 +38,13 @@ async function deploymentAction( // Deploy SismoAddressesProvider const { sismoAddressesProvider } = (await hre.run('deploy-sismo-addresses-provider', { owner: config.sismoAddressesProvider.owner, - badges: config.badges.address, - attestationsRegistry: config.attestationsRegistry.address, - front: config.front.address, - hydraS1AccountboundAttester: config.hydraS1AccountboundAttester.address, - commitmentMapperRegistry: config.commitmentMapper.address, - availableRootsRegistry: config.availableRootsRegistry.address, - hydraS1Verifier: config.hydraS1Verifier.address, + badges: '0x0000000000000000000000000000000000000000', + attestationsRegistry: '0x0000000000000000000000000000000000000000', + front: '0x0000000000000000000000000000000000000000', + hydraS1AccountboundAttester: '0x0000000000000000000000000000000000000000', + commitmentMapperRegistry: '0x0000000000000000000000000000000000000000', + availableRootsRegistry: '0x0000000000000000000000000000000000000000', + hydraS1Verifier: '0x0000000000000000000000000000000000000000', options: { ...options, proxyAdmin: config.deployOptions.proxyAdmin }, })) as DeployedSismoAddressesProvider; diff --git a/tasks/deploy-tasks/unit/core/deploy-sismo-addresses-provider.task.ts b/tasks/deploy-tasks/unit/core/deploy-sismo-addresses-provider.task.ts index 96f38579..9a16ec56 100644 --- a/tasks/deploy-tasks/unit/core/deploy-sismo-addresses-provider.task.ts +++ b/tasks/deploy-tasks/unit/core/deploy-sismo-addresses-provider.task.ts @@ -9,6 +9,7 @@ import { customDeployContract, wrapCommonDeployOptions, DeployOptions, + wrapAddressesProviderDeployOptions, } from '../../utils'; import { @@ -17,8 +18,8 @@ import { TransparentUpgradeableProxy__factory, } from '../../../../types'; import { utils } from 'ethers'; -import { deploymentsConfig } from '../../../../tasks/deploy-tasks/deployments-config'; import { confirm } from '../../../../tasks/utils'; +import { addressesProviderConfiguration } from '../../../../tasks/deploy-tasks/full/6-deploy-sismo-addresses-provider.task'; export interface DeploySismoAddressesProvider { owner: string; @@ -52,7 +53,7 @@ async function deploymentAction( }: DeploySismoAddressesProvider, hre: HardhatRuntimeEnvironment ): Promise { - const config = deploymentsConfig[hre.network.name]; + const config = addressesProviderConfiguration; const deployer = await getDeployer(hre); const deploymentName = buildDeploymentName(CONTRACT_NAME, options?.deploymentNamePrefix); @@ -253,9 +254,7 @@ async function deploymentAction( if (options?.log) { console.log( - `Transfer AddressesProvider ownership (${ - deployer.address - }) from the deployer to the expected one (${options?.proxyAdmin!})` + `Transfer AddressesProvider ownership (${deployer.address}) from the deployer to the expected one (${owner})` ); if (options?.manualConfirm) { await confirm(); @@ -276,4 +275,4 @@ task('deploy-sismo-addresses-provider') .addParam('availableRootsRegistry', 'Address of the availableRootsRegistry contract') .addParam('commitmentMapperRegistry', 'Address of the commitmentMapperRegistry contract') .addParam('hydraS1Verifier', 'Address of the hydraS1Verifier contract') - .setAction(wrapCommonDeployOptions(deploymentAction)); + .setAction(wrapAddressesProviderDeployOptions(deploymentAction, addressesProviderConfiguration)); diff --git a/tasks/deploy-tasks/utils/deployment.ts b/tasks/deploy-tasks/utils/deployment.ts index 2d2db2f9..c2ab1854 100644 --- a/tasks/deploy-tasks/utils/deployment.ts +++ b/tasks/deploy-tasks/utils/deployment.ts @@ -187,5 +187,21 @@ export const wrapCommonDeployOptions = (action: Function) => { }; }; +export const wrapAddressesProviderDeployOptions = (action: Function, configuration: any) => { + return (args: any, hre: HardhatRuntimeEnvironment) => { + const config = configuration; + return action( + { + ...args, + options: { + ...config.deployOptions, + ...args.options, + }, + }, + hre + ); + }; +}; + export const buildDeploymentName = (contractName: string, prefix?: string) => prefix ? `${prefix}_${contractName}` : contractName; diff --git a/test/unit/core/utils/sismo-addresses-provider.test.ts b/test/unit/core/utils/sismo-addresses-provider.test.ts index f74ea6ce..084dc076 100644 --- a/test/unit/core/utils/sismo-addresses-provider.test.ts +++ b/test/unit/core/utils/sismo-addresses-provider.test.ts @@ -71,6 +71,7 @@ describe('Test Sismo Addresses Provider', () => { hydraS1Verifier: hydraS1Verifier.address, options: { deploymentNamePrefix: 'firstDeployment', + proxyAdmin: deploymentsConfig[hre.network.name].deployOptions?.proxyAdmin, }, })); expect(sismoAddressesProvider.address).to.be.eql(addressesProviderContractAddress); diff --git a/test/unit/zkdrop/zk-badgebound-erc721.test.ts b/test/unit/zkdrop/zk-badgebound-erc721.test.ts index 895a65d0..1fdcf1fd 100644 --- a/test/unit/zkdrop/zk-badgebound-erc721.test.ts +++ b/test/unit/zkdrop/zk-badgebound-erc721.test.ts @@ -108,6 +108,7 @@ describe('Test ZK Badgebound ERC721 Contract', async () => { ({ attestationsRegistry, hydraS1AccountboundAttester, badges, availableRootsRegistry } = await deployCoreContracts(deployer, { deploymentNamePrefix: 'zk-badgebound-erc721', + proxyAdmin: deploymentsConfig[hre.network.name].deployOptions.proxyAdmin, })); badgeId = (await hydraS1AccountboundAttester.AUTHORIZED_COLLECTION_ID_FIRST()).add( diff --git a/utils/singletonFactory.ts b/utils/singletonFactory.ts index b0dc7b85..afbbc2f1 100644 --- a/utils/singletonFactory.ts +++ b/utils/singletonFactory.ts @@ -44,4 +44,13 @@ export const singletonFactory = { '0xf8a88085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf383027126a0b23aa3a7cf3654c8f2dc3ce3c6d37ff504a726085f835a9f4d32d61e865e261ea017add99e70915725b41244e4feefc854f5c17da90f4e1ac6fb994040ae5af242', address: '0xC4c11B14e9D876B031c1c7e05efE44088341f35B', }, + // scroll goerli + 534353: { + gasPrice: 100000000000, + gasLimit: 100000, + signerAddress: '0xBa68986f673c9193BB79eA0d21990225d464bb5C', + transaction: + '0xf8a88085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf383104ec5a0ae1bbd559b87c3e9b9116af0178587620b6cdb0b69112c15fbcf92515c6a111da0272fc08470cc1a9ebe1e06e55d733dbf7c93f0bc0d78616b0582366e6b73277e', + address: '0xC4c11B14e9D876B031c1c7e05efE44088341f35B', + }, };