-
Notifications
You must be signed in to change notification settings - Fork 0
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
Daniel Lima
committed
Jan 29, 2024
1 parent
ccf0ac6
commit 7f516a3
Showing
5 changed files
with
42 additions
and
5 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
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
4 changes: 2 additions & 2 deletions
4
scripts/02-grant-role.ts → scripts/roles-registry/02-grant-role.ts
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
4 changes: 2 additions & 2 deletions
4
scripts/03-revoke-role.ts → scripts/roles-registry/03-revoke-role.ts
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { ethers, network } from 'hardhat' | ||
import { AwsKmsSigner } from '@govtechsg/ethers-aws-kms-signer' | ||
|
||
const kmsCredentials = { | ||
accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'AKIAxxxxxxxxxxxxxxxx', // credentials for your IAM user with KMS access | ||
secretAccessKey: process.env.AWS_ACCESS_KEY_SECRET || 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // credentials for your IAM user with KMS access | ||
region: 'us-east-1', // region of your KMS key | ||
keyId: process.env.AWS_KMS_KEY_ID || 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', // KMS key id | ||
} | ||
|
||
const NETWORK = network.name | ||
const CONTRACT_NAME = 'SftRolesRegistrySingleRole' | ||
|
||
const networkConfig: any = network.config | ||
const provider = new ethers.providers.JsonRpcProvider(networkConfig.url || '') | ||
const signer = new AwsKmsSigner(kmsCredentials).connect(provider) | ||
|
||
async function main() { | ||
const operator = await signer.getAddress() | ||
console.log(`Deploying ${CONTRACT_NAME} contract on: ${NETWORK} network with ${operator}`) | ||
|
||
const ContractFactory = await ethers.getContractFactory(CONTRACT_NAME) | ||
const contract = await ContractFactory.deploy() | ||
await contract.deployed() | ||
|
||
console.log(`${CONTRACT_NAME} deployed at: ${contract.address}`) | ||
} | ||
|
||
main() | ||
.then(async () => { | ||
console.log('All done!') | ||
}) | ||
.catch(error => { | ||
console.error(error) | ||
process.exitCode = 1 | ||
}) |