# `Cartouche.TraceCall`
[🔗](https://github.com/zenhive/cartouche/blob/main/lib/cartouche/trace_call.ex#L1)

Represents an Ethereum `eth_callMany` trace, which contains information
about the call graph of the speculative execution of several transactions.

See `Cartouche.RPC.trace_call_many` for getting traces from
an Ethereum JSON-RPC host.

Note: `state_diff` and `vm_trace` are currently not supported and left `nil`

See also:
  * Infura docs: https://docs.infura.io/api/networks/ethereum/json-rpc-methods/trace-methods/trace_callmany

# `t`

```elixir
@type t() :: %Cartouche.TraceCall{
  output: binary(),
  state_diff: nil,
  trace: [Cartouche.Trace.t()],
  vm_trace: nil
}
```

# `deserialize`

```elixir
@spec deserialize(map()) :: t() | no_return()
```

Deserializes a single of trace result from `trace_callMany`.

## Examples

    iex> use Cartouche.Hex
    iex> %{
    ...>   "output" => "0x",
    ...>   "stateDiff" => nil,
    ...>   "trace" => [
    ...>     %{
    ...>       "action" => %{
    ...>         "callType" => "call",
    ...>         "from" => "0x0000000000000000000000000000000000000000",
    ...>         "gas" => "0x1dcd0f58",
    ...>         "input" =>
    ...>           "0xd1692f56000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a6120000000000000000000000000000000000000000000000000000000000000000",
    ...>         "to" => "0x13172ee393713fba9925a9a752341ebd31e8d9a7",
    ...>         "value" => "0x0"
    ...>       },
    ...>       "error" => "Reverted",
    ...>       "result" => %{"gasUsed" => "0x1d55dd47", "output" => "0x"},
    ...>       "subtraces" => 1,
    ...>       "traceAddress" => [],
    ...>       "type" => "call"
    ...>     },
    ...>     %{
    ...>       "action" => %{
    ...>         "from" => "0x13172ee393713fba9925a9a752341ebd31e8d9a7",
    ...>         "gas" => "0x1d555c99",
    ...>         "init" =>
    ...>           "0x60e03461009157601f6101ec38819003918201601f19168301916001600160401b038311848410176100965780849260609460405283398101031261009157610047816100ac565b906100606040610059602084016100ac565b92016100ac565b9060805260a05260c05260405161012b90816100c18239608051816088015260a051816045015260c0518160c60152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100915756fe608060405260043610156013575b3660ba57005b6000803560e01c8063238ac9331460775763c34c08e51460325750600d565b34607457806003193601126074576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b80fd5b5034607457806003193601126074577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166080908152602090f35b600036818037808036817f00000000000000000000000000000000000000000000000000000000000000005af4903d918282803e60f357fd5bf3fea264697066735822122032b5603d6937ceb7a252e16379744d8545670ff4978c8d76c985d051dfcfe46c64736f6c6343000817003300000000000000000000000049e5d261e95f6a02505078bb339fecb210a0b634000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612",
    ...>         "value" => "0x0"
    ...>       },
    ...>       "error" => "contract address collision",
    ...>       "result" => nil,
    ...>       "subtraces" => 0,
    ...>       "traceAddress" => [0],
    ...>       "type" => "create"
    ...>     }
    ...>   ],
    ...>   "vmTrace" => nil
    ...> }
    ...> |> Cartouche.TraceCall.deserialize()
    %Cartouche.TraceCall{
      output: "",
      state_diff: nil,
      trace: [
        %Cartouche.Trace{
          action: %Cartouche.Trace.Action{
            call_type: "call",
            init: nil,
            from: ~h[0x0000000000000000000000000000000000000000],
            gas: 499_978_072,
            input: ~h[0xd1692f56000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a6120000000000000000000000000000000000000000000000000000000000000000],
            to: ~h[0x13172ee393713fba9925a9a752341ebd31e8d9a7],
            value: 0
          },
          block_hash: nil,
          block_number: nil,
          gas_used: 492_166_471,
          error: "Reverted",
          output: "",
          result_code: nil,
          result_address: nil,
          subtraces: 1,
          trace_address: [],
          transaction_hash: nil,
          transaction_position: nil,
          type: "call"
        },
        %Cartouche.Trace{
          action: %Cartouche.Trace.Action{
            call_type: nil,
            init: ~h[0x60e03461009157601f6101ec38819003918201601f19168301916001600160401b038311848410176100965780849260609460405283398101031261009157610047816100ac565b906100606040610059602084016100ac565b92016100ac565b9060805260a05260c05260405161012b90816100c18239608051816088015260a051816045015260c0518160c60152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100915756fe608060405260043610156013575b3660ba57005b6000803560e01c8063238ac9331460775763c34c08e51460325750600d565b34607457806003193601126074576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b80fd5b5034607457806003193601126074577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166080908152602090f35b600036818037808036817f00000000000000000000000000000000000000000000000000000000000000005af4903d918282803e60f357fd5bf3fea264697066735822122032b5603d6937ceb7a252e16379744d8545670ff4978c8d76c985d051dfcfe46c64736f6c6343000817003300000000000000000000000049e5d261e95f6a02505078bb339fecb210a0b634000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612],
            from: ~h[0x13172ee393713fba9925a9a752341ebd31e8d9a7],
            gas: 492_133_529,
            input: nil,
            to: nil,
            value: 0
          },
          block_hash: nil,
          block_number: nil,
          gas_used: nil,
          error: "contract address collision",
          output: nil,
          result_code: nil,
          result_address: nil,
          subtraces: 0,
          trace_address: [0],
          transaction_hash: nil,
          transaction_position: nil,
          type: "create"
        }
      ],
      vm_trace: nil
    }

# `deserialize_many`

```elixir
@spec deserialize_many([map()]) :: [t()] | no_return()
```

Deserializes an array of trace results from `trace_callMany`.

## Examples

    iex> use Cartouche.Hex
    iex> [
    ...>   %{
    ...>     "output" => "0x",
    ...>     "stateDiff" => nil,
    ...>     "trace" => [
    ...>       %{
    ...>         "action" => %{
    ...>           "callType" => "call",
    ...>           "from" => "0x0000000000000000000000000000000000000000",
    ...>           "gas" => "0x1dcd0f58",
    ...>           "input" =>
    ...>             "0xd1692f56000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a6120000000000000000000000000000000000000000000000000000000000000000",
    ...>           "to" => "0x13172ee393713fba9925a9a752341ebd31e8d9a7",
    ...>           "value" => "0x0"
    ...>         },
    ...>         "error" => "Reverted",
    ...>         "result" => %{"gasUsed" => "0x1d55dd47", "output" => "0x"},
    ...>         "subtraces" => 1,
    ...>         "traceAddress" => [],
    ...>         "type" => "call"
    ...>       },
    ...>       %{
    ...>         "action" => %{
    ...>           "from" => "0x13172ee393713fba9925a9a752341ebd31e8d9a7",
    ...>           "gas" => "0x1d555c99",
    ...>           "init" =>
    ...>             "0x60e03461009157601f6101ec38819003918201601f19168301916001600160401b038311848410176100965780849260609460405283398101031261009157610047816100ac565b906100606040610059602084016100ac565b92016100ac565b9060805260a05260c05260405161012b90816100c18239608051816088015260a051816045015260c0518160c60152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100915756fe608060405260043610156013575b3660ba57005b6000803560e01c8063238ac9331460775763c34c08e51460325750600d565b34607457806003193601126074576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b80fd5b5034607457806003193601126074577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166080908152602090f35b600036818037808036817f00000000000000000000000000000000000000000000000000000000000000005af4903d918282803e60f357fd5bf3fea264697066735822122032b5603d6937ceb7a252e16379744d8545670ff4978c8d76c985d051dfcfe46c64736f6c6343000817003300000000000000000000000049e5d261e95f6a02505078bb339fecb210a0b634000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612",
    ...>           "value" => "0x0"
    ...>         },
    ...>         "error" => "contract address collision",
    ...>         "result" => nil,
    ...>         "subtraces" => 0,
    ...>         "traceAddress" => [0],
    ...>         "type" => "create"
    ...>       }
    ...>     ],
    ...>     "vmTrace" => nil
    ...>   },
    ...>   %{
    ...>     "output" => "0x00000000000000000000000079edbc4f3a6aa2266cd469cc544501743be8b078",
    ...>     "stateDiff" => nil,
    ...>     "trace" => [
    ...>       %{
    ...>         "action" => %{
    ...>           "callType" => "call",
    ...>           "from" => "0x0000000000000000000000000000000000000000",
    ...>           "gas" => "0x1dcc91bc",
    ...>           "input" =>
    ...>             "0xd6d38d3f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000081a60808060405234610016576107fe908161001c8239f35b600080fdfe6040608081526004908136101561001557600080fd5b600091823560e01c80630c0a769b146102eb57806350a4548914610255578063c3da3590146100fc5763f1afb11f1461004d57600080fd5b8291346100f85760803660031901126100f857610068610389565b61007061039f565b6100786103b5565b6001600160a01b03908116929091606435918390610097848288610482565b1693843b156100f457879460649386928851998a978896634232cd6360e01b88521690860152602485015260448401525af19081156100eb57506100d85750f35b6100e1906103fc565b6100e85780f35b80fd5b513d84823e3d90fd5b8780fd5b5050fd5b503461025157606036600319011261025157610116610389565b67ffffffffffffffff929060243584811161024d5761013890369085016103cb565b9190946044359081116102495761015290369086016103cb565b9590928681036102395791958793926001600160a01b0380891693909290865b83811061017d578780f35b6101a88561019461018f848887610448565b61046e565b168c6101a184878c610448565b3591610482565b6101b661018f828685610448565b6101c182858a610448565b3590873b15610235578a51631e573fb760e31b81526001600160a01b03909116818d019081526020810192909252908990829081906040010381838b5af1801561022b57908991610217575b5050600101610172565b610220906103fc565b6100f457873861020d565b8a513d8b823e3d90fd5b8980fd5b845163b4fa3fb360e01b81528690fd5b8680fd5b8580fd5b8280fd5b50346102515760a03660031901126102515761026f610389565b9161027861039f565b6102806103b5565b906001600160a01b039060643582811691908290036102e6578288971693843b156100f457879460849385879389519a8b988997639032317760e01b895216908701521660248501526044840152833560648401525af19081156100eb57506100d85750f35b600080fd5b5090346102515760603660031901126102515782610307610389565b61030f61039f565b604435916001600160a01b03906103298482858516610482565b1690813b15610385578451631e573fb760e31b81526001600160a01b039091169581019586526020860192909252909384919082908490829060400103925af19081156100eb5750610379575080f35b610382906103fc565b80f35b8380fd5b600435906001600160a01b03821682036102e657565b602435906001600160a01b03821682036102e657565b604435906001600160a01b03821682036102e657565b9181601f840112156102e65782359167ffffffffffffffff83116102e6576020808501948460051b0101116102e657565b67ffffffffffffffff811161041057604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff82111761041057604052565b91908110156104585760051b0190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b03811681036102e65790565b60405163095ea7b360e01b602082018181526001600160a01b0385166024840152604480840196909652948252949390926104be606485610426565b83516000926001600160a01b039291858416918591829182855af1906104e26105a4565b82610572575b5081610567575b50156104ff575b50505050509050565b60405196602088015216602486015280604486015260448552608085019085821067ffffffffffffffff8311176105535750610548939461054391604052826105fc565b6105fc565b8038808080806104f6565b634e487b7160e01b81526041600452602490fd5b90503b1515386104ef565b8051919250811591821561058a575b505090386104e8565b61059d92506020809183010191016105e4565b3880610581565b3d156105df573d9067ffffffffffffffff821161041057604051916105d3601f8201601f191660200184610426565b82523d6000602084013e565b606090565b908160209103126102e6575180151581036102e65790565b60408051908101916001600160a01b031667ffffffffffffffff8311828410176104105761066c926040526000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af16106666105a4565b916106f4565b8051908282159283156106dc575b505050156106855750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b6106ec93508201810191016105e4565b38828161067a565b919290156107565750815115610708575090565b3b156107115790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156107695750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b8285106107af575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061078c56fea264697066735822122065151e6cccce6828ff0901f46ab142cb8aa214fc37379817e3635a556dd638a564736f6c63430008170033000000000000",
    ...>           "to" => "0x2926631647877e9a84bb7e3a0821d643bf8d63c0",
    ...>           "value" => "0x0"
    ...>         },
    ...>         "result" => %{
    ...>           "gasUsed" => "0x10ca",
    ...>           "output" => "0x00000000000000000000000079edbc4f3a6aa2266cd469cc544501743be8b078"
    ...>         },
    ...>         "subtraces" => 0,
    ...>         "traceAddress" => [],
    ...>         "type" => "call"
    ...>       }
    ...>     ],
    ...>     "vmTrace" => nil
    ...>   },
    ...>   %{
    ...>     "output" => "0x82b42900",
    ...>     "stateDiff" => nil,
    ...>     "trace" => [
    ...>       %{
    ...>         "action" => %{
    ...>           "callType" => "call",
    ...>           "from" => "0x0000000000000000000000000000000000000000",
    ...>           "gas" => "0x1dcd0b70",
    ...>           "input" =>
    ...>             "0xdd560874000000000000000000000000000000000000000000000000000000000000000400000000000000000000000079edbc4f3a6aa2266cd469cc544501743be8b078000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000640c0a769b000000000000000000000000aec1f48e02cfb822be958b68c7957156eb3f0b6e0000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c723800000000000000000000000000000000000000000000000000000000000f429000000000000000000000000000000000000000000000000000000000",
    ...>           "to" => "0x6e995746b61c48c5bdf58fc788b1aea08dfb7e43",
    ...>           "value" => "0x0"
    ...>         },
    ...>         "error" => "Reverted",
    ...>         "result" => %{"gasUsed" => "0x106a", "output" => "0x82b42900"},
    ...>         "subtraces" => 1,
    ...>         "traceAddress" => [],
    ...>         "type" => "call"
    ...>       },
    ...>       %{
    ...>         "action" => %{
    ...>           "callType" => "delegatecall",
    ...>           "from" => "0x6e995746b61c48c5bdf58fc788b1aea08dfb7e43",
    ...>           "gas" => "0x1d55cc7b",
    ...>           "input" =>
    ...>             "0xdd560874000000000000000000000000000000000000000000000000000000000000000400000000000000000000000079edbc4f3a6aa2266cd469cc544501743be8b078000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000640c0a769b000000000000000000000000aec1f48e02cfb822be958b68c7957156eb3f0b6e0000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c723800000000000000000000000000000000000000000000000000000000000f429000000000000000000000000000000000000000000000000000000000",
    ...>           "to" => "0x49e5d261e95f6a02505078bb339fecb210a0b634",
    ...>           "value" => "0x0"
    ...>         },
    ...>         "error" => "Reverted",
    ...>         "result" => %{"gasUsed" => "0x552", "output" => "0x82b42900"},
    ...>         "subtraces" => 1,
    ...>         "traceAddress" => [0],
    ...>         "type" => "call"
    ...>       },
    ...>       %{
    ...>         "action" => %{
    ...>           "callType" => "staticcall",
    ...>           "from" => "0x6e995746b61c48c5bdf58fc788b1aea08dfb7e43",
    ...>           "gas" => "0x1ce0725a",
    ...>           "input" => "0xc34c08e5",
    ...>           "to" => "0x6e995746b61c48c5bdf58fc788b1aea08dfb7e43",
    ...>           "value" => "0x0"
    ...>         },
    ...>         "result" => %{
    ...>           "gasUsed" => "0xbe",
    ...>           "output" => "0x000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612"
    ...>         },
    ...>         "subtraces" => 0,
    ...>         "traceAddress" => [0, 0],
    ...>         "type" => "call"
    ...>       }
    ...>     ],
    ...>     "vmTrace" => nil
    ...>   }
    ...> ]
    ...> |> Cartouche.TraceCall.deserialize_many()
    [
      %Cartouche.TraceCall{
        output: "",
        state_diff: nil,
        trace: [
          %Cartouche.Trace{
            action: %Cartouche.Trace.Action{
              call_type: "call",
              init: nil,
              from: ~h[0x0000000000000000000000000000000000000000],
              gas: 499_978_072,
              input: ~h[0xd1692f56000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a6120000000000000000000000000000000000000000000000000000000000000000],
              to: ~h[0x13172EE393713FBA9925A9A752341EBD31E8D9A7],
              value: 0
            },
            block_hash: nil,
            block_number: nil,
            gas_used: 492_166_471,
            error: "Reverted",
            output: "",
            result_code: nil,
            result_address: nil,
            subtraces: 1,
            trace_address: [],
            transaction_hash: nil,
            transaction_position: nil,
            type: "call"
          },
          %Cartouche.Trace{
            action: %Cartouche.Trace.Action{
              call_type: nil,
              init: ~h[0x60e03461009157601f6101ec38819003918201601f19168301916001600160401b038311848410176100965780849260609460405283398101031261009157610047816100ac565b906100606040610059602084016100ac565b92016100ac565b9060805260a05260c05260405161012b90816100c18239608051816088015260a051816045015260c0518160c60152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100915756fe608060405260043610156013575b3660ba57005b6000803560e01c8063238ac9331460775763c34c08e51460325750600d565b34607457806003193601126074576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b80fd5b5034607457806003193601126074577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166080908152602090f35b600036818037808036817f00000000000000000000000000000000000000000000000000000000000000005af4903d918282803e60f357fd5bf3fea264697066735822122032b5603d6937ceb7a252e16379744d8545670ff4978c8d76c985d051dfcfe46c64736f6c6343000817003300000000000000000000000049e5d261e95f6a02505078bb339fecb210a0b634000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612],
              from: ~h[0x13172EE393713FBA9925A9A752341EBD31E8D9A7],
              gas: 492_133_529,
              input: nil,
              to: nil,
              value: 0
            },
            block_hash: nil,
            block_number: nil,
            gas_used: nil,
            error: "contract address collision",
            output: nil,
            result_code: nil,
            result_address: nil,
            subtraces: 0,
            trace_address: [0],
            transaction_hash: nil,
            transaction_position: nil,
            type: "create"
          }
        ],
        vm_trace: nil
      },
      %Cartouche.TraceCall{
        output: ~h[0x00000000000000000000000079EDBC4F3A6AA2266CD469CC544501743BE8B078],
        state_diff: nil,
        trace: [
          %Cartouche.Trace{
            action: %Cartouche.Trace.Action{
              call_type: "call",
              init: nil,
              from: ~h[0x0000000000000000000000000000000000000000],
              gas: 499_945_916,
              input: ~h[0xd6d38d3f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000081a60808060405234610016576107fe908161001c8239f35b600080fdfe6040608081526004908136101561001557600080fd5b600091823560e01c80630c0a769b146102eb57806350a4548914610255578063c3da3590146100fc5763f1afb11f1461004d57600080fd5b8291346100f85760803660031901126100f857610068610389565b61007061039f565b6100786103b5565b6001600160a01b03908116929091606435918390610097848288610482565b1693843b156100f457879460649386928851998a978896634232cd6360e01b88521690860152602485015260448401525af19081156100eb57506100d85750f35b6100e1906103fc565b6100e85780f35b80fd5b513d84823e3d90fd5b8780fd5b5050fd5b503461025157606036600319011261025157610116610389565b67ffffffffffffffff929060243584811161024d5761013890369085016103cb565b9190946044359081116102495761015290369086016103cb565b9590928681036102395791958793926001600160a01b0380891693909290865b83811061017d578780f35b6101a88561019461018f848887610448565b61046e565b168c6101a184878c610448565b3591610482565b6101b661018f828685610448565b6101c182858a610448565b3590873b15610235578a51631e573fb760e31b81526001600160a01b03909116818d019081526020810192909252908990829081906040010381838b5af1801561022b57908991610217575b5050600101610172565b610220906103fc565b6100f457873861020d565b8a513d8b823e3d90fd5b8980fd5b845163b4fa3fb360e01b81528690fd5b8680fd5b8580fd5b8280fd5b50346102515760a03660031901126102515761026f610389565b9161027861039f565b6102806103b5565b906001600160a01b039060643582811691908290036102e6578288971693843b156100f457879460849385879389519a8b988997639032317760e01b895216908701521660248501526044840152833560648401525af19081156100eb57506100d85750f35b600080fd5b5090346102515760603660031901126102515782610307610389565b61030f61039f565b604435916001600160a01b03906103298482858516610482565b1690813b15610385578451631e573fb760e31b81526001600160a01b039091169581019586526020860192909252909384919082908490829060400103925af19081156100eb5750610379575080f35b610382906103fc565b80f35b8380fd5b600435906001600160a01b03821682036102e657565b602435906001600160a01b03821682036102e657565b604435906001600160a01b03821682036102e657565b9181601f840112156102e65782359167ffffffffffffffff83116102e6576020808501948460051b0101116102e657565b67ffffffffffffffff811161041057604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff82111761041057604052565b91908110156104585760051b0190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b03811681036102e65790565b60405163095ea7b360e01b602082018181526001600160a01b0385166024840152604480840196909652948252949390926104be606485610426565b83516000926001600160a01b039291858416918591829182855af1906104e26105a4565b82610572575b5081610567575b50156104ff575b50505050509050565b60405196602088015216602486015280604486015260448552608085019085821067ffffffffffffffff8311176105535750610548939461054391604052826105fc565b6105fc565b8038808080806104f6565b634e487b7160e01b81526041600452602490fd5b90503b1515386104ef565b8051919250811591821561058a575b505090386104e8565b61059d92506020809183010191016105e4565b3880610581565b3d156105df573d9067ffffffffffffffff821161041057604051916105d3601f8201601f191660200184610426565b82523d6000602084013e565b606090565b908160209103126102e6575180151581036102e65790565b60408051908101916001600160a01b031667ffffffffffffffff8311828410176104105761066c926040526000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af16106666105a4565b916106f4565b8051908282159283156106dc575b505050156106855750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b6106ec93508201810191016105e4565b38828161067a565b919290156107565750815115610708575090565b3b156107115790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156107695750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b8285106107af575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061078c56fea264697066735822122065151e6cccce6828ff0901f46ab142cb8aa214fc37379817e3635a556dd638a564736f6c63430008170033000000000000],
              to: ~h[0x2926631647877E9A84BB7E3A0821D643BF8D63C0],
              value: 0
            },
            block_hash: nil,
            block_number: nil,
            gas_used: 4298,
            error: nil,
            output: ~h[0x00000000000000000000000079EDBC4F3A6AA2266CD469CC544501743BE8B078],
            result_code: nil,
            result_address: nil,
            subtraces: 0,
            trace_address: [],
            transaction_hash: nil,
            transaction_position: nil,
            type: "call"
          }
        ],
        vm_trace: nil
      },
      %Cartouche.TraceCall{
        output: <<130, 180, 41, 0>>,
        state_diff: nil,
        trace: [
          %Cartouche.Trace{
            action: %Cartouche.Trace.Action{
              call_type: "call",
              init: nil,
              from: ~h[0x0000000000000000000000000000000000000000],
              gas: 499_977_072,
              input: ~h[0xdd560874000000000000000000000000000000000000000000000000000000000000000400000000000000000000000079edbc4f3a6aa2266cd469cc544501743be8b078000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000640c0a769b000000000000000000000000aec1f48e02cfb822be958b68c7957156eb3f0b6e0000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c723800000000000000000000000000000000000000000000000000000000000f429000000000000000000000000000000000000000000000000000000000],
              to: ~h[0x6E995746B61C48C5BDF58FC788B1AEA08DFB7E43],
              value: 0
            },
            block_hash: nil,
            block_number: nil,
            gas_used: 4202,
            error: "Reverted",
            output: <<130, 180, 41, 0>>,
            result_code: nil,
            result_address: nil,
            subtraces: 1,
            trace_address: [],
            transaction_hash: nil,
            transaction_position: nil,
            type: "call"
          },
          %Cartouche.Trace{
            action: %Cartouche.Trace.Action{
              call_type: "delegatecall",
              init: nil,
              from: ~h[0x6E995746B61C48C5BDF58FC788B1AEA08DFB7E43],
              gas: 492_162_171,
              input: ~h[0xdd560874000000000000000000000000000000000000000000000000000000000000000400000000000000000000000079edbc4f3a6aa2266cd469cc544501743be8b078000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000640c0a769b000000000000000000000000aec1f48e02cfb822be958b68c7957156eb3f0b6e0000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c723800000000000000000000000000000000000000000000000000000000000f429000000000000000000000000000000000000000000000000000000000],
              to: ~h[0x49E5D261E95F6A02505078BB339FECB210A0B634],
              value: 0
            },
            block_hash: nil,
            block_number: nil,
            gas_used: 1362,
            error: "Reverted",
            output: <<130, 180, 41, 0>>,
            result_code: nil,
            result_address: nil,
            subtraces: 1,
            trace_address: [0],
            transaction_hash: nil,
            transaction_position: nil,
            type: "call"
          },
          %Cartouche.Trace{
            action: %Cartouche.Trace.Action{
              call_type: "staticcall",
              init: nil,
              from: ~h[0x6E995746B61C48C5BDF58FC788B1AEA08DFB7E43],
              gas: 484_471_386,
              input: <<195, 76, 8, 229>>,
              to: ~h[0x6E995746B61C48C5BDF58FC788B1AEA08DFB7E43],
              value: 0
            },
            block_hash: nil,
            block_number: nil,
            gas_used: 190,
            error: nil,
            output: ~h[0x000000000000000000000000142DA9114E5A98E015AA95AFCA0585E84832A612],
            result_code: nil,
            result_address: nil,
            subtraces: 0,
            trace_address: [0, 0],
            transaction_hash: nil,
            transaction_position: nil,
            type: "call"
          }
        ],
        vm_trace: nil
      }
    ]

# `serialize`

```elixir
@spec serialize(t()) :: map()
```

Deserializes a single of trace result from `trace_callMany`.

## Examples

    iex> use Cartouche.Hex
    iex> %Cartouche.TraceCall{
    ...>   output: "",
    ...>   state_diff: nil,
    ...>   trace: [
    ...>     %Cartouche.Trace{
    ...>       action: %Cartouche.Trace.Action{
    ...>         call_type: "call",
    ...>         init: nil,
    ...>         from: ~h[0x0000000000000000000000000000000000000000],
    ...>         gas: 499_978_072,
    ...>         input: ~h[0xd1692f56000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a6120000000000000000000000000000000000000000000000000000000000000000],
    ...>         to: ~h[0x13172ee393713fba9925a9a752341ebd31e8d9a7],
    ...>         value: 0
    ...>       },
    ...>       block_hash: nil,
    ...>       block_number: nil,
    ...>       gas_used: 492_166_471,
    ...>       error: "Reverted",
    ...>       output: "",
    ...>       result_code: nil,
    ...>       result_address: nil,
    ...>       subtraces: 1,
    ...>       trace_address: [],
    ...>       transaction_hash: nil,
    ...>       transaction_position: nil,
    ...>       type: "call"
    ...>     },
    ...>     %Cartouche.Trace{
    ...>       action: %Cartouche.Trace.Action{
    ...>         call_type: nil,
    ...>         init: ~h[0x60e03461009157601f6101ec38819003918201601f19168301916001600160401b038311848410176100965780849260609460405283398101031261009157610047816100ac565b906100606040610059602084016100ac565b92016100ac565b9060805260a05260c05260405161012b90816100c18239608051816088015260a051816045015260c0518160c60152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100915756fe608060405260043610156013575b3660ba57005b6000803560e01c8063238ac9331460775763c34c08e51460325750600d565b34607457806003193601126074576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b80fd5b5034607457806003193601126074577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166080908152602090f35b600036818037808036817f00000000000000000000000000000000000000000000000000000000000000005af4903d918282803e60f357fd5bf3fea264697066735822122032b5603d6937ceb7a252e16379744d8545670ff4978c8d76c985d051dfcfe46c64736f6c6343000817003300000000000000000000000049e5d261e95f6a02505078bb339fecb210a0b634000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612],
    ...>         from: ~h[0x13172ee393713fba9925a9a752341ebd31e8d9a7],
    ...>         gas: 492_133_529,
    ...>         input: nil,
    ...>         to: nil,
    ...>         value: 0
    ...>       },
    ...>       block_hash: nil,
    ...>       block_number: nil,
    ...>       gas_used: nil,
    ...>       error: "contract address collision",
    ...>       output: nil,
    ...>       result_code: nil,
    ...>       result_address: nil,
    ...>       subtraces: 0,
    ...>       trace_address: [0],
    ...>       transaction_hash: nil,
    ...>       transaction_position: nil,
    ...>       type: "create"
    ...>     }
    ...>   ],
    ...>   vm_trace: nil
    ...> }
    ...> |> Cartouche.TraceCall.serialize()
    %{
      output: "0x",
      stateDiff: nil,
      trace: [
        %{
          action: %{
            callType: "call",
            from: "0x0000000000000000000000000000000000000000",
            gas: "0x1DCD0F58",
            input:
              "0xd1692f56000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a6120000000000000000000000000000000000000000000000000000000000000000",
            to: "0x13172EE393713fbA9925A9A752341Ebd31e8D9a7",
            value: "0x0",
            init: nil
          },
          error: "Reverted",
          result: %{gasUsed: "0x1D55DD47", output: "0x", address: nil, code: nil},
          subtraces: 1,
          traceAddress: [],
          type: "call",
          blockHash: nil,
          blockNumber: nil,
          transactionHash: nil,
          transactionPosition: nil
        },
        %{
          action: %{
            from: "0x13172EE393713fbA9925A9A752341Ebd31e8D9a7",
            gas: "0x1D555C99",
            init:
              "0x60e03461009157601f6101ec38819003918201601f19168301916001600160401b038311848410176100965780849260609460405283398101031261009157610047816100ac565b906100606040610059602084016100ac565b92016100ac565b9060805260a05260c05260405161012b90816100c18239608051816088015260a051816045015260c0518160c60152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100915756fe608060405260043610156013575b3660ba57005b6000803560e01c8063238ac9331460775763c34c08e51460325750600d565b34607457806003193601126074576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b80fd5b5034607457806003193601126074577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166080908152602090f35b600036818037808036817f00000000000000000000000000000000000000000000000000000000000000005af4903d918282803e60f357fd5bf3fea264697066735822122032b5603d6937ceb7a252e16379744d8545670ff4978c8d76c985d051dfcfe46c64736f6c6343000817003300000000000000000000000049e5d261e95f6a02505078bb339fecb210a0b634000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612000000000000000000000000142da9114e5a98e015aa95afca0585e84832a612",
            value: "0x0",
            callType: nil,
            input: nil,
            to: nil
          },
          error: "contract address collision",
          result: %{code: nil, output: nil, address: nil, gasUsed: nil},
          subtraces: 0,
          traceAddress: [0],
          type: "create",
          blockHash: nil,
          blockNumber: nil,
          transactionHash: nil,
          transactionPosition: nil
        }
      ],
      vmTrace: nil
    }

---

*Consult [api-reference.md](api-reference.md) for complete listing*
