Open hats-bug-reporter[bot] opened 1 month ago
Why would a user want to only redeem part of their holdings? This function is a router function to redeem all your tokens when the market is resolved. This looks more like a feature request than a vuln. Moreover, we already added a amount parameter as a result of https://github.com/hats-finance/SeeR-PM-0x899bc13919880db76edf4ccd72bdfa5dfa666fb7/issues/82#issuecomment-2391361721
Github username: -- Twitter username: -- Submission hash (on-chain): 0xdac4932b4ba13934ec992da8bfe3e8db012c23c68f4bb021711f9af8da0fcff6 Severity: medium
Description:
Details
The Router contract enables users to interact with Conditional Token markets. The _redeemPositions function allows users to redeem their winning outcome tokens for the underlying collateral or parent outcome tokens after a market resolves.
The _redeemPositions function incorrectly assumes that the user wants to redeem their entire balance of a specific outcome token. It uses wrapped1155.balanceOf(msg.sender) to determine the amount to redeem. However, the user might only want to redeem a portion of their holdings. This could lead to unexpected behavior and incorrect redemption amounts.
Code Snippet
Impact
This bug forces users to redeem their entire balance of an outcome token, even if they only want to redeem a part of it. This limits user flexibility and could lead to unintended consequences.
Scenario
Fix
Instead of using wrapped1155.balanceOf(msg.sender), the function should accept an amount parameter to allow users to specify the exact amount of each outcome token they want to redeem.
Test
This test sets up a scenario where the user wants to redeem only half of their winning outcome tokens. It then checks the balance after calling redeemPositions with the specified amount to ensure that only the intended amount was redeemed. This verifies that the fix allows for partial redemptions.