IEthMultiVault

Git Source

Author: 0xIntuition

Interface for managing many ERC4626 style vaults in a single contract

Functions

init

Initializes the EthMultiVault contract

function init(
    GeneralConfig memory _generalConfig,
    AtomConfig memory _atomConfig,
    TripleConfig memory _tripleConfig,
    WalletConfig memory _walletConfig,
    VaultFees memory _defaultVaultFees,
    BondingCurveConfig memory _bondingCurveConfig
) external;

Parameters

NameTypeDescription
_generalConfigGeneralConfigGeneral configuration struct
_atomConfigAtomConfigAtom configuration struct
_tripleConfigTripleConfigTriple configuration struct
_walletConfigWalletConfigWallet configuration struct
_defaultVaultFeesVaultFeesDefault vault fees struct NOTE: This function is called only once (during contract deployment)
_bondingCurveConfigBondingCurveConfig

reinitialize

Reinitialize the contract with new bonding curve configuration

function reinitialize(BondingCurveConfig calldata bondingCurveConfig) external;

Parameters

NameTypeDescription
bondingCurveConfigBondingCurveConfigThe new bonding curve configuration

pause

pauses the pausable contract methods

function pause() external;

unpause

unpauses the pausable contract methods

function unpause() external;

scheduleOperation

schedule an operation to be executed after a delay

function scheduleOperation(bytes32 operationId, bytes calldata data) external;

Parameters

NameTypeDescription
operationIdbytes32unique identifier for the operation
databytesdata to be executed

cancelOperation

execute a scheduled operation

function cancelOperation(bytes32 operationId, bytes calldata data) external;

Parameters

NameTypeDescription
operationIdbytes32unique identifier for the operation
databytesdata to be executed

setAdmin

Requires new admin to 'confirm' the timelocked operation

set admin

function setAdmin(address admin) external;

Parameters

NameTypeDescription
adminaddressaddress of the new admin

setProtocolMultisig

set protocol multisig

function setProtocolMultisig(address protocolMultisig) external;

Parameters

NameTypeDescription
protocolMultisigaddressaddress of the new protocol multisig

setMinDeposit

sets the minimum deposit amount for atoms and triples

function setMinDeposit(uint256 minDeposit) external;

Parameters

NameTypeDescription
minDeposituint256new minimum deposit amount

setMinShare

sets the minimum share amount for atoms and triples

function setMinShare(uint256 minShare) external;

Parameters

NameTypeDescription
minShareuint256new minimum share amount

setAtomUriMaxLength

sets the atom URI max length

function setAtomUriMaxLength(uint256 atomUriMaxLength) external;

Parameters

NameTypeDescription
atomUriMaxLengthuint256new atom URI max length

setAtomWalletInitialDepositAmount

sets the atom share lock fee

function setAtomWalletInitialDepositAmount(uint256 atomWalletInitialDepositAmount) external;

Parameters

NameTypeDescription
atomWalletInitialDepositAmountuint256new atom share lock fee

setAtomCreationProtocolFee

sets the atom creation fee

function setAtomCreationProtocolFee(uint256 atomCreationProtocolFee) external;

Parameters

NameTypeDescription
atomCreationProtocolFeeuint256new atom creation fee

setTripleCreationProtocolFee

sets fee charged in wei when creating a triple to protocol multisig

function setTripleCreationProtocolFee(uint256 tripleCreationProtocolFee) external;

Parameters

NameTypeDescription
tripleCreationProtocolFeeuint256new fee in wei

setTotalAtomDepositsOnTripleCreation

sets the atom deposit fraction on triple creation used to increase the amount of assets in the underlying atom vaults on triple creation

function setTotalAtomDepositsOnTripleCreation(uint256 totalAtomDepositsOnTripleCreation) external;

Parameters

NameTypeDescription
totalAtomDepositsOnTripleCreationuint256new atom deposit fraction on triple creation

setAtomDepositFractionForTriple

sets the atom deposit fraction percentage for atoms used in triples (number to be divided by generalConfig.feeDenominator)

function setAtomDepositFractionForTriple(uint256 atomDepositFractionForTriple) external;

Parameters

NameTypeDescription
atomDepositFractionForTripleuint256new atom deposit fraction percentage

setBondingCurveConfig

sets the bonding curve configuration

function setBondingCurveConfig(address registry, uint256 defaultCurveId) external;

Parameters

NameTypeDescription
registryaddressaddress of the new bonding curve registry
defaultCurveIduint256new default curve ID

setEntryFee

sets entry fees for the specified vault (id=0 sets the default fees for all vaults) id = 0 changes the default entry fee, id = n changes fees for vault n specifically

admin cannot set the entry fee to be greater than maxEntryFeePercentage, which is set to be the 10% of generalConfig.feeDenominator (which represents 100%), to avoid being able to prevent users from depositing assets with unreasonable fees

function setEntryFee(uint256 id, uint256 entryFee) external;

Parameters

NameTypeDescription
iduint256vault id to set entry fee for
entryFeeuint256entry fee to set

setExitFee

sets exit fees for the specified vault (id=0 sets the default fees for all vaults) id = 0 changes the default exit fee, id = n changes fees for vault n specifically

admin cannot set the exit fee to be greater than maxExitFeePercentage, which is set to be the 10% of generalConfig.feeDenominator (which represents 100%), to avoid being able to prevent users from withdrawing their assets

function setExitFee(uint256 id, uint256 exitFee) external;

Parameters

NameTypeDescription
iduint256vault id to set exit fee for
exitFeeuint256exit fee to set

setProtocolFee

sets protocol fees for the specified vault (id=0 sets the default fees for all vaults) id = 0 changes the default protocol fee, id = n changes fees for vault n specifically

admin cannot set the protocol fee to be greater than maxProtocolFeePercentage, which is set to be the 10% of generalConfig.feeDenominator (which represents 100%), to avoid being able to prevent users from depositing or withdrawing their assets with unreasonable fees

function setProtocolFee(uint256 id, uint256 protocolFee) external;

Parameters

NameTypeDescription
iduint256vault id to set protocol fee for
protocolFeeuint256protocol fee to set

setAtomWarden

sets the atomWarden address

function setAtomWarden(address atomWarden) external;

Parameters

NameTypeDescription
atomWardenaddressaddress of the new atomWarden

deployAtomWallet

deploy a given atom wallet

function deployAtomWallet(uint256 atomId) external returns (address);

Parameters

NameTypeDescription
atomIduint256vault id of atom

Returns

NameTypeDescription
<none>addressatomWallet the address of the atom wallet NOTE: deploys an ERC4337 account (atom wallet) through a BeaconProxy. Reverts if the atom vault does not exist

approve

Set the approval type for a sender to act on behalf of the receiver

function approve(address sender, ApprovalTypes approvalType) external;

Parameters

NameTypeDescription
senderaddressaddress to set approval for
approvalTypeApprovalTypestype of approval to grant (NONE = 0, DEPOSIT = 1, REDEMPTION = 2, BOTH = 3)

createAtom

Create an atom and return its vault id

function createAtom(bytes calldata atomUri) external payable returns (uint256);

Parameters

NameTypeDescription
atomUribytesatom data to create atom with

Returns

NameTypeDescription
<none>uint256id vault id of the atom NOTE: This function will revert if called with less than getAtomCost() in msg.value

batchCreateAtom

Batch create atoms and return their vault ids

function batchCreateAtom(bytes[] calldata atomUris) external payable returns (uint256[] memory);

Parameters

NameTypeDescription
atomUrisbytes[]atom data array to create atoms with

Returns

NameTypeDescription
<none>uint256[]ids vault ids array of the atoms NOTE: This function will revert if called with less than getAtomCost() * atomUris.length in msg.value

createTriple

create a triple and return its vault id

function createTriple(uint256 subjectId, uint256 predicateId, uint256 objectId) external payable returns (uint256);

Parameters

NameTypeDescription
subjectIduint256vault id of the subject atom
predicateIduint256vault id of the predicate atom
objectIduint256vault id of the object atom

Returns

NameTypeDescription
<none>uint256id vault id of the triple NOTE: This function will revert if called with less than getTripleCost() in msg.value. This function will revert if any of the atoms do not exist or if any ids are triple vaults.

batchCreateTriple

batch create triples and return their vault ids

function batchCreateTriple(uint256[] calldata subjectIds, uint256[] calldata predicateIds, uint256[] calldata objectIds)
    external
    payable
    returns (uint256[] memory);

Parameters

NameTypeDescription
subjectIdsuint256[]vault ids array of subject atoms
predicateIdsuint256[]vault ids array of predicate atoms
objectIdsuint256[]vault ids array of object atoms NOTE: This function will revert if called with less than getTripleCost() * array.length in msg.value. This function will revert if any of the atoms do not exist or if any ids are triple vaults.

depositAtom

deposit eth into an atom vault and grant ownership of 'shares' to 'reciever' *payable msg.value amount of eth to deposit

assets parameter is omitted in favor of msg.value, unlike in ERC4626

function depositAtom(address receiver, uint256 id) external payable returns (uint256);

Parameters

NameTypeDescription
receiveraddressthe address to receive the shares
iduint256the vault ID of the atom

Returns

NameTypeDescription
<none>uint256shares the amount of shares minted NOTE: this function will revert if the minimum deposit amount of eth is not met and if the vault ID does not exist/is not an atom.

depositAtomCurve

deposit eth into an atom vault and grant ownership of 'shares' to 'reciever' *payable msg.value amount of eth to deposit

assets parameter is omitted in favor of msg.value, unlike in ERC4626

function depositAtomCurve(address receiver, uint256 atomId, uint256 curveId) external payable returns (uint256);

Parameters

NameTypeDescription
receiveraddressthe address to receive the shares
atomIduint256the vault ID of the atom
curveIduint256the vault ID of the curve

Returns

NameTypeDescription
<none>uint256shares the amount of shares minted NOTE: this function will revert if the minimum deposit amount of eth is not met and if the vault ID does not exist/is not an atom.

redeemAtom

redeem assets from an atom vault

function redeemAtom(uint256 shares, address receiver, uint256 id) external returns (uint256);

Parameters

NameTypeDescription
sharesuint256the amount of shares to redeem
receiveraddressthe address to receiver the assets
iduint256the vault ID of the atom

Returns

NameTypeDescription
<none>uint256assets the amount of assets/eth withdrawn NOTE: Emergency redemptions without any fees being charged are always possible, even if the contract is paused See getRedeemAssetsAndFees for more details on the fees charged

redeemAtomCurve

redeem shares from a bonding curve atom vault for assets

function redeemAtomCurve(uint256 shares, address receiver, uint256 atomId, uint256 curveId)
    external
    returns (uint256);

Parameters

NameTypeDescription
sharesuint256the amount of shares to redeem
receiveraddressthe address to receiver the assets
atomIduint256the vault ID of the atom
curveIduint256the vault ID of the curve

Returns

NameTypeDescription
<none>uint256assets the amount of assets/eth withdrawn NOTE: Emergency redemptions without any fees being charged are always possible, even if the contract is paused See getRedeemAssetsAndFees for more details on the fees charged

depositTriple

deposits assets of underlying tokens into a triple vault and grants ownership of 'shares' to 'receiver' *payable msg.value amount of eth to deposit

assets parameter is omitted in favor of msg.value, unlike in ERC4626

function depositTriple(address receiver, uint256 id) external payable returns (uint256);

Parameters

NameTypeDescription
receiveraddressthe address to receive the shares
iduint256the vault ID of the triple

Returns

NameTypeDescription
<none>uint256shares the amount of shares minted NOTE: this function will revert if the minimum deposit amount of eth is not met and if the vault ID does not exist/is not a triple.

depositTripleCurve

deposit eth into a bonding curve triple vault and grant ownership of 'shares' to 'receiver' *payable msg.value amount of eth to deposit

assets parameter is omitted in favor of msg.value, unlike in ERC4626

function depositTripleCurve(address receiver, uint256 tripleId, uint256 curveId) external payable returns (uint256);

Parameters

NameTypeDescription
receiveraddressthe address to receive the shares
tripleIduint256the vault ID of the triple
curveIduint256the vault ID of the curve

Returns

NameTypeDescription
<none>uint256shares the amount of shares minted NOTE: this function will revert if the minimum deposit amount of eth is not met and if the vault ID does not exist/is not a triple.

redeemTriple

redeems 'shares' number of shares from the triple vault and send 'assets' eth from the contract to 'reciever' factoring in exit fees

function redeemTriple(uint256 shares, address receiver, uint256 id) external returns (uint256);

Parameters

NameTypeDescription
sharesuint256the amount of shares to redeem
receiveraddressthe address to receiver the assets
iduint256the vault ID of the triple

Returns

NameTypeDescription
<none>uint256assets the amount of assets/eth withdrawn NOTE: Emergency redemptions without any fees being charged are always possible, even if the contract is paused See getRedeemAssetsAndFees for more details on the fees charged

redeemTripleCurve

redeem shares from a bonding curve triple vault for assets

function redeemTripleCurve(uint256 shares, address receiver, uint256 tripleId, uint256 curveId)
    external
    returns (uint256);

Parameters

NameTypeDescription
sharesuint256the amount of shares to redeem
receiveraddressthe address to receiver the assets
tripleIduint256the vault ID of the triple
curveIduint256the vault ID of the curve

Returns

NameTypeDescription
<none>uint256assets the amount of assets/eth withdrawn NOTE: Emergency redemptions without any fees being charged are always possible, even if the contract is paused See getRedeemAssetsAndFees for more details on the fees charged

batchDeposit

deposit eth into multiple terms and grant ownership of 'shares' to 'reciever' *payable msg.value amount of eth to deposit works with atoms, triples, and counter-triples

function batchDeposit(address receiver, uint256[] calldata termIds, uint256[] calldata amounts)
    external
    payable
    returns (uint256[] memory);

Parameters

NameTypeDescription
receiveraddressthe address to receive the shares
termIdsuint256[]the IDs of the terms (atoms, triples, or counter-triples) to deposit into
amountsuint256[]array of the amount to deposit in each vault

Returns

NameTypeDescription
<none>uint256[]shares the amount of shares minted for each atom

batchDepositCurve

deposit eth into an atom vault and grant ownership of 'shares' to 'reciever' *payable msg.value amount of eth to deposit

function batchDepositCurve(
    address receiver,
    uint256[] calldata termIds,
    uint256[] calldata curveIds,
    uint256[] calldata amounts
) external payable returns (uint256[] memory);

Parameters

NameTypeDescription
receiveraddressthe address to receive the shares
termIdsuint256[]array of the vault IDs of the terms (atoms, triples, or counter-triples)
curveIdsuint256[]array of the vault IDs of the curves
amountsuint256[]array of the amount to deposit in each vault

Returns

NameTypeDescription
<none>uint256[]shares array of the amount of shares minted in the specified vaults

batchRedeem

redeem shares from an atom vault for assets -- works for atoms, triples and counter-triples

function batchRedeem(uint256 percentage, address receiver, uint256[] calldata ids)
    external
    returns (uint256[] memory);

Parameters

NameTypeDescription
percentageuint256the percentage of shares to redeem from each vault (i.e. 50% -> 50, 100% -> 100)
receiveraddressthe address to receiver the assets
idsuint256[]array of IDs of the term (atom, triple or counter-triple) to redeem from

Returns

NameTypeDescription
<none>uint256[]assets the amount of assets/eth withdrawn

batchRedeemCurve

redeem shares from bonding curve atom vaults for assets

function batchRedeemCurve(uint256 percentage, address receiver, uint256[] calldata termIds, uint256[] calldata curveIds)
    external
    returns (uint256[] memory);

Parameters

NameTypeDescription
percentageuint256the percentage of shares to redeem from the vaults
receiveraddressthe address to receiver the assets
termIdsuint256[]array of the IDs of the terms (atoms, triples, or counter-triples)
curveIdsuint256[]array of the IDs of the curves for each term

Returns

NameTypeDescription
<none>uint256[]assets array of the amounts of assets/eth withdrawn

getAtomCost

returns the cost of creating an atom

function getAtomCost() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256atomCost the cost of creating an atom

getTripleCost

returns the cost of creating a triple

function getTripleCost() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256tripleCost the cost of creating a triple

getDepositFees

returns the total fees that would be charged for depositing 'assets' into a vault

function getDepositFees(uint256 assets, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate fees on
iduint256vault id to get corresponding fees for

Returns

NameTypeDescription
<none>uint256totalFees total fees that would be charged for depositing 'assets' into a vault

getDepositSharesAndFees

returns the shares for recipient and other important values when depositing 'assets' into a vault

function getDepositSharesAndFees(uint256 assets, uint256 id)
    external
    view
    returns (uint256, uint256, uint256, uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate fees on (should always be msg.value - protocolFee)
iduint256vault id to get corresponding fees for

Returns

NameTypeDescription
<none>uint256totalAssetsDelta changes in vault's total assets
<none>uint256sharesForReceiver changes in vault's total shares (shares owed to receiver)
<none>uint256userAssetsAfterTotalFees amount of assets that goes towards minting shares for the receiver
<none>uint256entryFee amount of assets that would be charged for the entry fee

getRedeemAssetsAndFees

returns the assets for receiver and other important values when redeeming 'shares' from a vault

function getRedeemAssetsAndFees(uint256 shares, uint256 id)
    external
    view
    returns (uint256, uint256, uint256, uint256);

Parameters

NameTypeDescription
sharesuint256amount of shares to calculate fees on
iduint256vault id to get corresponding fees for

Returns

NameTypeDescription
<none>uint256totalUserAssets total amount of assets user would receive if redeeming 'shares', not including fees
<none>uint256assetsForReceiver amount of assets that is redeemable by the receiver
<none>uint256protocolFee amount of assets that would be sent to the protocol multisig
<none>uint256exitFee amount of assets that would be charged for the exit fee

entryFeeAmount

returns amount of assets that would be charged for the entry fee given an amount of 'assets' provided

function entryFeeAmount(uint256 assets, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate fee on
iduint256vault id to get corresponding fees for

Returns

NameTypeDescription
<none>uint256feeAmount amount of assets that would be charged for the entry fee NOTE: if the vault being deposited on has a vault total shares of 0, the entry fee is not applied

exitFeeAmount

returns amount of assets that would be charged for the exit fee given an amount of 'assets' provided

function exitFeeAmount(uint256 assets, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate fee on
iduint256vault id to get corresponding fees for

Returns

NameTypeDescription
<none>uint256feeAmount amount of assets that would be charged for the exit fee NOTE: if the vault being redeemed from given the shares to redeem results in a total shares after of 0, the exit fee is not applied

protocolFeeAmount

returns amount of assets that would be charged by a vault on protocol fee given amount of 'assets' provided

function protocolFeeAmount(uint256 assets, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate fee on
iduint256vault id to get corresponding fees for

Returns

NameTypeDescription
<none>uint256feeAmount amount of assets that would be charged by vault on protocol fee

atomDepositsAmount

returns atom deposit given amount of 'assets' provided

function atomDepositsAmount(uint256 assets, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate fee on
iduint256vault id

Returns

NameTypeDescription
<none>uint256feeAmount amount of assets that would be used as atom deposit fraction NOTE: only applies to triple vaults

currentSharePrice

returns the current share price for the given vault id

function currentSharePrice(uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
iduint256vault id to get corresponding share price for

Returns

NameTypeDescription
<none>uint256price current share price for the given vault id

maxRedeem

returns max amount of shares that can be redeemed from the 'owner' balance through a redeem call

function maxRedeem(address owner, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
owneraddressaddress of the account to get max redeemable shares for
iduint256vault id to get corresponding shares for

Returns

NameTypeDescription
<none>uint256shares amount of shares that can be redeemed from the 'owner' balance through a redeem call

convertToShares

returns amount of shares that would be exchanged by vault given amount of 'assets' provided

function convertToShares(uint256 assets, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate shares on
iduint256vault id to get corresponding shares for

Returns

NameTypeDescription
<none>uint256shares amount of shares that would be exchanged by vault given amount of 'assets' provided

convertToAssets

returns amount of assets that would be exchanged by vault given amount of 'shares' provided

function convertToAssets(uint256 shares, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
sharesuint256amount of shares to calculate assets on
iduint256vault id to get corresponding assets for

Returns

NameTypeDescription
<none>uint256assets amount of assets that would be exchanged by vault given amount of 'shares' provided

previewDeposit

simulates the effects of the deposited amount of 'assets' and returns the estimated amount of shares that would be minted from the deposit of assets

function previewDeposit(uint256 assets, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate shares on
iduint256vault id to get corresponding shares for

Returns

NameTypeDescription
<none>uint256shares amount of shares that would be minted from the deposit of assets NOTE: this function pessimistically estimates the amount of shares that would be minted from the input amount of assets so if the vault is empty before the deposit the caller receives more shares than returned by this function, reference internal _depositIntoVault logic for details

previewRedeem

simulates the effects of the redemption of shares and returns the estimated amount of assets estimated to be returned to the receiver of the redeem

function previewRedeem(uint256 shares, uint256 id) external view returns (uint256);

Parameters

NameTypeDescription
sharesuint256amount of shares to calculate assets on
iduint256vault id to get corresponding assets for

Returns

NameTypeDescription
<none>uint256assets amount of assets estimated to be returned to the receiver

tripleHash

returns the corresponding hash for the given RDF triple, given the triple vault id

function tripleHash(uint256 id) external view returns (bytes32);

Parameters

NameTypeDescription
iduint256vault id of the triple

Returns

NameTypeDescription
<none>bytes32hash the corresponding hash for the given RDF triple NOTE: only applies to triple vault IDs as input

isTripleId

returns whether the supplied vault id is a triple

function isTripleId(uint256 id) external view returns (bool);

Parameters

NameTypeDescription
iduint256vault id to check

Returns

NameTypeDescription
<none>boolbool whether the supplied vault id is a triple

getTripleAtoms

returns the atoms that make up a triple/counter-triple

function getTripleAtoms(uint256 id) external view returns (uint256, uint256, uint256);

Parameters

NameTypeDescription
iduint256vault id of the triple/counter-triple

Returns

NameTypeDescription
<none>uint256tuple(atomIds) the atoms that make up the triple/counter-triple NOTE: only applies to triple vault IDs as input
<none>uint256
<none>uint256

tripleHashFromAtoms

returns the corresponding hash for the given RDF triple, given the atoms that make up the triple

function tripleHashFromAtoms(uint256 subjectId, uint256 predicateId, uint256 objectId)
    external
    pure
    returns (bytes32);

Parameters

NameTypeDescription
subjectIduint256the subject atom's vault id
predicateIduint256the predicate atom's vault id
objectIduint256the object atom's vault id

Returns

NameTypeDescription
<none>bytes32hash the corresponding hash for the given RDF triple based on the atom vault ids

getCounterIdFromTriple

returns the counter id from the given triple id

function getCounterIdFromTriple(uint256 id) external returns (uint256);

Parameters

NameTypeDescription
iduint256vault id of the triple

Returns

NameTypeDescription
<none>uint256counterId the counter vault id from the given triple id NOTE: only applies to triple vault IDs as input

getAtomWarden

returns the address of the atom warden

function getAtomWarden() external view returns (address);

getVaultStateForUser

returns the number of shares and assets (less fees) user has in the vault

function getVaultStateForUser(uint256 vaultId, address receiver) external view returns (uint256, uint256);

Parameters

NameTypeDescription
vaultIduint256vault id of the vault
receiveraddressaddress of the receiver

Returns

NameTypeDescription
<none>uint256shares number of shares user has in the vault
<none>uint256assets number of assets user has in the vault

getVaultStateForUserCurve

returns the number of shares and assets (less fees) user has in the vault for a specific curve

function getVaultStateForUserCurve(uint256 vaultId, uint256 curveId, address receiver)
    external
    view
    returns (uint256, uint256);

Parameters

NameTypeDescription
vaultIduint256vault id of the vault
curveIduint256curve id of the curve
receiveraddressaddress of the receiver

Returns

NameTypeDescription
<none>uint256shares number of shares user has in the vault
<none>uint256

getDepositSharesAndFeesCurve

returns the shares for recipient and other important values when depositing 'assets' into a bonding curve vault

function getDepositSharesAndFeesCurve(uint256 assets, uint256 vaultId, uint256 curveId)
    external
    view
    returns (uint256, uint256, uint256, uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate fees on (should always be msg.value - protocolFee)
vaultIduint256vault id to get corresponding fees for
curveIduint256curve id to get corresponding fees for

Returns

NameTypeDescription
<none>uint256totalAssetsDelta changes in vault's total assets
<none>uint256sharesForReceiver changes in vault's total shares (shares owed to receiver)
<none>uint256userAssetsAfterTotalFees amount of assets that goes towards minting shares for the receiver
<none>uint256entryFee amount of assets that would be charged for the entry fee

getRedeemAssetsAndFeesCurve

returns the assets for receiver and other important values when redeeming 'shares' from a bonding curve vault

function getRedeemAssetsAndFeesCurve(uint256 shares, uint256 vaultId, uint256 curveId)
    external
    view
    returns (uint256, uint256, uint256, uint256);

Parameters

NameTypeDescription
sharesuint256amount of shares to calculate fees on
vaultIduint256vault id to get corresponding fees for
curveIduint256curve id to get corresponding fees for

Returns

NameTypeDescription
<none>uint256totalUserAssets total amount of assets user would receive if redeeming 'shares', not including fees
<none>uint256assetsForReceiver amount of assets that is redeemable by the receiver
<none>uint256protocolFee amount of assets that would be sent to the protocol multisig
<none>uint256exitFee amount of assets that would be charged for the exit fee

currentSharePriceCurve

returns the current share price for the given vault id and curve id

function currentSharePriceCurve(uint256 vaultId, uint256 curveId) external view returns (uint256);

Parameters

NameTypeDescription
vaultIduint256vault id to get corresponding share price for
curveIduint256curve id to get corresponding share price for

Returns

NameTypeDescription
<none>uint256price current share price for the given vault id and curve id

maxDepositCurve

returns max amount of assets that can be deposited into the vault through a deposit call for a specific curve

function maxDepositCurve(uint256 curveId) external view returns (uint256);

Parameters

NameTypeDescription
curveIduint256curve id to get corresponding max deposit for

Returns

NameTypeDescription
<none>uint256maxAssets amount of assets that can be deposited into the vault through a deposit call

maxRedeemCurve

returns max amount of shares that can be redeemed from the 'owner' balance through a redeem call for a specific curve

function maxRedeemCurve(address owner, uint256 vaultId, uint256 curveId) external view returns (uint256);

Parameters

NameTypeDescription
owneraddressaddress of the account to get max redeemable shares for
vaultIduint256vault id to get corresponding shares for
curveIduint256curve id to get corresponding shares for

Returns

NameTypeDescription
<none>uint256shares amount of shares that can be redeemed from the 'owner' balance through a redeem call

convertToSharesCurve

returns amount of shares that would be exchanged by vault given amount of 'assets' provided for a specific curve

function convertToSharesCurve(uint256 assets, uint256 vaultId, uint256 curveId) external view returns (uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate shares on
vaultIduint256vault id to get corresponding shares for
curveIduint256curve id to get corresponding shares for

Returns

NameTypeDescription
<none>uint256shares amount of shares that would be exchanged by vault given amount of 'assets' provided

convertToAssetsCurve

returns amount of assets that would be exchanged by vault given amount of 'shares' provided for a specific curve

function convertToAssetsCurve(uint256 shares, uint256 vaultId, uint256 curveId) external view returns (uint256);

Parameters

NameTypeDescription
sharesuint256amount of shares to calculate assets on
vaultIduint256vault id to get corresponding assets for
curveIduint256curve id to get corresponding assets for

Returns

NameTypeDescription
<none>uint256assets amount of assets that would be exchanged by vault given amount of 'shares' provided

previewDepositCurve

simulates the effects of the deposited amount of 'assets' and returns the estimated amount of shares that would be minted from the deposit of assets for a specific curve

function previewDepositCurve(uint256 assets, uint256 vaultId, uint256 curveId) external view returns (uint256);

Parameters

NameTypeDescription
assetsuint256amount of assets to calculate shares on
vaultIduint256vault id to get corresponding shares for
curveIduint256curve id to get corresponding shares for

Returns

NameTypeDescription
<none>uint256shares amount of shares that would be minted from the deposit of assets NOTE: this function pessimistically estimates the amount of shares that would be minted from the input amount of assets so if the vault is empty before the deposit the caller receives more shares than returned by this function, reference internal _depositIntoVault logic for details

previewRedeemCurve

simulates the effects of the redemption of shares and returns the estimated amount of assets estimated to be returned to the receiver of the redeem for a specific curve

function previewRedeemCurve(uint256 shares, uint256 vaultId, uint256 curveId) external view returns (uint256);

Parameters

NameTypeDescription
sharesuint256amount of shares to calculate assets on
vaultIduint256vault id to get corresponding assets for
curveIduint256curve id to get corresponding assets for

Returns

NameTypeDescription
<none>uint256assets amount of assets estimated to be returned to the receiver

computeAtomWalletAddr

returns the Atom Wallet address for the given atom data

function computeAtomWalletAddr(uint256 id) external view returns (address);

Parameters

NameTypeDescription
iduint256vault id of the atom associated to the atom wallet

Returns

NameTypeDescription
<none>addressatomWallet the address of the atom wallet NOTE: the create2 salt is based off of the vault ID

isApprovedDeposit

Check if a sender is approved to deposit on behalf of a receiver

function isApprovedDeposit(address sender, address receiver) external view returns (bool);

Parameters

NameTypeDescription
senderaddressThe address of the sender
receiveraddressThe address of the receiver

Returns

NameTypeDescription
<none>boolbool Whether the sender is approved to deposit

isApprovedRedeem

Check if a sender is approved to redeem on behalf of a receiver

function isApprovedRedeem(address sender, address receiver) external view returns (bool);

Parameters

NameTypeDescription
senderaddressThe address of the sender
receiveraddressThe address of the receiver

Returns

NameTypeDescription
<none>boolbool Whether the sender is approved to redeem

Events

ApprovalTypeUpdated

Emitted when a receiver changes the approval type for a sender

event ApprovalTypeUpdated(address indexed sender, address indexed receiver, ApprovalTypes approvalType);

Parameters

NameTypeDescription
senderaddressaddress of the sender being approved/disapproved
receiveraddressaddress of the receiver granting/revoking approval
approvalTypeApprovalTypesthe type of approval granted (NONE = 0, DEPOSIT = 1, REDEMPTION = 2, BOTH = 3)

Deposited

Emitted upon the minting of shares in the vault by depositing assets

event Deposited(
    address indexed sender,
    address indexed receiver,
    uint256 receiverTotalSharesInVault,
    uint256 senderAssetsAfterTotalFees,
    uint256 sharesForReceiver,
    uint256 entryFee,
    uint256 vaultId,
    bool isTriple,
    bool isAtomWallet
);

Parameters

NameTypeDescription
senderaddressinitializer of the deposit
receiveraddressbeneficiary of the minted shares
receiverTotalSharesInVaultuint256total shares held by the receiver in the vault
senderAssetsAfterTotalFeesuint256total assets that go towards minting shares for the receiver
sharesForReceiveruint256total shares minted for the receiver
entryFeeuint256total fee amount collected for entering the vault
vaultIduint256vault id of the vault being deposited into
isTripleboolwhether the vault is a triple vault or not
isAtomWalletboolwhether the receiver is an atom wallet or not

DepositedCurve

event DepositedCurve(
    address indexed sender,
    address indexed receiver,
    uint256 receiverTotalSharesInVault,
    uint256 senderAssetsAfterTotalFees,
    uint256 sharesForReceiver,
    uint256 entryFee,
    uint256 vaultId,
    uint256 curveId,
    bool isTriple,
    bool isAtomWallet
);

Redeemed

Emitted upon the withdrawal of assets from the vault by redeeming shares

event Redeemed(
    address indexed sender,
    address indexed receiver,
    uint256 senderTotalSharesInVault,
    uint256 assetsForReceiver,
    uint256 sharesRedeemedBySender,
    uint256 exitFee,
    uint256 vaultId
);

Parameters

NameTypeDescription
senderaddressinitializer of the withdrawal (owner of the shares)
receiveraddressbeneficiary of the withdrawn assets (can be different from the sender)
senderTotalSharesInVaultuint256total shares held by the sender in the vault
assetsForReceiveruint256quantity of assets withdrawn by the receiver
sharesRedeemedBySenderuint256quantity of shares redeemed by the sender
exitFeeuint256total fee amount collected for exiting the vault
vaultIduint256vault id of the vault being redeemed from

RedeemedCurve

event RedeemedCurve(
    address indexed sender,
    address indexed receiver,
    uint256 senderTotalSharesInVault,
    uint256 assetsForReceiver,
    uint256 sharesRedeemedBySender,
    uint256 exitFee,
    uint256 vaultId,
    uint256 curveId
);

AtomCreated

emitted upon creation of an atom

event AtomCreated(address indexed creator, address indexed atomWallet, bytes atomData, uint256 vaultId);

Parameters

NameTypeDescription
creatoraddressaddress of the atom creator
atomWalletaddressaddress of the atom's associated abstract account
atomDatabytesthe atom's respective string
vaultIduint256the vault id of the atom

TripleCreated

emitted upon creation of a triple

event TripleCreated(address indexed creator, uint256 subjectId, uint256 predicateId, uint256 objectId, uint256 vaultId);

Parameters

NameTypeDescription
creatoraddressaddress of the triple creator
subjectIduint256the triple's respective subject atom
predicateIduint256the triple's respective predicate atom
objectIduint256the triple's respective object atom
vaultIduint256the vault id of the triple

FeesTransferred

emitted upon the transfer of fees to the protocol multisig

event FeesTransferred(address indexed sender, address indexed protocolMultisig, uint256 amount);

Parameters

NameTypeDescription
senderaddressaddress of the sender
protocolMultisigaddressaddress of the protocol multisig
amountuint256amount of fees transferred

OperationScheduled

emitted upon scheduling an operation

event OperationScheduled(bytes32 indexed operationId, bytes data, uint256 readyTime);

Parameters

NameTypeDescription
operationIdbytes32unique identifier for the operation
databytesdata to be executed
readyTimeuint256block number when the operation is ready

OperationExecuted

emitted upon executing an operation

event OperationExecuted(bytes32 indexed operationId, bytes data);

Parameters

NameTypeDescription
operationIdbytes32unique identifier for the operation
databytesdata of the operation that was executed

OperationCancelled

emitted upon cancelling an operation

event OperationCancelled(bytes32 indexed operationId, bytes data);

Parameters

NameTypeDescription
operationIdbytes32unique identifier for the operation
databytesdata of the operation that was cancelled

AdminSet

emitted upon changing the admin

event AdminSet(address indexed newAdmin, address indexed oldAdmin);

Parameters

NameTypeDescription
newAdminaddressaddress of the new admin
oldAdminaddressaddress of the old admin

protocolMultisigSet

emitted upon changing the protocol multisig

event protocolMultisigSet(address indexed newProtocolMultisig, address indexed oldProtocolMultisig);

Parameters

NameTypeDescription
newProtocolMultisigaddressaddress of the new protocol multisig
oldProtocolMultisigaddressaddress of the old protocol multisig

MinDepositSet

emitted upon changing the minimum deposit amount

event MinDepositSet(uint256 newMinDeposit, uint256 oldMinDeposit);

Parameters

NameTypeDescription
newMinDeposituint256new minimum deposit amount
oldMinDeposituint256old minimum deposit amount

MinShareSet

emitted upon changing the minimum share amount

event MinShareSet(uint256 newMinShare, uint256 oldMinShare);

Parameters

NameTypeDescription
newMinShareuint256new minimum share amount
oldMinShareuint256old minimum share amount

AtomUriMaxLengthSet

emitted upon changing the atom URI max length

event AtomUriMaxLengthSet(uint256 newAtomUriMaxLength, uint256 oldAtomUriMaxLength);

Parameters

NameTypeDescription
newAtomUriMaxLengthuint256new atom URI max length
oldAtomUriMaxLengthuint256old atom URI max length

AtomWalletInitialDepositAmountSet

emitted upon changing the atom share lock fee

event AtomWalletInitialDepositAmountSet(
    uint256 newAtomWalletInitialDepositAmount, uint256 oldAtomWalletInitialDepositAmount
);

Parameters

NameTypeDescription
newAtomWalletInitialDepositAmountuint256new atom share lock fee
oldAtomWalletInitialDepositAmountuint256old atom share lock fee

AtomCreationProtocolFeeSet

emitted upon changing the atom creation fee

event AtomCreationProtocolFeeSet(uint256 newAtomCreationProtocolFee, uint256 oldAtomCreationProtocolFee);

Parameters

NameTypeDescription
newAtomCreationProtocolFeeuint256new atom creation fee
oldAtomCreationProtocolFeeuint256old atom creation fee

TripleCreationProtocolFeeSet

emitted upon changing the triple creation fee

event TripleCreationProtocolFeeSet(uint256 newTripleCreationProtocolFee, uint256 oldTripleCreationProtocolFee);

Parameters

NameTypeDescription
newTripleCreationProtocolFeeuint256new triple creation fee
oldTripleCreationProtocolFeeuint256old triple creation fee

TotalAtomDepositsOnTripleCreationSet

emitted upon changing the atom deposit fraction on triple creation

event TotalAtomDepositsOnTripleCreationSet(
    uint256 newTotalAtomDepositsOnTripleCreation, uint256 oldTotalAtomDepositsOnTripleCreation
);

Parameters

NameTypeDescription
newTotalAtomDepositsOnTripleCreationuint256new atom deposit fraction on triple creation
oldTotalAtomDepositsOnTripleCreationuint256old atom deposit fraction on triple creation

AtomDepositFractionForTripleSet

emitted upon changing the atom deposit fraction for triples

event AtomDepositFractionForTripleSet(uint256 newAtomDepositFractionForTriple, uint256 oldAtomDepositFractionForTriple);

Parameters

NameTypeDescription
newAtomDepositFractionForTripleuint256new atom deposit fraction for triples
oldAtomDepositFractionForTripleuint256old atom deposit fraction for triples

BondingCurveConfigSet

emitted upon changing the bonding curve configuration

event BondingCurveConfigSet(
    address indexed newRegistry, uint256 newDefaultCurveId, address indexed oldRegistry, uint256 oldDefaultCurveId
);

Parameters

NameTypeDescription
newRegistryaddressaddress of the new bonding curve registry
newDefaultCurveIduint256new default curve ID
oldRegistryaddressaddress of the old bonding curve registry
oldDefaultCurveIduint256old default curve ID

EntryFeeSet

emitted upon changing the entry fee

event EntryFeeSet(uint256 id, uint256 newEntryFee, uint256 oldEntryFee);

Parameters

NameTypeDescription
iduint256vault id to set entry fee for
newEntryFeeuint256new entry fee for the vault
oldEntryFeeuint256old entry fee for the vault

ExitFeeSet

emitted upon changing the exit fee

event ExitFeeSet(uint256 id, uint256 newExitFee, uint256 oldExitFee);

Parameters

NameTypeDescription
iduint256vault id to set exit fee for
newExitFeeuint256new exit fee for the vault
oldExitFeeuint256old exit fee for the vault

ProtocolFeeSet

emitted upon changing the protocol fee

event ProtocolFeeSet(uint256 id, uint256 newProtocolFee, uint256 oldProtocolFee);

Parameters

NameTypeDescription
iduint256vault id to set protocol fee for
newProtocolFeeuint256new protocol fee for the vault
oldProtocolFeeuint256old protocol fee for the vault

AtomWardenSet

emitted upon changing the atomWarden

event AtomWardenSet(address indexed newAtomWarden, address indexed oldAtomWarden);

Parameters

NameTypeDescription
newAtomWardenaddressaddress of the new atomWarden
oldAtomWardenaddressaddress of the old atomWarden

AtomWalletDeployed

emitted upon deploying an atom wallet

event AtomWalletDeployed(uint256 indexed vaultId, address indexed atomWallet);

Parameters

NameTypeDescription
vaultIduint256vault id of the atom
atomWalletaddressaddress of the atom wallet

SharePriceChanged

emitted upon changing the share price of a term base vault

event SharePriceChanged(uint256 indexed termId, uint256 newSharePrice, uint256 totalAssets, uint256 totalShares);

Parameters

NameTypeDescription
termIduint256id of the atom, triple or counter triple
newSharePriceuint256new share price of the vault
totalAssetsuint256new total assets in vault
totalSharesuint256new total shares in vault

SharePriceChangedCurve

emitted upon changing the share price of a curve vault

event SharePriceChangedCurve(
    uint256 indexed termId, uint256 indexed curveId, uint256 newSharePrice, uint256 totalAssets, uint256 totalShares
);

Parameters

NameTypeDescription
termIduint256id of the atom, triple or counter triple
curveIduint256curve id of the curve
newSharePriceuint256new share price of the curve vault
totalAssetsuint256new total assets in vault
totalSharesuint256new total shares in vault

Structs

GeneralConfig

General configuration struct

struct GeneralConfig {
    address admin;
    address protocolMultisig;
    uint256 feeDenominator;
    uint256 minDeposit;
    uint256 minShare;
    uint256 atomUriMaxLength;
    uint256 decimalPrecision;
    uint256 minDelay;
}

BondingCurveConfig

struct BondingCurveConfig {
    address registry;
    uint256 defaultCurveId;
}

AtomConfig

Atom configuration struct

struct AtomConfig {
    uint256 atomWalletInitialDepositAmount;
    uint256 atomCreationProtocolFee;
}

TripleConfig

Triple configuration struct

struct TripleConfig {
    uint256 tripleCreationProtocolFee;
    uint256 totalAtomDepositsOnTripleCreation;
    uint256 atomDepositFractionForTriple;
}

WalletConfig

Atom wallet configuration struct

struct WalletConfig {
    IPermit2 permit2;
    address entryPoint;
    address atomWarden;
    address atomWalletBeacon;
}

VaultState

Vault state struct

struct VaultState {
    uint256 totalAssets;
    uint256 totalShares;
    mapping(address account => uint256 balance) balanceOf;
}

VaultFees

Vault fees struct

struct VaultFees {
    uint256 entryFee;
    uint256 exitFee;
    uint256 protocolFee;
}

Timelock

Timelock struct

struct Timelock {
    bytes data;
    uint256 readyTime;
    bool executed;
}

Enums

ApprovalTypes

enum ApprovalTypes {
    NONE,
    DEPOSIT,
    REDEMPTION,
    BOTH
}