This repository has been archived by the owner on Jul 14, 2024. It is now read-only.
nmirchev8 - Curve pool may not be set as oracle, because it perfect 1:1 ratio of uAD, which is hardly possible and anyone can break it depositing/swapping 1 wei #102
Labels
Non-Reward
This issue will not receive a payout
nmirchev8
medium
Curve pool may not be set as oracle, because it perfect 1:1 ratio of uAD, which is hardly possible and anyone can break it depositing/swapping 1 wei
Summary
Protocol sets curve uAD/3CRV metapool as an oracle pool. There is function
LibTWAPOracle::setPool
, which set the pool for ubiquity pool, but there is one validation, which is hardly achievablerequire(_reserve0 != 0 && _reserve1 != 0, "TWAPOracle: NO_RESERVES");
Vulnerability Detail
Curve metapools are pools between 3pool (DAI, USDC, USDT) and another stablecoin pair. The pool liquidity aims to be balanced between the pair, but it is almost impossible to have exact 1:1 allocation of funds in metapool. Here is an example for quite stable pool
USD Metapool: Liquity
:For each stable metapool that you check, there won't be 1:1 ratio between two assets, which means that following the current implementation, code cannot be deployed. Tests are working, because mocked metapool doesn't really act as a real one.
Coded PoC:
Impact
LibTWAPOracle
Code Snippet
https://github.com/sherlock-audit/2023-12-ubiquity/blob/main/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibTWAPOracle.sol#L51
Tool used
Manual Review
Recommendation
Example of 5% tolerance:
Duplicate of #14
The text was updated successfully, but these errors were encountered: