Skip to content

Commit

Permalink
Merge pull request #338 from Thetta/dev-enkogu-sept
Browse files Browse the repository at this point in the history
Dev enkogu sept
  • Loading branch information
AnthonyAkentiev authored Sep 27, 2018
2 parents 990a7a7 + 691b700 commit 0d733c5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 27 deletions.
2 changes: 1 addition & 1 deletion migrations/2_deploy_contracts_libraries.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var migrateLibs = require('../scripts/migrateLibs');

module.exports = function (deployer, network, accounts) {
return migrateLibs(artifacts, deployer, network, accounts);
return migrateLibs(artifacts, [], deployer, network, accounts);
};
81 changes: 55 additions & 26 deletions scripts/migrateLibs.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,58 @@
function migrateLibs (artifacts, deployer, network, accounts) {
var UtilsLib = artifacts.require("./UtilsLib");
var DaoBase = artifacts.require("./DaoBase");
var DaoBaseImpersonated = artifacts.require("./DaoBaseImpersonated");
var DaoBaseWithUnpackers = artifacts.require("./DaoBaseWithUnpackers");
var GenericCaller = artifacts.require("./GenericCaller");
var GenericCallerLib = artifacts.require("./GenericCallerLib");
var MoneyflowAuto = artifacts.require("./MoneyflowAuto");
var Voting = artifacts.require("./Voting");
var VotingLib = artifacts.require("./VotingLib");
var DaoBaseAuto = artifacts.require("./DaoBaseAuto");
var DaoBaseWithUnpackersMock = artifacts.require("./DaoBaseWithUnpackersMock");
var DaoStorage = artifacts.require("./DaoStorage");
var DaoBaseMock = artifacts.require("./DaoBaseMock");
var StdDaoToken = artifacts.require("./StdDaoToken");
var DaoBaseLib = artifacts.require("./DaoBaseLib");

return deployer
.then(() => deployer.deploy(UtilsLib))
.then(() => deployer.link(UtilsLib, [DaoBaseImpersonated, DaoBaseWithUnpackers, GenericCaller, VotingLib, DaoBaseAuto, DaoBaseWithUnpackersMock, DaoBaseMock, DaoStorage, StdDaoToken]))
.then(() => deployer.deploy(VotingLib))
.then(() => deployer.link(VotingLib, [Voting, GenericCallerLib, GenericCaller, MoneyflowAuto, DaoBaseAuto]))
.then(() => deployer.deploy(GenericCallerLib))
.then(() => deployer.link(GenericCallerLib, [GenericCaller, MoneyflowAuto, DaoBaseAuto]))
.then(() => deployer.deploy(DaoBaseLib))
.then(() => deployer.link(DaoBaseLib, [DaoBase, DaoBaseWithUnpackers, DaoBaseWithUnpackersMock, DaoBaseMock]))
function migrateLibs (artifacts, additionalContracts, deployer, network, accounts) {

return deployer.then(async () => {
var UtilsLib = artifacts.require("./UtilsLib");
var GenericCallerLib = artifacts.require("./GenericCallerLib");
var VotingLib = artifacts.require("./VotingLib");
var DaoBaseLib = artifacts.require("./DaoBaseLib");

async function linkIfExist(contractName){
try {
await deployer.link(UtilsLib, artifacts.require(contractName));
await deployer.link(VotingLib, artifacts.require(contractName));
await deployer.link(GenericCallerLib, artifacts.require(contractName));
await deployer.link(DaoBaseLib, artifacts.require(contractName));
} catch(error) {}
}

await deployer.deploy(UtilsLib);
await deployer.link(UtilsLib, VotingLib);
await deployer.deploy(VotingLib);
await deployer.link(VotingLib, GenericCallerLib);
await deployer.deploy(GenericCallerLib);
await deployer.deploy(DaoBaseLib);

contractsArr = [ "./DaoBaseImpersonated"
, "./DaoBaseWithUnpackers"
, "./GenericCaller"
, "./VotingLib"
, "./DaoBaseAuto"
, "./DaoBaseWithUnpackersMock"
, "./DaoBaseMock"
, "./DaoStorage"
, "./StdDaoToken"
, "./Voting"
, "./GenericCallerLib"
, "./GenericCaller"
, "./MoneyflowAuto"
, "./DaoBaseAuto"
, "./GenericCaller"
, "./MoneyflowAuto"
, "./DaoBaseAuto"
, "./DaoBase"
, "./DaoBaseWithUnpackers"
, "./DaoBaseWithUnpackersMock"
, "./DaoBaseMock"
]

contractsArr = contractsArr.concat(additionalContracts);

for(let contract of contractsArr){
await linkIfExist(contract);
}


});
};

module.exports = migrateLibs

0 comments on commit 0d733c5

Please sign in to comment.