Skip to content

Commit

Permalink
add deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoAcosta committed Apr 6, 2022
1 parent 5db62c3 commit 4fccce0
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions scripts/deploy-mainnet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const {BigNumber} = require('ethers')
const hre = require('hardhat')

const uris = require('../metadata/uris')
const contractURI = 'https://ipfs.io/ipfs/' + uris.collection.json

async function deploy() {
const Violet = await hre.ethers.getContractFactory('Violet')
const violet = await Violet.deploy(
contractURI,
process.env.MAINNET_WITHDRAWAL_1,
process.env.MAINNET_WITHDRAWAL_2,
{gasPrice: BigNumber.from(process.env.MAINNET_GAS_PRICE)}
)

const tx = violet.deployTransaction
console.log('Deployment tx:', tx.hash)

await violet.deployed()
;[deployer, ...addrs] = await ethers.getSigners()

console.log('Violet deployed to:', violet.address)
console.log('Deployed by:', deployer.address)
}

const tryToDeploy = async () => {
// Repeat deploy() until gasPrice < block base fee
deploy().catch((error) => {
console.error(error)
tryToDeploy()
})
}

tryToDeploy()

0 comments on commit 4fccce0

Please sign in to comment.