Incorrect token-in transfer amount in swap_2_internal_erc20 #16
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-5
🤖_02_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-10-superposition/blob/main/pkg/seawater/src/lib.rs#L286-L297
Vulnerability details
Proof of Concept
In the
swap_2_internal
function, if the first pool experiences a liquidity depletion, it could result inamount_in
being less thanoriginal_amount
. In this case, the contract takesamount_in
tokens from the user and returnsoriginal_amount - amount_in
tokens back to the user. However, the correct calculation should takeoriginal_amount
tokens from the user first. The pool losesoriginal_amount - amount_in
tokens in such cases.Recommended Mitigation Steps
Assessed type
Math
The text was updated successfully, but these errors were encountered: