If an order is partially filled, the user will not receive a refund
Summary
If a filler chooses to partially fill a order, The input token of the submitter of the order will be transferred in full to GladiusReactor, and won't be refunded.
Vulnerability Detail
When the contract requests input tokens from Permit2, the following logic is executed:
LTDingZhen
high
If an order is partially filled, the user will not receive a refund
Summary
If a filler chooses to partially fill a order, The input token of the submitter of the order will be transferred in full to
GladiusReactor
, and won't be refunded.Vulnerability Detail
When the contract requests input tokens from
Permit2
, the following logic is executed:function
toPermit()
is used to extract token transfer logic fromorder
:As shown above, the
maxAmount
input token of the user's order is transferred toGladiusReactor
, rather than the amount being filled.When paying the exchanged tokens to the user, these input tokens are not refunded.
Impact
A partion of input tokens of partially filled orders are locked in the contract.
Code Snippet
https://github.com/sherlock-audit/2024-02-rubicon-finance/blob/main/gladius-contracts-internal/src/lib/Permit2Lib.sol#L10
Tool used
Manual Review
Recommendation
Add a refund mechanism, or modify the
Permit2Lib
to make it avaliable for partial transferfrom.