foundry-rs / foundry-rs/foundry

Add flag to `forge script` to display a table of addresses and labels upon deployment

Open
#4,515 4 comments 0 reactions 0 assignees View on GitHub
C-forge Cmd-forge-script T-feature T-post-V1
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
18h 20m
Merged PRs (30d)
510

Description

### Component

Forge

### Describe the feature you would like

After a forge script deployment a `run-latest.json` file is created that contains the name and corresponding addresses of the deployed contracts. Reading and sharing just the addresses makes it necessary to use a script that prints them out. I use something like this:

```python
import json

P = "../broadcast/Deploy.Goerli.s.sol/5/run-latest.json"

f = open(P)
d = json.load(f)

# there are some dups that we need to filter out
contractNames = []
for k in d["transactions"]:
contractName = k["contractName"]
if contractName not in contractNames:
print(contractName.ljust(12), k["contractAddress"])
contractNames.append(contractName)
```

I would like to create and integrate a forge command for that. Is this also interesting to others?

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.