Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

Fix compoundV3 get balance of base asset #577

Closed pedrovalido closed 1 year ago

pedrovalido commented 1 year ago

As previously discussed, CompoundV3 has two function for getting the balance of the user depending on the asset. In the provider CompoundV3's getBorrowBalance it was already correct because only the base asset can be borrowed.

In the getDepositBalance, there had to be a slight change to call cMarketV3.collateralBalanceOf(user, asset) (for non base asset) and cMarketV3.balanceOf(user) (for base asset).

In addition to this, a test was added for this purpose using the YieldVault which is the only case we use the base asset as collateral asset.