What’s sizzling with the latest Bacon update

Allan Carroll
BaconCoin
Published in
2 min readOct 25, 2021

tl;dr

  • We launched the v0.2.1 release on Friday Oct 15th, 2021
  • Fixed a bug in the interest calculation logic
  • Reduced gas costs by using paid interest instead of accrued interest

Last week, the team released an important update to the smart contracts that power the Bacon Protocol. Most importantly, this release fixed one bug and reduced gas costs.

Fixed Interest Calculation Bug

We released a fix for a bug in the method that calculates the interest due for loans in the bHOME Pan. It was calculating that loans owed more interest than they really did.

The bug was caused by a simple mishandling of the USDC token’s atypical 6 decimal point. We have added more test coverage and process around our releases to avoid these kinds of issues in the future.

Because the fix went in before the first payment was due for the loans outstanding, there was no effect on the borrowers or their loans. The contract now shows the correct amount of interest due for their first payments that come due at the start of November.

Lower Gas

Previously, the total value locked in the system was calculated using the interest accrued on the loans. Recalculating the accrued interest required looping over all the loans on each method call. Naturally this was a huge gas guzzler that would only get worse over time and added unneeded complexity to the code. The Pan now uses a much single variable in the calculations that includes the value in the protocol and the interest that has already been paid into the contract.

What’s next?

  • The logic and contracts for the $BACON governance token are being built and tested. We can’t wait to get those tokens on chain for all our early Liquidity Providers!
  • On the side of the loan issuers, we have overwhelming demand to improve the functionality to “lock” rates for borrowers. The process servicers use today to lock rates is costly and requires the Egg to be minted and staked early in the process.

--

--