2021-03-28 16:14:09 +00:00
|
|
|
const hre = require("hardhat");
|
|
|
|
const RLP = require('rlp');
|
|
|
|
const { ethers } = hre;
|
|
|
|
|
|
|
|
async function main() {
|
2021-04-05 21:49:01 +00:00
|
|
|
const deployerAddress = '0xf6839085F692bDe6A8062573E3DA35E7e947C21E'
|
2021-03-28 23:13:10 +00:00
|
|
|
const initialSupply = ethers.utils.parseEther("100000000") // 100M supply
|
2021-04-05 21:49:01 +00:00
|
|
|
const initialHolder = '0xb1DC62EC38E6E3857a887210C38418E4A17Da5B2'
|
|
|
|
const mintingAfter = 1704067200 // Monday, 1 January 2024 00:00:00
|
|
|
|
const governanceAdmin = '0xb1DC62EC38E6E3857a887210C38418E4A17Da5B2'
|
2021-03-28 23:13:10 +00:00
|
|
|
const votingPeriod = 17280 // ~3 days in blocks (assuming 15s blocks)
|
|
|
|
const votingDelay = 1 // 1 block
|
|
|
|
const proposalThreshold = ethers.utils.parseEther("1000000") // 1M
|
|
|
|
const timelockDelay = 172800 // ~2 days in blocks (assuming 15s blocks)
|
2021-03-28 16:14:09 +00:00
|
|
|
|
2021-03-28 22:58:28 +00:00
|
|
|
const TokenDelegate = await ethers.getContractFactory("InstaTokenDelegate")
|
2021-03-28 16:14:09 +00:00
|
|
|
const tokenDelegate = await TokenDelegate.deploy()
|
|
|
|
|
|
|
|
await tokenDelegate.deployed()
|
|
|
|
|
2021-03-28 22:58:28 +00:00
|
|
|
const TokenDelegator = await ethers.getContractFactory("InstaTokenDelegator")
|
2021-03-28 16:14:09 +00:00
|
|
|
const tokenDelegator = await TokenDelegator
|
2021-03-29 18:42:48 +00:00
|
|
|
.deploy(initialHolder, tokenDelegate.address, initialSupply, mintingAfter, false)
|
2021-03-28 16:14:09 +00:00
|
|
|
|
|
|
|
await tokenDelegator.deployed()
|
|
|
|
|
|
|
|
const txCount = await ethers.provider.getTransactionCount(deployerAddress) + 2
|
|
|
|
|
|
|
|
const timelockAddress = '0x' + ethers.utils.keccak256(RLP.encode([deployerAddress, txCount])).slice(12).substring(14)
|
|
|
|
|
2021-03-28 22:58:28 +00:00
|
|
|
const GovernorDelegate = await ethers.getContractFactory("InstaGovernorBravoDelegate")
|
2021-03-28 16:14:09 +00:00
|
|
|
const governorDelegate = await GovernorDelegate.deploy()
|
|
|
|
|
|
|
|
await governorDelegate.deployed()
|
|
|
|
|
2021-03-28 22:58:28 +00:00
|
|
|
const GovernorDelegator = await ethers.getContractFactory("InstaGovernorBravoDelegator")
|
2021-03-28 16:14:09 +00:00
|
|
|
const governorDelegator = await GovernorDelegator
|
|
|
|
.deploy(
|
|
|
|
timelockAddress,
|
|
|
|
governanceAdmin,
|
|
|
|
tokenDelegator.address,
|
|
|
|
governorDelegate.address,
|
|
|
|
votingPeriod,
|
|
|
|
votingDelay,
|
|
|
|
proposalThreshold
|
|
|
|
)
|
|
|
|
|
|
|
|
await governorDelegator.deployed()
|
|
|
|
|
2021-03-28 22:58:28 +00:00
|
|
|
const Timelock = await ethers.getContractFactory("InstaTimelock")
|
2021-03-28 16:14:09 +00:00
|
|
|
const timelock = await Timelock.deploy(governorDelegator.address, timelockDelay)
|
|
|
|
|
2021-03-29 05:00:39 +00:00
|
|
|
await timelock.deployed()
|
|
|
|
|
2021-03-28 22:58:28 +00:00
|
|
|
console.log("InstaTokenDelegate: ", tokenDelegate.address)
|
|
|
|
console.log("InstaTokenDelegator: ", tokenDelegator.address)
|
|
|
|
console.log("InstaTimelock: ", timelock.address)
|
|
|
|
console.log("InstaGovernorBravoDelegate: ", governorDelegate.address)
|
|
|
|
console.log("InstaGovernorBravoDelegator: ", governorDelegator.address)
|
2021-03-28 16:14:09 +00:00
|
|
|
console.log()
|
|
|
|
|
|
|
|
await hre.run("verify:verify", {
|
|
|
|
address: tokenDelegate.address,
|
|
|
|
constructorArguments: []
|
|
|
|
})
|
|
|
|
|
|
|
|
await hre.run("verify:verify", {
|
|
|
|
address: tokenDelegator.address,
|
2021-03-29 18:42:48 +00:00
|
|
|
constructorArguments: [initialHolder, tokenDelegate.address, initialSupply, mintingAfter, false]
|
2021-03-28 16:14:09 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
await hre.run("verify:verify", {
|
|
|
|
address: governorDelegate.address,
|
|
|
|
constructorArguments: []
|
|
|
|
})
|
|
|
|
|
|
|
|
await hre.run("verify:verify", {
|
|
|
|
address: governorDelegator.address,
|
|
|
|
constructorArguments: [
|
|
|
|
timelockAddress,
|
|
|
|
governanceAdmin,
|
|
|
|
tokenDelegator.address,
|
|
|
|
governorDelegate.address,
|
|
|
|
votingPeriod,
|
|
|
|
votingDelay,
|
|
|
|
proposalThreshold
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
await hre.run("verify:verify", {
|
|
|
|
address: timelock.address,
|
|
|
|
constructorArguments: [governorDelegator.address, timelockDelay]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
|
|
.then(() => process.exit(0))
|
|
|
|
.catch(error => {
|
|
|
|
console.error(error);
|
|
|
|
process.exit(1);
|
|
|
|
});
|