Skip to content

Solidity API

PropsERC4626Internal

_getDeploymentSeedAmount

solidity
function _getDeploymentSeedAmount(address _asset) internal view returns (uint256)

_calculateFee

solidity
function _calculateFee(uint256 amount) internal pure returns (uint256)

Calculates fee amount for a given value

__ERC4626_init

solidity
function __ERC4626_init(contract IERC20 asset_) internal

Set the underlying asset contract. This must be an ERC20-compatible contract (ERC-20 or ERC-777).

__ERC4626_init_unchained

solidity
function __ERC4626_init_unchained(contract IERC20 asset_) internal

_asset

solidity
function _asset() internal view virtual returns (address)

_totalAssets

solidity
function _totalAssets() internal view virtual returns (uint256)

See {IERC4626-totalAssets}.

_totalTokens

solidity
function _totalTokens() internal view virtual returns (uint256)

_totalTokenReserve

solidity
function _totalTokenReserve() internal view virtual returns (uint256)

_setIsGraduated

solidity
function _setIsGraduated(bool isGraduated) internal

_isGraduated

solidity
function _isGraduated() internal view returns (bool)

_totalAssetReserve

solidity
function _totalAssetReserve() internal view virtual returns (uint256)

_maxDeposit

solidity
function _maxDeposit(address owner) internal view virtual returns (uint256)

_maxMint

solidity
function _maxMint(address receiver) internal view virtual returns (uint256)

_maxWithdraw

solidity
function _maxWithdraw(address owner) internal view virtual returns (uint256)

_maxRedeem

solidity
function _maxRedeem(address owner) internal view virtual returns (uint256)

_previewDeposit

solidity
function _previewDeposit(uint256 assets) internal view virtual returns (uint256, uint256, uint256)

_previewMint

solidity
function _previewMint(uint256 assets) internal view virtual returns (uint256, uint256, uint256)

_previewWithdraw

solidity
function _previewWithdraw(uint256 shares) internal view virtual returns (uint256, uint256, uint256)

_previewRedeem

solidity
function _previewRedeem(uint256 shares) internal view virtual returns (uint256, uint256, uint256)

f

solidity
function f(uint256 A) internal pure returns (uint256)

_Square root bonding curve function mapping asset reserve A to cumulative minted shares. f(A) = SEED_SHARES * sqrt(A/TARGET_ASSETS) Properties:

  • f(0) = 0
  • f(TARGET_ASSETS) = SEED_SHARES
  • Gradual distribution that slows down as more assets are added_

fInv

solidity
function fInv(uint256 S) internal pure returns (uint256)

Inverse of the square root bonding curve. Given S shares, returns the asset amount A where f(A) = S. A = TARGET_ASSETS * (S/SEED_SHARES)^2

_convertToShares

solidity
function _convertToShares(uint256 assets, enum Math.Rounding) internal view virtual returns (uint256, uint256, uint256)

Internal conversion function (from assets to shares) using the differential model. Computes minted shares as: mintedShares = f(A_current + ΔA_net) - f(A_current), where ΔA_net = assets - deposit fee.

_convertToAssets

solidity
function _convertToAssets(uint256 shares, enum Math.Rounding) internal view virtual returns (uint256, uint256, uint256)

Internal conversion function (from shares to assets) using the differential model. Redemption is computed by "rewinding" the cumulative function. Let f(A_current) be the cumulative share count at the current asset reserve A_current. Redeeming X shares will yield an asset redemption of: grossAssets = A_current - fInv( f(A_current) - X ). After subtracting the withdrawal fee, the returned asset amount is: netAssets = grossAssets - fee.

_deposit

solidity
function _deposit(address caller, address receiver, uint256 assets, uint256 shares, uint256 assetFee, uint256 sharesFee) internal virtual

Deposit/mint common workflow. Includes 0.3% fee collection

_withdraw

solidity
function _withdraw(address caller, address receiver, address owner, uint256 assets, uint256 shares, uint256 assetFee, uint256 sharesFee) internal virtual

Withdraw/redeem common workflow. Includes 0.3% fee collection

_increaseTreasuryAssetBalance

solidity
function _increaseTreasuryAssetBalance(uint256 amount) internal

_decreaseTreasuryAssetBalance

solidity
function _decreaseTreasuryAssetBalance(uint256 amount) internal

_getTreasuryAssetBalance

solidity
function _getTreasuryAssetBalance() internal view returns (uint256)

_withdrawAssetsFromTreasury

solidity
function _withdrawAssetsFromTreasury(uint256 assets, address receiver) internal

_increaseTreasuryTokenBalance

solidity
function _increaseTreasuryTokenBalance(uint256 amount) internal

_decreaseTreasuryTokenBalance

solidity
function _decreaseTreasuryTokenBalance(uint256 amount) internal

_getTreasuryTokenBalance

solidity
function _getTreasuryTokenBalance() internal view returns (uint256)

_withdrawTokensFromTreasury

solidity
function _withdrawTokensFromTreasury(uint256 tokens, address receiver) internal

_decimalsOffset

solidity
function _decimalsOffset() internal view virtual returns (uint8)

_setName

solidity
function _setName(string name_) internal

_allowance

solidity
function _allowance(address owner, address spender) internal view returns (uint256)

_approve

solidity
function _approve(address owner, address spender, uint256 amount) internal returns (bool)

_balanceOf

solidity
function _balanceOf(address account) internal view returns (uint256)

Query the token balance of given account

Returns the current balance of an address from storage

Parameters

NameTypeDescription
accountaddressAddress to query the balance of

Return Values

NameTypeDescription
[0]uint256Number of tokens owned by the account

_name

solidity
function _name() internal view returns (string)

Returns the name of the token

Reads the token name from the ERC20MetadataStorage layout

Return Values

NameTypeDescription
[0]stringThe name of the token as a string

_symbol

solidity
function _symbol() internal view returns (string)

Returns the symbol of the token

Reads the token symbol from the ERC20MetadataStorage layout

Return Values

NameTypeDescription
[0]stringThe symbol of the token as a string

_decimals

solidity
function _decimals() internal view virtual returns (uint8)

Returns the number of decimals used for token display

Reads the decimals value from the ERC20MetadataStorage layout. The decimals value is used to determine how to interpret the token's raw numeric value. For example, if decimals is 2, a raw value of 100 should be displayed as 1.00

Return Values

NameTypeDescription
[0]uint8The number of decimals places for token display

_totalSupply

solidity
function _totalSupply() internal view virtual returns (uint256)

See {IERC4626-totalAssets}.

_transfer

solidity
function _transfer(address from, address to, uint256 amount) internal returns (bool)

_transferFrom

solidity
function _transferFrom(address from, address to, uint256 amount) internal returns (bool)

_getPercentOfGraduation

solidity
function _getPercentOfGraduation() internal view returns (uint256)

_hasReachedGraduation

solidity
function _hasReachedGraduation() internal view returns (bool)

Check if the pool has reached graduation threshold (51% of SEED_SHARES distributed)