From c76d132707a2769416627006add1fb69a3800285 Mon Sep 17 00:00:00 2001 From: bigq Date: Thu, 1 Jun 2023 16:06:28 +0200 Subject: [PATCH 1/5] feat: add scroll goerli testnet config --- hardhat.config.ts | 3 + helper-hardhat-config.ts | 14 +++- tasks/deploy-tasks/deployments-config.ts | 69 +++++++++++++++++++ .../deploy-sismo-addresses-provider.task.ts | 4 +- 4 files changed, 85 insertions(+), 5 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 422cdbe..8582e90 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -5,6 +5,7 @@ import { PolygonNetwork, GnosisNetwork, NETWORKS_RPC_URL, + ScrollNetwork, } from './helper-hardhat-config'; import '@nomiclabs/hardhat-etherscan'; import '@nomiclabs/hardhat-waffle'; @@ -56,6 +57,7 @@ const forkUrl = { goerliStaging: NETWORKS_RPC_URL[EthereumNetwork.goerli], mumbaiStaging: NETWORKS_RPC_URL[PolygonNetwork.mumbai], gnosis: NETWORKS_RPC_URL[GnosisNetwork.gnosis], + scrollGoerliTestnet: NETWORKS_RPC_URL[ScrollNetwork.goerli], }; const forking = FORK @@ -126,6 +128,7 @@ const config: HardhatUserConfig = { mumbaiStaging: getCommonNetworkConfig(PolygonNetwork.mumbai, 80001), goerliTestnet: getCommonNetworkConfig(EthereumNetwork.goerli, 5), mumbaiTestnet: getCommonNetworkConfig(PolygonNetwork.mumbai, 80001), + scrollGoerliTestnet: getCommonNetworkConfig(ScrollNetwork.goerli, 534353), gnosis: getCommonNetworkConfig(GnosisNetwork.gnosis, 100), local: { url: `http://${LOCAL_HOSTNAME}:${LOCAL_PORT}`, diff --git a/helper-hardhat-config.ts b/helper-hardhat-config.ts index 97373bc..ae5b4c8 100644 --- a/helper-hardhat-config.ts +++ b/helper-hardhat-config.ts @@ -1,7 +1,7 @@ import dotenv from 'dotenv'; dotenv.config({}); -export type Network = EthereumNetwork | PolygonNetwork | GnosisNetwork; +export type Network = EthereumNetwork | PolygonNetwork | GnosisNetwork | ScrollNetwork; export enum EthereumNetwork { kovan = 'kovan', @@ -22,10 +22,15 @@ export enum GnosisNetwork { gnosis = 'gnosis', } +export enum ScrollNetwork { + goerli = 'scroll-testnet-goerli', +} + export type ParamsPerNetwork = | EthereumParamsPerNetwork | PolygonParamsPerNetwork - | XDaiParamsPerNetwork; + | XDaiParamsPerNetwork + | ScrollParamsPerNetwork; export interface EthereumParamsPerNetwork { [EthereumNetwork.harhatevm]: Network; @@ -45,6 +50,10 @@ export interface XDaiParamsPerNetwork { [GnosisNetwork.gnosis]: T; } +export interface ScrollParamsPerNetwork { + [ScrollNetwork.goerli]: T; +} + export interface ObjectString { [key: string]: string; } @@ -76,4 +85,5 @@ export const NETWORKS_RPC_URL: ParamsPerNetwork = { process.env.POLYGON_RPC_URL ), [GnosisNetwork.gnosis]: 'https://rpc.gnosischain.com', + [ScrollNetwork.goerli]: 'https://alpha-rpc.scroll.io/l2', }; diff --git a/tasks/deploy-tasks/deployments-config.ts b/tasks/deploy-tasks/deployments-config.ts index 68121d8..00fc6e7 100644 --- a/tasks/deploy-tasks/deployments-config.ts +++ b/tasks/deploy-tasks/deployments-config.ts @@ -59,6 +59,10 @@ const ALPHA_GOERLI_TESTNET_PROXY_ADMIN = '0x2110475dfbB8d331b300178A867372991ff3 const ALPHA_MUMBAI_TESTNET_OWNER = '0xaee4acd5c4Bf516330ca8fe11B07206fC6709294'; const ALPHA_MUMBAI_TESTNET_ROOTS_OWNER_RELAYER = '0xca0583a6682607282963d3e2545cd2e75697c2bb'; const ALPHA_MUMBAI_TESTNET_PROXY_ADMIN = '0x2110475dfbB8d331b300178A867372991ff35fA3'; +// Scroll Goerli Testnet +const ALPHA_SCROLL_GOERLI_TESTNET_OWNER = '0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B'; +const ALPHA_SCROLL_GOERLI_TESTNET_ROOTS_OWNER = '0x8f9c04d7bA132Fd0CbA124eFCE3936328d217458'; // Sismo Signer from Hub +const ALPHA_SCROLL_GOERLI_TESTNET_PROXY_ADMIN = '0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc'; // Goerli Staging const ALPHA_GOERLI_STAGING_OWNER = '0x4e070E9b85a659F0B7B47cde33152ad6c2F63954'; @@ -463,6 +467,71 @@ export const deploymentsConfig: DeploymentsConfigTypes = { owner: ALPHA_MUMBAI_TESTNET_OWNER, }, }, + scrollGoerliTestnet: { + deployOptions: { + manualConfirm: true, + log: true, + behindProxy: true, + proxyAdmin: ALPHA_SCROLL_GOERLI_TESTNET_PROXY_ADMIN, + }, + badges: { + address: '0x0000000000000000000000000000000000000000', + owner: '', + // Badges Metadata URI for the Badges contract + uri: '', + }, + front: { + address: '0x0000000000000000000000000000000000000000', + collectionIdFirst: '', + collectionIdLast: '', + }, + hydraS1Verifier: { + address: '0x0000000000000000000000000000000000000000', + }, + hydraS1SimpleAttester: { + enableDeployment: false, + address: '0x0000000000000000000000000000000000000000', + collectionIdFirst: '', + collectionIdLast: '', + initialRoot: '0', + }, + hydraS1AccountboundAttester: { + address: '0x0000000000000000000000000000000000000000', + collectionIdFirst: '', + collectionIdLast: '', + initialRoot: '', + owner: '', + }, + pythia1Verifier: { + address: '0x0000000000000000000000000000000000000000', + }, + synapsPythia1SimpleAttester: { + address: '0x0000000000000000000000000000000000000000', + collectionIdFirst: '', + collectionIdLast: '', + commitmentSignerPubKeyX: '', + commitmentSignerPubKeyY: '', + owner: '', + }, + attestationsRegistry: { + address: '0x0000000000000000000000000000000000000000', + owner: '', + }, + availableRootsRegistry: { + address: '0x0000000000000000000000000000000000000000', + owner: '', + }, + commitmentMapper: { + address: '0x0000000000000000000000000000000000000000', + owner: '', + EdDSAPubKeyX: '', + EdDSAPubKeyY: '', + }, + sismoAddressesProvider: { + address: '', + owner: ALPHA_SCROLL_GOERLI_TESTNET_OWNER, + }, + }, ///////////////////////////////////////////////////////////////////////// // STAGING // 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 96f3857..337abf0 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 @@ -253,9 +253,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(); From cb5f58604e9bd5d8bd08c9f1ca311c8245247c89 Mon Sep 17 00:00:00 2001 From: bigq Date: Thu, 1 Jun 2023 18:47:06 +0200 Subject: [PATCH 2/5] feat: allow to deploy AddressesProvider contract on any chain --- hardhat.config.ts | 15 +++- helper-hardhat-config.ts | 14 +--- tasks/deploy-tasks/deployments-config.ts | 69 ------------------- .../6-deploy-sismo-addresses-provider.task.ts | 29 +++++--- .../deploy-sismo-addresses-provider.task.ts | 4 +- 5 files changed, 37 insertions(+), 94 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 8582e90..632deaa 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -5,7 +5,6 @@ import { PolygonNetwork, GnosisNetwork, NETWORKS_RPC_URL, - ScrollNetwork, } from './helper-hardhat-config'; import '@nomiclabs/hardhat-etherscan'; import '@nomiclabs/hardhat-waffle'; @@ -57,7 +56,7 @@ const forkUrl = { goerliStaging: NETWORKS_RPC_URL[EthereumNetwork.goerli], mumbaiStaging: NETWORKS_RPC_URL[PolygonNetwork.mumbai], gnosis: NETWORKS_RPC_URL[GnosisNetwork.gnosis], - scrollGoerliTestnet: NETWORKS_RPC_URL[ScrollNetwork.goerli], + customNetwork: process.env.RPC_URL, }; const forking = FORK @@ -128,7 +127,17 @@ const config: HardhatUserConfig = { mumbaiStaging: getCommonNetworkConfig(PolygonNetwork.mumbai, 80001), goerliTestnet: getCommonNetworkConfig(EthereumNetwork.goerli, 5), mumbaiTestnet: getCommonNetworkConfig(PolygonNetwork.mumbai, 80001), - scrollGoerliTestnet: getCommonNetworkConfig(ScrollNetwork.goerli, 534353), + 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/helper-hardhat-config.ts b/helper-hardhat-config.ts index ae5b4c8..97373bc 100644 --- a/helper-hardhat-config.ts +++ b/helper-hardhat-config.ts @@ -1,7 +1,7 @@ import dotenv from 'dotenv'; dotenv.config({}); -export type Network = EthereumNetwork | PolygonNetwork | GnosisNetwork | ScrollNetwork; +export type Network = EthereumNetwork | PolygonNetwork | GnosisNetwork; export enum EthereumNetwork { kovan = 'kovan', @@ -22,15 +22,10 @@ export enum GnosisNetwork { gnosis = 'gnosis', } -export enum ScrollNetwork { - goerli = 'scroll-testnet-goerli', -} - export type ParamsPerNetwork = | EthereumParamsPerNetwork | PolygonParamsPerNetwork - | XDaiParamsPerNetwork - | ScrollParamsPerNetwork; + | XDaiParamsPerNetwork; export interface EthereumParamsPerNetwork { [EthereumNetwork.harhatevm]: Network; @@ -50,10 +45,6 @@ export interface XDaiParamsPerNetwork { [GnosisNetwork.gnosis]: T; } -export interface ScrollParamsPerNetwork { - [ScrollNetwork.goerli]: T; -} - export interface ObjectString { [key: string]: string; } @@ -85,5 +76,4 @@ export const NETWORKS_RPC_URL: ParamsPerNetwork = { process.env.POLYGON_RPC_URL ), [GnosisNetwork.gnosis]: 'https://rpc.gnosischain.com', - [ScrollNetwork.goerli]: 'https://alpha-rpc.scroll.io/l2', }; diff --git a/tasks/deploy-tasks/deployments-config.ts b/tasks/deploy-tasks/deployments-config.ts index 00fc6e7..68121d8 100644 --- a/tasks/deploy-tasks/deployments-config.ts +++ b/tasks/deploy-tasks/deployments-config.ts @@ -59,10 +59,6 @@ const ALPHA_GOERLI_TESTNET_PROXY_ADMIN = '0x2110475dfbB8d331b300178A867372991ff3 const ALPHA_MUMBAI_TESTNET_OWNER = '0xaee4acd5c4Bf516330ca8fe11B07206fC6709294'; const ALPHA_MUMBAI_TESTNET_ROOTS_OWNER_RELAYER = '0xca0583a6682607282963d3e2545cd2e75697c2bb'; const ALPHA_MUMBAI_TESTNET_PROXY_ADMIN = '0x2110475dfbB8d331b300178A867372991ff35fA3'; -// Scroll Goerli Testnet -const ALPHA_SCROLL_GOERLI_TESTNET_OWNER = '0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B'; -const ALPHA_SCROLL_GOERLI_TESTNET_ROOTS_OWNER = '0x8f9c04d7bA132Fd0CbA124eFCE3936328d217458'; // Sismo Signer from Hub -const ALPHA_SCROLL_GOERLI_TESTNET_PROXY_ADMIN = '0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc'; // Goerli Staging const ALPHA_GOERLI_STAGING_OWNER = '0x4e070E9b85a659F0B7B47cde33152ad6c2F63954'; @@ -467,71 +463,6 @@ export const deploymentsConfig: DeploymentsConfigTypes = { owner: ALPHA_MUMBAI_TESTNET_OWNER, }, }, - scrollGoerliTestnet: { - deployOptions: { - manualConfirm: true, - log: true, - behindProxy: true, - proxyAdmin: ALPHA_SCROLL_GOERLI_TESTNET_PROXY_ADMIN, - }, - badges: { - address: '0x0000000000000000000000000000000000000000', - owner: '', - // Badges Metadata URI for the Badges contract - uri: '', - }, - front: { - address: '0x0000000000000000000000000000000000000000', - collectionIdFirst: '', - collectionIdLast: '', - }, - hydraS1Verifier: { - address: '0x0000000000000000000000000000000000000000', - }, - hydraS1SimpleAttester: { - enableDeployment: false, - address: '0x0000000000000000000000000000000000000000', - collectionIdFirst: '', - collectionIdLast: '', - initialRoot: '0', - }, - hydraS1AccountboundAttester: { - address: '0x0000000000000000000000000000000000000000', - collectionIdFirst: '', - collectionIdLast: '', - initialRoot: '', - owner: '', - }, - pythia1Verifier: { - address: '0x0000000000000000000000000000000000000000', - }, - synapsPythia1SimpleAttester: { - address: '0x0000000000000000000000000000000000000000', - collectionIdFirst: '', - collectionIdLast: '', - commitmentSignerPubKeyX: '', - commitmentSignerPubKeyY: '', - owner: '', - }, - attestationsRegistry: { - address: '0x0000000000000000000000000000000000000000', - owner: '', - }, - availableRootsRegistry: { - address: '0x0000000000000000000000000000000000000000', - owner: '', - }, - commitmentMapper: { - address: '0x0000000000000000000000000000000000000000', - owner: '', - EdDSAPubKeyX: '', - EdDSAPubKeyY: '', - }, - sismoAddressesProvider: { - address: '', - owner: ALPHA_SCROLL_GOERLI_TESTNET_OWNER, - }, - }, ///////////////////////////////////////////////////////////////////////// // STAGING // 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 9aa9722..926fe86 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 @@ -13,7 +13,19 @@ 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 = { + deployOptions: { + manualConfirm: true, + log: true, + behindProxy: true, + proxyAdmin: process.env.PROXY_ADMIN, + }, + sismoAddressesProvider: { + owner: process.env.SISMO_ADDRESSES_PROVIDER_OWNER, + }, + }; + options = { ...config.deployOptions, ...options }; if (options.manualConfirm || options.log) { @@ -22,14 +34,15 @@ async function deploymentAction( // Deploy SismoAddressesProvider const { sismoAddressesProvider } = (await hre.run('deploy-sismo-addresses-provider', { + config, 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 337abf0..ab0bbb4 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 @@ -21,6 +21,7 @@ import { deploymentsConfig } from '../../../../tasks/deploy-tasks/deployments-co import { confirm } from '../../../../tasks/utils'; export interface DeploySismoAddressesProvider { + config: any; owner: string; badges: string; attestationsRegistry: string; @@ -40,6 +41,7 @@ const CONTRACT_NAME = 'AddressesProvider'; async function deploymentAction( { + config, owner, badges, attestationsRegistry, @@ -52,8 +54,6 @@ async function deploymentAction( }: DeploySismoAddressesProvider, hre: HardhatRuntimeEnvironment ): Promise { - const config = deploymentsConfig[hre.network.name]; - const deployer = await getDeployer(hre); const deploymentName = buildDeploymentName(CONTRACT_NAME, options?.deploymentNamePrefix); From 5211b968da8eaa98ad52270f810aced3f8ef8bfc Mon Sep 17 00:00:00 2001 From: bigq Date: Fri, 2 Jun 2023 09:29:36 +0200 Subject: [PATCH 3/5] feat: allow a one liner deployment command --- .../6-deploy-sismo-addresses-provider.task.ts | 28 ++++++++++--------- .../deploy-sismo-addresses-provider.task.ts | 21 +++++++++++--- tasks/deploy-tasks/utils/deployment.ts | 16 +++++++++++ 3 files changed, 48 insertions(+), 17 deletions(-) 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 926fe86..a0f26e7 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,22 +9,25 @@ export interface Deployed6 { sismoAddressesProvider: AddressesProvider; } +const addressesProviderConfiguration = { + deployOptions: { + manualConfirm: 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 { // ZK Badges are deprecated, we only use SismoAddressesProvider for Sismo Connect - const config = { - deployOptions: { - manualConfirm: true, - log: true, - behindProxy: true, - proxyAdmin: process.env.PROXY_ADMIN, - }, - sismoAddressesProvider: { - owner: process.env.SISMO_ADDRESSES_PROVIDER_OWNER, - }, - }; + const config = addressesProviderConfiguration; options = { ...config.deployOptions, ...options }; @@ -34,7 +37,6 @@ async function deploymentAction( // Deploy SismoAddressesProvider const { sismoAddressesProvider } = (await hre.run('deploy-sismo-addresses-provider', { - config, owner: config.sismoAddressesProvider.owner, badges: '0x0000000000000000000000000000000000000000', attestationsRegistry: '0x0000000000000000000000000000000000000000', 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 ab0bbb4..48368e4 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,11 +18,10 @@ import { TransparentUpgradeableProxy__factory, } from '../../../../types'; import { utils } from 'ethers'; -import { deploymentsConfig } from '../../../../tasks/deploy-tasks/deployments-config'; +import { SISMO_ADDRESSES_PROVIDER_CONTRACT_ADDRESS } from '../../../../tasks/deploy-tasks/deployments-config'; import { confirm } from '../../../../tasks/utils'; export interface DeploySismoAddressesProvider { - config: any; owner: string; badges: string; attestationsRegistry: string; @@ -38,10 +38,21 @@ export interface DeployedSismoAddressesProvider { } const CONTRACT_NAME = 'AddressesProvider'; +const addressesProviderConfiguration = { + deployOptions: { + manualConfirm: 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( { - config, owner, badges, attestationsRegistry, @@ -54,6 +65,8 @@ async function deploymentAction( }: DeploySismoAddressesProvider, hre: HardhatRuntimeEnvironment ): Promise { + const config = addressesProviderConfiguration; + const deployer = await getDeployer(hre); const deploymentName = buildDeploymentName(CONTRACT_NAME, options?.deploymentNamePrefix); @@ -274,4 +287,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 2d2db2f..c2ab185 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; From 712781355f6e2cd50642dd674ed3739f9fd9e1dd Mon Sep 17 00:00:00 2001 From: bigq Date: Fri, 2 Jun 2023 10:17:17 +0200 Subject: [PATCH 4/5] feat: fix tests --- .../full/6-deploy-sismo-addresses-provider.task.ts | 8 ++++---- .../core/deploy-sismo-addresses-provider.task.ts | 14 +------------- .../core/utils/sismo-addresses-provider.test.ts | 1 + test/unit/zkdrop/zk-badgebound-erc721.test.ts | 1 + 4 files changed, 7 insertions(+), 17 deletions(-) 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 a0f26e7..c1f096c 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 @@ -9,16 +9,16 @@ export interface Deployed6 { sismoAddressesProvider: AddressesProvider; } -const addressesProviderConfiguration = { +export const addressesProviderConfiguration = { deployOptions: { - manualConfirm: true, + manualConfirm: process.env.MANUAL_CONFIRM === 'true', log: true, behindProxy: true, - proxyAdmin: process.env.PROXY_ADMIN ?? '', + proxyAdmin: process.env.PROXY_ADMIN, }, sismoAddressesProvider: { address: SISMO_ADDRESSES_PROVIDER_CONTRACT_ADDRESS, - owner: process.env.SISMO_ADDRESSES_PROVIDER_OWNER ?? '', + owner: process.env.SISMO_ADDRESSES_PROVIDER_OWNER, }, }; 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 48368e4..9a16ec5 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 @@ -18,8 +18,8 @@ import { TransparentUpgradeableProxy__factory, } from '../../../../types'; import { utils } from 'ethers'; -import { SISMO_ADDRESSES_PROVIDER_CONTRACT_ADDRESS } 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; @@ -38,18 +38,6 @@ export interface DeployedSismoAddressesProvider { } const CONTRACT_NAME = 'AddressesProvider'; -const addressesProviderConfiguration = { - deployOptions: { - manualConfirm: 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( { diff --git a/test/unit/core/utils/sismo-addresses-provider.test.ts b/test/unit/core/utils/sismo-addresses-provider.test.ts index f74ea6c..084dc07 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 895a65d..1fdcf1f 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( From d2aa7f418b145e0328c0955c1cdccfd53aac1929 Mon Sep 17 00:00:00 2001 From: leo Sayous Date: Wed, 7 Jun 2023 18:31:05 +0200 Subject: [PATCH 5/5] feat: add scroll goerli singleton factory --- utils/singletonFactory.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utils/singletonFactory.ts b/utils/singletonFactory.ts index b0dc7b8..afbbc2f 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', + }, };