From ddfd795b17d289603e2afa52d11b163d40d804d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DAX=20=E2=82=BFONDYE?= Date: Mon, 19 Feb 2018 11:35:58 -0800 Subject: [PATCH] Create 2_deploy_contracts.js --- contracts/DispatcherStorage.sol | 5 ++--- migrations/2_deploy_contracts.js | 20 ++++++++++++++++++++ truffle.js | 1 - 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 migrations/2_deploy_contracts.js diff --git a/contracts/DispatcherStorage.sol b/contracts/DispatcherStorage.sol index 5c6a203..a95b01c 100644 --- a/contracts/DispatcherStorage.sol +++ b/contracts/DispatcherStorage.sol @@ -1,14 +1,13 @@ pragma solidity ^0.4.8; -import "zeppelin-solidity/contracts/ownership/Ownable.sol"; -contract DispatcherStorage is Ownable { +contract DispatcherStorage { address public lib; function DispatcherStorage(address newLib) public { replace(newLib); } - function replace(address newLib) public onlyOwner /* onlyDAO */ { + function replace(address newLib) public /* onlyDAO */ { lib = newLib; } } diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js new file mode 100644 index 0000000..861c261 --- /dev/null +++ b/migrations/2_deploy_contracts.js @@ -0,0 +1,20 @@ +var LibInterface = artifacts.require("./LibInterface.sol"); +var DispatcherStorage = artifacts.require("./DispatcherStorage.sol"); +var Dispatcher = artifacts.require("./Dispatcher.sol"); +var TheContract = artifacts.require("./TheContract.sol"); + +module.exports = function(deployer) { + deployer.deploy(LibInterface) + .then(() => { + return deployer.deploy(DispatcherStorage, LibInterface.address)}) + .then(() => { + Dispatcher.unlinked_binary = Dispatcher.unlinked_binary.replace( + '0x1111222233334444555566667777888899990000', + DispatcherStorage.address + ); + return deployer.deploy(Dispatcher)}) + .then(() => { + deployer.link(Dispatcher, TheContract).then(() => { + return deployer.deploy(TheContract)}) + }); +}; \ No newline at end of file diff --git a/truffle.js b/truffle.js index 99ea54b..45fdcc1 100644 --- a/truffle.js +++ b/truffle.js @@ -1,4 +1,3 @@ -require('babel-polyfill'); module.exports = { networks: {