Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. pragma solidity ^0.5.0;
  2.  
  3. library FeesLibrary {
  4.  
  5. // this calculates fee of 10% of the original amount
  6. function calcFees(uint256 amount) public view returns (uint256) {
  7. uint256 Fees = amount * 10 / 100;
  8. return Fees;
  9. }
  10.  
  11. function lessFees(uint256 amount) public view returns (uint256) {
  12. return amount - calcFees(amount);
  13. }
  14.  
  15.  
  16. }
  17.  
  18. contract FoodDelivery {
  19.  
  20. function calcFees(uint256 amount) public view returns (uint256) {
  21. return FeesLibrary.calcFees(amount);
  22. }
  23.  
  24. function lessFees(uint256 amount) public view returns (uint256) {
  25. return FeesLibrary.lessFees(amount);
  26. }
  27.  
  28. function Pay(address payable seller, address payable delivery, uint256 amount) public {
  29. seller.transfer(lessFees(amount));
  30. delivery.transfer(calcFees(amount));
  31. }
  32. }
  33.  
  34. contract RentalPayment {
  35.  
  36. function calcFees(uint256 amount) public view returns (uint256) {
  37. return FeesLibrary.calcFees(amount);
  38. }
  39.  
  40. function lessFees(uint256 amount) public view returns (uint256) {
  41. return FeesLibrary.lessFees(amount);
  42. }
  43.  
  44. function PayRent(address payable landlord, address payable broker, uint256 amount) public {
  45. landlord.transfer(lessFees(amount));
  46. broker.transfer(calcFees(amount));
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement