Following the swap example, here's an example of adding an ETH-USDC LP. The context is in the previous example, so I'll just paste the core code.
Here we're showing an example of creating liquidity using both tokens in a pair, but since Velocore's LPs all allow imbalanced deposits, it doesn't matter if it's just one. The frontend shows this as a 'Magic deposit'.
**Always refer Example Codes to see what was the exact implementation of helper functions like toToken, toPoolId, toTokenInfo.
// Add LP involves 3 tokens. ETH, USDC, LP token.Token[] memory tokens =new Token[](3);tokens[0] =toToken(IERC20(usdc));tokens[1] = NATIVE_TOKEN;tokens[2] =toToken(IERC20(usdc_eth_lp));// Adding LP is swapping 2 tokens to 1 lp. So op type is again, swap!VelocoreOperation[] memory ops =new VelocoreOperation[](1);ops[0].poolId =toPoolId(SWAP,usdc_eth_lp);ops[0].tokenInformations =newbytes32[](3);// We use "EXACTLY" for the amount we know and "AT_MOST" for what we don't know exactly but expect to receive at least a certain amount.// Want to use 0.1e6 USDC(index 0) + 0.001e18 ETH(index 1) in exchange for at least 0 LP(index 2). (apply your slippage here)ops[0].tokenInformations[0] =toTokenInfo(0x00,EXACTLY,0.1e6);ops[0].tokenInformations[1] =toTokenInfo(0x01,EXACTLY,0.001e18);ops[0].tokenInformations[2] =toTokenInfo(0x02,AT_MOST,0);ops[0].data ="";//we just called execute() here but of course if you are calling an external contract with ETH value transfer involved,// you should write it like this : vault.execute{value:0.001e18}(tokens, new int128[](3), ops);returnexecute(tokens,newint128[](3), ops);