From 04ee629017456fb57d2391eb1f2e75fb7930dff4 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 23 May 2025 11:24:47 +0200 Subject: [PATCH] Remove previous deployment scripts --- deploy/marketplace.js | 53 ------------------------------------------- deploy/token.js | 36 ----------------------------- deploy/verifier.js | 24 -------------------- 3 files changed, 113 deletions(-) delete mode 100644 deploy/marketplace.js delete mode 100644 deploy/token.js delete mode 100644 deploy/verifier.js diff --git a/deploy/marketplace.js b/deploy/marketplace.js deleted file mode 100644 index d1cb51d..0000000 --- a/deploy/marketplace.js +++ /dev/null @@ -1,53 +0,0 @@ -const { loadZkeyHash } = require("../verifier/verifier.js") -const { loadConfiguration } = require("../configuration/configuration.js") - -async function mine256blocks({ network, ethers }) { - if (network.tags.local) { - await ethers.provider.send("hardhat_mine", ["0x100"]) - } -} - -// deploys a marketplace with a real Groth16 verifier -async function deployMarketplace({ deployments, getNamedAccounts }) { - const token = await deployments.get("TestToken") - const verifier = await deployments.get("Groth16Verifier") - const zkeyHash = loadZkeyHash(network.name) - let configuration = loadConfiguration(network.name) - configuration.proofs.zkeyHash = zkeyHash - const args = [configuration, token.address, verifier.address] - const { deployer: from } = await getNamedAccounts() - const marketplace = await deployments.deploy("Marketplace", { args, from }) - console.log("Deployed Marketplace with Groth16 Verifier at:") - console.log(marketplace.address) - console.log() -} - -// deploys a marketplace with a testing verifier -async function deployTestMarketplace({ - network, - deployments, - getNamedAccounts, -}) { - if (network.tags.local) { - const token = await deployments.get("TestToken") - const verifier = await deployments.get("TestVerifier") - const zkeyHash = loadZkeyHash(network.name) - let configuration = loadConfiguration(network.name) - configuration.proofs.zkeyHash = zkeyHash - const args = [configuration, token.address, verifier.address] - const { deployer: from } = await getNamedAccounts() - const marketplace = await deployments.deploy("Marketplace", { args, from }) - console.log("Deployed Marketplace with Test Verifier at:") - console.log(marketplace.address) - console.log() - } -} - -module.exports = async (environment) => { - await mine256blocks(environment) - await deployMarketplace(environment) - await deployTestMarketplace(environment) -} - -module.exports.tags = ["Marketplace"] -module.exports.dependencies = ["TestToken", "Verifier"] diff --git a/deploy/token.js b/deploy/token.js deleted file mode 100644 index 4e473d4..0000000 --- a/deploy/token.js +++ /dev/null @@ -1,36 +0,0 @@ -const MINTED_TOKENS = 1_000_000_000_000_000 - -module.exports = async ({ - deployments, - getNamedAccounts, - getUnnamedAccounts, - network, -}) => { - const { deployer } = await getNamedAccounts() - const tokenDeployment = await deployments.deploy("TestToken", { - from: deployer, - skipIfAlreadyDeployed: true, - }) - const token = await hre.ethers.getContractAt( - "TestToken", - tokenDeployment.address - ) - - const accounts = [ - ...Object.values(await getNamedAccounts()), - ...(await getUnnamedAccounts()), - ] - if (network.tags.local) { - for (const account of accounts) { - console.log(`Minting ${MINTED_TOKENS} tokens to address ${account}`) - - const transaction = await token.mint(account, MINTED_TOKENS, { - from: deployer, - }) - await transaction.wait() - } - console.log() - } -} - -module.exports.tags = ["TestToken"] diff --git a/deploy/verifier.js b/deploy/verifier.js deleted file mode 100644 index a2ff561..0000000 --- a/deploy/verifier.js +++ /dev/null @@ -1,24 +0,0 @@ -const { loadVerificationKey } = require("../verifier/verifier.js") - -async function deployVerifier({ deployments, getNamedAccounts }) { - const { deployer } = await getNamedAccounts() - const verificationKey = loadVerificationKey(network.name) - await deployments.deploy("Groth16Verifier", { - args: [verificationKey], - from: deployer, - }) -} - -async function deployTestVerifier({ network, deployments, getNamedAccounts }) { - if (network.tags.local) { - const { deployer } = await getNamedAccounts() - await deployments.deploy("TestVerifier", { from: deployer }) - } -} - -module.exports = async (environment) => { - await deployVerifier(environment) - await deployTestVerifier(environment) -} - -module.exports.tags = ["Verifier"]