Changed constructor

This commit is contained in:
Richard Ramos 2018-06-26 15:41:28 -04:00
parent 9eb347e32c
commit 2979fbcc2e
5 changed files with 24 additions and 19 deletions

View File

@ -48,10 +48,6 @@
"TestToken": {
"deploy": true
},
"MultiOptionPollManager": {
"deploy": false
},
"SNT": {
"instanceOf": "MiniMeToken",
"deploy": true,
@ -83,10 +79,13 @@
],
"gasLimit": 5000000
},
"PollManager": {
"deploy": true,
"args": ["$MiniMeTokenFactory", "$SNT"]
},
"SingleChoiceFactory": {
"deploy": false
},
"PollManager": {
"deploy": true,
"args": ["$MiniMeTokenFactory", "$SNT"]
},
"SingleChoice": {
"deploy": false
}

View File

@ -0,0 +1,5 @@
pragma solidity ^0.4.23;
contract IPollFactory {
function create(bytes _description) public returns(address);
}

View File

@ -3,6 +3,10 @@ pragma solidity ^0.4.23;
import "../common/Controlled.sol";
import "./LowLevelStringManipulator.sol";
import "../token/MiniMeToken.sol";
import "./IPollFactory.sol";
import "./SingleChoiceFactory.sol";
contract IPollContract {
function deltaVote(int _amount, bytes32 _ballot) public returns (bool _succes);
@ -10,9 +14,6 @@ contract IPollContract {
function question() public constant returns (string);
}
contract IPollFactory {
function create(bytes _description) public returns(address);
}
contract PollManager is LowLevelStringManipulator, Controlled {
@ -33,6 +34,7 @@ contract PollManager is LowLevelStringManipulator, Controlled {
}
Poll[] _polls;
IPollFactory pollFactory;
MiniMeTokenFactory public tokenFactory;
MiniMeToken public token;
@ -41,6 +43,7 @@ contract PollManager is LowLevelStringManipulator, Controlled {
public {
tokenFactory = MiniMeTokenFactory(_tokenFactory);
token = MiniMeToken(_token);
pollFactory = IPollFactory(new SingleChoiceFactory());
}
modifier onlySNTHolder {
@ -52,7 +55,6 @@ contract PollManager is LowLevelStringManipulator, Controlled {
function addPoll(
uint _startBlock,
uint _endBlock,
address _pollFactory,
bytes _description)
public
onlySNTHolder
@ -82,7 +84,7 @@ contract PollManager is LowLevelStringManipulator, Controlled {
proposalSymbol,
true);
p.pollContract = IPollFactory(_pollFactory).create(_description);
p.pollContract = pollFactory.create(_description);
require(p.pollContract != 0);

View File

@ -1,7 +1,8 @@
pragma solidity ^0.4.6;
import "./SingleChoice.sol";
import "./PollManager.sol";
import "./IPollFactory.sol";
contract SingleChoiceFactory is IPollFactory {
uint salt;

View File

@ -26,12 +26,12 @@ config({
],
"gasLimit": 4000000
},
"SingleChoiceFactory": {
"deploy": false
},
"PollManager": {
"deploy": true,
"args": ["$MiniMeTokenFactory", "$SNT"]
},
"SingleChoiceFactory": {
"deploy": true
}
}
});
@ -84,7 +84,6 @@ describe("VotingDapp", function () {
receipt = await PollManager.methods.addPoll(
blockNumber,
blockNumber + 10,
SingleChoiceFactory.options.address,
question)
.send({from: accounts[8]});
assert.fail('should have reverted before');
@ -99,7 +98,6 @@ describe("VotingDapp", function () {
receipt = await PollManager.methods.addPoll(
blockNumber,
blockNumber + 10,
SingleChoiceFactory.options.address,
question)
.send({from: accounts[0]});