diff --git a/.env.example.deploy b/.env.example.deploy index 5a60c3d..1075b32 100644 --- a/.env.example.deploy +++ b/.env.example.deploy @@ -1,5 +1,6 @@ L2_NODE_WEB3_URL= -ADMIN_PRIVATE_KEY= +DEPLOYER_PRIVATE_KEY= +ADMIN_ADDRESS= THRESHOLD=3 NUMBER_OF_MEMBERS=5 DEGREE=18 diff --git a/contracts/zkdvrf_pre.sol b/contracts/zkdvrf_pre.sol index c7793c8..c8fbead 100644 --- a/contracts/zkdvrf_pre.sol +++ b/contracts/zkdvrf_pre.sol @@ -78,7 +78,7 @@ contract zkdvrf_pre is Ownable { mapping(uint256 => IPseudoRand.PseudoRandom) public roundToRandom; - constructor(uint32 thresholdValue, uint32 numberValue, address halo2VerifierAddress, address halo2VerifyingKeyAddress, address globalPublicParamsAddress, address pseudoRandAddress, uint256 minDeposit) Ownable(msg.sender) { + constructor(uint32 thresholdValue, uint32 numberValue, address owner, address halo2VerifierAddress, address halo2VerifyingKeyAddress, address globalPublicParamsAddress, address pseudoRandAddress, uint256 minDeposit) Ownable(owner) { require(halo2VerifierAddress != address(0) && globalPublicParamsAddress != address(0) && pseudoRandAddress != address(0), "Cannot be zero addresses"); memberCount = numberValue; threshold = thresholdValue; diff --git a/scripts/deploy.ts b/scripts/deploy.ts index 18c71bd..df33420 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -3,7 +3,8 @@ import {Contract, ContractFactory, providers, utils, Wallet} from "ethers"; async function main() { const netprovider = new providers.JsonRpcProvider(process.env.L2_NODE_WEB3_URL) - const accPrivateKey = process.env.ADMIN_PRIVATE_KEY ?? '' + const accPrivateKey = process.env.DEPLOYER_PRIVATE_KEY ?? '' + const adminAddress = process.env.ADMIN_ADDRESS ?? '' const deployerWallet = new Wallet(accPrivateKey, netprovider) const threshold = process.env.THRESHOLD const numberOfMembers = process.env.NUMBER_OF_MEMBERS @@ -53,7 +54,7 @@ async function main() { } const Zkdvrf = await ethers.getContractFactory('zkdvrf_pre') - const zkdvrf = await Zkdvrf.connect(deployerWallet).deploy(threshold, numberOfMembers, halo2VerifierAddress, halo2VerifyingKeyAddress, globalPublicParamsAddress, pseudoRandAddress, minDeposit) + const zkdvrf = await Zkdvrf.connect(deployerWallet).deploy(threshold, numberOfMembers, adminAddress, halo2VerifierAddress, halo2VerifyingKeyAddress, globalPublicParamsAddress, pseudoRandAddress, minDeposit) await zkdvrf.deployed() console.log("zkdvrf_pre deployed at", zkdvrf.address) diff --git a/test/zkdvrf_pre.spec.ts b/test/zkdvrf_pre.spec.ts index f0fd6c1..302d63a 100644 --- a/test/zkdvrf_pre.spec.ts +++ b/test/zkdvrf_pre.spec.ts @@ -155,9 +155,6 @@ describe('ZKDVRF (with precomputation of hash) on-chain tests', async () => { Halo2VerifyingKey = await (await ethers.getContractFactory('contracts/Halo2VerifyingKey-3-5-18-g2.sol:Halo2VerifyingKey')).deploy() GlobalPublicParams = await (await ethers.getContractFactory('GlobalPublicParams')).deploy() PseudoRand = await (await ethers.getContractFactory('PseudoRand')).deploy() - Zkdvrf = await ( - await ethers.getContractFactory('zkdvrf_pre') - ).deploy(3, 5, Halo2Verifier.address, Halo2VerifyingKey.address, GlobalPublicParams.address, PseudoRand.address, minDeposit) account1 = (await ethers.getSigners())[0] account2 = (await ethers.getSigners())[1] @@ -170,6 +167,11 @@ describe('ZKDVRF (with precomputation of hash) on-chain tests', async () => { account4Address = await account4.getAddress() account5Address = await account5.getAddress() + Zkdvrf = await ( + await ethers.getContractFactory('zkdvrf_pre') + ).deploy(3, 5, account1Address, Halo2Verifier.address, Halo2VerifyingKey.address, GlobalPublicParams.address, PseudoRand.address, minDeposit) + + lotteryAdmin = (await ethers.getSigners())[5] player1 = (await ethers.getSigners())[6] player2 = (await ethers.getSigners())[7]