dethcrypto / dethcrypto/dethtools

Feature Request: Integrate `decodeMultiSendData` from `@safe-global/protocol-kit` for Enhanced MultiSend Calldata Decoding

Open
#99 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
83
Forks
19
PR merge metrics
No merged PRs in 30d

Description

#### Description

I propose an enhancement to the [tools.deth.net/calldata-decoder](https://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](https://github.com/safe-global/safe-contracts/blob/main/contracts/libraries/MultiSend.sol) `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:

```javascript
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:
```javascript
import { decodeMultiSendData } from "@safe-global/protocol-kit/dist/src/utils";

const multiSendEncodedData = '0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000018b0046b6dbd5f2a68dbb387a363720bf5e9f213d7be5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000443e091ee9000000000000000000000000000000000000000000000000000009184e72a000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0046b6dbd5f2a68dbb387a363720bf5e9f213d7be5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000245ffc1ff70000000000000000000000000000000000000000000000000011c37937e080000046b6dbd5f2a68dbb387a363720bf5e9f213d7be5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000242bbb56d9000000000000000000000000dbdb6e722fdb392442787c8808600a4f6ccb6d02000000000000000000000000000000000000000000';

console.log(decodedTransactions); // output below
```
```javascript
[
{
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(...)`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.