diff --git a/contracts/OrcaVoteManager.sol b/contracts/OrcaVoteManager.sol index 6c1016b..b137eae 100644 --- a/contracts/OrcaVoteManager.sol +++ b/contracts/OrcaVoteManager.sol @@ -4,38 +4,36 @@ pragma solidity 0.7.4; import './OrcaPodManager.sol'; contract OrcaVoteManager { - address deployer; - OrcaPodManager podManager; - // Vote Strategys struct PodVoteStrategy { uint256 votingPeriod; // number of blocks. uint256 minQuorum; // minimum number of votes needed to ratify. } - mapping(uint256 => PodVoteStrategy) public voteStrategiesByPod; - - event CreateVoteStrategy( - uint256 podId, - uint256 votingPeriod, - uint256 minQuorum - ); - // Vote Proposals struct PodVoteProposal { uint256 propoalBlock; // block number of proposal uint256 approveVotes; // number of votes for proposal uint256 rejectVotes; // number of votes against proposal - + bool pending; // has the final vote been tallied address ruleAddress; uint256 ruleMinBalance; } + address private deployer; + OrcaPodManager private podManager; + mapping(uint256 => PodVoteStrategy) public voteStrategiesByPod; mapping(uint256 => PodVoteProposal) public voteProposalByPod; + event CreateVoteStrategy( + uint256 podId, + uint256 votingPeriod, + uint256 minQuorum + ); + event CreateProposal( uint256 podId, address ruleAddress, @@ -47,13 +45,21 @@ contract OrcaVoteManager { constructor(OrcaPodManager _podManager) public { deployer = msg.sender; + podManager = _podManager; } function createProposal (uint256 _podId, address _ruleAddress, uint256 _ruleMinBalance) public { // Check for Pod membership require(!voteProposalByPod[_podId].pending, "There is currently a proposal pending"); - voteProposalByPod[_podId] = PodVoteProposal(block.number,0,0,true,_ruleAddress,_ruleMinBalance ); + voteProposalByPod[_podId] = PodVoteProposal( + block.number + voteStrategiesByPod[_podId].votingPeriod, + 0, + 0, + true, + _ruleAddress, + _ruleMinBalance + ); CreateProposal(_podId, _ruleAddress, _ruleMinBalance, msg.sender); } diff --git a/test/orca.js b/test/orca.js index ec6c0f3..8c48944 100644 --- a/test/orca.js +++ b/test/orca.js @@ -76,8 +76,14 @@ describe("Orca Tests", () => { .to.emit(orcaVoteManager, "CreateProposal") .withArgs(1, orcaToken.address, 10, member.address); - console.log(await orcaVoteManager.voteProposalByPod(1)); - - expect().to.include(0, 0, true, orcaToken.address, 10); + const voteProposale = await orcaVoteManager.voteProposalByPod(1); + // test vote propsale saved + // propoalBlock, approveVotes, rejectVotes, pending, ruleAddress, ruleMinBalance; + // await expect(voteProposale[0]).to.equal(blocknumber) + await expect(voteProposale[1]).to.equal(0); + await expect(voteProposale[2]).to.equal(0); + await expect(voteProposale[3]).to.equal(true); + await expect(voteProposale[4]).to.equal(orcaToken.address); + await expect(voteProposale[5]).to.equal(10); }); });