dappconnect-vote-poll-sdk/packages/contracts/deploy/deploy.ts

23 lines
757 B
TypeScript
Raw Normal View History

2021-08-31 23:06:04 +00:00
import { ethers } from 'ethers'
import { deployContract } from 'ethereum-waffle'
import { VotingContract } from '../abi'
2021-08-31 23:06:04 +00:00
const deploy = async () => {
const providerName = process.env.ETHEREUM_PROVIDER
const privateKey = process.env.ETHEREUM_PRIVATE_KEY
console.log(privateKey)
if (privateKey && providerName) {
console.log(`deploying on ${providerName}`)
const provider = ethers.getDefaultProvider(process.env.ETHEREUM_PROVIDER)
const wallet = new ethers.Wallet(privateKey, provider)
2021-09-13 15:02:29 +00:00
const votingContract = await deployContract(wallet, VotingContract,[process.env.ETHEREUM_TOKEN_ADDRESS,1000])
2021-08-31 23:06:04 +00:00
console.log(`Voting contract deployed with address: ${votingContract.address}`)
}
}
deploy()