2

Using a smart contract's ABI and the input data from a transaction on Etherscan, I am able to decode the input data using this tool: https://lab.miguelmota.com/ethereum-input-data-decoder/example/

Output

{
  "method": "execute",
  "types": [
    "address",
    "bytes"
  ],
  "inputs": [
    "c5cc1dfb64a62b9c7bb6cbf53c2a579e2856bf92",
    {
      "type": "Buffer",
      "data": [
        159,
        108,
        61,
        189,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        90,
        167,
        26,
        58,
        225,
        192,
        189,
        106,
        194,
        122,
        31,
        40,
        225,
        65,
        95,
        255,
        182,
        241,
        91,
        140,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        234,
        25,
        13,
        189,
        199,
        173,
        242,
        101,
        38,
        14,
        196,
        218,
        110,
        150,
        117,
        253,
        79,
        90,
        120,
        187,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        13,
        224,
        182,
        179,
        167,
        100,
        0,
        0
      ]
    }
  ],
  "names": [
    "_target",
    "_data"
  ]
}

method, types and inputs[0] are all self explanatory, however I am looking to decode the bytes object in inputs[1].

All I know is that it led to the following "internal transactions". How can I actually read the methods that were called on the address c5cc1dfb64a62b9c7bb6cbf53c2a579e2856bf92? https://kovan.etherscan.io/tx/0xffc071b71dc25813df4b6dd4b412940a3ab7f426664cf7f51e49dae57de7853e#internal

ABI and input data below for anyone who may want to recreate using the tool above:

ABI

[{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_target","type":"address"},{"name":"_data","type":"bytes"}],"name":"execute","outputs":[{"name":"response","type":"bytes32"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_code","type":"bytes"},{"name":"_data","type":"bytes"}],"name":"execute","outputs":[{"name":"target","type":"address"},{"name":"response","type":"bytes32"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"cache","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_cacheAddr","type":"address"}],"name":"setCache","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_cacheAddr","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"}]

Input Data

0x1cff79cd000000000000000000000000c5cc1dfb64a62b9c7bb6cbf53c2a579e2856bf92000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000649f6c3dbd0000000000000000000000005aa71a3ae1c0bd6ac27a1f28e1415fffb6f15b8c000000000000000000000000ea190dbdc7adf265260ec4da6e9675fd4f5a78bb0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000
2

From Ethereum ABI decoder the transaction is calling the function execute(address _target, bytes _data) we have that it is being called with this parameters (after transforming them to hex):

  • _target = 0xc5cc1dfb64a62b9c7bb6cbf53c2a579e2856bf92
  • _data = 0x9f6c3dbd00000....0de0b6b3a7640000 (length 100 bytes or 200 hex chars)

Examining the source code at https://kovan.etherscan.io/address/0x9568eef80fdb55f68fbfe2e2d59f1b698e2819bd#code it delegatecall to the _target and pass _data as input for that contract.

We can use Ethereum ABI decoder again with the _data obtained previously and the ABI from Etherscan at 0xc5cc1dfb64a62b9c7bb6cbf53c2a579e2856bf92. We get the following

{
  "method": "join",
  "types": [
    "address",
    "address",
    "uint256"
  ],
  "inputs": [
    "5aa71a3ae1c0bd6ac27a1f28e1415fffb6f15b8c",
    "ea190dbdc7adf265260ec4da6e9675fd4f5a78bb",
    "de0b6b3a7640000"
  ],
  "names": [
    "daiJoin",
    "pot",
    "wad"
  ]
}

It is calling join(address daiJoin, address pot, uint256 wad) with

  • daiJoin = 0x5aa71a3ae1c0bd6ac27a1f28e1415fffb6f15b8c
  • pot = 0xea190dbdc7adf265260ec4da6e9675fd4f5a78bb
  • wad = 0xde0b6b3a7640000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.