dethtools
dethtools copied to clipboard
Feature Request: Integrate `decodeMultiSendData` from `@safe-global/protocol-kit` for Enhanced MultiSend Calldata Decoding
Description
I propose an enhancement to the tools.deth.net/calldata-decoder tool to include the decoding of multiSend
transactions using the decodeMultiSendData
function from the @safe-global/protocol-kit
package. While the tool effectively identifies calls to the Safe Global MultiSend multiSend
function (starting with the function selector 0x8d80ff0a
), it currently does not decode the transaction bytes within the data
fields of each transaction in the multiSend
call.
To enhance the functionality of the Calldata Decoder, I suggest integrating the decodeMultiSendData
function from the @safe-global/protocol-kit
package. This function is specifically designed to decode multiSend
transaction data into a more readable and structured format.
Use Case
The multiSend
function is a crucial component of the Gnosis Safe contract, allowing multiple transactions to be sent in one Ethereum transaction. Enhancing the Calldata Decoder with this functionality would significantly benefit developers and users interacting with complex smart contracts, especially those involving batch transactions.
Proposed Functionality
The decodeMultiSendData
function decodes the multiSend
data and provides detailed insights into each transaction. Here is an overview of the function:
function decodeMultiSendData(encodedData: string): MetaTransactionData[] {
// Function implementation...
}
This function breaks down the encoded multiSend
data into individual transactions, revealing important details like the operation type, destination address, value, and data payload for each transaction.
Expected Benefits
-
Enhanced Decoding: Users will be able to decode not just the
multiSend
call but also the nested transactions within it, providing a comprehensive view of the batched transactions. - Increased Usability: This feature will make the Calldata Decoder tool even more versatile and useful for a wider range of Ethereum smart contract interactions.
-
Developer Convenience: Developers working with Gnosis Safe contracts or other contracts utilizing
multiSend
will greatly benefit from the ability to decode and analyze transactions in-depth directly from the tool.
Test Case and Output
I tested the decodeMultiSendData
function with the following multiSend
encoded data:
import { decodeMultiSendData } from "@safe-global/protocol-kit/dist/src/utils";
const multiSendEncodedData = '0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000018b0046b6dbd5f2a68dbb387a363720bf5e9f213d7be5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000443e091ee9000000000000000000000000000000000000000000000000000009184e72a000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0046b6dbd5f2a68dbb387a363720bf5e9f213d7be5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000245ffc1ff70000000000000000000000000000000000000000000000000011c37937e080000046b6dbd5f2a68dbb387a363720bf5e9f213d7be5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000242bbb56d9000000000000000000000000dbdb6e722fdb392442787c8808600a4f6ccb6d02000000000000000000000000000000000000000000';
console.log(decodedTransactions); // output below
[
{
operation: 0,
to: '0x46b6dBd5f2a68dBB387A363720Bf5E9F213D7BE5',
value: '0',
data: '0x3e091ee9000000000000000000000000000000000000000000000000000009184e72a000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
},
{
operation: 0,
to: '0x46b6dBd5f2a68dBB387A363720Bf5E9F213D7BE5',
value: '0',
data: '0x5ffc1ff70000000000000000000000000000000000000000000000000011c37937e08000'
},
{
operation: 0,
to: '0x46b6dBd5f2a68dBB387A363720Bf5E9F213D7BE5',
value: '0',
data: '0x2bbb56d9000000000000000000000000dbdb6e722fdb392442787c8808600a4f6ccb6d02'
}
]
Now if each data
field is decoded we get setDepositMax(...)
, setHysteresis(...)
and setAffiliate(...)
This request could easily extend to include decoding the callData
in each Call
to the multicall
function.
https://github.com/Uniswap/v3-periphery/blob/main/contracts/lens/UniswapInterfaceMulticall.sol