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

shaka - Ubiquity Dollar is pegged to 3CRV instead of USD #15

Closed
sherlock-admin opened this issue Jan 10, 2024 · 2 comments
Closed

shaka - Ubiquity Dollar is pegged to 3CRV instead of USD #15

sherlock-admin opened this issue Jan 10, 2024 · 2 comments
Labels
Non-Reward This issue will not receive a payout

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Jan 10, 2024

shaka

high

Ubiquity Dollar is pegged to 3CRV instead of USD

Summary

The stability of the Ubiquity Dollar is tracked in terms of its price in 3CRV, not in USD. So in the event of 3CRV depegging from USD, the stabilization mechanism will not work as intended.

Vulnerability Detail

The mintDollar and redeemDollar functions in the UbiquityPoolFacet contract are meant to be called on Ubiquity Dollar depeg events in order to recover the peg to the USD.

The mint function checks that the Ubiquity Dollar price is over the mintPriceThreshold and the redeem function checks that the Ubiquity Dollar price is under the redeemPriceThreshold.

The issue is that the price returned by getDollarPriceUsd() is the price of the Ubiquity Dollar in 3CRV, not the price of the Ubiquity Dollar in USD, so the mint and redeem functions can only be called when the price of the Ubiquity Dollar depegs from 3CRV.

This will lead to issues in several scenarios. Let's explore some of them:

  • 3CRV depegs from USD, but the Ubiquity Dollar maintains its peg to 3CRV. In this case, the mint and redeem functions will not be callable, even though the Ubiquity Dollar is not pegged to USD.
  • 3CRV depegs from USD, and the Ubiquity Dollar depegs from 3CRV in the opposite direction. For example, 3CRV is worth 0.95 USD, and Ubiquity Dollar is worth 1.02 3CRV (so 0.969 USD). In this case, the mint function will be callable instead of the redeem function, that would be the desired.

Impact

The stabilization mechanism of the price via minting and redeeming will not work as intended, and the Ubiquity Dollar will not be able to recover its peg to USD in depeg events.

Code Snippet

https://github.com/sherlock-audit/2023-12-ubiquity/blob/main/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibTWAPOracle.sol#L104-L122

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

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

Tool used

Manual Review

Recommendation

Use Chainlink price feeds to get the price of the 3CRV token in USD, as explained in the this article and with that value calculate the price of the Ubiquity Dollar in USD.

Duplicate of #59

@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

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

0xLogos commented:

Peg is mantained by collateral pricing in mint/redeem, twap only used only for preventing unnecessary mint/redeem. Also twap is aproximate by nature and intended to prevent manipulation, not peg

auditsea commented:

Defining Ubiquitiy Dollar price based on LP price is protocol decision and seems fine

@github-actions github-actions bot added High A valid High 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

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

0xLogos commented:

Peg is mantained by collateral pricing in mint/redeem, twap only used only for preventing unnecessary mint/redeem. Also twap is aproximate by nature and intended to prevent manipulation, not peg

auditsea commented:

Defining Ubiquitiy Dollar price based on LP price is protocol decision and seems fine

@sherlock-admin sherlock-admin changed the title Dancing Vinyl Sawfish - Ubiquity Dollar is pegged to 3CRV instead of USD shaka - Ubiquity Dollar is pegged to 3CRV instead of USD Jan 24, 2024
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Jan 24, 2024
@Czar102 Czar102 removed the High A valid High severity issue label Feb 19, 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 Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Non-Reward This issue will not receive a payout
Projects
None yet
Development

No branches or pull requests

3 participants