From sd0x-dev-flow
Decodes EVM revert data, calldata, function selectors, and custom errors from 0x hex inputs. Handles standard Error/Panic, local selector lookup, and ABI fetches from Sourcify/Etherscan.
npx claudepluginhub sd0xdev/sd0x-dev-flow --plugin sd0x-dev-flowThis skill is limited to using the following tools:
Decode EVM contract function selectors, custom errors, calldata, and revert data.
Guides Foundry cast CLI for EVM blockchain interactions: send/call transactions, sign messages, ABI encode/decode, query balances/nonces via RPC endpoints like RouteMesh.
Analyzes EVM internals for gas optimization, Yul assembly, opcodes, storage layout, calldata, proxies, and bytecode. Useful for Solidity efficiency, debugging, MEV design. Activates on EVM/gas/yul mentions.
Interact with EVM-compatible blockchains using Foundry's cast CLI for querying balances, calling contracts, sending transactions, and blockchain exploration. Use for command-line Ethereum VM operations.
Share bugs, ideas, or general feedback.
Decode EVM contract function selectors, custom errors, calldata, and revert data.
0x + 8+ hex chars (selector or revert data)Error(string) revert already handled by your codebaseExtract from user input:
| Field | Source | Example |
|---|---|---|
revertData | Error data or user-pasted hex | 0xaca553e4 |
calldata | Transaction data | 0x5e15c749000...1c05 |
contractAddr | Contract address | 0x5874...f064 |
chainId | Chain identifier | 1 (Ethereum mainnet) |
Step 1: Classify input → Step 2: Local fast decode → Step 3: ABI query → Step 4: Precise decode → Report
| Length | Classification | Next Step |
|---|---|---|
4 bytes (0x + 8 hex) | Pure selector | Step 2 |
| > 4 bytes, with selector prefix | Calldata or revert data | Step 2 + Step 3 |
| Contract address | Need ABI first | Step 3 |
Try in order:
2a. Standard error decode
| Selector | Type | Decode Method |
|---|---|---|
0x08c379a0 | Error(string) | cast abi-decode "Error(string)" <data> |
0x4e487b71 | Panic(uint256) | cast abi-decode "Panic(uint256)" <data> → lookup panic code |
Panic code reference:
| Code | Meaning |
|---|---|
| 0x00 | generic compiler panic |
| 0x01 | assert failure |
| 0x11 | arithmetic overflow |
| 0x12 | division by zero |
| 0x21 | enum conversion |
| 0x22 | storage encoding |
| 0x31 | pop empty array |
| 0x32 | array out of bounds |
| 0x41 | too much memory |
| 0x51 | zero function pointer |
2b. Selector lookup (cast) — optional, skip if cast not installed
timeout 5 cast 4byte <selector>
If cast is unavailable or crashes, fall back to Step 3 API query.
See references/apis.md for full endpoints and parameters.
Query strategy:
Has contract address? → 3a. ABI path (precise) → get ABI → Step 4
No contract address? → 3b. Selector DB path (candidates) → get signature candidates
3a. ABI path (has contract address + chainId)
3b. Selector DB path (no contract address or ABI query failed)
confidence: low, list all possibilitiesWith ABI, use cast (if available):
# Decode revert data (needs ABI file)
cast decode-error <revert_data> --abi <abi_file>
# Decode calldata
cast decode-calldata <calldata> --abi <abi_file>
# Or decode with signature directly
cast calldata-decode "functionName(type1,type2)" <calldata>
Without ABI but with signature candidates:
cast abi-decode "functionName(type1,type2)" <data_without_selector>
## Contract Decode Report
| Field | Value |
|-------|-------|
| Type | function call / revert error / event |
| Selector | `0x5e15c749` |
| Signature | `finalizeWithdrawal(uint256)` |
| Decoded Args | `tokenId: 7173` |
| Confidence | High (verified ABI) / Medium (selector DB) / Low (multiple candidates) |
| Source | Sourcify / Etherscan / 4byte.directory / cast |
| Contract | `0x5874...f064` |
| Chain | Ethereum Mainnet (chainId: 1) |
### Raw Data
- Revert: `0xaca553e4`
- Calldata: `0x5e15c749000...1c05`
Multiple candidates:
### Ambiguous Candidates
| # | Signature | Confidence |
|---|-----------|------------|
| 1 | `WithdrawalRequestDoesNotExist()` | Likely (context match) |
| 2 | `SomeOtherError()` | Unlikely |
| File | Purpose | When to Read |
|---|---|---|
references/apis.md | API endpoints, parameters, rate limits | Before Step 3 |
Input: Decode 0xaca553e4
Action: 4 bytes → selector → cast 4byte → 4byte.directory → return candidate signatures
Input: What is this revert data 0x08c379a0000...
Action: selector = Error(string) → local cast abi-decode → return error message
Input: Decode this with contract 0x5874..., chainId 1, revert data 0xaca553e4
Action: Has contract + chainId → Sourcify ABI → cast decode-error → precise decode