Search code examples
functionparametersethereumencodesmartcontracts

How to send `byte32`, `bytes` and `uint8` params to contract?


I tried to simulate transaction to smart contract. You can find it here: https://arbiscan.io/address/0xba12222222228d8ba445958a75a0704d566bf2c8#writeContract

I want to call function swap, I have a successfull transaction as an example.

Function: swap((bytes32,uint8,address,address,uint256,bytes), (address,bool,address,bool), uint256, uint256)

enter image description here

But when I tried to send a new transaction with same params, I got an error without any details. I think that I should encode a few params such as bytes, uint8 and byte32 before sending transaction, but I don't know how. Any ideas?

enter image description here


Solution

  • Blockscan UI accepts tupple items wrapped in brackets [] - same as array items. And hex strings wrapped in quotes ".

    Example:

    ["0x536f2b3c8607aa5bc16e25a194e93e5bba8c2faf000200000000000000000107", 0, "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", "0x64343594Ab9b56e99087BfA6F2335Db24c2d1F17", 3100000, "0x"]
    

    screenshot of the input