Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.5.0;
- library FeesLibrary {
- // this calculates fee of 10% of the original amount
- function calcFees(uint256 amount) public view returns (uint256) {
- uint256 Fees = amount * 10 / 100;
- return Fees;
- }
- function lessFees(uint256 amount) public view returns (uint256) {
- return amount - calcFees(amount);
- }
- }
- contract FoodDelivery {
- function calcFees(uint256 amount) public view returns (uint256) {
- return FeesLibrary.calcFees(amount);
- }
- function lessFees(uint256 amount) public view returns (uint256) {
- return FeesLibrary.lessFees(amount);
- }
- function Pay(address payable seller, address payable delivery, uint256 amount) public {
- seller.transfer(lessFees(amount));
- delivery.transfer(calcFees(amount));
- }
- }
- contract RentalPayment {
- function calcFees(uint256 amount) public view returns (uint256) {
- return FeesLibrary.calcFees(amount);
- }
- function lessFees(uint256 amount) public view returns (uint256) {
- return FeesLibrary.lessFees(amount);
- }
- function PayRent(address payable landlord, address payable broker, uint256 amount) public {
- landlord.transfer(lessFees(amount));
- broker.transfer(calcFees(amount));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement