Commit 77683af8 authored by George Hotz's avatar George Hotz

factor out deployment

parent 6ea43350
const { deploy } = require("../scripts/lib")
async function main() {
var [c, m, mm] = await deploy()
console.log("deployed at", c.address, m.address, mm.address)
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
const goldenRoot = "0x1f6285b6d372ee187815a8580d1af3ab348cea34abbee18a8e13272454a4c4af"
async function deploy() {
const MIPS = await ethers.getContractFactory("MIPS")
const m = await MIPS.deploy()
const mm = await ethers.getContractAt("MIPSMemory", await m.m())
const Challenge = await ethers.getContractFactory("Challenge")
const c = await Challenge.deploy(m.address, goldenRoot)
return [c,m,mm]
}
module.exports = { deploy }
const { expect } = require("chai");
const fs = require("fs");
const { expect } = require("chai")
const fs = require("fs")
const { deploy } = require("../scripts/lib")
// golden minigeth.bin hash
const goldenRoot = "0x1f6285b6d372ee187815a8580d1af3ab348cea34abbee18a8e13272454a4c4af"
describe("Challenge contract", function () {
beforeEach(async function () {
// this mips can be reused for other challenges
const MIPS = await ethers.getContractFactory("MIPS")
const m = await MIPS.deploy()
mm = await ethers.getContractAt("MIPSMemory", await m.m())
const Challenge = await ethers.getContractFactory("Challenge")
c = await Challenge.deploy(m.address, goldenRoot)
[c, m, mm] = await deploy()
})
it("challenge contract deploys", async function() {
console.log("Challenge deployed at", c.address)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment