Skip to content

Commit

Permalink
Merge pull request #17 from rstormsf/master
Browse files Browse the repository at this point in the history
add deployment script
  • Loading branch information
vbaranov committed Dec 7, 2017
2 parents 9f66b11 + 762dd61 commit 31209cd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ testrpc:
--account="0x1fdc76364db4a4bcfad8f2c010995a96fcb98a165e34858665a234ba54715105, 1000000000000000000000000000" \

test:
node_modules/.bin/truffle test
node_modules/.bin/truffle test --network test

solhint:
solhint contracts/*.sol contracts/util/*.sol
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IKeysManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ contract IKeysManager {
uint256 public maxNumberOfInitialKeys;
uint256 public initialKeysCount;
uint256 public maxLimitValidators;
mapping(address => bool) public initialKeys;
mapping(address => uint8) public initialKeys;
mapping(address => address) public getMiningKeyByVoting;
mapping(address => address) public miningKeyHistory;

Expand Down
44 changes: 44 additions & 0 deletions migrations/2_deploy_contract.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
var PoaNetworkConsensus = artifacts.require("./PoaNetworkConsensus.sol");
var ProxyStorage = artifacts.require("./ProxyStorage.sol");
var KeysManager = artifacts.require("./KeysManager.sol");
var BallotsStorage = artifacts.require("./BallotsStorage.sol");
var ValidatorMetadata = artifacts.require("./ValidatorMetadata.sol");
let VotingToChangeKeys = artifacts.require('./mockContracts/VotingToChangeKeys');
let VotingToChangeMinThreshold = artifacts.require('./mockContracts/VotingToChangeMinThreshold');
let VotingToChangeProxyAddress = artifacts.require('./mockContracts/VotingToChangeProxyAddress');

module.exports = async function(deployer, network, accounts) {
let masterOfCeremony = process.env.MASTER_OF_CEREMONY;
let poaNetworkConsensusAddress = process.env.POA_NETWORK_CONSENSUS_ADDRESS;
if(network === 'sokol'){
poaNetworkConsensus = await PoaNetworkConsensus.at(poaNetworkConsensusAddress);
await deployer.deploy(ProxyStorage, poaNetworkConsensusAddress, masterOfCeremony);
await poaNetworkConsensus.setProxyStorage(ProxyStorage.address);
await deployer.deploy(KeysManager, ProxyStorage.address, poaNetworkConsensusAddress, masterOfCeremony);
await deployer.deploy(BallotsStorage, ProxyStorage.address);
await deployer.deploy(ValidatorMetadata, ProxyStorage.address);
await deployer.deploy(VotingToChangeKeys, ProxyStorage.address);
await deployer.deploy(VotingToChangeMinThreshold, ProxyStorage.address);
await deployer.deploy(VotingToChangeProxyAddress, ProxyStorage.address);
let proxyStorage = await ProxyStorage.deployed();
await proxyStorage.initializeAddresses(KeysManager.address,
VotingToChangeKeys.address,
VotingToChangeMinThreshold.address,
VotingToChangeProxyAddress.address,
BallotsStorage.address)
console.log('Done')
console.log('ADDRESSES:\n',
`VotingToChangeKeys.address ${VotingToChangeKeys.address} \n
VotingToChangeMinThreshold.address ${VotingToChangeMinThreshold.address} \n
VotingToChangeProxyAddress.address ${VotingToChangeProxyAddress.address} \n
BallotsStorage.address ${BallotsStorage.address} \n
KeysManager.address ${KeysManager.address} \n
ValidatorMetadata.address ${ValidatorMetadata.address} \n
`)

// let initialKey = '0x030b90762cee7a87ee4f51e715a302177043835e';
// let keysManager = await KeysManager.at('0x758492834ed6454f41d6d3d6b73d6e46d4555429');
// await keysManager.initiateKeys(initialKey);
// await keysManager.initiateKeys('0x90B3E2dA7217144E34028FD7f4700a9Cb254f079');
}
};
8 changes: 7 additions & 1 deletion truffle.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ module.exports = {
port: 8555,
gas: 0xfffffffffff,
gasPrice: 0x01
}
},
sokol: {
host: "localhost",
port: 8545,
gas: 4700000,
network_id: "*" // Match any network id
},
},
mocha: {
reporter: 'mochawesome'
Expand Down

0 comments on commit 31209cd

Please sign in to comment.