GithubHelp home page GithubHelp logo

mortgage's Introduction

Mortgage

PROBLEM: What happens if someone does not pay? I think in real life that is why there is a down payment, so it will be the same here

Methodology: I need to update lastPayment at the correct time. For example, if payments are due at the first of each month, I need to update lastPayment when the on the first of each month. This should not be effected if the borrower makes extra payments. PROBLEM: what if the borrower makes a payment during the month so it counts all towards the principal, but does not make a payment at the end of the month when the payment is due. Maybe I should have a collectPayment that the lendor calls at the start of each month. All of the payments made by the borrower for the month will then be correctly allocated. I will first find if he has payed enough to cover the one required payment - if he has then the rest of the payment will go towards principal. But this gets rid of the benefit of paying early in a month so that you reduce the interest for your next payment. I can account for this by figuring out if he has enough to cover the required payment if there was no reduction in interest. Then calculate the new (and smaller)
required payment. Then deduct everything except the new interest payment from the principal

PROBLEM: Under this method, if you only make the minimum payment, which is the interest due, you will only pay off the interest and never reduce the principal so you will never pay off the mortgage

mortgage's People

Watchers

James Cloos avatar Aaron Diamond-Reivich avatar

mortgage's Issues

Unclear Magic Number

Mortgage/Code

Line 71 in 0679664

remainingPrincipal = _principal * 1000;

Why is 1000 used here? It seems like you might be trying to turn things into Finney - but this would require a / rather than a *. Comments would be helpful - and declaring and constants as such, with helpful names!

Magic Numbers Unclear

Unclear constants used throughout the contract. Hard to follow. Should define them as constant uints to help reader/auditer follow along (and to stop yourself from forgetting to update in multiple places!).

Closing other issue about this as this is a superset of that.

Here are some examples:

Mortgage/Code

Line 79 in 0679664

uncollectedPayments += msg.value * 1000;

https://github.com/aarondr77/Mortgage/blob/master/Code#L71

https://github.com/aarondr77/Mortgage/blob/master/Code#L84

collectMoney does not collectMoney

Mortgage/Code

Line 120 in 0679664

collectMoney(withdrawable[lender], withdrawable[borrower]);

collectMoney seems like a mis-named event. Also - style says capitalize the first letter of the Event as well - else this looks like a function call.

Missing Tests/Truffle Structure

Any/all good contract will have some tests to go along with it. This contract would go well with a Truffle directory (and some tests!).

This would help us catch any rounding issues (which I have yet to look for [and I'll refrain for now]) - as well as any other typos that might exist.

Looking forward to checking a comprehensive test suite out :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.