Open hats-bug-reporter[bot] opened 9 months ago
USDB
rebasing is disabled by default for contracts, the protocol could opt-in to enable rebasing, but there is no function to support that. Additionally (if there were functions to support it) the contracts could receive yield anyway by manually claiming without rebase. I mentioned these in my submission: https://github.com/hats-finance/Blast-Futures-Exchange-0x97895c329b950755566ddcdad3395caaea395074/issues/25
The need to check that a transfer sent the expected amount of tokens arises with fee on transfer tokens, which this contract is not intended to work with. A rebasing token such as USDB does not require this check.
Automatic USDB rebasing is enabled by default for both contracts and EOAs, see https://docs.blast.io/building/guides/weth-yield
Background note: at the time of writing of the current contracts, USDB rebasing was not implemented on blast-sepolia. Redistribution of yield to users is planned for a future version of the contract.
Github username: -- Twitter username: -- Submission hash (on-chain): 0x25a82e92067efc2dd7c7f9ef314133b5f81fd816d421d41637968d3b30a9ffc1 Severity: medium
Description: Description\
Blast Futures Exchange is expected to be deployed on Blast-L2 chain. The Protocol contracts accept USDB token as
PaymentToken
during deposits/transfers/withdraw or claim the tokens.The contracts do not appear to support rebasing tokens i.e USDB whose balance changes during transfers or over time. It should be noted that Rebasing tokens automatically adjusts its supply to maintain a stable price. Therefore, a volatility is expected while using rebasing tokens.
However, The necessary checks include at least verifying the amount of tokens transferred to contracts before and after the actual transfer to infer any fees/interest is missing in contract functionality.
With current implementation, it seems a normal ERC20 token is used in contract, however it is not true. The documentation mentions,
Therefore, balance before and balance after checks should be added in contract so that rebasing tokens should be compatible.
The following instances does not check before and after balance while transfering the tokens to contracts or from contracts, Functions like
stake()
,deposit()
andwithdraw()
is affected in below instances.1)
Bfx.sol
atL-65]
, atL-80
, atL-89
2)
BfxVault.sol
atL-47
, at277
3)PoolDeposit.sol
atL-50
, atL-68
, atL-82
,Recommendation\
Add support in contracts functionality for such rebasing tokens i.e USDB(here) before accepting user-supplied tokens, Consider to check before/after balances during transfers.