Appearance
Solidity API
PropsERC4626
Diamond facet implementing the ERC4626 tokenized vault standard
Extends ERC4626 (tokenized vault) functionality within the Diamond architecture Manages deposits and withdrawals of an underlying asset token, issuing shares in return Includes treasury management, fee calculation, and graduation mechanisms All core implementation details are in PropsERC4626Internal
TREASURY_ROLE
solidity
bytes32 TREASURY_ROLERole identifier for accounts with treasury management privileges
Constant used by the access control system
init
solidity
function init(address deployer, address _asset, uint256 _initialAssetDeposit) externalInitializes the ERC4626 vault with initial parameters
Can only be called once by the diamond owner or factory Sets up the vault with initial shares and makes an initial deposit
Parameters
| Name | Type | Description |
|---|---|---|
| deployer | address | Address that will provide the initial asset deposit |
| _asset | address | Address of the underlying ERC20 token |
| _initialAssetDeposit | uint256 | Amount of underlying assets to deposit initially |
getDeploymentSeedAmount
solidity
function getDeploymentSeedAmount(address _asset) external view returns (uint256)Gets the deployment seed amount for a given asset
Returns the amount of assets used for initial seeding during deployment
Parameters
| Name | Type | Description |
|---|---|---|
| _asset | address | Address of the underlying asset |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The seed amount for the specified asset |
withdrawAssetsFromTreasury
solidity
function withdrawAssetsFromTreasury(uint256 assets, address receiver) externalWithdraws assets from the treasury
Can only be called by accounts with TREASURY_ROLE or the diamond owner
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | Amount of assets to withdraw |
| receiver | address | Address to receive the withdrawn assets |
decimals
solidity
function decimals() external view virtual returns (uint8)Returns the number of decimals for the vault shares
Decimals are computed by adding an offset to the underlying asset's decimals If reading asset decimals fails, defaults to 18
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint8 | The number of decimals for the vault shares |
asset
solidity
function asset() external view virtual returns (address)Returns the address of the underlying token
Implements IERC4626-asset
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | address | The address of the underlying ERC20 token |
totalAssets
solidity
function totalAssets() external view virtual returns (uint256)Returns the total amount of underlying assets managed by the vault
Implements IERC4626-totalAssets
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The total amount of underlying assets in the vault |
getTreasuryAssetsBalance
solidity
function getTreasuryAssetsBalance() external view virtual returns (uint256)Returns the balance of assets in the treasury
Used to track how many assets are specifically in the treasury portion
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The balance of underlying assets in the treasury |
totalTokens
solidity
function totalTokens() external view virtual returns (uint256)Returns the total amount of vault tokens
Alias for totalSupply
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The total amount of vault tokens/shares |
getTreasuryTokensBalance
solidity
function getTreasuryTokensBalance() external view virtual returns (uint256)Returns the balance of tokens in the treasury
Used to track how many shares are specifically in the treasury portion
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The balance of vault tokens in the treasury |
calculateFee
solidity
function calculateFee(uint256 amount) external view virtual returns (uint256)Calculates the fee amount for a given amount
The fee calculation depends on internal fee rates
Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | The amount to calculate fee for |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The fee amount |
getPercentOfGraduation
solidity
function getPercentOfGraduation() external view virtual returns (uint256)Gets the current percentage towards graduation
Graduation is a milestone that triggers additional behavior
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The percentage progress towards graduation (0-100) |
hasReachedGraduation
solidity
function hasReachedGraduation() external view virtual returns (bool)Checks if the vault has reached graduation
Graduation may trigger liquidity pool deployment
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | Whether graduation has been reached |
convertToSharesWithFees
solidity
function convertToSharesWithFees(uint256 assets) external view virtual returns (uint256, uint256, uint256)Converts an asset amount to share amount while calculating fees
Returns the shares amount, asset fee, and shares fee
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of assets to convert |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | shares The amount of shares that would be minted |
| [1] | uint256 | assetFee The fee amount in assets |
| [2] | uint256 | sharesFee The fee amount in shares |
convertToShares
solidity
function convertToShares(uint256 assets) external view virtual returns (uint256)Converts an asset amount to share amount
Implements IERC4626-convertToShares
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of assets to convert |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of shares that would be minted |
convertToAssetsWithFees
solidity
function convertToAssetsWithFees(uint256 shares) external view virtual returns (uint256, uint256, uint256)Converts a share amount to asset amount while calculating fees
Returns the assets amount, asset fee, and shares fee
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of shares to convert |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | assets The amount of assets that would be withdrawn |
| [1] | uint256 | assetFee The fee amount in assets |
| [2] | uint256 | sharesFee The fee amount in shares |
convertToAssets
solidity
function convertToAssets(uint256 shares) external view virtual returns (uint256)Converts a share amount to asset amount
Implements IERC4626-convertToAssets
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of shares to convert |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of assets that would be withdrawn |
maxDeposit
solidity
function maxDeposit(address owner) external view virtual returns (uint256)Returns the maximum amount of assets that can be deposited
Implements IERC4626-maxDeposit
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | The address that would deposit assets |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The maximum amount of assets that can be deposited |
maxMint
solidity
function maxMint(address receiver) external view virtual returns (uint256)Returns the maximum amount of shares that can be minted
Implements IERC4626-maxMint
Parameters
| Name | Type | Description |
|---|---|---|
| receiver | address | The address that would receive minted shares |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The maximum amount of shares that can be minted |
maxWithdraw
solidity
function maxWithdraw(address owner) external view virtual returns (uint256)Returns the maximum amount of assets that can be withdrawn
Implements IERC4626-maxWithdraw
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | The address that owns the shares |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The maximum amount of assets that can be withdrawn |
maxRedeem
solidity
function maxRedeem(address owner) external view virtual returns (uint256)Returns the maximum amount of shares that can be redeemed
Implements IERC4626-maxRedeem
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | The address that owns the shares |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The maximum amount of shares that can be redeemed |
previewDeposit
solidity
function previewDeposit(uint256 assets) external view virtual returns (uint256)Simulates the amount of shares that would be minted from a deposit
Implements IERC4626-previewDeposit
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of assets to deposit |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of shares that would be minted |
previewMint
solidity
function previewMint(uint256 shares) external view virtual returns (uint256)Simulates the amount of assets needed to mint a specific amount of shares
Implements IERC4626-previewMint
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of shares to mint |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of assets needed |
previewWithdraw
solidity
function previewWithdraw(uint256 assets) external view virtual returns (uint256)Simulates the amount of shares that would be burned for a withdrawal
Implements IERC4626-previewWithdraw
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of assets to withdraw |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of shares that would be burned |
previewRedeem
solidity
function previewRedeem(uint256 shares) external view virtual returns (uint256)Simulates the amount of assets that would be withdrawn from redeeming shares
Implements IERC4626-previewRedeem
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of shares to redeem |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of assets that would be withdrawn |
deposit
solidity
function deposit(uint256 assets, address receiver) public virtual returns (uint256)Deposits assets into the vault and mints shares to receiver
Implements IERC4626-deposit Handles fee calculation and may trigger graduation if threshold is reached
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of assets to deposit |
| receiver | address | The address to receive the minted shares |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of shares minted |
isGraduated
solidity
function isGraduated() external view virtual returns (bool)Indicates whether the vault has already graduated
Graduation triggers liquidity pool creation
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | Whether graduation has already occurred |
mint
solidity
function mint(uint256 shares, address receiver) public virtual returns (uint256)Mints shares to receiver by depositing assets
Implements IERC4626-mint Calculates the required amount of assets for requested shares
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of shares to mint |
| receiver | address | The address to receive the minted shares |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of assets deposited |
withdraw
solidity
function withdraw(uint256 assets, address receiver, address owner) public virtual returns (uint256)Withdraws assets from the vault to receiver
Implements IERC4626-withdraw Burns shares from owner to withdraw assets
Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of assets to withdraw |
| receiver | address | The address to receive the withdrawn assets |
| owner | address | The address that owns the shares to be burned |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of shares burned |
redeem
solidity
function redeem(uint256 shares, address receiver, address owner) public virtual returns (uint256)Redeems shares from owner and sends assets to receiver
Implements IERC4626-redeem Burns shares to withdraw assets
Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of shares to redeem |
| receiver | address | The address to receive the withdrawn assets |
| owner | address | The address that owns the shares |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of assets withdrawn |
allowance
solidity
function allowance(address owner, address spender) public view returns (uint256)Returns the amount of tokens owner has allowed spender to use
Implements IERC20-allowance
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | The address that owns the tokens |
| spender | address | The address authorized to spend tokens |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of tokens approved for spending |
approve
solidity
function approve(address spender, uint256 amount) public returns (bool)Approves spender to spend tokens on behalf of the caller
Implements IERC20-approve
Parameters
| Name | Type | Description |
|---|---|---|
| spender | address | The address authorized to spend tokens |
| amount | uint256 | The amount of tokens to approve |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | Whether the operation succeeded |
balanceOf
solidity
function balanceOf(address account) public view returns (uint256)Returns the balance of tokens owned by an account
Implements IERC20-balanceOf
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | The address to query the balance of |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The amount of tokens owned by account |
name
solidity
function name() public view returns (string)Returns the name of the token
Implements IERC20-name
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | string | The name of the token |
symbol
solidity
function symbol() public view returns (string)Returns the symbol of the token
Implements IERC20-symbol
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | string | The symbol of the token |
totalSupply
solidity
function totalSupply() public view returns (uint256)Returns the total supply of tokens
Implements IERC20-totalSupply
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | uint256 | The total supply of tokens |
transfer
solidity
function transfer(address to, uint256 amount) public returns (bool)Transfers tokens from caller to recipient
Implements IERC20-transfer
Parameters
| Name | Type | Description |
|---|---|---|
| to | address | The address to transfer tokens to |
| amount | uint256 | The amount of tokens to transfer |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | Whether the operation succeeded |
transferFrom
solidity
function transferFrom(address from, address to, uint256 amount) public returns (bool)Transfers tokens from sender to recipient using caller's allowance
Implements IERC20-transferFrom
Parameters
| Name | Type | Description |
|---|---|---|
| from | address | The address to transfer tokens from |
| to | address | The address to transfer tokens to |
| amount | uint256 | The amount of tokens to transfer |
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bool | Whether the operation succeeded |