The SablierFlowBase::recover
function is designed to recover funds that have been accidentally sent to the contract. It calculates the contract's token balance, subtracts the aggregate balance of that same token, and sends the remaining difference to an address specified in the function's parameters.
Note: The aggregateBalance
is a mapping (mapping(IERC20 token => uint256 amount)
) that tracks the total balances of the every token that interacts with the contract functions.
The issue arises when a token has multiple addresses through which its functions can be called. In this situation, the protocol's admin could potentially drain the entire balance of a token by using an address that was not originally employed to create the streams.
Note: Currently, I am not aware of any tokens with this behavior, but it should be considered because such tokens could emerge in the future. Since the tokens used in the streams are selected by regular users, it's important to account for this possibility.
Additionally, it could lead to the creation of multiple aggregate balances for the same token.
Drain the contract funds of a specific token.
Creation of multiple aggregate balances for the same token.
Add a function to block specific addresses of tokens. This will allow you to block secondary addresses when such tokens are introduced in the future.
Create a modifier:
Add it to the function:
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.