/
awesome-readme.config.js
189 lines (151 loc) · 7.61 KB
/
awesome-readme.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
module.exports = {
figlet: `
888 888 888 888 888
888 888 888 888 888
888 888 888 888 888
.d88888 .d88b. 88888b. 888 .d88b. 888 88888888b.d88b. .d88b. 88888b. 888888 888888 .d88b. .d88b. 888
d88" 888d8P Y8b888 "88b888d88""88b888 888888 "888 "88bd8P Y8b888 "88b888 888 d88""88bd88""88b888
888 88888888888888 888888888 888888 888888 888 88888888888888 888888 888888888 888 888888 888888
Y88b 888Y8b. 888 d88P888Y88..88PY88b 888888 888 888Y8b. 888 888Y88b. Y88b. Y88..88PY88..88P888
"Y88888 "Y8888 88888P" 888 "Y88P" "Y88888888 888 888 "Y8888 888 888 "Y888 "Y888 "Y88P" "Y88P" 888
888 888
888 Y8b d88P
888 "Y88P"
`,
root_license: `[![npm version](https://badge.fury.io/js/deployment-tool.svg)](https://badge.fury.io/js/deployment-tool)`,
root_header: `
This Hardhat plugin add 4 tasks and 3 functions to deploy and upgrade smart contracts.
Step include :
- Compile your contracts
- Verify storage layout, deploy a proxy admin if non existent, deploy implementation contract if non existent
- Get last commit id (8 first characters)
- Deploy a Transparent Upgradeable Proxy OR Upgrade Proxy using implementation contract
- Save address of the Proxy, Proxy Admin address and initialize arguments
- Verify contract on etherscan.io (if selected)
- Commit new storage layout file and address file with Contract Name and CommitId in commit msg
- Git Pull & Push
## How to install this package
### 1. Install this package
With NPM
\`\`\`
npm install deployment-tool
\`\`\`
Or with Yarn
\`\`\`
yarn add deployment-tool
\`\`\`
### 2. Import/Require this package in your hardhat.config.js/.ts
Inside inside hardhat.config.js
\`\`\`
require("deployment-tool");
\`\`\`
or inside hardhat.config.ts (Typescript)
\`\`\`
import 'deployment-tool'
\`\`\`
`,
root_body: `
### Other option
<details>
<summary>Clone this repository and create a symlink</summary>
\`\`\`
git clone https://github.com/marc-aurele-besner/deployment-tool
cd deployment-tool
npm install
npm run build
npm link
\`\`\`
in the hardhat project, you want to use this plugin
\`\`\`
npm link deployment-tool
\`\`\`
</details>
## Tasks
\`\`\`
npx hardhat deployment
npx hardhat deploy-contract
npx hardhat upgrade-contract
npx hardhat deploy-contract-static
npx hardhat test-deploy-then-upgrade-contract
\`\`\`
### Task: deploy-contract
Usage: hardhat [GLOBAL OPTIONS] deploy-contract [--contract-name <STRING>] [--extra <STRING>] [--initialize-arguments <STRING>] [--initialize-signature <STRING>] [--skip-git <STRING>] [--tag <STRING>] [--verify-contract <STRING>]
OPTIONS:
- --contract-name The name of the contract to deploy (default: "")
- --extra Extra data to save with this deployment (default: "")
- --initialize-arguments The initialize() argument (default: "")
- --initialize-signature Function signature of the initialize function (default: "")
- --skip-git Skit git commit, pull & push (default: "false")
- --tag Add a extra tag to this version of the contract (default: "")
- --verify-contract Validate the contract on Etherscan.io (default: "false")
deploy-contract: Deploy a proxy contract, initialize it, save the address, commit, pull and push
### Task: upgrade-contract
Usage: hardhat [GLOBAL OPTIONS] upgrade-contract [--contract-name <STRING>] [--extra <STRING>] [--skip-git <STRING>] [--tag <STRING>] [--verify-contract <STRING>]
OPTIONS:
- --contract-name The name of the contract to deploy (default: "")
- --extra Extra data to save with this deployment (default: "")
- --skip-git Skit git commit, pull & push (default: "false")
- --tag Add a extra tag to this version of the contract (default: "")
- --verify-contract Validate the contract on Etherscan.io (default: "false")
upgrade-contract: Upgrade a proxy contract, save the address, commit, pull and push
### Task: deploy-contract-static
Usage: hardhat [GLOBAL OPTIONS] deploy-contract-static [--contract-name <STRING>] [--extra <STRING>] [--constructor-arguments <STRING>] [--skip-git <STRING>] [--tag <STRING>] [--verify-contract <STRING>]
OPTIONS:
- --contract-name The name of the contract to deploy (default: "")
- --extra Extra data to save with this deployment (default: "")
- --constructor-arguments The constructor() argument (default: "")
- --skip-git Skit git commit, pull & push (default: "false")
- --tag Add a extra tag to this version of the contract (default: "")
- --verify-contract Validate the contract on Etherscan.io (default: "false")
deploy-contract-static: Deploy a static contract, save the address, commit, pull and push
### Task: test-deploy-then-upgrade-contract
Usage: hardhat [GLOBAL OPTIONS] test-deploy-then-upgrade-contract [--contract-name <STRING>] [--extra <STRING>] [--initialize-arguments <STRING>] [--initialize-signature <STRING>] [--skip-git <STRING>] [--tag <STRING>] [--verify-contract <STRING>]
OPTIONS:
- --contract-name The name of the contract to deploy (default: "")
- --extra Extra data to save with this deployment (default: "")
- --initialize-arguments The initialize() argument (default: "")
- --initialize-signature Function signature of the initialize function (default: "")
- --skip-git Skit git commit, pull & push (default: "false")
- --tag Add a extra tag to this version of the contract (default: "")
- --verify-contract Validate the contract on Etherscan.io (default: "false")
test-deploy-then-upgrade-contract: Upgrade a proxy contract, save the address, commit, pull and push
## Functions
Function allow you to use the deployment OR upgrade script in scripts or tests files, they all return a instance of the contract that you can use.
\`\`\`
const { contractDeployment } = require('hardhat');
contractDeployment.deployContract(
contractName: string,
initializeArguments: any[] = [],
initializeSignature: string = 'initialize',
tag?: string,
extra?: any,
skipGit?: boolean,
verifyContract?: boolean
)
contractDeployment.upgradeContract(
contractName: string,
tag?: string,
extra?: any,
skipGit?: boolean,
verifyContract?: boolean
)
contractDeployment.testDeployThenUpgradeContract(
contractName: string,
initializeArguments: any[] = [],
initializeSignature: string = 'initialize',
tag?: string,
extra?: any,
skipGit?: boolean,
verifyContract?: boolean
)
\`\`\`
`,
root_footer: `
### Dependencies
This package/plugin use other hardhat plugins that you can then reuse, for example https://www.npmjs.com/package/hardhat-awesome-cli is used to save the contract address and initialization details, this can be access with a function like
\`\`\`
const { addressBook } = require('hardhat');
addressBook.retrieveContractObject(contractName: string, deployedNetwork: string)
\`\`\`
`
}