Error when calling Execute function in Universal Router

According to uniswap's code, the order of the encoded parameters should be:

  • address recipient
  • uint256 amountIn
  • uint256 amountOutMin
  • address[] path
  • bool payerIsUser

So you should probably change that line in your code to:

inputs[0] = abi.encode(address(this), daiAmount, usdcAmount, [DAI, USDC], payerIsUser);

I'm not sure if the payer is also the user in your case, so you should fill that up accordingly.

You might also need to replace [DAI, USDC], which is a static array of 2 addresses, with a dynamic array which consists of the same 2 addresses; here is how you can initialize such an array:

address[] path = new address[](2);
path[0] = DAI;
path[1] = USDC;