Skip to content

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_ROLE

Role identifier for accounts with treasury management privileges

Constant used by the access control system

init

solidity
function init(address deployer, address _asset, uint256 _initialAssetDeposit) external

Initializes 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

NameTypeDescription
deployeraddressAddress that will provide the initial asset deposit
_assetaddressAddress of the underlying ERC20 token
_initialAssetDeposituint256Amount 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

NameTypeDescription
_assetaddressAddress of the underlying asset

Return Values

NameTypeDescription
[0]uint256The seed amount for the specified asset

withdrawAssetsFromTreasury

solidity
function withdrawAssetsFromTreasury(uint256 assets, address receiver) external

Withdraws assets from the treasury

Can only be called by accounts with TREASURY_ROLE or the diamond owner

Parameters

NameTypeDescription
assetsuint256Amount of assets to withdraw
receiveraddressAddress 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

NameTypeDescription
[0]uint8The 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

NameTypeDescription
[0]addressThe 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

NameTypeDescription
[0]uint256The 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

NameTypeDescription
[0]uint256The 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

NameTypeDescription
[0]uint256The 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

NameTypeDescription
[0]uint256The 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

NameTypeDescription
amountuint256The amount to calculate fee for

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
[0]uint256The 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

NameTypeDescription
[0]boolWhether 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

NameTypeDescription
assetsuint256The amount of assets to convert

Return Values

NameTypeDescription
[0]uint256shares The amount of shares that would be minted
[1]uint256assetFee The fee amount in assets
[2]uint256sharesFee 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

NameTypeDescription
assetsuint256The amount of assets to convert

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
sharesuint256The amount of shares to convert

Return Values

NameTypeDescription
[0]uint256assets The amount of assets that would be withdrawn
[1]uint256assetFee The fee amount in assets
[2]uint256sharesFee 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

NameTypeDescription
sharesuint256The amount of shares to convert

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
owneraddressThe address that would deposit assets

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
receiveraddressThe address that would receive minted shares

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
owneraddressThe address that owns the shares

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
owneraddressThe address that owns the shares

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
assetsuint256The amount of assets to deposit

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
sharesuint256The amount of shares to mint

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
assetsuint256The amount of assets to withdraw

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
sharesuint256The amount of shares to redeem

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
assetsuint256The amount of assets to deposit
receiveraddressThe address to receive the minted shares

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
[0]boolWhether 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

NameTypeDescription
sharesuint256The amount of shares to mint
receiveraddressThe address to receive the minted shares

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
assetsuint256The amount of assets to withdraw
receiveraddressThe address to receive the withdrawn assets
owneraddressThe address that owns the shares to be burned

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
sharesuint256The amount of shares to redeem
receiveraddressThe address to receive the withdrawn assets
owneraddressThe address that owns the shares

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
owneraddressThe address that owns the tokens
spenderaddressThe address authorized to spend tokens

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
spenderaddressThe address authorized to spend tokens
amountuint256The amount of tokens to approve

Return Values

NameTypeDescription
[0]boolWhether 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

NameTypeDescription
accountaddressThe address to query the balance of

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
[0]stringThe name of the token

symbol

solidity
function symbol() public view returns (string)

Returns the symbol of the token

Implements IERC20-symbol

Return Values

NameTypeDescription
[0]stringThe symbol of the token

totalSupply

solidity
function totalSupply() public view returns (uint256)

Returns the total supply of tokens

Implements IERC20-totalSupply

Return Values

NameTypeDescription
[0]uint256The 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

NameTypeDescription
toaddressThe address to transfer tokens to
amountuint256The amount of tokens to transfer

Return Values

NameTypeDescription
[0]boolWhether 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

NameTypeDescription
fromaddressThe address to transfer tokens from
toaddressThe address to transfer tokens to
amountuint256The amount of tokens to transfer

Return Values

NameTypeDescription
[0]boolWhether the operation succeeded