diff --git a/Makefile b/Makefile index b133fbc..7a56987 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/contracts/interfaces/IKeysManager.sol b/contracts/interfaces/IKeysManager.sol index 0cd461d..8508274 100644 --- a/contracts/interfaces/IKeysManager.sol +++ b/contracts/interfaces/IKeysManager.sol @@ -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; diff --git a/migrations/2_deploy_contract.js b/migrations/2_deploy_contract.js new file mode 100644 index 0000000..8a6099e --- /dev/null +++ b/migrations/2_deploy_contract.js @@ -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'); + } +}; diff --git a/truffle.js b/truffle.js index 1be2f85..ce2f637 100644 --- a/truffle.js +++ b/truffle.js @@ -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'