The `OperatorStaking` contract allows operators to deposit tokens but fails to transfer out tokens during the withdrawal process. Although the internal accounting is handled correctly, the actual token transfer is missing, leaving operators unable to retrieve their staked tokens when they initiate a withdrawal.
In the `OperatorStaking` contract, deposits are accepted using the `onTokenTransfer` function, which increases the operator's share balances. However, the `_withdraw` function, which is responsible for processing withdrawals, only adjusts the internal accounting for shares and does not perform the actual token transfer. This results in the operator being unable to retrieve their staked tokens from the contract.
Relevant parts of the contract:
1. **Deposit Function** (`onTokenTransfer`):
2. **remove Operators Function** (`_withdraw`):
3. **Withdraw Function** (`_withdraw`):
The `_withdraw` function only performs the internal accounting of shares but fails to include the logic for transferring tokens back to the operator, which means operators will never receive their tokens after initiating a withdrawal.
- **Loss of Withdrawn Funds**: Operators can deposit tokens into the staking pool, but when they attempt to withdraw, the tokens remain locked in the contract. This results in operators permanently losing access to their staked tokens.
Manual review
To fix this issue, the withdrawal function should include a token transfer to return the tokens to the operator.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.