IEthMultiVault
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
Name | Type | Description |
---|---|---|
_generalConfig | GeneralConfig | General configuration struct |
_atomConfig | AtomConfig | Atom configuration struct |
_tripleConfig | TripleConfig | Triple configuration struct |
_walletConfig | WalletConfig | Wallet configuration struct |
_defaultVaultFees | VaultFees | Default vault fees struct NOTE: This function is called only once (during contract deployment) |
_bondingCurveConfig | BondingCurveConfig |
reinitialize
Reinitialize the contract with new bonding curve configuration
function reinitialize(BondingCurveConfig calldata bondingCurveConfig) external;
Parameters
Name | Type | Description |
---|---|---|
bondingCurveConfig | BondingCurveConfig | The 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
Name | Type | Description |
---|---|---|
operationId | bytes32 | unique identifier for the operation |
data | bytes | data to be executed |
cancelOperation
execute a scheduled operation
function cancelOperation(bytes32 operationId, bytes calldata data) external;
Parameters
Name | Type | Description |
---|---|---|
operationId | bytes32 | unique identifier for the operation |
data | bytes | data to be executed |
setAdmin
Requires new admin to 'confirm' the timelocked operation
set admin
function setAdmin(address admin) external;
Parameters
Name | Type | Description |
---|---|---|
admin | address | address of the new admin |
setProtocolMultisig
set protocol multisig
function setProtocolMultisig(address protocolMultisig) external;
Parameters
Name | Type | Description |
---|---|---|
protocolMultisig | address | address of the new protocol multisig |
setMinDeposit
sets the minimum deposit amount for atoms and triples
function setMinDeposit(uint256 minDeposit) external;
Parameters
Name | Type | Description |
---|---|---|
minDeposit | uint256 | new minimum deposit amount |
setMinShare
sets the minimum share amount for atoms and triples
function setMinShare(uint256 minShare) external;
Parameters
Name | Type | Description |
---|---|---|
minShare | uint256 | new minimum share amount |
setAtomUriMaxLength
sets the atom URI max length
function setAtomUriMaxLength(uint256 atomUriMaxLength) external;
Parameters
Name | Type | Description |
---|---|---|
atomUriMaxLength | uint256 | new atom URI max length |
setAtomWalletInitialDepositAmount
sets the atom share lock fee
function setAtomWalletInitialDepositAmount(uint256 atomWalletInitialDepositAmount) external;
Parameters
Name | Type | Description |
---|---|---|
atomWalletInitialDepositAmount | uint256 | new atom share lock fee |
setAtomCreationProtocolFee
sets the atom creation fee
function setAtomCreationProtocolFee(uint256 atomCreationProtocolFee) external;
Parameters
Name | Type | Description |
---|---|---|
atomCreationProtocolFee | uint256 | new atom creation fee |
setTripleCreationProtocolFee
sets fee charged in wei when creating a triple to protocol multisig
function setTripleCreationProtocolFee(uint256 tripleCreationProtocolFee) external;
Parameters
Name | Type | Description |
---|---|---|
tripleCreationProtocolFee | uint256 | new 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
Name | Type | Description |
---|---|---|
totalAtomDepositsOnTripleCreation | uint256 | new 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
Name | Type | Description |
---|---|---|
atomDepositFractionForTriple | uint256 | new atom deposit fraction percentage |
setBondingCurveConfig
sets the bonding curve configuration
function setBondingCurveConfig(address registry, uint256 defaultCurveId) external;
Parameters
Name | Type | Description |
---|---|---|
registry | address | address of the new bonding curve registry |
defaultCurveId | uint256 | new 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
Name | Type | Description |
---|---|---|
id | uint256 | vault id to set entry fee for |
entryFee | uint256 | entry 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
Name | Type | Description |
---|---|---|
id | uint256 | vault id to set exit fee for |
exitFee | uint256 | exit 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
Name | Type | Description |
---|---|---|
id | uint256 | vault id to set protocol fee for |
protocolFee | uint256 | protocol fee to set |
setAtomWarden
sets the atomWarden address
function setAtomWarden(address atomWarden) external;
Parameters
Name | Type | Description |
---|---|---|
atomWarden | address | address of the new atomWarden |
deployAtomWallet
deploy a given atom wallet
function deployAtomWallet(uint256 atomId) external returns (address);
Parameters
Name | Type | Description |
---|---|---|
atomId | uint256 | vault id of atom |
Returns
Name | Type | Description |
---|---|---|
<none> | address | atomWallet 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
Name | Type | Description |
---|---|---|
sender | address | address to set approval for |
approvalType | ApprovalTypes | type 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
Name | Type | Description |
---|---|---|
atomUri | bytes | atom data to create atom with |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | id 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
Name | Type | Description |
---|---|---|
atomUris | bytes[] | atom data array to create atoms with |
Returns
Name | Type | Description |
---|---|---|
<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
Name | Type | Description |
---|---|---|
subjectId | uint256 | vault id of the subject atom |
predicateId | uint256 | vault id of the predicate atom |
objectId | uint256 | vault id of the object atom |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | id 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
Name | Type | Description |
---|---|---|
subjectIds | uint256[] | vault ids array of subject atoms |
predicateIds | uint256[] | vault ids array of predicate atoms |
objectIds | uint256[] | 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
Name | Type | Description |
---|---|---|
receiver | address | the address to receive the shares |
id | uint256 | the vault ID of the atom |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
receiver | address | the address to receive the shares |
atomId | uint256 | the vault ID of the atom |
curveId | uint256 | the vault ID of the curve |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
shares | uint256 | the amount of shares to redeem |
receiver | address | the address to receiver the assets |
id | uint256 | the vault ID of the atom |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets 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
Name | Type | Description |
---|---|---|
shares | uint256 | the amount of shares to redeem |
receiver | address | the address to receiver the assets |
atomId | uint256 | the vault ID of the atom |
curveId | uint256 | the vault ID of the curve |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets 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
Name | Type | Description |
---|---|---|
receiver | address | the address to receive the shares |
id | uint256 | the vault ID of the triple |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
receiver | address | the address to receive the shares |
tripleId | uint256 | the vault ID of the triple |
curveId | uint256 | the vault ID of the curve |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
shares | uint256 | the amount of shares to redeem |
receiver | address | the address to receiver the assets |
id | uint256 | the vault ID of the triple |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets 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
Name | Type | Description |
---|---|---|
shares | uint256 | the amount of shares to redeem |
receiver | address | the address to receiver the assets |
tripleId | uint256 | the vault ID of the triple |
curveId | uint256 | the vault ID of the curve |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets 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
Name | Type | Description |
---|---|---|
receiver | address | the address to receive the shares |
termIds | uint256[] | the IDs of the terms (atoms, triples, or counter-triples) to deposit into |
amounts | uint256[] | array of the amount to deposit in each vault |
Returns
Name | Type | Description |
---|---|---|
<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
Name | Type | Description |
---|---|---|
receiver | address | the address to receive the shares |
termIds | uint256[] | array of the vault IDs of the terms (atoms, triples, or counter-triples) |
curveIds | uint256[] | array of the vault IDs of the curves |
amounts | uint256[] | array of the amount to deposit in each vault |
Returns
Name | Type | Description |
---|---|---|
<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
Name | Type | Description |
---|---|---|
percentage | uint256 | the percentage of shares to redeem from each vault (i.e. 50% -> 50, 100% -> 100) |
receiver | address | the address to receiver the assets |
ids | uint256[] | array of IDs of the term (atom, triple or counter-triple) to redeem from |
Returns
Name | Type | Description |
---|---|---|
<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
Name | Type | Description |
---|---|---|
percentage | uint256 | the percentage of shares to redeem from the vaults |
receiver | address | the address to receiver the assets |
termIds | uint256[] | array of the IDs of the terms (atoms, triples, or counter-triples) |
curveIds | uint256[] | array of the IDs of the curves for each term |
Returns
Name | Type | Description |
---|---|---|
<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
Name | Type | Description |
---|---|---|
<none> | uint256 | atomCost the cost of creating an atom |
getTripleCost
returns the cost of creating a triple
function getTripleCost() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | tripleCost 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate fees on |
id | uint256 | vault id to get corresponding fees for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | totalFees 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate fees on (should always be msg.value - protocolFee) |
id | uint256 | vault id to get corresponding fees for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | totalAssetsDelta changes in vault's total assets |
<none> | uint256 | sharesForReceiver changes in vault's total shares (shares owed to receiver) |
<none> | uint256 | userAssetsAfterTotalFees amount of assets that goes towards minting shares for the receiver |
<none> | uint256 | entryFee 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
Name | Type | Description |
---|---|---|
shares | uint256 | amount of shares to calculate fees on |
id | uint256 | vault id to get corresponding fees for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | totalUserAssets total amount of assets user would receive if redeeming 'shares', not including fees |
<none> | uint256 | assetsForReceiver amount of assets that is redeemable by the receiver |
<none> | uint256 | protocolFee amount of assets that would be sent to the protocol multisig |
<none> | uint256 | exitFee 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate fee on |
id | uint256 | vault id to get corresponding fees for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | feeAmount 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate fee on |
id | uint256 | vault id to get corresponding fees for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | feeAmount 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate fee on |
id | uint256 | vault id to get corresponding fees for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | feeAmount 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate fee on |
id | uint256 | vault id |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | feeAmount 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
Name | Type | Description |
---|---|---|
id | uint256 | vault id to get corresponding share price for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | price 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
Name | Type | Description |
---|---|---|
owner | address | address of the account to get max redeemable shares for |
id | uint256 | vault id to get corresponding shares for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate shares on |
id | uint256 | vault id to get corresponding shares for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
shares | uint256 | amount of shares to calculate assets on |
id | uint256 | vault id to get corresponding assets for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate shares on |
id | uint256 | vault id to get corresponding shares for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
shares | uint256 | amount of shares to calculate assets on |
id | uint256 | vault id to get corresponding assets for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets 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
Name | Type | Description |
---|---|---|
id | uint256 | vault id of the triple |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32 | hash 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
Name | Type | Description |
---|---|---|
id | uint256 | vault id to check |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool 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
Name | Type | Description |
---|---|---|
id | uint256 | vault id of the triple/counter-triple |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | tuple(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
Name | Type | Description |
---|---|---|
subjectId | uint256 | the subject atom's vault id |
predicateId | uint256 | the predicate atom's vault id |
objectId | uint256 | the object atom's vault id |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32 | hash 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
Name | Type | Description |
---|---|---|
id | uint256 | vault id of the triple |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | counterId 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
Name | Type | Description |
---|---|---|
vaultId | uint256 | vault id of the vault |
receiver | address | address of the receiver |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares number of shares user has in the vault |
<none> | uint256 | assets 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
Name | Type | Description |
---|---|---|
vaultId | uint256 | vault id of the vault |
curveId | uint256 | curve id of the curve |
receiver | address | address of the receiver |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate fees on (should always be msg.value - protocolFee) |
vaultId | uint256 | vault id to get corresponding fees for |
curveId | uint256 | curve id to get corresponding fees for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | totalAssetsDelta changes in vault's total assets |
<none> | uint256 | sharesForReceiver changes in vault's total shares (shares owed to receiver) |
<none> | uint256 | userAssetsAfterTotalFees amount of assets that goes towards minting shares for the receiver |
<none> | uint256 | entryFee 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
Name | Type | Description |
---|---|---|
shares | uint256 | amount of shares to calculate fees on |
vaultId | uint256 | vault id to get corresponding fees for |
curveId | uint256 | curve id to get corresponding fees for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | totalUserAssets total amount of assets user would receive if redeeming 'shares', not including fees |
<none> | uint256 | assetsForReceiver amount of assets that is redeemable by the receiver |
<none> | uint256 | protocolFee amount of assets that would be sent to the protocol multisig |
<none> | uint256 | exitFee 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
Name | Type | Description |
---|---|---|
vaultId | uint256 | vault id to get corresponding share price for |
curveId | uint256 | curve id to get corresponding share price for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | price 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
Name | Type | Description |
---|---|---|
curveId | uint256 | curve id to get corresponding max deposit for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | maxAssets 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
Name | Type | Description |
---|---|---|
owner | address | address of the account to get max redeemable shares for |
vaultId | uint256 | vault id to get corresponding shares for |
curveId | uint256 | curve id to get corresponding shares for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate shares on |
vaultId | uint256 | vault id to get corresponding shares for |
curveId | uint256 | curve id to get corresponding shares for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
shares | uint256 | amount of shares to calculate assets on |
vaultId | uint256 | vault id to get corresponding assets for |
curveId | uint256 | curve id to get corresponding assets for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets 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
Name | Type | Description |
---|---|---|
assets | uint256 | amount of assets to calculate shares on |
vaultId | uint256 | vault id to get corresponding shares for |
curveId | uint256 | curve id to get corresponding shares for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares 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
Name | Type | Description |
---|---|---|
shares | uint256 | amount of shares to calculate assets on |
vaultId | uint256 | vault id to get corresponding assets for |
curveId | uint256 | curve id to get corresponding assets for |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets 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
Name | Type | Description |
---|---|---|
id | uint256 | vault id of the atom associated to the atom wallet |
Returns
Name | Type | Description |
---|---|---|
<none> | address | atomWallet 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
Name | Type | Description |
---|---|---|
sender | address | The address of the sender |
receiver | address | The address of the receiver |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool 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
Name | Type | Description |
---|---|---|
sender | address | The address of the sender |
receiver | address | The address of the receiver |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool 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
Name | Type | Description |
---|---|---|
sender | address | address of the sender being approved/disapproved |
receiver | address | address of the receiver granting/revoking approval |
approvalType | ApprovalTypes | the 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
Name | Type | Description |
---|---|---|
sender | address | initializer of the deposit |
receiver | address | beneficiary of the minted shares |
receiverTotalSharesInVault | uint256 | total shares held by the receiver in the vault |
senderAssetsAfterTotalFees | uint256 | total assets that go towards minting shares for the receiver |
sharesForReceiver | uint256 | total shares minted for the receiver |
entryFee | uint256 | total fee amount collected for entering the vault |
vaultId | uint256 | vault id of the vault being deposited into |
isTriple | bool | whether the vault is a triple vault or not |
isAtomWallet | bool | whether 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
Name | Type | Description |
---|---|---|
sender | address | initializer of the withdrawal (owner of the shares) |
receiver | address | beneficiary of the withdrawn assets (can be different from the sender) |
senderTotalSharesInVault | uint256 | total shares held by the sender in the vault |
assetsForReceiver | uint256 | quantity of assets withdrawn by the receiver |
sharesRedeemedBySender | uint256 | quantity of shares redeemed by the sender |
exitFee | uint256 | total fee amount collected for exiting the vault |
vaultId | uint256 | vault 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
Name | Type | Description |
---|---|---|
creator | address | address of the atom creator |
atomWallet | address | address of the atom's associated abstract account |
atomData | bytes | the atom's respective string |
vaultId | uint256 | the 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
Name | Type | Description |
---|---|---|
creator | address | address of the triple creator |
subjectId | uint256 | the triple's respective subject atom |
predicateId | uint256 | the triple's respective predicate atom |
objectId | uint256 | the triple's respective object atom |
vaultId | uint256 | the 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
Name | Type | Description |
---|---|---|
sender | address | address of the sender |
protocolMultisig | address | address of the protocol multisig |
amount | uint256 | amount of fees transferred |
OperationScheduled
emitted upon scheduling an operation
event OperationScheduled(bytes32 indexed operationId, bytes data, uint256 readyTime);
Parameters
Name | Type | Description |
---|---|---|
operationId | bytes32 | unique identifier for the operation |
data | bytes | data to be executed |
readyTime | uint256 | block number when the operation is ready |
OperationExecuted
emitted upon executing an operation
event OperationExecuted(bytes32 indexed operationId, bytes data);
Parameters
Name | Type | Description |
---|---|---|
operationId | bytes32 | unique identifier for the operation |
data | bytes | data of the operation that was executed |
OperationCancelled
emitted upon cancelling an operation
event OperationCancelled(bytes32 indexed operationId, bytes data);
Parameters
Name | Type | Description |
---|---|---|
operationId | bytes32 | unique identifier for the operation |
data | bytes | data of the operation that was cancelled |
AdminSet
emitted upon changing the admin
event AdminSet(address indexed newAdmin, address indexed oldAdmin);
Parameters
Name | Type | Description |
---|---|---|
newAdmin | address | address of the new admin |
oldAdmin | address | address of the old admin |
protocolMultisigSet
emitted upon changing the protocol multisig
event protocolMultisigSet(address indexed newProtocolMultisig, address indexed oldProtocolMultisig);
Parameters
Name | Type | Description |
---|---|---|
newProtocolMultisig | address | address of the new protocol multisig |
oldProtocolMultisig | address | address of the old protocol multisig |
MinDepositSet
emitted upon changing the minimum deposit amount
event MinDepositSet(uint256 newMinDeposit, uint256 oldMinDeposit);
Parameters
Name | Type | Description |
---|---|---|
newMinDeposit | uint256 | new minimum deposit amount |
oldMinDeposit | uint256 | old minimum deposit amount |
MinShareSet
emitted upon changing the minimum share amount
event MinShareSet(uint256 newMinShare, uint256 oldMinShare);
Parameters
Name | Type | Description |
---|---|---|
newMinShare | uint256 | new minimum share amount |
oldMinShare | uint256 | old minimum share amount |
AtomUriMaxLengthSet
emitted upon changing the atom URI max length
event AtomUriMaxLengthSet(uint256 newAtomUriMaxLength, uint256 oldAtomUriMaxLength);
Parameters
Name | Type | Description |
---|---|---|
newAtomUriMaxLength | uint256 | new atom URI max length |
oldAtomUriMaxLength | uint256 | old atom URI max length |
AtomWalletInitialDepositAmountSet
emitted upon changing the atom share lock fee
event AtomWalletInitialDepositAmountSet(
uint256 newAtomWalletInitialDepositAmount, uint256 oldAtomWalletInitialDepositAmount
);
Parameters
Name | Type | Description |
---|---|---|
newAtomWalletInitialDepositAmount | uint256 | new atom share lock fee |
oldAtomWalletInitialDepositAmount | uint256 | old atom share lock fee |
AtomCreationProtocolFeeSet
emitted upon changing the atom creation fee
event AtomCreationProtocolFeeSet(uint256 newAtomCreationProtocolFee, uint256 oldAtomCreationProtocolFee);
Parameters
Name | Type | Description |
---|---|---|
newAtomCreationProtocolFee | uint256 | new atom creation fee |
oldAtomCreationProtocolFee | uint256 | old atom creation fee |
TripleCreationProtocolFeeSet
emitted upon changing the triple creation fee
event TripleCreationProtocolFeeSet(uint256 newTripleCreationProtocolFee, uint256 oldTripleCreationProtocolFee);
Parameters
Name | Type | Description |
---|---|---|
newTripleCreationProtocolFee | uint256 | new triple creation fee |
oldTripleCreationProtocolFee | uint256 | old triple creation fee |
TotalAtomDepositsOnTripleCreationSet
emitted upon changing the atom deposit fraction on triple creation
event TotalAtomDepositsOnTripleCreationSet(
uint256 newTotalAtomDepositsOnTripleCreation, uint256 oldTotalAtomDepositsOnTripleCreation
);
Parameters
Name | Type | Description |
---|---|---|
newTotalAtomDepositsOnTripleCreation | uint256 | new atom deposit fraction on triple creation |
oldTotalAtomDepositsOnTripleCreation | uint256 | old atom deposit fraction on triple creation |
AtomDepositFractionForTripleSet
emitted upon changing the atom deposit fraction for triples
event AtomDepositFractionForTripleSet(uint256 newAtomDepositFractionForTriple, uint256 oldAtomDepositFractionForTriple);
Parameters
Name | Type | Description |
---|---|---|
newAtomDepositFractionForTriple | uint256 | new atom deposit fraction for triples |
oldAtomDepositFractionForTriple | uint256 | old 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
Name | Type | Description |
---|---|---|
newRegistry | address | address of the new bonding curve registry |
newDefaultCurveId | uint256 | new default curve ID |
oldRegistry | address | address of the old bonding curve registry |
oldDefaultCurveId | uint256 | old default curve ID |
EntryFeeSet
emitted upon changing the entry fee
event EntryFeeSet(uint256 id, uint256 newEntryFee, uint256 oldEntryFee);
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | vault id to set entry fee for |
newEntryFee | uint256 | new entry fee for the vault |
oldEntryFee | uint256 | old entry fee for the vault |
ExitFeeSet
emitted upon changing the exit fee
event ExitFeeSet(uint256 id, uint256 newExitFee, uint256 oldExitFee);
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | vault id to set exit fee for |
newExitFee | uint256 | new exit fee for the vault |
oldExitFee | uint256 | old exit fee for the vault |
ProtocolFeeSet
emitted upon changing the protocol fee
event ProtocolFeeSet(uint256 id, uint256 newProtocolFee, uint256 oldProtocolFee);
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | vault id to set protocol fee for |
newProtocolFee | uint256 | new protocol fee for the vault |
oldProtocolFee | uint256 | old protocol fee for the vault |
AtomWardenSet
emitted upon changing the atomWarden
event AtomWardenSet(address indexed newAtomWarden, address indexed oldAtomWarden);
Parameters
Name | Type | Description |
---|---|---|
newAtomWarden | address | address of the new atomWarden |
oldAtomWarden | address | address of the old atomWarden |
AtomWalletDeployed
emitted upon deploying an atom wallet
event AtomWalletDeployed(uint256 indexed vaultId, address indexed atomWallet);
Parameters
Name | Type | Description |
---|---|---|
vaultId | uint256 | vault id of the atom |
atomWallet | address | address 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
Name | Type | Description |
---|---|---|
termId | uint256 | id of the atom, triple or counter triple |
newSharePrice | uint256 | new share price of the vault |
totalAssets | uint256 | new total assets in vault |
totalShares | uint256 | new 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
Name | Type | Description |
---|---|---|
termId | uint256 | id of the atom, triple or counter triple |
curveId | uint256 | curve id of the curve |
newSharePrice | uint256 | new share price of the curve vault |
totalAssets | uint256 | new total assets in vault |
totalShares | uint256 | new 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
}