Change Log

The Following changes have been made to Compound Protocol V2 to allow for additional flexibility while also increasing stability. The fork also allows for additional lines of business to be created once the protocol matures more.
Add borrow cap feature, this feature is cherry-picked from Compound Finance compound-finance/compound-protocol#65
Add a borrow cap check in Comptroller's borrowAllowed hook, disallow further borrowing if a market's totalBorrows reaches its borrow cap Add supply cap feature, implemented in Comptroller.sol, BCapableErc20.sol
Add a supply cap check in Comptroller's mintAllowed hook, disallow further minting (supplying) if a market's cash + totalBorrows reaches its supply cap BCapableErc20 tracks cash by itself instead of using balanceOf of the underlying token. This avoids direct transferring to bToken to manipulate cash. Add collateral cap feature, implemented in Comptroller.sol, BCollateralCapErc20.sol
Add a collateral cap to determine the maximum balance to be considered as collateral. If the cap is reached, users could still supply the asset but it can't be used as collateral. The maximum borrow power of this kind of asset is roughly collateralCap * collateralFactor. Add BWrappedNative to replace old BEther
BWrappedNative could support both the native token and the wrapped native token. Users could choose the native token or the wrapped native token when supplying / borrowing / redeeming / repaying. Support protocol to protocol borrowing without collateral, this gives whitelisted protocol borrows up to credit limit without collateral.
Add credit limit in Comptroller.sol When setting up a credit limit, it also needs to specify the borrowing markets. This can also assist in the Protocol not reaching 100% utilization as a line of credit can be lower than the total TVL inside of the protocol. Support flash loan feature to offer a wide range of use cases, including democratized liquidations, arbitrage, collateral swapping, and interest rate swapping.
Blueberry Bank flash loan complies with EIP-3156 standard. Not every market supports flash loans.