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.