diff --git a/hardhat.config.js b/hardhat.config.js index ce99226..e232a5b 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -1,34 +1,27 @@ -require("@nomiclabs/hardhat-waffle"); +require('@nomiclabs/hardhat-waffle') require('dotenv').config() module.exports = { - defaultNetwork: "localhost", + defaultNetwork: 'localhost', networks: { - hardhat: { - }, localhost: { - url: "http://127.0.0.1:8545" + url: 'http://127.0.0.1:8545', }, - rinkeby: { - url: process.env.ENDPOINT_URL, - // chainId: 4, - accounts: [process.env.DEPLOYER_KEY] - } }, solidity: { version: '0.8.11', settings: { optimizer: { enabled: true, - runs: 200 - } - } + runs: 200, + }, + }, }, paths: { - sources: "./src/contracts", - artifacts: "./src/abis" + sources: './src/contracts', + artifacts: './src/abis', }, mocha: { - timeout: 40000 - } -} \ No newline at end of file + timeout: 40000, + }, +} diff --git a/scripts/deploy.js b/scripts/deploy.js index e69de29..771d5c8 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -0,0 +1,24 @@ +const { ethers } = require('hardhat') +const fs = require('fs') + +async function main() { + const contract_name = '' + 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 +})