Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. function buy(address _referal) payable{
  2.  
  3. uint256 amount = msg.value * MULTIPLIER / tokenPrice;
  4.  
  5. amount = amount + amount * buyDiscount / 100;
  6.  
  7. require(balances[owner] >= amount + amount * 7 / 100);
  8. require(balances[msg.sender] + amount + amount * 2 / 100 >= minTokensAmount);
  9. require(balances[msg.sender] + amount + amount * 2 / 100 <= maxTokensAmount);
  10. require(balances[_referal] + amount * 5 / 100 <= maxTokensAmount);
  11.  
  12.  
  13. balances[msg.sender] = balances[msg.sender].add(amount + amount * 2 / 100);
  14.  
  15. balances[_referal] = balances[_referal].add(amount * 5 / 100);
  16.  
  17. balances[owner] = balances[owner] - amount - amount * 7 / 100;
  18.  
  19. tokensSoldInCurrentStage = tokensSoldInCurrentStage.add(amount + amount * 7 / 100);
  20.  
  21. Transfer(owner, msg.sender, amount + amount * 2 / 100);
  22. Transfer(owner, _referal, amount * 5 / 100);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement