Guest User

Untitled

a guest
Jul 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. pragma solidity ^0.4.19;
  2.  
  3. contract Test2 {
  4. mapping (address => uint) balances;
  5. event Send(address from, address to, uint value);
  6.  
  7.  
  8. constructor (uint256 _balance) public payable {
  9. balances[msg.sender] = _balance;
  10. }
  11.  
  12. function transferInEqualParts(uint256 summaryAmount, address [] recipients) public {
  13. for(uint i=0; i<recipients.length; i++) {
  14. sendTo(summaryAmount/recipients.length, recipients[i]);
  15. }
  16. }
  17.  
  18. function queryBalance(address adr) view returns (uint balance) {
  19. return balances[adr];
  20. }
  21.  
  22. function sendTo(uint _amount, address _recipient) public {
  23. balances[msg.sender] -= _amount;
  24. balances[_recipient] += _amount;
  25.  
  26. Send(msg.sender, _recipient, _amount);
  27. }
  28. }
Add Comment
Please, Sign In to add comment