I want to use UniversalRouter to do swap, and the function supplied in UniswapRouter smart contract is here.
function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline)
external
payable
checkDeadline(deadline)
{
execute(commands, inputs);
}
here is a transaction data example in Arbiscan
Function: execute(bytes commands,bytes[] inputs,uint256 deadline)
MethodID: 0x3593564c
[0]: 0000000000000000000000000000000000000000000000000000000000000060
[1]: 00000000000000000000000000000000000000000000000000000000000000a0
[2]: 0000000000000000000000000000000000000000000000000000000063fdeb90
[3]: 0000000000000000000000000000000000000000000000000000000000000002
[4]: 0b00000000000000000000000000000000000000000000000000000000000000
[5]: 0000000000000000000000000000000000000000000000000000000000000002
[6]: 0000000000000000000000000000000000000000000000000000000000000040
[7]: 00000000000000000000000000000000000000000000000000000000000000a0
[8]: 0000000000000000000000000000000000000000000000000000000000000040
[9]: 0000000000000000000000000000000000000000000000000000000000000002
[10]: 000000000000000000000000000000000000000000000000000aa87bee538000
[11]: 0000000000000000000000000000000000000000000000000000000000000100
[12]: 0000000000000000000000000000000000000000000000000000000000000001
[13]: 000000000000000000000000000000000000000000000000000aa87bee538000
[14]: 00000000000000000000000000000000000000000000000000eb08bf1ab3308a
[15]: 00000000000000000000000000000000000000000000000000000000000000a0
[16]: 0000000000000000000000000000000000000000000000000000000000000000
[17]: 000000000000000000000000000000000000000000000000000000000000002b
[18]: 82af49447d8a07e3bd95bd0d56f35241523fbab1000bb8fc5a1a6eb076a2c7ad
[19]: 06ed22c90d7e710e35ad0a000000000000000000000000000000000000000000
I want to know how can i construct the arguments of commands and inputs so that i can use the function. Are there any public implementations to refer to? I need help in this problem, please.
Related link: code
https://github.com/Uniswap/universal-router/blob/main/contracts/UniversalRouter.sol
transaction
https://arbiscan.io/tx/0xb1151d16a8dd84696ec81f9c9c61ec9aa8759099ae51765ba9877ee2313c897f