Skip to content

Instantly share code, notes, and snippets.

@EtDu
Last active March 22, 2020 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EtDu/c28287ce1d72b89d2385837d2a584882 to your computer and use it in GitHub Desktop.
Save EtDu/c28287ce1d72b89d2385837d2a584882 to your computer and use it in GitHub Desktop.
function withdrawFunds() public onlyLandlord {
require(leaseBalanceWei > 0, "Lease balance must be greater than 0");
uint transferAmount = leaseBalanceWei;
leaseBalanceWei = 0;
landlordAddress.transfer(transferAmount);
emit fundsWithdrawn(
transferAmount,
leaseBalanceWei
);
}
function getLease(address tenant) public view returns (
uint8,
uint8,
uint16,
uint16,
uint32,
uint64,
uint64,
bool,
bool) {
Lease memory lease = tenantLease[tenant];
return (
lease.numberOfMonths,
lease.monthsPaid,
lease.monthlyAmountUsd,
lease.leaseDepositUsd,
lease.leasePaymentWindowSeconds,
lease.leasePaymentWindowEnd,
lease.depositPaymentWindowEnd,
lease.leaseDepositPaid,
lease.leaseFullyPaid
);
}
function getRate() public view returns (uint) {
return ETHUSD;
}
function getContractBalance() public view returns (uint) {
return uint(address(this).balance);
}
function() external payable {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment