Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
feat: add SubnetRegistrator deployment script
Browse files Browse the repository at this point in the history
Signed-off-by: Jawad Tariq <[email protected]>
  • Loading branch information
JDawg287 committed Sep 8, 2023
1 parent 52df007 commit 3f0d496
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions scripts/deploy-subnet-registrator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { providers, utils, Wallet } from 'ethers'
import subnetRegistratorJSON from '../artifacts/contracts/topos-core/SubnetRegistrator.sol/SubnetRegistrator.json'
import { Arg, deployContractConstant } from './const-addr-deployer'

const main = async function (..._args: Arg[]) {
const [providerEndpoint, privateKey, salt, gasLimit, ...args] = _args
const provider = new providers.JsonRpcProvider(<string>providerEndpoint)

if (!privateKey || !utils.isHexString('0x' + <string>privateKey, 32)) {
console.error('ERROR: Please provide a valid private key!')
return
}

const wallet = new Wallet('0x' + <string>privateKey || '', provider)
const address = await deployContractConstant(
wallet,
subnetRegistratorJSON,
<string>salt,
[wallet.address, ...args],
<number>gasLimit
)
.then(({ address }) => address)
.catch(console.error)
console.log(address)
}

const args = process.argv.slice(2)
main(...args)

0 comments on commit 3f0d496

Please sign in to comment.