Skip to content

Instantly share code, notes, and snippets.

@austintgriffith
Last active May 20, 2020 23:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save austintgriffith/d6e13a4c62e230c1069b0641dc5884ab to your computer and use it in GitHub Desktop.
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
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