This app runs inside the BotSurf browser. Don't have it yet? Get the app or extension now!

Diamond Standard Facet Cut Executor

Developer Tools · All
0 installs · Verified BotGentz app
Launch App
Opens in BotSurf — nothing to install.
CategoryDeveloper Tools
PlatformAll
Pricing Free
Installs0
Download BotSurf to use — free
No account needed for free apps. Once BotSurf is open, find this app in Apps from the + menu.

About this app

WHAT IT DOES

Diamond Standard Facet Cut Executor is a developer tool that executes diamond cuts (EIP-2535) to add, replace, or remove facets and their functions from a diamond contract. It reads the diamond contract address, the facet address to cut, facet selector functions (function signatures), the action type (add, replace, or remove), the current facet list on the diamond, chain ID, account nonce, gas estimates for cutting, and previous cut records. The tool then guides you through executing the diamond cut, updating the diamond storage, emitting a DiamondCut event, and syncing facet status across chains.

HOW TO USE

Connect your wallet via the built-in connector. Select the network where the diamond contract is deployed. Enter the diamond contract address, the facet address you wish to cut, the function selectors (comma-separated hex values), the action type (Add, Replace, or Remove), and the payment token address (use address(0) for native token). The tool will read on-chain data and display a preview including: diamond address, facet address, selectors, action type, payment token, account nonce, current facets on the diamond, estimated gas, and cut status. Review all details carefully. Click "execute diamond cut" to perform the cut. The tool will guide you through three steps: preparing the FacetCut structure, executing the cut on the diamond, and verifying the update.

TECHNICAL MECHANISM

The tool uses ethers.js v5.7.2 to interact with the diamond contract. It reads the current facet list using `diamond.facetAddresses()` and `diamond.facetFunctionSelectors(facetAddress)` to check for existing selectors and validate the cut. The account nonce is read via `provider.getTransactionCount(deployer)` and gas estimates are calculated using `estimateGas` on the diamond's `diamondCut()` method with EIP-1559 fee data from `feeData`. For the cut, the tool constructs a `FacetCut` struct containing the facet address, the action (0 for add, 1 for replace, 2 for remove), and the function selectors. The diamondCut transaction calls `diamondCut(facetCuts, init, initData)` on the diamond contract. The tool supports all three action types: Add (adds new functions to the diamond), Replace (replaces existing functions with new implementations), and Remove (removes functions from the diamond). For Remove actions, the facet address must be zero. Gas estimates are calculated using `estimateGas` with EIP-1559 fee data from `feeData`. All transactions are built with EIP-1559 fee data, and the tool uses `effectiveGasPrice` from receipts for accurate cost accounting. The tool also verifies the cut by checking the updated facet list after the transaction.

WHAT IT CANNOT SEE

This tool cannot verify that the facet is secure or free from vulnerabilities—it only executes the cut. It cannot detect if the facet will conflict with existing functions—selectors must be unique. It cannot guarantee that the diamond will function correctly after the cut—this depends on the facet's implementation and storage layout. It cannot ensure that the facet is compatible with the diamond's storage layout—facets must use the same storage structure. It cannot validate that the facet's selectors are correct—you must provide the correct function signatures. It cannot detect if the diamond contract has been modified. It cannot verify that the facet matches the intended implementation. It cannot predict gas costs for the cut.

PLEASE NOTE

This tool is EVM-only and supports Ethereum, Polygon, BNB Chain, Arbitrum, Optimism, and Avalanche. Diamond cut transactions are signed by the connected wallet, and the user pays gas fees. Diamond cuts are irreversible—ensure the facet is correct before executing. Always test on testnet before using on mainnet. The tool does not store or transmit any cut data.

Similar Apps

Log in to BotGentz

Suggest an App

Tell us what you'd find useful — if we build it, we'll email you the moment it's ready.