Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
nbanmp committed May 16, 2019
1 parent 3f23a57 commit 9d05f55
Showing 1 changed file with 0 additions and 68 deletions.
68 changes: 0 additions & 68 deletions lib/wfc.js
Expand Up @@ -21,7 +21,6 @@ const vyperCompile = require('truffle-compile-vyper');
const externalCompile = require('truffle-external-compile');
const expect = require('truffle-expect');
const Resolver = require('truffle-resolver');
const Artifactor = require('truffle-artifactor');
const OS = require('os');

const SUPPORTED_COMPILERS = {
Expand All @@ -30,68 +29,6 @@ const SUPPORTED_COMPILERS = {
'external': externalCompile,
};

/* A replacement for truffe-artifacts.save, that
puts in only MythX-needed fields.
*/
const mythXsave = function(object) {
var self = this;

return new Promise(function(accept, reject) {

if (object.contractName == null) {
return reject(new Error('You must specify a contract name.'));
}

delete object.contract_name;

var outputPath = object.contractName;

// Create new path off of destination.
outputPath = path.join(self.destination, outputPath);
outputPath = path.resolve(outputPath);

// Add json extension.
outputPath = outputPath + '.json';

fs.readFile(outputPath, {encoding: 'utf8'}, function(err, json) {
// No need to handle the error. If the file doesn't exist then we'll start afresh
// with a new object.

const finalObject = object;

if (!err) {
try {
JSON.parse(json);
} catch (e) {
reject(e);
}

/*
// normalize existing and merge into final
finalObject = Schema.normalize(existingObjDirty);
// merge networks
var finalNetworks = {};
_.merge(finalNetworks, finalObject.networks, object.networks);
// update existing with new
_.assign(finalObject, object);
finalObject.networks = finalNetworks;
*/
}

// update timestamp
finalObject.updatedAt = new Date().toISOString();

// output object
fs.outputFile(outputPath, JSON.stringify(finalObject, null, 2), 'utf8', function(err) {
if (err) return reject(err);
accept();
});
});
});
};

/* FIXME: if truffle-worflow-compile added a parameter, a directory name
under "build", we wouldn't have to change this.
*/
Expand All @@ -109,11 +46,6 @@ function prepareConfig(options) {
config.resolver = new Resolver(config);
}

if (!config.artifactor) {
config.artifactor = new Artifactor(config.build_mythx_contracts);
config.artifactor.save = mythXsave;
}

return config;
}

Expand Down

0 comments on commit 9d05f55

Please sign in to comment.