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

Sneaky Zinc Narwhal - some funds will not be converted nor returned to the depositor #555

Open
sherlock-admin2 opened this issue Feb 17, 2025 · 0 comments

Comments

@sherlock-admin2
Copy link

Sneaky Zinc Narwhal

High

some funds will not be converted nor returned to the depositor

Summary

in the contract TokenRewards function depositFromPairedLpToken line 177 it will try to swap the PAIRED_LP_TOKEN into reward and it uses the function _swapForRewards and if _rewardsSwapAmountInOverride is greater than zero it will override the amounin variable and use that instead of the one that the user deposited so if _rewardsSwapAmountInOverride is less than the one that the user deposited it will try to swap a small amount the problem here is that the user will not receive the remaining amount which is (the amount that the user deposited - _rewardsSwapAmountInOverride)

if (_rewardsSwapAmountInOverride > 0) {
            _adminAmt = (_adminAmt * _rewardsSwapAmountInOverride) / _amountIn;
            _amountOut = (_amountOut * _rewardsSwapAmountInOverride) / _amountIn;
            _amountIn = _rewardsSwapAmountInOverride;
        }

https://github.com/sherlock-audit/2025-01-peapods-finance/blob/main/contracts/contracts/TokenRewards.sol#L293

Root Cause

in the function line 293 _rewardsSwapAmountInOverride will override the actual amount that the user deposited

Internal Pre-conditions

_rewardsSwapAmountInOverride have to be greater than zero

External Pre-conditions

nothing

Attack Path

nothing

Impact

the fund will not be convert or might even stack in the contract

PoC

No response

Mitigation

No response

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