Skip to content

Commit

Permalink
Polygon sft single role deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lima committed Jan 29, 2024
1 parent ccf0ac6 commit 7f516a3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const DeployAddresses = {
ImmutableOwnerCreate2Factory: '0x066f91a9Aa4C33D4ea4c12aBee6f4cb4e919F71d',
RolesRegistry: '0xB1b599Ec67ad23AF7FAC240191319822e674571A',
KMSDeployer: '0x04c8c6c56dab836f8bd62cb6884371507e706806',
SftRolesRegistryPolygon: '0x071BC9F5aA747A9A8E8cE796e006d10dBf241E04',
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ethers, network } from 'hardhat'
import { AwsKmsSigner } from '@govtechsg/ethers-aws-kms-signer'
import { DeployAddresses } from '../config'
import { DeployAddresses } from '../../config'
import { keccak256 } from 'ethers/lib/utils'

const kmsCredentials = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ethers, network } from 'hardhat'
import { AwsKmsSigner } from '@govtechsg/ethers-aws-kms-signer'
import { DeployAddresses } from '../config'
import { RoleAssignment } from '../test/types'
import { DeployAddresses } from '../../config'
import { RoleAssignment } from '../../test/types'

const kmsCredentials = {
accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'AKIAxxxxxxxxxxxxxxxx', // credentials for your IAM user with KMS access
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ethers, network } from 'hardhat'
import { AwsKmsSigner } from '@govtechsg/ethers-aws-kms-signer'
import { DeployAddresses } from '../config'
import { RoleAssignment } from '../test/types'
import { DeployAddresses } from '../../config'
import { RoleAssignment } from '../../test/types'

const kmsCredentials = {
accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'AKIAxxxxxxxxxxxxxxxx', // credentials for your IAM user with KMS access
Expand Down
36 changes: 36 additions & 0 deletions scripts/sft-roles-registry-single-role/01-deploy.ts
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
})

0 comments on commit 7f516a3

Please sign in to comment.