2024-01-25 09:49:53 +00:00
|
|
|
const { loadZkeyHash } = require("../verifier/verifier.js")
|
2024-11-07 14:27:22 +00:00
|
|
|
const { loadConfiguration } = require("../configuration/configuration.js")
|
2021-11-16 12:54:38 +00:00
|
|
|
|
2022-03-15 15:45:35 +00:00
|
|
|
async function mine256blocks({ network, ethers }) {
|
|
|
|
if (network.tags.local) {
|
|
|
|
await ethers.provider.send("hardhat_mine", ["0x100"])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-25 09:49:53 +00:00
|
|
|
// deploys a marketplace with a real Groth16 verifier
|
2024-01-25 14:00:46 +00:00
|
|
|
async function deployMarketplace({ deployments, getNamedAccounts }) {
|
2024-01-25 09:49:53 +00:00
|
|
|
const token = await deployments.get("TestToken")
|
|
|
|
const verifier = await deployments.get("Groth16Verifier")
|
|
|
|
const zkeyHash = loadZkeyHash(network.name)
|
2024-11-07 14:27:22 +00:00
|
|
|
let configuration = loadConfiguration(network.name)
|
2024-01-31 14:58:18 +00:00
|
|
|
configuration.proofs.zkeyHash = zkeyHash
|
2024-01-25 09:49:53 +00:00
|
|
|
const args = [configuration, token.address, verifier.address]
|
|
|
|
const { deployer: from } = await getNamedAccounts()
|
|
|
|
const marketplace = await deployments.deploy("Marketplace", { args, from })
|
2024-01-25 14:00:46 +00:00
|
|
|
console.log("Deployed Marketplace with Groth16 Verifier at:")
|
|
|
|
console.log(marketplace.address)
|
|
|
|
console.log()
|
2024-01-25 09:49:53 +00:00
|
|
|
}
|
2023-04-26 07:44:55 +00:00
|
|
|
|
2024-01-25 09:49:53 +00:00
|
|
|
// 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)
|
2024-11-07 14:27:22 +00:00
|
|
|
let configuration = loadConfiguration(network.name)
|
2024-01-31 14:58:18 +00:00
|
|
|
configuration.proofs.zkeyHash = zkeyHash
|
2024-01-25 09:49:53 +00:00
|
|
|
const args = [configuration, token.address, verifier.address]
|
|
|
|
const { deployer: from } = await getNamedAccounts()
|
|
|
|
const marketplace = await deployments.deploy("Marketplace", { args, from })
|
2024-01-25 14:00:46 +00:00
|
|
|
console.log("Deployed Marketplace with Test Verifier at:")
|
|
|
|
console.log(marketplace.address)
|
|
|
|
console.log()
|
2023-04-26 07:44:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-15 15:45:35 +00:00
|
|
|
module.exports = async (environment) => {
|
|
|
|
await mine256blocks(environment)
|
2023-01-09 15:01:43 +00:00
|
|
|
await deployMarketplace(environment)
|
2024-01-25 09:49:53 +00:00
|
|
|
await deployTestMarketplace(environment)
|
2022-03-15 15:45:35 +00:00
|
|
|
}
|
|
|
|
|
2023-01-09 15:01:43 +00:00
|
|
|
module.exports.tags = ["Marketplace"]
|
2024-01-25 09:49:53 +00:00
|
|
|
module.exports.dependencies = ["TestToken", "Verifier"]
|