Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.19;
- contract owned {
- address public owner;
- function owned() {
- owner = msg.sender;
- }
- modifier onlyOwner {
- require(msg.sender == owner);
- _;
- }
- function transferOwnership(address newOwner) onlyOwner {
- owner = newOwner;
- }
- }
- contract tokenRecipient {
- uint256 public balance;
- event receivedEther(address sender, uint amount);
- // event receivedTokens(address _from, uint256 _value, address _token, bytes _extraData);
- // function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData){
- // // Token t = Token(_token);
- // require(t.transferFrom(_from, this, _value));
- // // receivedTokens(_from, _value, _token, _extraData);
- // }
- function () payable {
- receivedEther(msg.sender, msg.value);
- balance += msg.value;
- }
- }
- // contract Token {
- // mapping (address => uint256) public balanceOf;
- // function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
- // }
- /**
- * The shareholder association contract itself
- */
- contract ShareholderOrg is owned, tokenRecipient {
- uint public minimumQuorum;
- uint public debatingPeriodInMinutes;
- Proposal[] public proposals;
- uint public numProposals;
- // Token public sharesTokenAddress;
- event ProposalAdded(uint proposalID, address recipient, uint amount, string description);
- event Voted(uint proposalID, bool position, address voter);
- event ProposalTallied(uint proposalID, uint result, uint quorum, bool active);
- event ChangeOfRules(uint newMinimumQuorum, uint newDebatingPeriodInMinutes, address newSharesTokenAddress);
- struct Proposal {
- address recipient;
- uint amount;
- string description;
- uint votingDeadline;
- bool executed;
- bool proposalPassed;
- uint numberOfVotes;
- bytes32 proposalHash;
- Vote[] votes;
- mapping (address => bool) voted;
- }
- struct Vote {
- bool inSupport;
- address voter;
- }
- // Modifier that allows only shareholders to vote and create new proposals
- modifier onlyShareholders {
- require(sharesTokenAddress.balanceOf(msg.sender) > 0);
- _;
- }
- function withdrawProfit() onlyShareholders returns (bool success) {
- }
- /**
- * Constructor function
- *
- * First time setup
- */
- function ShareholderOrg(Token sharesAddress, uint minimumSharesToPassAVote, uint minutesForDebate) payable {
- changeVotingRules(sharesAddress, minimumSharesToPassAVote, minutesForDebate);
- }
- /**
- * Change voting rules
- *
- * Make so that proposals need tobe discussed for at least `minutesForDebate/60` hours
- * and all voters combined must own more than `minimumSharesToPassAVote` shares of token `sharesAddress` to be executed
- *
- * @param sharesAddress token address
- * @param minimumSharesToPassAVote proposal can vote only if the sum of shares held by all voters exceed this number
- * @param minutesForDebate the minimum amount of delay between when a proposal is made and when it can be executed
- */
- function changeVotingRules(Token sharesAddress, uint minimumSharesToPassAVote, uint minutesForDebate) onlyOwner {
- sharesTokenAddress = Token(sharesAddress);
- if (minimumSharesToPassAVote == 0 ) minimumSharesToPassAVote = 1;
- minimumQuorum = minimumSharesToPassAVote;
- debatingPeriodInMinutes = minutesForDebate;
- ChangeOfRules(minimumQuorum, debatingPeriodInMinutes, sharesTokenAddress);
- }
- }
Add Comment
Please, Sign In to add comment