Skip to content

Commit

Permalink
feat: script to deploy nodes to blockchain
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvit07 committed Feb 4, 2023
1 parent 41d4c65 commit 3ce17b1
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions web3/scripts/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { ethers } from 'hardhat';
import console from 'console';

const _metadataUri = 'https://gateway.pinata.cloud/ipfs/https://gateway.pinata.cloud/ipfs/QmX2ubhtBPtYw75Wrpv6HLb1fhbJqxrnbhDo1RViW3oVoi';

async function deploy(name: string, ...params: [string]) {
const contractFactory = await ethers.getContractFactory(name);

return await contractFactory.deploy(...params).then((f) => f.deployed());
}

async function main() {
const [admin] = await ethers.getSigners();

console.log(`Deploying a smart contract...`);

const PokeMon = (await deploy('PokeMon', _metadataUri)).connect(admin);

console.log({ PokeMon: PokeMon.address });
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
});

0 comments on commit 3ce17b1

Please sign in to comment.