While there is only 1 underlying LP token per vault, Alluo enables you to deposit and withdraw in any token supported by the Alluo Exchange
There are two ways you can Deposit:
1. Deposit with the underlying LP token
You can either use the standard ERC4626 Deposit and Mint functions
Alluo Vault
/// @notice Deposits an amount of LP underlying and mints shares in the vault./// @dev Read the difference between deposit and mint at the start of the contract. Makes sure to distribute rewards before any actions occur/// @param assets Amount of assets deposited/// @param receiver Recipient of shares/// @return New amount of shares mintedfunctiondeposit(uint256 assets,address receiver) publicoverridereturns(uint256) {//// // Rewards are distributed BEFORE new shares are minted to ensure that correct reward distribution is achieved//_distributeReward(_msgSender());require(assets <=maxDeposit(receiver),"ERC4626: deposit more than max");uint256 shares =previewDeposit(assets);_deposit(_msgSender(), receiver, assets, shares);return shares;}
Deposit is adding an exact amount of underlying LP tokens for a certain amount of shares in the Vault.
Mint is adding enough underlying LP tokens to mint an exact amount of shares in the vault.
2. Deposit with non LP tokens:
You can use the function below to deposit a quantity of your ERC20 token for shares in the Vault.
For this specific StEth-Eth example, there are extra steps to be compatible with native ETH but all Vaults follow this fundamental logic when depositing ERC20 tokens that are not the underlying LP token.
Swap the entryToken to one of the poolTokens supported by the Curve Pool.
Get the LP and mint the correct amount of shares
AlluoStEthEthVault.sol
/// @notice Deposits an amount of any ERC20 and mints shares in the vault./// @dev Read the difference between deposit and mint at the start of the contract. Makes sure to distribute rewards before any actions occur/// Converts all the entry tokens to a token eligible for adding liquidity. Then carry out same deposit procedure/// @param assets Amount of assets deposited/// @param entryToken Recipient of shares/// @return New amount of shares mintedfunctiondepositWithoutLP(uint256 assets,address entryToken) publicreturns(uint256) {_distributeReward(_msgSender());IERC20MetadataUpgradeable(entryToken).safeTransferFrom(_msgSender(),address(this), assets);IERC20MetadataUpgradeable(entryToken).safeIncreaseAllowance(address(exchange), assets); assets = exchange.exchange(entryToken,asset(),assets,0);require(assets <=_nonLpMaxDeposit(assets),"ERC4626: deposit more than max");uint256 shares =_nonLpPreviewDeposit(assets);_mint(_msgSender(), shares);emitDeposit(_msgSender(),_msgSender(), assets, shares);return shares;}