The FjordStaking contract fails to properly handle Sablier stream withdrawals, potentially leading to loss of staked tokens for users. When a stream sender withdraws tokens from a Sablier stream that has been staked in the FjordStaking contract, the withdrawn tokens are sent to the contract but not accounted for.
The onStreamWithdrawn
function in the FjordStaking contract is currently left unimplemented:
This lack of implementation creates an issue in the following scenario:
Alice creates a Sablier stream with 100 Fjord tokens to Bob.
Bob stakes the stream NFT in the FjordStaking contract.
Alice calls withdraw
on the Sablier contract, sending 100 Fjord tokens to the FjordStaking contract (the current owner of the NFT).
The withdrawable amount of the NFT is now 0, but the FjordStaking contract has not updated its internal accounting.
When Bob attempts to unstake the NFT using unstakeVested
, he receives back the NFT, but it now has 0 withdrawable tokens.
The 100 Fjord tokens are now trapped in the FjordStaking contract, with no mechanism to retrieve them.
Direct Token Loss: Stakers can permanently lose access to their staked tokens if a stream withdrawal occurs before they unstake.
The contract's internal accounting becomes inaccurate, leading to discrepancies between actual and recorded token balances.
Manual
Implement the onStreamWithdrawn
function in the FjordStaking contract to handle increase the DepositReceipt.staked and reduce DepositReceipt.vestedStaked by the amount. For example:
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.