WrappedVault
Inherits: ERC4626
A wrapper vault built on ERC4626 to facilitate staking operations and reward distribution through the Infrared protocol. Each staking token has a corresponding wrapped vault.
deploy 1 wrapped vault per staking token
State Variables
rewardDistributor
Address of the reward distributor, typically a multisig.
address public immutable rewardDistributor;
iVault
Instance of the associated InfraredVault for staking.
InfraredVault public immutable iVault;
deadShares
Inflation attack prevention
uint256 internal constant deadShares = 1e3;
Functions
constructor
Initializes a new WrappedVault contract for a specific staking token.
constructor(
address _rewardDistributor,
address _infrared,
address _stakingToken,
string memory _name,
string memory _symbol
) ERC4626(ERC20(_stakingToken), _name, _symbol);
Parameters
Name | Type | Description |
---|---|---|
_rewardDistributor | address | Address of the reward distributor (e.g., multisig). |
_infrared | address | Address of the Infrared protocol. |
_stakingToken | address | Address of the ERC20 staking token. |
_name | string | Name of the wrapped vault token (ERC4626). |
_symbol | string | Symbol of the wrapped vault token (ERC4626). |
totalAssets
Returns the total assets managed by the wrapped vault.
Overrides the ERC4626 totalAssets
function to integrate with the InfraredVault balance.
function totalAssets() public view virtual override returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The total amount of staking tokens held by the InfraredVault. |
beforeWithdraw
Hook called before withdrawal operations.
This function ensures that the requested amount of staking tokens is withdrawn from the InfraredVault before being transferred to the user.
function beforeWithdraw(uint256 assets, uint256) internal virtual override;
Parameters
Name | Type | Description |
---|---|---|
assets | uint256 | The amount of assets to withdraw. |
<none> | uint256 |
afterDeposit
Hook called after deposit operations.
This function stakes the deposited tokens into the InfraredVault.
function afterDeposit(uint256 assets, uint256) internal virtual override;
Parameters
Name | Type | Description |
---|---|---|
assets | uint256 | The amount of assets being deposited. |
<none> | uint256 |
claimRewards
Claims rewards from the InfraredVault and transfers them to the reward distributor.
Only rewards other than the staking token itself are transferred.
function claimRewards() external;
Events
RewardClaimed
Event emitted when reward tokens claimed
event RewardClaimed(address indexed token, uint256 amount);