MIP-3 Add cache to reduce gas costs

Simple Summary

Depositing and withdrawing from lending markets (Compound, Aave) constitutes 70-90% of the gas cost of a given transaction. This MIP proposes to implement a cache to reduce frequency of interactions with the lending pools, thus reducing gas costs in MINT, SWAP and REDEEM by 70-90% for the majority of users.


We propose upgrading the Masset.sol contract, allowing it to track and retain a percentage of all collateral in it’s “cache”. Only if necessary will the Masset then deposit or withdraw from the lending markets. When a deposit or withdrawal happens, the cache will reset to the ideal target weight, determined by a governance parameter. Subsequently, the BasketManager.sol will be upgraded to use the cache data during normal interest collection.

Configurable Values (Via MCCP)

Configurable value: Max Cache %

This value will determine the maximum amount of each bAsset that should be in the cache, and is a percentage of total supply of the mAsset. This can be configured by governance.




I like this but does this create a problem like it did for harvest and the exploit? I’m not a dev but I hear it can be easily coded with a time weighted average. I like the idea of this actually but we should make sure it’s safe.

Assuming it is audited and safe as @savannah mentioned, I like it.

What the current related gas cost (estimate… Hundreds? Thousands?) I can see this could save a lot in the long run for sure.

I minted a few hundred mUSD last night and the transaction required 633,598 gas to complete. At 20 Gwei that only cost $4.93, but that’s huge if you only have $20 or $25 worth of stablecoins to mint at once. And if SAVE is truly to be the world’s savings account, then any reduction in gas for people in developing countries is beneficial (especially going from $5 to closer to $2).

@savannah No this will not open up this sort of exploit :slight_smile:

@itsAsecret616 Yeah basically 70-90% savings across the board :slight_smile: so in the hundreds of thousands :laughing:

@dereksilva :ok_hand:

1 Like