-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,44 @@ | ||
> [!NOTE] | ||
> Interim repository. | ||
# Deplyoment Log Generator | ||
|
||
``` | ||
The deployment log generator is a tool that generates a json file and a human readable markdown log file with the deployment information about contracts deployed using `forge script`. It can keep track of upgrades for transparent proxies and generates a history of deployments. An example for such a log can be found [here](https://github.com/0xPolygon/pol-token/blob/main/deployments/5.md). Logs are generated by extracting information from the `run-latest.json` file generated by `forge script` in the `broadcast` directory. | ||
|
||
## Requirements | ||
|
||
The script utilizes Node.js to run. We recommend the node version defined in the `.nvmrc` file. | ||
|
||
## Installation | ||
|
||
```bash | ||
forge install 0xPolygon/deployment-log-generator | ||
``` | ||
|
||
## Usage Example | ||
|
||
The following command will create a log for the contracts deployed in the `Deploy.s.sol` script on Ethereum mainnet. | ||
|
||
```bash | ||
node lib/deployment-log-generator Deploy.s.sol --chain-id 1 --rpc-url https://mainnet.infura.io/v3/{your-infura-key} | ||
``` | ||
|
||
## Usage | ||
|
||
Deployment markdown & json log file will be placed within the `deployments` directory. The name of the file will be the chain id of the network where the script was executed (e.g., for Ethereum mainnet the files will be `deployments/1.md` and `deployments/json/1.json`). | ||
|
||
Supplying the RPC url _can_ be optional. When contracts are deployed, the RPC url is used to check whether the deployed contracts implement a `version()` function. If they do, the version is extracted and recorded within the log file. If no RPC url is supplied, the version check is skipped. | ||
|
||
Supplying the RPC url is _required_ when an upgrade is deployed for a transparent proxy. The script can recognize when an upgrade is deployed, however, most of the times, only an implementation is deployed and the actual upgrade is performed by a multisig or governance. When an upgrade is detected, the RPC url will be used to verify that the upgrade was performed on chain directly and only then, deployment log files will be generated. If the upgrade was not performed on chain yet, the script will abort. | ||
|
||
## Flags | ||
|
||
| --flag | -flag | Description | | ||
| ----------- | ----- | -------------------------------------------------------------------------- | | ||
| --rpc-url | -r | RPC url used for versioning and upgrade verification (default: $RPC_URL) | | ||
| --chain-id | -c | Chain id of the network where the script was executed (default: 31337) | | ||
| --skip-json | -s | Skip generation of json file and only generate markdown from existing json | | ||
| Options | | | | ||
| --help | -h | Print help | | ||
| --version | -v | Print the version number | | ||
|
||
--- | ||
|
||
© 2023 PT Services DMCC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters