-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KupiaSec - The protocol should consider the variance of quote tokens' price #113
Comments
Escalate This issue deserves Medium. |
You've created a valid escalation! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
After additionally considering this issue, here's my understanding. Let's assume a scenario of 30% depeg and USDT = 0.7 USD.
Hence, even though it's not a direct loss of funds but a loss in value, this should be a valid medium (considering depeg as an extensive limitation). Thus, planning to accept the escalation and duplicate with #52, since it does a better job of explaining the issue. |
Result: |
Escalations have been resolved successfully! Escalation status:
|
KupiaSec
Medium
The protocol should consider the variance of quote tokens' price
Summary
The protocol uses the
USD
price of base token and it assumes quote token is stablecoin: fixed conversion rate of1 USD = 1 quote token
.But the price of stablecoin can be changed.
There is a recent depeg event in March 2023, where USDC price went as low as 87 cents(Reference).
As a result, if there is variance of quote token, all the conversion between base and quote is incorrect and this can break the protocol's design.
Root Cause
In
oracle.vy:89
, it returns theUSD
price of base token regardless of quote token's price.Internal pre-conditions
None
External pre-conditions
None
Attack Path
None
Impact
The quote token's price variance causes incorrect calculation of token amount and breaks the protocol's design.
PoC
The oracle provides the
USD
price of base token and the protocol uses theUSD
price regardless of quote token's price here.If the quote token's price is changed, these functions return incorrect value.
Mitigation
Ideally, there needs to be an additional oracle to check current Price of quote token and take it's price into the consideration.
Duplicate of #52
The text was updated successfully, but these errors were encountered: