Keydonix / liquid-long

The Unlicense
8 stars 1 forks source link

Improves library estimate and adds constraint to contracts. #88

Closed MicahZoltu closed 5 years ago

MicahZoltu commented 5 years ago

Makes library return max(estimated_cost, loan_size * 0.01) so that the user will never have 0 for estimated costs. This will increase the chances of the transaction going through successfully, and they'll get a refund in those cases.

Added a constraint to openCdp that ensures the contract ends with the same amount of WETH it started with. This should never fail, but if someone finds a way to attack the contract this is an added layer of protection. This change blew the stack depth limit, so I had to extract some code out into a helper function.

MicahZoltu commented 5 years ago

Changed to >=. Please re-review (only change I made was >= but I want to make sure I didn't get it backward).