Staking in volatile and stable pools is slightly different, so we'll show you how to do it in turn.
Harvesting (without additional staking) can be done by interacting with the gauge with the combination [VC,AT_MOST,0] without specifying the LP token, which we'll also show as an example below.
1) Staking USDC-ETH LP.
The only difference between Wombat Pool and Volatile Pool is that Wombat Pool has a separate Gauge contract for each token.
// Stake involves 2 tokens. LP token and VC because it also trigger harvest of $VC token.Token[] memory tokens =new Token[](2);tokens[0] =toToken(IERC20(usdc_eth_lp));tokens[1] =toToken(IERC20(vc));operation[] memory ops =new operation[](1);// address usdc_eth_pool = vault.getPair(usdc, eth);// OP type STAKE(GAUGE). For volatile pools, LP contract itself is a gauge contract. so use pool address for relevant pool address.// This is different for Wombat Pool, and I will return to that later.ops[0].poolId =toPoolId(GAUGE,usdc_eth_pool);ops[0].tokenInformations =newbytes32[](2);int128 stakeAmount =int128(int256(IERC20(usdc_eth_lp).balanceOf(address(this))));ops[0].tokenInformations[0] =toTokenInfo(0x00,EXACTLY,stakeAmount);//we don't know how much VC we'd harvest in this action. so just use AT_MOST 0 .ops[0].tokenInformations[1] =toTokenInfo(0x01,AT_MOST,0); ops[0].data ="";returnexecute(tokens,newint128[](2), ops);
2) Harvesting
Quite similar to Staking. Just use only VC in the token info.
//HarvestToken[] memory tokens =new Token[](1);tokens[0] =toToken(IERC20(vc));operation[] memory ops =new operation[](1);// Similar with Stake, we use op type STAKE with the pool but giving only VC as token info.// OP type STAKE(GAUGE). For volatile pools, LP contract itself is a gauge contract. so use pool address for relevant pool address.// This is different for Wombat Pool, and I will return to that later.ops[0].poolId =poolId(GAUGE,usdc_eth_pool);ops[0].tokenInformations =newbytes32[](1);//we don't know how much VC we'd harvest in this action. so just use AT_MOST 0 .ops[0].tokenInformations[0] =toTokenInfo(0x00,AT_MOST,0);ops[0].data ="";returnexecute(tokens,newint128[](1), ops);