Deposit process with the Liquidity Handler
Example: A walkthrough of a USDC deposit into IbAlluoUSD
function deposit(address _token, uint256 _amount) external {
if (supportedTokens.contains(_token) == false) {
IERC20Upgradeable(_token).safeTransferFrom(_msgSender(), address(this), _amount);
(, address primaryToken) = ILiquidityHandler(liquidityHandler).getAdapterCoreTokensFromIbAlluo(address(this));
IERC20Upgradeable(_token).safeIncreaseAllowance(exchangeAddress, _amount);
_amount = IExchange(exchangeAddress).exchange(_token, primaryToken, _amount, 0);
_token = primaryToken;
//Funds are sent to the liquidity Handler
IERC20Upgradeable(primaryToken).safeTransfer(address(liquidityHandler), _amount);
} else {
//Funds are sent to the liquidity Handler
IERC20Upgradeable(_token).safeTransferFrom(_msgSender(),address(liquidityHandler),_amount);
}
updateRatio();
ILiquidityHandler(liquidityHandler).deposit(_token, _amount);
uint256 amountIn18 = _amount * 10**(18 - AlluoERC20Upgradable(_token).decimals());
uint256 adjustedAmount = (amountIn18 * multiplier) / growingRatio;
_mint(_msgSender(), adjustedAmount);
emit TransferAssetValue(address(0), _msgSender(), adjustedAmount, amountIn18, growingRatio);
emit Deposited(_msgSender(), _token, _amount);
}Step 2: Now the 100 USDC are in the liquidityHandler and the deposit function is called, either two of the following occur
Step 3: If this new deposit allows preexisting withdrawal requests to be met, turn on a flag that allows our gelato resolver to execute the pending withdrawal
Last updated