Alluo Explained
Search
K

Investing into a pool

All investments are grouped by assetId.
  • 0 = USDC
  • 1 = EURT
  • 2 = WETH
  • 3 = WBTC
For each asset there are several investment strategies where funds can be allocated, as shown below in the diagram.
Assets and corresponding investment strategies
Investment happens in 3 steps:
  1. 1.
    We call executor encodeLiquidityCommand(codeName, percent) to get ids and hashed messages. We can call it multiple times if we want to split the funds between different strategies.
    NB: the sum of percent should add up to 100 (10000 in the units passed to the function)
    Example: we want to invest 60% of funds to Frax/Usdc pool and 40% to Mim+3CRV.
const request1 = await executor.callStatic.encodeLiquidityCommand(_codeName, 6000);
const request2 = await executor.callStatic.encodeLiquidityCommand("Curve/Convex Mim+3CRV", 4000);
If we already have a position in other investment strategies corresponding to USDC, we should first exit those. For instance, if we had everything in Curve/FraxConvex Frax+USDC in the beginning, we should have called encodeLiquidityCommand('Curve/FraxConvex Frax+USDC', 0) and included the hashed data into encodeAllMessages().
2. We call encodeAllMessages() and pass the data from requests to get the inputData, which we pass to submitData().
const request3 = await executor.callStatic.encodeAllMessages([idx, request2[0], request5[0]], [messages, request2[1], request5[1]]);
const inputData = request3[2];
await executor.submitData(inputData);
3. Finally, we call executeSpecificData() which will withdraw the funds from the strategies if needed and then we call executeDeposits()
await executor.executeSpecificData(id);
await executor.connect(admin).executeDeposits();