Closed github-actions[bot] closed 1 year ago
RageTrade shares are held by the depository. It is not the intention to have the user redeem()
the shares created when they deposited. Rather, the user redeems a fixed amount of asset
to the amount of UXD they redeem (1:1). So our usecase users redeem for a given number of assets, not shares.
Closing the issue based on Sponsor's comment.
R2
high
Inconsistent work with
DnGmxSeniorVault
inRageDnDepository
Summary
Inconsistent work with
assets/shares
leads to users funds lossVulnerability Detail
DnGmxSeniorVault
inherits fromERC4626Upgradeable
And inassets/shares
terminology users collateral token (e.g.USDC
) is anasset
(assertToken
), which you deposits to thevault
. And someDnGmxSeniorVault
ERC-20 token is ashares
tokenSo you deposit
asserts
and getshares
Then you withdrawassers
(byvault.withdraw()
) and it burns yourshares
Shares
represents which part of totals vault assets is yoursBut you don't event save you
shares
returned invault.deposit()
function call. You userassets
asshares
and it may lead to big problems:rage-trade
protocol will add fees (it's possible because they use proxy pattern) your protocol will be brokenrage-trade
protocol, you protocol behaviour will be unpredictableImpact
Possibility of protocol DoS in case of adding fees or some unpredictable logic by
rage-trade
protocolCode Snippet
https://github.com/sherlock-audit/2023-01-uxd/blob/main/contracts/integrations/rage-trade/RageDnDepository.sol#L109
https://github.com/sherlock-audit/2023-01-uxd/blob/main/contracts/integrations/rage-trade/RageDnDepository.sol#L131
Tool used
Manual Review
Recommendation
shares
returned fromvault.deposit()
RageDnDepository. redeem()
usevault.redeem()
and user savedshares
instead of usingvault.withdraw()