Skip to content

Commit 97aedc2

Browse files
committed
feat: add deployment ID support for Hardhat Ignition in environment configuration and deployment script
1 parent 3fbf473 commit 97aedc2

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

.github/workflows/sharing-smart-contract-deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ jobs:
123123
echo "deployment-id=$DEPLOYMENT_ID" >> $GITHUB_OUTPUT
124124
POCO_ADDRESS="${{ vars.POCO_ADDRESS }}" \
125125
DATASET_REGISTRY_ADDRESS="${{ vars.DATASET_REGISTRY_ADDRESS }}" \
126-
npm run deploy -- --network ${{ inputs.network }} --deployment-id "$DEPLOYMENT_ID"
126+
DEPLOYMENT_ID="$DEPLOYMENT_ID" \
127+
npm run deploy -- --network ${{ inputs.network }}
127128
fi
128129
129130
- name: Verify contracts

packages/sharing-smart-contract/.env.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ EXPLORER_API_KEY=
2424

2525
## Whether to use API V2 verification format
2626
IS_VERIFICATION_API_V2=
27+
## Deployment ID for Hardhat Ignition
28+
29+
DEPLOYMENT_ID=...

packages/sharing-smart-contract/config/env.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ const envSchema = z.object({
6464
message: 'IS_VERIFICATION_API_V2 must be "true" or "false"',
6565
})
6666
.transform((val) => val === 'true'),
67+
68+
// Deployment ID for Hardhat Ignition
69+
DEPLOYMENT_ID: z.string().optional().or(z.literal('')),
6770
});
6871

6972
module.exports = envSchema.parse(process.env);

packages/sharing-smart-contract/scripts/deploy.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ import DataProtectorSharingModule from '../ignition/modules/DataProtectorSharing
44

55
const { ethers, upgrades } = hre;
66

7-
// Parse command line arguments
8-
const args = process.argv.slice(2);
9-
const deploymentIdIndex = args.indexOf('--deployment-id');
10-
const deploymentId =
11-
deploymentIdIndex !== -1 && deploymentIdIndex + 1 < args.length
12-
? args[deploymentIdIndex + 1]
13-
: undefined;
7+
// Get deployment ID from environment variable
8+
const deploymentId = env.DEPLOYMENT_ID;
149

1510
/**
1611
* This script deploys DataProtectorSharing contract and its dependencies using

0 commit comments

Comments
 (0)