2023-04-26 07:44:55 +00:00
|
|
|
const MARKETPLACE_HARDCODED_ADDRESS = "0x59b670e9fA9D0A427751Af201D676719a970857b"
|
|
|
|
|
2023-01-09 15:01:43 +00:00
|
|
|
async function deployMarketplace({ deployments, getNamedAccounts }) {
|
2022-02-09 13:17:23 +00:00
|
|
|
const token = await deployments.get("TestToken")
|
2023-01-17 14:09:19 +00:00
|
|
|
const configuration = {
|
|
|
|
collateral: {
|
2023-03-30 09:11:21 +00:00
|
|
|
repairRewardPercentage: 10,
|
|
|
|
maxNumberOfSlashes: 5,
|
2023-01-17 14:09:19 +00:00
|
|
|
slashCriterion: 3,
|
|
|
|
slashPercentage: 10,
|
|
|
|
},
|
|
|
|
proofs: {
|
|
|
|
period: 10,
|
|
|
|
timeout: 5,
|
|
|
|
downtime: 64,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
const args = [token.address, configuration]
|
2021-11-16 12:54:38 +00:00
|
|
|
const { deployer } = await getNamedAccounts()
|
2023-01-09 15:01:43 +00:00
|
|
|
await deployments.deploy("Marketplace", { args, from: deployer })
|
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"])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-26 07:44:55 +00:00
|
|
|
async function aliasContract({deployments, network}) {
|
|
|
|
if (network.tags.local) {
|
|
|
|
const marketplaceDeployment = await deployments.get("Marketplace")
|
|
|
|
|
|
|
|
if (marketplaceDeployment.address === MARKETPLACE_HARDCODED_ADDRESS) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(`Aliasing marketplace from address ${marketplaceDeployment.address} to ${MARKETPLACE_HARDCODED_ADDRESS}`)
|
|
|
|
await ethers.provider.send("hardhat_setCode", [MARKETPLACE_HARDCODED_ADDRESS, marketplaceDeployment.address])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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)
|
2023-04-26 07:44:55 +00:00
|
|
|
await aliasContract(environment)
|
2022-03-15 15:45:35 +00:00
|
|
|
}
|
|
|
|
|
2023-01-09 15:01:43 +00:00
|
|
|
module.exports.tags = ["Marketplace"]
|
2022-02-09 13:17:23 +00:00
|
|
|
module.exports.dependencies = ["TestToken"]
|