Skip to content

Commit

Permalink
Merge pull request trufflesuite#86 from trufflesuite/remove-soljs
Browse files Browse the repository at this point in the history
Remove solcjs upgrade logic and test example
  • Loading branch information
gnidan committed Feb 26, 2018
2 parents a5b84bc + 25d5382 commit abe27c1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 806 deletions.
47 changes: 0 additions & 47 deletions packages/truffle-contract/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,6 @@ var contract = function(options) {
return Contract.clone(binary);
};

// To be used to upgrade old .sol.js abstractions
contract.fromSolJS = function(soljs_abstraction, ignore_default_network) {
if (ignore_default_network == null) {
ignore_default_network = false;
}

// Find the latest binary
var latest_network = null;
var latest_network_updated_at = 0;

var networks = {};

Object.keys(soljs_abstraction.all_networks).forEach(function(network_name) {

if (network_name == "default") {
if (ignore_default_network == true ) {
return;
} else {
throw new Error(soljs_abstraction.contract_name + " has legacy 'default' network artifacts stored within it. Generally these artifacts were a result of running Truffle on a development environment -- in order to store contracts with truffle-contract, all networks must have an identified id. If you're sure this default network represents your development environment, you can ignore processing of the default network by passing `true` as the second argument to this function. However, if you think this network represents artifacts you'd like to keep (i.e., addresses deployed to the main network), you'll need to edit your .sol.js file yourself and change the default network id to be the id of your desired network. For most people, ignoring the default network is the correct option.");
}
}

if (soljs_abstraction.all_networks[network_name].updated_at > latest_network_updated_at) {
latest_network = network_name;
latest_network_updated_at = soljs_abstraction.all_networks[network_name].updated_at;
}

networks[network_name] = {};

["address", "events", "links", "updated_at"].forEach(function(key) {
networks[network_name][key] = soljs_abstraction.all_networks[network_name][key];
})
});

latest_network = soljs_abstraction.all_networks[latest_network] || {};

var json = {
contractName: soljs_abstraction.contractName,
unlinked_binary: latest_network.unlinked_binary,
abi: latest_network.abi,
networks: networks,
updated_at: latest_network_updated_at == 0 ? undefined : latest_network_updated_at
};

return contract(json);
};

module.exports = contract;

if (typeof window !== "undefined") {
Expand Down
4 changes: 2 additions & 2 deletions packages/truffle-contract/test/lib/MetaCoin.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
"ConvertLib": "0xfb2844d30ba493d0b3d661811b4200f04b5ce969"
},
"address": "0x9b1f922a7d25d237883527c3de6b4765a6d25955",
"updated_at": 1492723344362
"updatedAt": 1492723344362
}
},
"schema_version": "0.0.5",
"updated_at": 1492723344362
"updatedAt": 1492723344362
}
Loading

0 comments on commit abe27c1

Please sign in to comment.