pub fn virtual_share_offset(base_decimals: u8) -> MathResult<u128>Expand description
The virtual share supply backing one virtual base atom:
10^(SHARE_DECIMALS - base_decimals), the empty-vault mint ratio.
Deposits and redeems price against (total_shares + offset, total_assets + 1)
instead of the raw pair. This is the ERC-4626 virtual-offset defense against
donation/first-deposit share-price inflation: the virtual position absorbs
donated value, so inflating a later depositor’s rounding loss costs the
attacker ~offset times that loss. It also makes pricing continuous through
the empty vault — the first deposit needs no special case.
Only virtual shares are scaled (virtual assets stay at 1): a virtual-asset
offset above 1 would let a full redeem price above total_assets. That
requires base_decimals <= SHARE_DECIMALS, enforced at vault initialization.