ERC4626FeesUpgradeable
Inherits: Initializable, ERC4626Upgradeable
ERC-4626 vault with entry/exit fees expressed in https://en.wikipedia.org/wiki/Basis_point[basis point (bp)]. NOTE: The contract charges fees in terms of assets, not shares. This means that the fees are calculated based on the amount of assets that are being deposited or withdrawn, and not based on the amount of shares that are being minted or redeemed. This is an opinionated design decision that should be taken into account when integrating this contract. WARNING: This contract has not been audited and shouldn't be considered production ready. Consider using it with caution.
State Variables
_BASIS_POINT_SCALE
uint256 private constant _BASIS_POINT_SCALE = 1e4;
Functions
__ERC4626Fees_init
function __ERC4626Fees_init() internal onlyInitializing;
__ERC4626Fees_init_unchained
function __ERC4626Fees_init_unchained() internal onlyInitializing;
previewDeposit
Preview taking an entry fee on deposit. See IERC4626-previewDeposit.
function previewDeposit(uint256 assets) public view virtual override returns (uint256);
previewMint
Preview adding an entry fee on mint. See IERC4626-previewMint.
function previewMint(uint256 shares) public view virtual override returns (uint256);
previewWithdraw
Preview adding an exit fee on withdraw. See IERC4626-previewWithdraw.
function previewWithdraw(uint256 assets) public view virtual override returns (uint256);
previewRedeem
Preview taking an exit fee on redeem. See IERC4626-previewRedeem.
function previewRedeem(uint256 shares) public view virtual override returns (uint256);
_deposit
Send entry fee to _entryFeeRecipient. See {IERC4626-_deposit}.
function _deposit(address caller, address receiver, uint256 assets, uint256 shares) internal virtual override;
_withdraw
Send exit fee to _exitFeeRecipient. See {IERC4626-_deposit}.
function _withdraw(address caller, address receiver, address owner, uint256 assets, uint256 shares)
internal
virtual
override;
_entryFeeBasisPoints
function _entryFeeBasisPoints() internal view virtual returns (uint256);
_exitFeeBasisPoints
function _exitFeeBasisPoints() internal view virtual returns (uint256);
_entryFeeRecipient
function _entryFeeRecipient() internal view virtual returns (address);
_exitFeeRecipient
function _exitFeeRecipient() internal view virtual returns (address);
_feeOnRaw
Calculates the fees that should be added to an amount assets
that does not already include fees.
Used in IERC4626-mint and {IERC4626-withdraw} operations.
function _feeOnRaw(uint256 assets, uint256 feeBasisPoints) private pure returns (uint256);
_feeOnTotal
Calculates the fee part of an amount assets
that already includes fees.
Used in IERC4626-deposit and {IERC4626-redeem} operations.
function _feeOnTotal(uint256 assets, uint256 feeBasisPoints) private pure returns (uint256);