Skip to content
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

Proud Wintergreen Butterfly - incase_token_got_stuck_handler does not update protocol state leading to corrupted state #83

Open
sherlock-admin4 opened this issue Sep 24, 2024 · 0 comments

Comments

@sherlock-admin4
Copy link

Proud Wintergreen Butterfly

High

incase_token_got_stuck_handler does not update protocol state leading to corrupted state

Summary

The function incase_token_got_stuck_handler does not properly update the pool’s state when transferring tokens from the pool to the admin, which results in corrupted state.

Vulnerability Detail

When calling deposit , withdraw , claim_fee , claim_fee_amount , or swap the pool’s state is properly updated i.e. the reserve and unclaimed_fee variables are checked and increased or decreased.

This is not the case for the incase_token_got_stuck_handler function where there are no checks or updates to the state. Which leads to the rest of the functions to revert if the checks do not hold true.

E.g. when trying to swap amounts that the pool’s reserve says there is enough reserve to swap, but the token_vault’s amount is not sufficient.

Impact

The pool’s core functionality will be unusable if incase_token_got_stuck_handler is used. The issue cannot be reversed since there is no mechanism to correct the corrupted pool state.

Code Snippet

incase_token_got_stuck function
withdraw’s function checks and state update
swap’s sanity check that will revert

Tool used

Manual Review

Recommendation

Properly update the pool state’s reserve and unclaimed_fee so that the pool’s state is not corrupted, and trading may be resumed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant