🛠️For Developers
This section describes the main technical elements required for smart contract integration, if you have any specific questions please don't hesitate to contact us.
Portfolio Data
getTokens
Returns the current list of tokens in the vault.
Function Signature: getTokens() external view returns (address[] memory)
Returns:
An array of addresses representing the tokens in the vault.
Usage:
This function provides a list of all tokens currently held in the vault, allowing users to get an overview of the vault's composition. By converting the token balances to USD, the total value of the vault can be calculated. Dividing this total value by the total supply of portfolio tokens results in the price of each portfolio token. Additionally, the weights can be identified by knowing the USD values of each token or having a common value for each token.
totalSupply
Returns the total supply of the portfolio tokens.
Function Signature: totalSupply() external view returns (uint256)
Returns:
A uint256 representing the total supply of the portfolio tokens.
Usage: This function provides the total supply of the portfolio tokens. It is useful for understanding the overall amount of tokens issued by the portfolio.
Deposit
multiTokenDeposit
Allows the sender to deposit multiple tokens into the fund.
Function Signature: multiTokenDeposit(uint256[] calldata depositAmounts, uint256 _minMintAmount, IAllowanceTransfer.PermitBatch calldata _permit, bytes calldata _signature) external
Parameters:
depositAmounts: Array of amounts for each token to deposit.
_minMintAmount: Minimum amount of portfolio tokens expected to mint. This is used to protect against slippage.
_permit: Permit batch for tokens. This includes details for each token, spender address, and the signature deadline.
_signature: Signature for the permit batch.
multiTokenDepositFor
Allows a specified depositor to deposit multiple tokens into the fund.
Function Signature: multiTokenDepositFor(address _depositFor, uint256[] calldata depositAmounts, uint256 _minMintAmount) external
Parameters:
_depositFor: Address of the user for whom the deposit is being made.
depositAmounts: Array of amounts for each token to deposit.
_minMintAmount: Minimum amount of portfolio tokens expected to mint. This is used to protect against slippage.
Withdraw
multiTokenWithdrawalFor
Allows an approved user to withdraw portfolio tokens on behalf of another user.
Function Signature: multiTokenWithdrawalFor(address _withdrawFor, address _tokenReceiver, uint256 _portfolioTokenAmount) external
Parameters:
_withdrawFor: Address of the user on whose behalf the withdrawal is being made.
_tokenReceiver: Address where the withdrawn portfolio tokens will be sent.
_portfolioTokenAmount: Amount of portfolio tokens to withdraw.
Usage: This function allows an approved user to withdraw a specified amount of portfolio tokens on behalf of another user. The portfolio tokens are sent to the specified _tokenReceiver address.
multiTokenWithdrawal
Allows users to withdraw their deposit from the fund.
Function Signature: multiTokenWithdrawal(uint256 _portfolioTokenAmount) external
Parameters:
_portfolioTokenAmount: Amount of portfolio tokens to withdraw.
Usage: This function allows users to withdraw their deposits from the fund by burning the specified amount of portfolio tokens.
emergencyWithdrawal
Allows users to perform an emergency withdrawal.
Function Signature: emergencyWithdrawal(uint256 _portfolioTokenAmount, address[] memory _exemptionTokens) external
Parameters:
_portfolioTokenAmount: Amount of portfolio tokens to withdraw.
_exemptionTokens: Array of token addresses that are exempt from withdrawal restrictions.
Usage: This function allows users to perform an emergency withdrawal of their funds. The _exemptionTokens parameter lets users specify tokens they are willing to lose due to potential transfer issues. These tokens are handled within a try-catch block; if a transfer restriction or any other issue arises with a specified _exemptionToken, the error is caught, and the withdrawal process continues without withdrawing that underlying portfolio token.
emergencyWithdrawalFor
Allows an authorized user to perform an emergency withdrawal on behalf of another user.
Function Signature: emergencyWithdrawalFor(address _withdrawFor, address _tokenReceiver, uint256 _portfolioTokenAmount, address[] memory _exemptionTokens) external
Parameters:
_withdrawFor: Address of the user on whose behalf the emergency withdrawal is being made.
_tokenReceiver: Address where the withdrawn tokens will be sent.
_portfolioTokenAmount: Amount of portfolio tokens to withdraw.
_exemptionTokens: Array of token addresses that are exempt from withdrawal restrictions.
Usage: This function allows users to perform an emergency withdrawal on behalf of another user. The _exemptionTokens parameter lets users specify tokens they are willing to lose due to potential transfer issues. These tokens are handled within a try-catch block; if a transfer restriction or any other issue arises with a specified _exemptionToken, the error is caught, and the withdrawal process continues without withdrawing that underlying portfolio token.
Claim Removed Portfolio Tokens
claimRemovedTokens
Allows users to claim their share of removed portfolio tokens.
Function Signature: claimRemovedTokens(address user, uint256 startId, uint256 endId) external
Parameters:
user: Address of the user claiming the tokens.
startId: The starting ID from which tokens are being claimed.
endId: The ending ID up to which tokens are being claimed.
Usage: This function allows users to claim their share of removed tokens within a specified range, from startId to endId. It is useful for claiming multiple tokens in one transaction.
claimTokenAtId
Claims a removed token for a given user at a specific ID.
Function Signature: claimTokenAtId(address user, uint256 id) external
Parameters:
user: Address of the user claiming the token.
id: The ID of the token being claimed.
Usage: This function allows a user to claim a removed token at a specific ID. It is useful for claiming a single token without needing to specify a range.
getDataAtId
Retrieves the validity and balance of a user's interaction at a given ID.
Function Signature: getDataAtId(address user, uint256 id) external view returns (bool, uint256)
Parameters:
user: Address of the user.
id: The ID for which data is being retrieved.
Returns:
bool: A boolean indicating the validity of the interaction at the given ID.
uint256: The balance of the user at the given ID.
Usage: This function retrieves the validity and balance of a user's interaction at a specific ID. It is useful for verifying the status and amount of tokens before performing a claim.
Last updated