Skip to content

Commit

Permalink
Merge pull request #5 from bugout-dev/update-docs
Browse files Browse the repository at this point in the history
Updated documentation (instructions to set up different networks)
  • Loading branch information
zomglings authored Apr 18, 2022
2 parents 5d77dc1 + 6b67655 commit 5d28322
Showing 1 changed file with 107 additions and 1 deletion.
108 changes: 107 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Inspector Facet

<a href="https://media.giphy.com/media/14mgxYFJHXGmoo/giphy.gif" target="_blank"><img src="https://media.giphy.com/media/14mgxYFJHXGmoo/giphy.gif" /></a>

A tool that allows you to inspect deployed [EIP-2535 Diamond proxy](https://eips.ethereum.org/EIPS/eip-2535)
contracts from your command line.

Expand All @@ -17,7 +19,7 @@ We support side information obtained from:
We support Diamond introspection:

- [x] Using the `DiamondLoupeFacet` interface
- [ ] From `DiamondCut` events crawled from the blockchain (using the [Moonstream API](https://moonstream.to)).
- [ ] From `DiamondCut` events crawled from the blockchain (using [`moonworm`](https://github.com/bugout-dev/moonworm)).

### Installation

Expand Down Expand Up @@ -61,6 +63,110 @@ inspector-facet \
--format json
```

### Connecting to a blockchain

Internally, Inspector Facet uses [`brownie`](https://github.com/eth-brownie/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:

```bash
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:

```bash
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:

```bash
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:
Expand Down

0 comments on commit 5d28322

Please sign in to comment.