Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrations and deployments #69

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `darknode-sol`
# `⚖️ darknode-sol`
## Solidity smart contracts used by Ren Darknodes

[![CircleCI](https://circleci.com/gh/renproject/darknode-sol.svg?style=shield)](https://circleci.com/gh/renproject/darknode-sol)
Expand Down
45 changes: 45 additions & 0 deletions build/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Only keeps "contractName", "abi", "sourcePath", "compiler", "networks",
* "schemaVersion" and "updatedAt".
*/

const glob = require("glob");
const fs = require("fs");

const networks = ["testnet", "devnet", "localnet"];

const path = require('path');
const dirname = path.dirname(__filename);

for (const network of networks) {
const directory = path.join(dirname, `./${network}/*.json`);
glob(directory, function (err, files) { // read the folder or folders if you want: example json/**/*.json
if (err) {
console.log(`error while reading the files in ${directory}`, err);
}
files.forEach(function (file) {
fs.readFile(file, 'utf8', function (err, data) { // Read each file
if (err) {
console.log(`error while reading the contents of ${file}`, err);
}
var obj = JSON.parse(data);
const newObj = {
contractName: obj.contractName,
abi: obj.abi,
sourcePath: obj.sourcePath,
compiler: obj.compiler,
networks: obj.networks,
schemaVersion: obj.schemaVersion,
}
const newData = JSON.stringify(newObj, null, " ");

if (data !== newData) {
fs.writeFile(file, JSON.stringify(newObj, null, " "), function (err) {
if (err) return console.log(err);
console.log(` Updated \x1b[33m${file}\x1b[0m.`);
});
}
});
});
});
}
Loading