pragma solidity ^0.4.17; contract ProposalContract { address private owner; struct Proposal { address to; uint256 amount; string description; string companyName; address proposalOwner; string link; string company_dh_public; string user_dh_public; string communication_id; } struct ApprovedCompany { address company_wallet; string description; string companyName; } Proposal[] public proposals; ApprovedCompany[] public approved; int256 public proposalCount = -1; int256 public approvalCount = -1; modifier ownerOnly() { require(owner == msg.sender); _; } function ProposalContract () public { owner = msg.sender; } function deleteProposal (uint256 _proposalPosition) public { for (uint i = 0; i < proposals.length; i++) { if (msg.sender == proposals[_proposalPosition].proposalOwner || msg.sender == owner) { delete proposals[_proposalPosition]; break; } } } function approveCompany (address _wallet, string _description, string _companyName) public ownerOnly { approved.push(ApprovedCompany({ company_wallet: _wallet, description: _description, companyName: _companyName })); for (uint i = 0; i < proposals.length; i++) { if (proposals[i].proposalOwner == _wallet) { proposals[i].companyName = _companyName; } } approvalCount++; } function deleteCompany (uint256 _companyPosition) public ownerOnly { require(msg.sender == owner); for (uint i = 0; i < proposals.length; i++) { if (proposals[i].proposalOwner == approved[_companyPosition].company_wallet) { proposals[i].companyName = "Company is not approved"; } } delete approved[_companyPosition]; } function kill() public ownerOnly { require(msg.sender == owner); selfdestruct(owner); } } contract EntryUser is ProposalContract { address private owner; struct Offer { string tags; string dbLink; string contacts; address offerOwner; } Offer[] public offers; int256 public walletsCount = -1; modifier ownerOnly() { require(owner == msg.sender); _; } function addOffer (string _tags, string _dbLink, string _contacts) public { offers.push(Offer({ tags: _tags, dbLink: _dbLink, contacts: _contacts, offerOwner: msg.sender })); walletsCount++; } function deleteOffer (uint256 _offerPosition) public { for (uint i = 0; i < offers.length; i++) { if (msg.sender == offers[_offerPosition].offerOwner || msg.sender == owner) { delete offers[_offerPosition]; break; } } } function kill() public ownerOnly { selfdestruct(owner); } } contract IssueTokens is ProposalContract { uint public totalSupply; string public name; string public symbol; uint public decimals; address private owner; mapping (address => uint) allowed; function IssueTokens(uint _amount, string _name, string _symbol, uint _decimals) public { owner = msg.sender; totalSupply = _amount; name = _name; symbol = _symbol; decimals = _decimals; } modifier ownerOnly() { require(owner == msg.sender); _; } function acceptProposal (address _receiver, uint index) public { if (_receiver == msg.sender) { if (allowed[_receiver] == 0) { allowed[_receiver] = proposals[index].amount; } else { allowed[_receiver] += proposals[index].amount; } } } function addProposal (address _to, uint256 _amount, string _description, string _companyName, string _link, string _company_dh_public, string _user_dh_public, string _communication_id) public { bool status = true; for (uint i = 0; i < approved.length; i++) { if (approved[i].company_wallet == msg.sender) { if (allowed[msg.sender] >= _amount) { allowed[msg.sender] -= _amount; proposals.push(Proposal({ to: _to, amount: _amount, description: _description, companyName: _companyName, link: _link, company_dh_public: _company_dh_public, user_dh_public: _user_dh_public, communication_id: _communication_id, proposalOwner: msg.sender })); proposalCount++; status = false; break; } } } if (status == true) { if (allowed[msg.sender] >= _amount) { proposals.push(Proposal({ to: _to, amount: _amount, description: _description, companyName: "Company is not approved", link: _link, company_dh_public: _company_dh_public, user_dh_public: _user_dh_public, communication_id: _communication_id, proposalOwner: msg.sender })); proposalCount++; } } } event EtherDeposit(uint indexed _deposited); event Approval(address indexed _spender, uint256 _value); event Transfer(address indexed _from, address indexed _to, uint _value); event Suicide(address indexed _contract, uint indexed _sentAmount); event Burnt(uint indexed _burnt, uint indexed _totalSupply); function () public ownerOnly payable { EtherDeposit(msg.value); } function balanceOf(address _owner) public view returns (uint balance) { return allowed[_owner]; } function approve(address _spender, uint _value) public ownerOnly returns (bool success) { require(totalSupply >= _value); totalSupply -= _value; allowed[_spender] += _value; Approval(_spender, _value); return true; } function kill() public ownerOnly { Suicide(msg.sender, this.balance); selfdestruct(owner); } function transfer(address _to, uint _amount) public returns (bool success) { require(allowed[msg.sender] >= _amount); allowed[msg.sender] -= _amount; allowed[_to] += _amount; return true; } function transferFrom(address _from, address _to, uint _value) public ownerOnly returns (bool success) { require(allowed[_from] >= _value && allowed[_to] > 0); allowed[_from] -= _value; allowed[_to] += _value; return true; } function burn(uint _amount) public ownerOnly { require(totalSupply >= _amount); totalSupply -= _amount; Burnt(_amount, totalSupply); } }
0.4.17