Last active
May 20, 2020 23:19
-
-
Save austintgriffith/d6e13a4c62e230c1069b0641dc5884ab to your computer and use it in GitHub Desktop.
Buidler Deploy Script - any .json artifact in the contracts folder will get deployed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const chalk = require('chalk'); | |
async function main() { | |
let contractList = fs.readdirSync("./artifacts") | |
for(let c in contractList){ | |
if(contractList[c].indexOf(".json")>=0){ | |
const name = contractList[c].replace(".json","") | |
const contractArtifacts = artifacts.require(name); | |
const contract = await contractArtifacts.new() | |
console.log(chalk.cyan(name),"deployed to:", chalk.magenta(contract.address)); | |
fs.writeFileSync("artifacts/"+name+".address",contract.address); | |
} | |
} | |
} | |
main() | |
.then(() => process.exit(0)) | |
.catch(error => { | |
console.error(error); | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment