Swap function doesn't contain an amountLimit, a user might end up receiving a different amount of assets than expected, or spending more than intended due to price changes during the transaction's execution.
Impact
Financial loss due to receiving execution of the transaction in a time not controlled by the user
Add amountLimit parameter to swap function,
and revert the transaction if amountOut won't be greater or equal to amountLimit if the amountType is IN,
or revert if amountIn will be greater than amountLimitif the amountType is OUT,
PawelK
medium
No
amountLimit
inswap
functionSummary
No
amountLimit
parameter inswap
functionVulnerability Detail
Swap function doesn't contain an
amountLimit
, a user might end up receiving a different amount of assets than expected, or spending more than intended due to price changes during the transaction's execution.Impact
Financial loss due to receiving execution of the transaction in a time not controlled by the user
Code Snippet
Tool used
Manual Review
Recommendation
Add
amountLimit
parameter toswap
function, and revert the transaction ifamountOut
won't be greater or equal to amountLimit if theamountType
isIN
, or revert ifamountIn
will be greater thanamountLimit
if theamountType
isOUT
,Duplicate of #88