{"size": 757, "ext": "js", "max_stars_repo_path": "React/lottery-react/web/deploy.js", "max_stars_repo_name": "Vrushali-anil-Chaudhari/Dev-Scripts", "max_stars_repo_stars_event_min_datetime": "2021-10-02T07:30:48.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T13:43:32.000Z", "max_issues_repo_path": "React/lottery-react/web/deploy.js", "max_issues_repo_name": "Vrushali-anil-Chaudhari/Dev-Scripts", "max_issues_repo_issues_event_min_datetime": "2021-10-02T07:13:00.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T20:40:51.000Z", "max_forks_repo_path": "React/lottery-react/web/deploy.js", "max_forks_repo_name": "Vrushali-anil-Chaudhari/Dev-Scripts", "max_forks_repo_forks_event_min_datetime": "2021-10-02T07:30:53.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T08:25:54.000Z"}
{"max_stars_count": 32, "max_issues_count": 170, "max_forks_count": 69, "avg_line_length": 25.2333333333, "max_line_length": 68, "alphanum_fraction": 0.6618229855}
const HDWalletProvider = require('@truffle/hdwallet-provider');
const Web3 = require('web3');
const dotenv = require('dotenv');
const { abi, evm } = require('./compile');


dotenv.config();
const provider = new HDWalletProvider(
    process.env.SEED_PHRASE,
    process.env.INFURA,
);


const web3 = new Web3(provider);

const deploy = async () => {
    const accounts = await web3.eth.getAccounts();

    console.log('Attempting to deploy from account :', accounts[0]);

    const result = await new web3.eth.Contract(abi)
        .deploy({ data : evm.bytecode.object })
        .send({ gas : '1000000', from : accounts[0] });

    console.log(abi);
    console.log('Contract deployed to', result.options.address);
    provider.engine.stop();
};

deploy();