In the Sablier contract, anybody can withdraw tokens to the recipient address regardless he is the recipient or not, and calling this on vested tokens will lead to a fatal loss of tokens by the VestedStaker who staked with this stream
In the Sablier contract, anybody can withdraw funds for the recipient of a stream.
Code from SablierV2LockUp::withdraw Line 385
According to the above check, anyone can pass in a to
address as the recipient and withdraw to the recipient address the streamed and claimeable amount.
Since the recipient is the owner of the stream nft, for this case the recipient will be the FjordStaking
contract address. This call will send the vestedStaker's funds from the Sablier lockup contract to FjordStaking
contract address.
These sent funds will be distributed as rewards to all stakers due to the logic in FjordStaking::_checkEpochRollover()
function which subtracts already recorded values and distributes the remaining as rewards.
code from FjordStaking::_checkEpochRollover() Line 691
One may say that the below code in Sablier::withdraw
function will call the FjordStaking::onStreamWithdrawn
function but this function will do nothing since it is intentionally left blank by the developers.
Code from sablierV2LockUp::withdraw function Line 404:
The _allowToHook[recipient]
cannot be true since this contract does not implement the supportInterface function which is required for allowToHook
to be set to true. Even if its true the FjordStaking::onStreamWithdraw function is blank and will do nothing to handle the sent tokens.
The blank FjordStaking::onStreamWithdrawn function Line 792:
The root cause of this issue is the fact that the above FjordStaking::onStreamWithdrawn
function does nothing to handle such a withdraw to it in such a scenario to allocate the staker's funds.
During unstaking, the vestedStaker will not be able to recover his staked funds hence a loss of tokens.
Manual Review
Consider implemnting the FjordStaking::onStreamWithdrawn
function to handle these tokens and add them to the user's staked ammount and prevent it from being distributed as rewards
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.