Inspector Facet - What methods is your EIP2535 Diamond proxy contract serving?
Project description
Inspector Facet
A tool that allows you to inspect deployed EIP-2535 Diamond proxy contracts from your command line.
Inspector Facet was inspired by Louper.dev (GitHub).
Inspector Facet uses side information about facet ABIs to match the selectors that a Diamond proxy is serving to human-understandable information about the facets and the functions.
We support side information obtained from:
We support Diamond introspection:
- Using the
DiamondLoupeFacet
interface - From
DiamondCut
events crawled from the blockchain (usingmoonworm
).
Installation
Inspector Facet is written in Python 3 and is distributed using PyPI: https://pypi.org/project/inspector-facet/
To install Inspector Facet, run:
pip install inspector-facet
Usage
inspector-facet --help
To use Inspector Facet with:
A brownie
project
The following command produces human-readable output:
inspector-facet \
--network <brownie network name for blockchain> \
--address <address of diamond contract> \
--project <path to brownie project (should contain build artifacts in build/contracts)> \
--format human
The following command produces JSON output and can be used to inspect a Diamond contract programatically (e.g. as part of a CI/CD pipeline):
inspector-facet \
--network <brownie network name for blockchain> \
--address <address of diamond contract> \
--project <path to brownie project (should contain build artifacts in build/contracts)> \
--format json
Connecting to a blockchain
Internally, Inspector Facet uses brownie
to work with any
Ethereum-based blockchain. When you use inspector-facet
, even with a hardhat
project, inspector-facet
will still use brownie
to interact with any blockchain.
Any inspector-facet
command that calls out to a blockchain will take a -n/--network
argument. The value
of this argument must be the name of a brownie
network configured in your Python environment.
brownie
is a dependency of inspector-facet
and is automatically installed when you install inspector-facet
.
To see a list of available brownie
networks, activate the Python environment in which you installed
inspector-facet
and run:
brownie networks list
The output will look like this (truncated for brevity):
$ brownie networks list
Brownie v1.17.2 - Python development framework for Ethereum
The following networks are declared:
Ethereum
├─Mainnet (Infura): mainnet
├─Ropsten (Infura): ropsten
├─Rinkeby (Infura): rinkeby
├─Goerli (Infura): goerli
└─Kovan (Infura): kovan
Ethereum Classic
├─Mainnet: etc
└─Kotti: kotti
Arbitrum
└─Mainnet: arbitrum-main
...
To view the details for any particular network, use:
brownie networks modify $NETWORK
For example:
$ brownie networks modify mainnet
$ brownie networks modify mainnet
Brownie v1.17.2 - Python development framework for Ethereum
SUCCESS: Network 'Mainnet (Infura)' has been modified
└─Mainnet (Infura)
├─id: mainnet
├─chainid: 1
├─explorer: https://api.etherscan.io/api
├─host: https://mainnet.infura.io/v3/$WEB3_INFURA_PROJECT_ID
└─multicall2: 0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696
If you want to connect to this network, using Infura, all you have to do is set your WEB3_INFURA_PROJECT_ID
environment variable (get this information from your project dashboard on Infura) and set --network mainnet
when you invoke inspector-facet
.
For networks which have publicly available nodes, it's even more straightforward:
$ brownie networks modify etc
Brownie v1.17.2 - Python development framework for Ethereum
SUCCESS: Network 'Mainnet' has been modified
└─Mainnet
├─id: etc
├─chainid: 61
├─explorer: https://blockscout.com/etc/mainnet/api
└─host: https://www.ethercluster.com/etc
You don't need any additional environment variables.
Adding a custom network
To add your own network, use the brownie networks add
command.
The signature for this command is:
brownie networks add <label> <network-name> chainid=<chain ID for network> host=<JSON RPC endpoint> explorer=<API URL for blockchain explorer>
The <label>
is purely for organizational purposes and can be set to whatever string you want.
For example, if you wanted to add the public Polygon RPC service as a network, you would do:
brownie networks add Polygon matic chainid=137 host=https://polygon-rpc.com explorer=https://api.polygonscan.com/api
Support
You can get help in any of the following ways:
- File an issue
- Ask for help on Moonstream Discord
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for inspector_facet-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b54967ddb445ba20f5bca9b38f1ffd4f3d072fc2546c1e5e94110b468672ac24 |
|
MD5 | 8bf3bbb27dcbcf76071909402c5b9037 |
|
BLAKE2b-256 | 3229bf91ef78f5291d53ebf491490dc10d989358e80e2738350896b621fa1d43 |