ebtc-protocol / ebtc

GNU General Public License v3.0
56 stars 25 forks source link

Refactor #686

Closed dapp-whisperer closed 1 year ago

dapp-whisperer commented 1 year ago

The code for surplus will benefit by a refactoring which I can apply after we merge down the rest of the code

The logic is basically a 4x4 -> Underwater or Not -> Full or Partial Liq

If not underwater then math is straightforward

If underwater:

This causes some of the additional checks to be skippable in different scenarios (gas savings)

The logic is sound, imo can be clarified, and I have a draft refactoring I can send once we merge down this + any conflict

Lastly @dapp-whisperer the naming here doesn't have shares not even in the new PR, worth figuring this one out before doing any code changes