Skip to content

Commit

Permalink
Remove contract aliasing; doesn't work
Browse files Browse the repository at this point in the history
Contract aliasing (specifying a fixed address for a
contract) doesn't work. We're now echoing the
addresses of the deployed contracts instead.
  • Loading branch information
markspanbroek committed Jan 31, 2024
1 parent c7b18af commit 31bbd70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
22 changes: 7 additions & 15 deletions deploy/marketplace.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
const { loadZkeyHash } = require("../verifier/verifier.js")

// hardcoded addresses when deploying on local network
const MARKETPLACE_REAL = "0x59b670e9fA9D0A427751Af201D676719a970857b"
const MARKETPLACE_TEST = "0xfacadee9fA9D0A427751Af201D676719a9facade"

// marketplace configuration
const CONFIGURATION = {
collateral: {
Expand All @@ -25,24 +21,18 @@ async function mine256blocks({ network, ethers }) {
}
}

async function aliasContract(address, alias) {
if (address !== alias) {
await ethers.provider.send("hardhat_setCode", [alias, address])
}
}

// deploys a marketplace with a real Groth16 verifier
async function deployMarketplace({ network, deployments, getNamedAccounts }) {
async function deployMarketplace({ deployments, getNamedAccounts }) {
const token = await deployments.get("TestToken")
const verifier = await deployments.get("Groth16Verifier")
const zkeyHash = loadZkeyHash(network.name)
const configuration = { ...CONFIGURATION, zkeyHash }
const args = [configuration, token.address, verifier.address]
const { deployer: from } = await getNamedAccounts()
const marketplace = await deployments.deploy("Marketplace", { args, from })
if (network.tags.local) {
await aliasContract(marketplace.address, MARKETPLACE_REAL)
}
console.log("Deployed Marketplace with Groth16 Verifier at:")
console.log(marketplace.address)
console.log()
}

// deploys a marketplace with a testing verifier
Expand All @@ -59,7 +49,9 @@ async function deployTestMarketplace({
const args = [configuration, token.address, verifier.address]
const { deployer: from } = await getNamedAccounts()
const marketplace = await deployments.deploy("Marketplace", { args, from })
await aliasContract(marketplace.address, MARKETPLACE_TEST)
console.log("Deployed Marketplace with Test Verifier at:")
console.log(marketplace.address)
console.log()
}
}

Expand Down
1 change: 1 addition & 0 deletions deploy/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = async ({ deployments, getNamedAccounts, getUnnamedAccounts, net
const transaction = await token.mint(account, MINTED_TOKENS, { from: deployer })
await transaction.wait()
}
console.log()
}
}

Expand Down

0 comments on commit 31bbd70

Please sign in to comment.