Last active
April 18, 2023 13:50
-
-
Save kalouo/d10bcd125e3cc7ff194ba1e2c3c26420 to your computer and use it in GitHub Desktop.
Smart contracts with Hardhat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | |
import { DeployFunction } from 'hardhat-deploy/types'; | |
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | |
const { | |
deployments: { deploy }, | |
getNamedAccounts, | |
} = hre; | |
const { deployer } = await getNamedAccounts(); | |
await deploy('ERC20', { | |
from: deployer, | |
args: ['Medium', 'MDM'], | |
log: true, | |
}); | |
}; | |
export default func; | |
func.tags = ['ERC20']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SPDX-License-Identifier: Unlicense | |
pragma solidity 0.8.3; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
contract _ERC20 is ERC20 { | |
constructor (string memory _name, string memory _symbol) ERC20(_name, _symbol) {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import '@nomiclabs/hardhat-waffle'; | |
import '@nomiclabs/hardhat-ethers'; | |
import 'hardhat-deploy'; | |
import * as dotenv from 'dotenv'; | |
import { HardhatUserConfig } from 'hardhat/config'; | |
dotenv.config(); | |
/* This loads the variables in your .env file to `process.env` */ | |
const { DEPLOYER_PRIVATE_KEY, INFURA_PROJECT_ID } = process.env; | |
const config: HardhatUserConfig = { | |
solidity: '0.8.3', | |
networks: { | |
mainnet: { | |
url: `https://mainnet.infura.io/v3/${INFURA_PROJECT_ID}`, | |
chainId: 1, | |
accounts: [`0x${DEPLOYER_PRIVATE_KEY}`], | |
}, | |
kovan: { | |
url: `https://kovan.infura.io/v3/${INFURA_PROJECT_ID}`, | |
chainId: 42, | |
accounts: [`0x${DEPLOYER_PRIVATE_KEY}`], | |
}, | |
}, | |
namedAccounts: { | |
deployer: 0, | |
}, | |
}; | |
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bsc_testnet: { | |
url: 'https://data-seed-prebsc-1-s1.binance.org:8545', | |
chainId: 97, | |
accounts: [`0x${DEPLOYER_PRIVATE_KEY}`], | |
}, | |
bsc_mainnet: { | |
url: 'https://bsc-dataseed.binance.org/', | |
chainId: 56, | |
accounts: [`0x${DEPLOYER_PRIVATE_KEY}`], | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment