Incompatible with fee-on-transfer tokens
Users can deposit collateral tokens into the vault and receive shares. The implementation updates the active stake and calculates shares with the user's specified amount.
function deposit(address onBehalfOf, uint256 amount) external returns (uint256 shares) {
// [...]
IERC20(collateral).safeTransferFrom(msg.sender, address(this), amount);
uint256 activeStake_ = activeStake();
uint256 activeShares_ = activeShares();
shares = ERC4626Math.previewDeposit(amount, activeShares_, activeStake_);
_activeStake.push(Time.timestamp(), activeStake_ + amount);
// [...]
}
If the collateral is a fee-on-transfer token, the vault will receive tokens less than the amount
. This will cause a mismatch between the accounting and the actual balance of the contract.
To support fee-on-transfer tokens, we recommend checking the balance before and after the transfer. This way the vault gets the actual amount of tokens received.