Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function sortByDependencies(compiledContracts) {
var depsGraph = buildDependencyGraph(compiledContracts);
var dependsOrdering = GraphAlgorithms.postorder(depsGraph, depsGraph.nodes());
logDebug('Deployment order: ', dependsOrdering);
compiledContracts.sort(function (a, b) {
return dependsOrdering.indexOf(a.name) - dependsOrdering.indexOf(b.name);
});
}