|
| 1 | +# iExec PoCo Smart Contracts |
| 2 | + |
1 | 3 | [](https://codecov.io/github/iExecBlockchainComputing/PoCo) |
2 | 4 |
|
3 | 5 | # Introduction |
@@ -117,23 +119,69 @@ npm run test |
117 | 119 |
|
118 | 120 | ## Deploy |
119 | 121 |
|
120 | | -You can deploy the smart contracts according to the [deploy/0_deploy.ts](./deploy/0_deploy.ts) content. This will automatically save some addresses of the deployed artifacts to the `./build` folder. |
| 122 | +The iExec PoCo contracts support automated deployment through both command-line interface and GitHub Actions workflows. |
| 123 | +
|
| 124 | +### Command Line Deployment |
| 125 | +
|
| 126 | +You can deploy the smart contracts according to the [deploy/0_deploy.ts](./deploy/0_deploy.ts) content. This will automatically save some addresses of the deployed artifacts to the `./deployments` folder. |
121 | 127 |
|
122 | | -To do so: |
| 128 | +To deploy using the CLI: |
123 | 129 |
|
124 | | -1. Make sure you followed the "Configure a deployment" section; |
125 | | -2. Enter your targeted blockchain parameters in `hardhat.config.ts` configuration file; |
| 130 | +1. Make sure you followed the "Configure a deployment" section above |
| 131 | +2. Enter your targeted blockchain parameters in `hardhat.config.ts` |
126 | 132 | 3. Run the deployment using: |
| 133 | +
|
127 | 134 | ``` |
128 | 135 | npx hardhat deploy --network <your network name> |
129 | 136 | ``` |
130 | 137 |
|
131 | | -Example of "complex" deployment: |
| 138 | +Example with custom salt: |
132 | 139 |
|
133 | 140 | ``` |
134 | 141 | SALT=0x0000000000000000000000000000000000000000000000000000000000000001 npx hardhat deploy --network hardhat |
135 | 142 | ``` |
136 | 143 |
|
| 144 | +### GitHub Actions Deployment |
| 145 | +
|
| 146 | +For production deployments, we use GitHub Actions to automate the process with enhanced security. The workflow allows deploying to different networks with different environment configurations (development or production). |
| 147 | +
|
| 148 | +To deploy using GitHub Actions: |
| 149 | +
|
| 150 | +1. Navigate to the Actions tab in your GitHub repository |
| 151 | +2. Select the "Deploy PoCo Contracts" workflow |
| 152 | +3. Click "Run workflow" |
| 153 | +4. Choose the target network from the dropdown |
| 154 | +5. Select the deployment environment (develop or production) |
| 155 | +6. Start the workflow |
| 156 | +
|
| 157 | +The workflow will: |
| 158 | +1. Run tests for the target network (only in development environment) |
| 159 | +2. Deploy the contracts using the appropriate environment keys |
| 160 | +3. Update the `config.json` file with the deployed contract addresses |
| 161 | +4. Commit the deployment artifacts and updated configuration back to the repository |
| 162 | +5. Wait for the contracts to be indexed by the block explorer |
| 163 | +6. Verify the contracts on the blockchain explorer |
| 164 | +
|
| 165 | +## Contract Verification |
| 166 | +
|
| 167 | +After deploying contracts, you can verify them on block explorers to make their source code publicly available. |
| 168 | +
|
| 169 | +### Manual Verification |
| 170 | +
|
| 171 | +To manually verify contracts: |
| 172 | +
|
| 173 | +``` |
| 174 | +npx hardhat run ./scripts/verify.ts --network <your network name> |
| 175 | +``` |
| 176 | +
|
| 177 | +This script automatically reads all deployed contract addresses and their constructor arguments from the deployment artifacts and verifies them on the relevant block explorer. |
| 178 | +
|
| 179 | +### Automated Verification via GitHub Actions |
| 180 | +
|
| 181 | +The GitHub Actions workflow automatically handles contract verification after deployment. It waits 60 seconds for the contracts to be indexed by the block explorer before attempting verification. |
| 182 | +
|
| 183 | +The verification process uses the same script (`./scripts/verify.ts`) that reads deployment artifacts to verify each contract with its correct constructor arguments. |
| 184 | +
|
137 | 185 | ## Formatting |
138 | 186 |
|
139 | 187 | Format a specific file or files in a directory: |
|
0 commit comments