hifi-finance / hifi

Monorepo implementing the Hifi fixed-rate, fixed-term lending protocol
https://app.hifi.finance
Other
106 stars 15 forks source link

[protocol] Reduce gas costs via unchecked arithmetic #9

Closed PaulRBerg closed 3 years ago

PaulRBerg commented 3 years ago

Because of two reasons:

  1. Checking for {over,under}flow is cheaper.
  2. Certiain operations like modulo are cheaper
PaulRBerg commented 3 years ago

I will close this issue because it's vague and we added lots of unchecked blocks in the meantime. If there is an opportunity to save some gas somewhere, we could open a specific GitHub issue to track that optimization.