Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

fugazzi - Fragile collateralization model will likely cause bad debt #194

Closed
sherlock-admin2 opened this issue Jan 10, 2024 · 2 comments
Closed
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Jan 10, 2024

fugazzi

high

Fragile collateralization model will likely cause bad debt

Summary

Users are allowed to fully mint on their collateral value, potentially causing bad debt as soon as the collateral price drops.

Vulnerability Detail

The Ubiquity Pool allows users to mint Dollar tokens (uAD) by depositing collateral. The amount of uAD tokens a user is allowed to mint is given by the getDollarInCollateral() function:

    function getDollarInCollateral(
        uint256 collateralIndex,
        uint256 dollarAmount
    ) internal view returns (uint256) {
        UbiquityPoolStorage storage poolStorage = ubiquityPoolStorage();
        return
            dollarAmount
                .mul(UBIQUITY_POOL_PRICE_PRECISION)
                .div(10 ** poolStorage.missingDecimals[collateralIndex])
                .div(poolStorage.collateralPrices[collateralIndex]);
    }

This function takes the requested uAD amount (dollarAmount) and divides it by the current collateral price (poolStorage.collateralPrices[collateralIndex]), returned by Chainlink. This basically means that users are allowed to fully mint on their collateral value, the effective LTV on all collaterals is 100%.

This creates an extremely fragile ecosystem: whenever the price of an asset drops this will instantly mean bad debt for the protocol. Even if the collateral tokens are going to be non-volatile assets such as stablecoins DAI or LUSD, there is no guarantee that these are going to be always pegged to 1 USD. For example, there are times in which DAI dropped significantly from the $1 peg.

Impact

The collateralization model will fail as soon as any supported collateral drops in value, creating bad debt in the pool.

Code Snippet

https://github.com/sherlock-audit/2023-12-ubiquity/blob/main/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol#L284-L294

Tool used

Manual Review

Recommendation

Introduce LTV configurations on collaterals to allow minting up to a certain value of the deposited collateral. Allow and incentivize liquidations to avoid bad debt in the protocol.

Duplicate of #17

@github-actions github-actions bot added the Excluded Excluded by the judge without consulting the protocol or the senior label Jan 14, 2024
@sherlock-admin2
Copy link
Contributor Author

1 comment(s) were left on this issue during the judging contest.

auditsea commented:

The issue describes about the protocol insolvancy in case of collateral depeg. It's not avoidable, that's why the protocol has borrowing function to get yield, take fees on mint and redeem, these features will hedge the risk from protocol insolvancy

@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label and removed Excluded Excluded by the judge without consulting the protocol or the senior labels Jan 16, 2024
@sherlock-admin2
Copy link
Contributor Author

1 comment(s) were left on this issue during the judging contest.

auditsea commented:

The issue describes about the protocol insolvancy in case of collateral depeg. It's not avoidable, that's why the protocol has borrowing function to get yield, take fees on mint and redeem, these features will hedge the risk from protocol insolvancy

@sherlock-admin2 sherlock-admin2 changed the title Soft Coconut Mongoose - Fragile collateralization model will likely cause bad debt fugazzi - Fragile collateralization model will likely cause bad debt Jan 24, 2024
@sherlock-admin2 sherlock-admin2 added the Reward A payout will be made for this issue label Jan 24, 2024
@Czar102 Czar102 removed the Medium A valid Medium severity issue label Feb 14, 2024
@sherlock-admin sherlock-admin added Non-Reward This issue will not receive a payout and removed Reward A payout will be made for this issue labels Feb 14, 2024
@Czar102 Czar102 added the Medium A valid Medium severity issue label Feb 19, 2024
@sherlock-admin sherlock-admin added Reward A payout will be made for this issue and removed Non-Reward This issue will not receive a payout labels Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

3 participants