Skip to content

Instantly share code, notes, and snippets.

@covelitein
Created August 17, 2023 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save covelitein/36be619252923d325955894126c9d459 to your computer and use it in GitHub Desktop.
Save covelitein/36be619252923d325955894126c9d459 to your computer and use it in GitHub Desktop.
p2e
const { ethers } = require('hardhat')
const fs = require('fs')
const toWei = (num) => ethers.utils.parseEther(num.toString())
async function main() {
const contract_name = 'PlayToEarn'
const Contract = await ethers.getContractFactory(contract_name)
const contract = await Contract.deploy()
await contract.deployed()
const address = JSON.stringify({ address: contract.address }, null, 4)
fs.writeFile('./src/abis/contractAddress.json', address, 'utf8', (err) => {
if (err) {
console.error(err)
return
}
console.log('Deployed contract address', contract.address)
})
}
main().catch((error) => {
console.error(error)
process.exitCode = 1
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment