sherlock-audit / 2023-04-jojo-judging

7 stars 4 forks source link

GalloDaSballo - Lack of Fee means JUSDExchange is anti-economical #397

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

GalloDaSballo

medium

Lack of Fee means JUSDExchange is anti-economical

Summary

JUSDExchange doesn't charge a fee, meaning it will always be preferrable to buy JUSD rather than borrowing it.

Vulnerability Detail

JUSD is minted and has an interest rate that has to be paid over time.

Because of liquidations LTV for borrowing will have to be less than 100%

For those reasons, the price of JUSD should always be higher than it's reference asset (USDC) because it unlocks liquidations, and it reflects the loss of opportunity cost losing the ability to gain yield (USDC yields around 4% in most of Defi, for example, Sonne Finance).

This loss of opportunity cost has to be reflected in the token price, for example, see LUSD that always trades above peg because of it.

Knowing this, any rational actor will rather buy JUSD than borrow it

Impact

All JUSD from JUSDExchange will be bought before anyone rationally starts borrowing it (and paying extra)

Code Snippet

https://github.com/sherlock-audit/2023-04-jojo/blob/main/JUSDV1/src/Impl/JUSDExchange.sol#L41-L46

Tool used

Manual Review

Recommendation

Add a fee to JUSDExchange

Also consider allowing to borrow JUSD for free and taking a premium in liquidations, or by investing the collateral in low risk sources

jotaro-ora commented 1 year ago

If a user has no USDC, only ETH, but wants to get some collateral to open a position, they will borrow JUSD.