Unable to decode input using Etherscan ABI

abidecodingfantomtransactions

I'm looking at the input for a transaction that calls a Smart Contract and I cannot make sense of it. This specific sample is on FTM, but I'm assuming there is no difference in behaviour to ETH?

Consider this transaction: https://ftmscan.com/tx/0x6f9df515d75e9f0444ec2388d4c880b668d71c37ddd673a82941cdae39cac0a9

The input is 0x42d8669300000000000000000000000088367cd6c890fc38ee3ec5a7b9baf71ef8ab6972 meaning that the method signature is 0x42d86693.

Now, looking at the published ABI on ftmscan for the Smart Contract this transaction Interacts with, which I can see has its Source Code marked as verified, it provides the ABI, copied below

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"enum Tangle.FacetCutAction","name":"action","type":"uint8"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"indexed":false,"internalType":"struct Tangle.FacetCut[]","name":"_diamondCut","type":"tuple[]"},{"indexed":false,"internalType":"address","name":"_init","type":"address"},{"indexed":false,"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"DiamondCut","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"enum Tangle.FacetCutAction","name":"action","type":"uint8"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"internalType":"struct Tangle.FacetCut[]","name":"_diamondCut","type":"tuple[]"},{"internalType":"address","name":"_init","type":"address"},{"internalType":"bytes","name":"_calldata","type":"bytes"}],"name":"diamondCut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_functionSelector","type":"bytes4"}],"name":"facetAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"facetAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_facet","type":"address"}],"name":"facetFunctionSelectors","outputs":[{"internalType":"bytes4[]","name":"","type":"bytes4[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"facets","outputs":[{"components":[{"internalType":"address","name":"facetAddress","type":"address"},{"internalType":"bytes4[]","name":"functionSelectors","type":"bytes4[]"}],"internalType":"struct Tangle.Facet[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

Strangely (?) None of the functions in the ABI match the signature in the input field (0x42d86693).

In fact if I use https://lab.miguelmota.com/ethereum-input-data-decoder/example/ to decode the input with the ABI, it's not able to be decoded. According to https://4byte.directory this method is withdrawRewards(address), and seems to make sense but there is no such function in the contract?

I have also gotten a copy of the bytecode using web3.eth.getCode, and decompiled it with https://ethervm.io/, and it looks like the ABI published on ftmscan does indeed match with the bytecode.

Can anyone help shed some light on what is happening here? How is the function with signature 0x42d86693 being invoked on a contract with seemingly no function with said signature?

Thank you!

Best Answer

In your contract no any withdrawRewards(address) function but you are calling non-existent function then fallback function will be executed.In this contract fallback function delegate call to other contract so that's reason you can't decode the input because input decoder can't know the other contract ABI.

Related Topic