-
-
Save Skyge/a7476b10e080af9fb75cc2c3c38d45f9 to your computer and use it in GitHub Desktop.
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
PRIVATE_KEY = | |
INFURA_KEY = | |
ETHERSCAN_KEY = |
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
async function main() { | |
const [deployer] = await ethers.getSigners(); | |
console.log( | |
"Deploying contracts with the account:", | |
deployer.address | |
); | |
console.log("Account balance:", (await deployer.getBalance()).toString()); | |
const Token = await ethers.getContractFactory("Token"); | |
const token = await upgrades.deployProxy(Token, ["Mock Token", "MT"], { initializer: 'initialize' }); | |
console.log("Token address:", token.address); | |
} | |
main() | |
.then(() => process.exit(0)) | |
.catch(error => { | |
console.error(error); | |
process.exit(1); | |
}); |
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 'dotenv/config'; | |
import { HardhatUserConfig } from 'hardhat/config' | |
import '@nomiclabs/hardhat-ethers' | |
import '@nomiclabs/hardhat-waffle' | |
import '@nomiclabs/hardhat-etherscan' | |
import '@openzeppelin/hardhat-upgrades' | |
import 'hardhat-typechain' | |
const privateKey = process.env.PRIVATE_KEY; | |
const infuraKey = process.env.INFURA_KEY; | |
const config: HardhatUserConfig = { | |
defaultNetwork: 'hardhat', | |
// This is a sample solc configuration that specifies which version of solc to use | |
solidity: { | |
version: '0.6.12', | |
settings: { | |
optimizer: { | |
enabled: true, | |
runs: 2000, | |
}, | |
}, | |
}, | |
networks: { | |
kovan: { | |
url: `https://kovan.infura.io/v3/${infuraKey}`, | |
accounts: [`0x${privateKey}`], | |
gasPrice: 1000000000, | |
}, | |
}, | |
typechain: { | |
outDir: 'types', | |
target: 'ethers-v5', | |
}, | |
etherscan: { | |
apiKey: process.env.ETHERSCAN_KEY | |
}, | |
} | |
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
{ | |
"name": "mycontract", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"devDependencies": { | |
"@nomiclabs/hardhat-ethers": "^2.0.0", | |
"@nomiclabs/hardhat-etherscan": "^2.0.1", | |
"@nomiclabs/hardhat-waffle": "^2.0.0", | |
"@openzeppelin/contracts-upgradeable": "^3.2.0", | |
"@openzeppelin/hardhat-upgrades": "^1.3.1", | |
"@typechain/ethers-v5": "^4.0.0", | |
"dotenv": "^8.2.0", | |
"ethers": "^5.0.20", | |
"hardhat": "^2.0.3", | |
"hardhat-typechain": "^0.3.3", | |
"ts-node": "^9.0.0", | |
"typechain": "^4.0.0", | |
"typescript": "^4.0.5" | |
} | |
} |
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
pragma solidity 0.6.12; | |
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol"; | |
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; | |
contract Token is Initializable, ERC20Upgradeable{ | |
function initialize( | |
string memory _name, | |
string memory _symbol | |
) public initializer { | |
__ERC20_init(_name, _symbol); | |
} | |
function mint(address account, uint256 amount) public { | |
_mint(account, amount); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment