Supported Ethereum Decoded Data

TrustVault currently indexes all of Ethereum transactions and this allows us to pass some of that indexed data on in Webhook calls.

This is particularly useful in DeFi transactions as the index can provide more information on exactly what method was called and what the parameter values were. Additionally, we can show the result of the transaction (e.g. which ERC-20 tokens were transferred) if the transaction contract call has included the events.

If you need some background reading, you could start with a primer on understanding transactions, followed by a bit more detail on a transaction and finally you can ready the details of decoding an ethereum transaction.

Armed with this information on a transaction you can see that the chain provides a reasonable set of information about the transaction such as the method arguments and data types. However, what is missing is the method names and the argument names. This information has to be added manually and this is what a TrustVault Webhook will do for you.

This is really useful for:

  • Understanding what you’ve actually called in a contact
  • Understanding the values that were passed to arguments
  • Confirming that what you expected was called
  • Adding additional rules to your workflow

NB: This information is used in our DeFi firewall product which will analyse data from a transaction to decide if the transaction should be signed or not.

Additionally, TrustVault will pass the Log data from the transaction to confirm the output of the transaction.
This article about Logs and Events is also well worth a read to help you understand if you need it.

An example of the payload with decoded Ethereum data can be found on our webhooks page. The “Sample ERC20 Received Event Object” is particularly useful, but here’s a snippet.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...other fields excluded
"decodedInput": {
"id": "0xa9059cbb",
"signature": "transfer(address to, uint256 amount)",
"params": [
{
"name": "to",
"type": "address",
"value": "0x671e96593ea93bfcb510375f4cec111d0e5cf1b8"
},
{
"name": "amount",
"type": "uint256",
"value": "0xcaf67003701680000"
}
]
}
...other fields excluded

This shows that for this transaction, the method transfer(address to, uint256 amount) was called passing in the value 0x671e96593ea93bfcb510375f4cec111d0e5cf1b8 to the address field and the value 0xcaf67003701680000 to the amount field. This is in hex so the decimal value is 234000000000000000000. (Given this contract has 18 decimal places this is 234 tokens)

The table below lists the method signatures that have been specifically indexed (most are from well know DeFi protocols such as KyberSwap) and, if your transaction calls any of these methods, that detail will be provided in the webhook.

Supported Ethereum Decoded Method Signature

Supported Ethereum decoded method signatures for ChainRawEthereumTransaction.decodedInput field in the transactions query.

Any unsupported method signatures will have a value of null.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
addLiquidity(address tokenA,address tokenB,uint amountADesired,uint amountBDesired,uint amountAMin,uint amountBMin,address to,uint deadline)
addLiquidityETH(address token,uint amountTokenDesired,uint amountTokenMin,uint amountETHMin,address to,uint deadline)
approve(address to, uint256 amount)
bid(address,uint256)
borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf)
burn(address to)
createPair(address tokenA, address tokenB)
delegate()
deposit(uint256 a,uint256 b)
deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode)
flashLoan(address receiverAddress, address[] calldata assets, uint256[] calldata amounts, uint256[] modes, address onBehalfOf, bytes calldata params, uint16 referralCode)
getReward()
liquidationCall(address collateral, address debt, address user, uint256 debtToCover, bool receiveAToken)
mint(address to)
permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s)
redeem(uint256 amount)
removeLiquidity(address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline)
removeLiquidityETH(address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline)
removeLiquidityETHWithPermit(address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s)
removeLiquidityWithPermit(address tokenA,address tokenB,uint liquidity,uint amountAMin,uint amountBMin,address to,uint deadline,bool approveMax, uint8 v, bytes32 r, bytes32 s)
repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf)
reveal(uint256 secret)
safeTransferFrom(address,address,uint256,uint256,bytes)
skim(address to)
stakeStart(uint256 newStakedHearts,uint256 newStakedDays)
submit(uint256 a, int256 b)
swap(uint amount0Out, uint amount1Out, address to, bytes calldata data)
swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
swapExactETHForTokens(uint256 amountOutMin,address[] path,address to,uint256 deadline)
function swapExactETHForTokensSupportingFeeOnTransferTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
swapExactTokensForETH(uint256 amountOut,uint256 amountInMax,address[] path,address to,uint256 deadline)
swapExactTokensForTokens(uint256 amountIn,uint256 amountOutMin,address[] path,address to,uint256 deadline)
swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn,uint amountOutMin,address[] calldata path,address to,uint deadline)
swapExactTokensForTokensSupportingFeeOnTransferTokens(uint amountIn,uint amountOutMin,address[] calldata path,address to,uint deadline)
swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
swapTokensForExactTokens(uint256 amountInMin,uint256 amountOut,address[] path,address to,uint256 deadline)
sync()
transfer(address to, uint256 amount)
transferFrom(address from, address to, uint value)
withdraw(uint256 amount)
withdraw(address token, uint256 amount, address destination)

Supported Ethereum Decoded Event Logs

Supported Ethereum decoded event logs for ChainRawEthereumTransaction.decodedEvents field in the transactions query.

Any unsupported event logs will not be included in the ChainRawEthereumTransaction.decodedEvents array.

1
2
3
4
5
Approval(address indexed owner, address indexed spender, uint256 value)
Burn(address indexed sender, uint amount0, uint amount1, address indexed to)
Mint(address indexed sender, uint amount0, uint amount1)
Swap(address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to)
Transfer(address indexed from, address indexed to, uint256 value)