Skip to content

Instantly share code, notes, and snippets.

@austintgriffith

austintgriffith/deploy.js

Last active May 20, 2020
Embed
What would you like to do?
Buidler Deploy Script - any .json artifact in the contracts folder will get deployed
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