From 1ab6d700af89aa34ec848ef620c2ca667bebc73e Mon Sep 17 00:00:00 2001 From: Eric Mastro Date: Thu, 25 Aug 2022 13:21:50 +1000 Subject: [PATCH] [fix] fix test deployment --- deploy/storage.js | 4 ++-- deploy/test/storage.js | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 deploy/test/storage.js diff --git a/deploy/storage.js b/deploy/storage.js index 675d0de..c9c83d2 100644 --- a/deploy/storage.js +++ b/deploy/storage.js @@ -18,7 +18,7 @@ async function deployStorage({ deployments, getNamedAccounts }) { minCollateralThreshold, ] const { deployer } = await getNamedAccounts() - await deployments.deploy("TestStorage", { args, from: deployer }) + await deployments.deploy("Storage", { args, from: deployer }) } async function mine256blocks({ network, ethers }) { @@ -32,5 +32,5 @@ module.exports = async (environment) => { await deployStorage(environment) } -module.exports.tags = ["TestStorage"] +module.exports.tags = ["Storage"] module.exports.dependencies = ["TestToken"] diff --git a/deploy/test/storage.js b/deploy/test/storage.js new file mode 100644 index 0000000..675d0de --- /dev/null +++ b/deploy/test/storage.js @@ -0,0 +1,36 @@ +async function deployStorage({ deployments, getNamedAccounts }) { + const token = await deployments.get("TestToken") + const proofPeriod = 10 + const proofTimeout = 5 + const proofDowntime = 64 + const collateralAmount = 100 + const slashMisses = 3 + const slashPercentage = 10 + const minCollateralThreshold = 40 + const args = [ + token.address, + proofPeriod, + proofTimeout, + proofDowntime, + collateralAmount, + slashMisses, + slashPercentage, + minCollateralThreshold, + ] + const { deployer } = await getNamedAccounts() + await deployments.deploy("TestStorage", { args, from: deployer }) +} + +async function mine256blocks({ network, ethers }) { + if (network.tags.local) { + await ethers.provider.send("hardhat_mine", ["0x100"]) + } +} + +module.exports = async (environment) => { + await mine256blocks(environment) + await deployStorage(environment) +} + +module.exports.tags = ["TestStorage"] +module.exports.dependencies = ["TestToken"]