Add hardhat deployment by T-Hax

This commit is contained in:
Theo 2023-06-13 11:33:37 -07:00
commit a935093f54
8 changed files with 137 additions and 11 deletions

7
.env.example Normal file

@ -0,0 +1,7 @@
MAINNET_RPC_URL=
ETHERSCAN_KEY=
PRIVATE_KEY=
GOERLI_RPC_URL=
SEOPLIA_RPC_URL=
RINKEBY_RPC_URL=

11
.gitignore vendored

@ -3,9 +3,7 @@ cache/
out/
# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/
broadcast
# Docs
docs/
@ -20,6 +18,11 @@ package-lock.json
# yarn
yarn.lock
yarn-error.log
# VScode files
.vscode
.vscode
# hh
artifacts
cache_hardhat

5
config.js Normal file

@ -0,0 +1,5 @@
module.exports = {
torn: "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C",
governanceProxy: "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce",
registryProxy: "0x58E8dCC13BE9780fC42E8723D8EaD4CF46943dF2"
}

@ -5,7 +5,7 @@ out = 'out'
libs = ["node_modules", "lib"]
# Compiler
auto_detect_solc = true
solc = "0.6.12"
via_ir = true
optimizer = true
optimizer-runs = 200

76
hardhat.config.js Normal file

@ -0,0 +1,76 @@
require('dotenv').config()
require('@nomicfoundation/hardhat-foundry')
require('@nomicfoundation/hardhat-verify')
require('@nomiclabs/hardhat-ethers')
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: {
compilers: [
{
version: '0.6.2',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
networks: {
hardhat: {
forking: {
url: `${process.env.MAINNET_RPC_URL}`,
},
chainId: 1,
loggingEnabled: false,
allowUnlimitedContractSize: false,
},
rinkeby: {
url: `${process.env.RINKEBY_RPC_URL}`,
accounts: `${process.env.PRIVATE_KEY}`
? [`${process.env.PRIVATE_KEY}`]
: { mnemonic: 'test test test test test junk' },
},
goerli: {
url: `${process.env.GOERLI_RPC_URL}`,
accounts: `${process.env.PRIVATE_KEY}`
? [`${process.env.PRIVATE_KEY}`]
: { mnemonic: 'test test test test test junk' },
},
sepolia: {
url: `${process.env.SEPOLIA_RPC_URL}`,
accounts: `${process.env.PRIVATE_KEY}`
? [`${process.env.PRIVATE_KEY}`]
: { mnemonic: 'test test test test test junk' },
},
mainnet: {
url: `${process.env.MAINNET_RPC_URL}`,
accounts: `${process.env.PRIVATE_KEY}`
? [`${process.env.PRIVATE_KEY}`]
: { mnemonic: 'test test test test test junk' },
},
},
mocha: {
timeout: 9999999999 /* The following simply does not work: ignore: ["factory.with.registry.test.js", "sidechain.instance.factory.test.js"] */,
},
spdxLicenseIdentifier: {
overwrite: true,
runOnCompile: true,
},
etherscan: {
apiKey: `${process.env.ETHERSCAN_KEY}`,
},
}

@ -1 +1 @@
Subproject commit e8a047e3f40f13fa37af6fe14e6e06283d9a060e
Subproject commit 9b49a72cfdb36bcf195eb863f868f01a6d6d3186

@ -14,20 +14,27 @@
"author": "Theo",
"license": "MIT",
"dependencies": {
"bignumber.js": "^9.1.1",
"dotenv": "^16.1.3",
"web3": "^1.10.0",
"web3-utils": "^1.10.0",
"@openzeppelin/contracts": "^3.2.0-rc.0",
"@openzeppelin/upgrades-core": "^1.0.1",
"torn-token": "^1.0.4"
"bignumber.js": "^9.1.1",
"dotenv": "^16.1.4",
"torn-token": "^1.0.4",
"web3": "^1.10.0",
"web3-utils": "^1.10.0"
},
"devDependencies": {
<<<<<<< HEAD
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-waffle": "^2.0.6",
"chai": "^4.3.7",
"ethereum-waffle": "^4.0.10",
"ethers": "^6.5.1",
=======
"@nomicfoundation/hardhat-foundry": "^1.0.1",
"@nomicfoundation/hardhat-verify": "^1.0.1",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"ethers": "^5",
>>>>>>> 80078475d5d09a2b730f8334120a524d069ec5b1
"hardhat": "^2.15.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.3"

28
scripts/deployProposal.js Normal file

@ -0,0 +1,28 @@
const hre = require('hardhat')
const config = require("../config")
const { ethers } = hre
async function main() {
const factory_staking = await ethers.getContractFactory("TornadoStakingRewards")
const factory_proposal = await ethers.getContractFactory("Proposal")
const staking = await factory_staking.deploy(config.governanceProxy, config.torn, config.registryProxy)
console.log("\nStaking contract impl successfully deployed @ " + staking.address + '\n')
await hre.run('verify:verify', {
address: staking.address,
constructorArguments: [config.governanceProxy, config.torn, config.registryProxy],
})
const proposal = await factory_proposal.deploy(staking.address)
console.log("\nProposal 25 successfully deployed @ " + proposal.address + '\n')
await hre.run('verify:verify', {
address: proposal.address,
constructorArguments: [staking.address],
})
}
main().then((res) => console.log(res ?? "\nScript finished.\n"))