Skip to content

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 7, 2023
1 parent 52df007 commit ff391b8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/deploy-subnet-registrator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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, salt, gasLimit, ...args] = _args
const provider = new providers.JsonRpcProvider(<string>providerEndpoint)
const privateKey = process.env.PRIVATE_KEY

if (!privateKey || !utils.isHexString(privateKey, 32)) {
console.error('ERROR: Please provide a valid private key! (PRIVATE_KEY)')
return
}

const wallet = new Wallet(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 ff391b8

Please sign in to comment.