Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
gretzke committed Dec 7, 2023
1 parent 83fc527 commit 8252ec0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
44 changes: 41 additions & 3 deletions README.md
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
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function validateAndExtractInputs() {

const printHelp = () => {
console.log(
"\nUsage: node lib/deployment-log-generator <scriptName> [-c chain-id] [-r rpc-url] [-s skip-json]\n\nCommands:\n -c, --chain-id\tChain id of the network where the script was executed (default: 31337)\n -r, --rpc-url\t\tRPC url used to fetch the version of the contract (default: $RPC_URL). If no rpc url is provided, version fetching is skipped.\n -s, --skip-json\tSkips the json generation and creates the markdown file using an existing json file\n\nOptions:\n -h, --help\t\tPrint help\n -v, --version\t\tPrint version\n\nDocumentation can be found at https://github.com/0xPolygon/deployment-log-generator",
"\nUsage: node lib/deployment-log-generator <scriptName> [-c chain-id] [-r rpc-url] [-s skip-json]\n\nCommands:\n -c, --chain-id\tChain id of the network where the script was executed (default: 31337)\n -r, --rpc-url\t\tRPC url used to fetch the version of the contract or verify an upgrade (default: $RPC_URL). If no rpc url is provided, version fetching is skipped.\n -s, --skip-json\tSkips the json generation and creates the markdown file using an existing json file\n\nOptions:\n -h, --help\t\tPrint help\n -v, --version\t\tPrint version\n\nDocumentation can be found at https://github.com/0xPolygon/deployment-log-generator",
);
};

Expand Down

0 comments on commit 8252ec0

Please sign in to comment.