Module offset

Source
Expand description

Virtual shares offset module for the vault to guard against inflation attacks.

Structs§

TotalShares
This struct wraps the VirtualOffset struct with [TOTAL_SHARES] storage features checked_add_shares and checked_sub_shares implemented. Other methods are mapped to the underlying VirtualOffset instance.
VirtualOffset
Follows the OpenZeppelin’s ERC4626 mitigation strategy for inflation attack. Using a “virtual” offset to +1 to both total shares and assets representing the virtual total shares and virtual total assets. A donation of 1 and under will be completely captured by the vault—without affecting the user. A donation greater than 1, the attacker will suffer loss greater than the user. [https://github.com/OpenZeppelin/openzeppelin-contracts/blob/fa995ef1fe66e1447783cb6038470aba23a6343f/contracts/token/ERC20/extensions/ERC4626.sol#L30-L37]

Functions§

get_total_shares
Get the total shares in circulation