set back to bytes32 resolve, proposal threshold 1000, proper env

This commit is contained in:
Tisamenus 2021-11-13 20:25:31 +01:00
parent 8155cffb76
commit f12ac4cf3e
6 changed files with 17 additions and 20 deletions

View File

@ -1,3 +1,3 @@
etherscan_api_key=
mainnet_rpc_key=
ETHERSCAN_KEY=
ALCHEMY_KEY_MAINNET=
use_latest_block=false

View File

@ -31,7 +31,7 @@ contract Configuration {
EXECUTION_DELAY = 2 days;
EXECUTION_EXPIRATION = 3 days;
QUORUM_VOTES = 25000e18; // 0.25% of TORN
PROPOSAL_THRESHOLD = 10000e18; // 0.1% of TORN
PROPOSAL_THRESHOLD = 1000e18; // 0.1% of TORN
VOTING_DELAY = 75 seconds;
VOTING_PERIOD = 3 days;
CLOSING_PERIOD = 1 hours;

View File

@ -89,8 +89,8 @@ contract Governance is Initializable, Configuration, Delegation, EnsResolve {
_initializeConfiguration();
}
function initialize(address _torn) public initializer {
torn = TORN(_torn);
function initialize(bytes32 _torn) public initializer {
torn = TORN(resolve(_torn));
// Create a dummy proposal so that indexes start from 1
proposals.push(
Proposal({

View File

@ -46,7 +46,7 @@ module.exports = {
networks: {
hardhat: {
forking: {
url: `https://mainnet.infura.io/v3/${process.env.mainnet_rpc_key}`,
url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY_MAINNET}`,
blockNumber: 13042331,
},
initialBaseFeePerGas: 5,
@ -56,7 +56,7 @@ module.exports = {
timeout: 120000,
},
mainnet: {
url: `https://mainnet.infura.io/v3/${process.env.mainnet_rpc_key}`,
url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY_MAINNET}`,
accounts: ['900e9f0e8ce24c022026649c48a059fb6ffa0a2523811d797b47d789bf106def'], // random pk off keys.lol
timeout: 2147483647,
},
@ -67,6 +67,6 @@ module.exports = {
runOnCompile: true,
},
etherscan: {
apiKey: `${process.env.etherscan_api_key}`,
apiKey: `${process.env.ETHERSCAN_KEY}`,
},
}

View File

@ -85,10 +85,7 @@ describe('Governance tests', () => {
proxy = await ethers.getContractFactory('MockProxy')
proxy = await proxy.deploy(
governance.address,
'0xc4d66de8000000000000000000000000c351628eb244ec633d5f21fbd6621e1a683b1181',
)
proxy = await proxy.deploy(governance.address, [])
governance = await ethers.getContractAt('MockGovernance', proxy.address)
@ -96,7 +93,7 @@ describe('Governance tests', () => {
{ to: miningPublicKey, amount: cap.toString() },
])
await governance.setTorn(torn.address)
await governance.initialize(torn.address + '000000000000000000000000')
expect(await governance.torn()).to.equal(torn.address)
@ -223,21 +220,21 @@ describe('Governance tests', () => {
})
it('fails if proposer does not have voting power', async function () {
const voterBob = signerArray[5]
const tenThousandTorn = ethers.utils.parseEther('10000')
const oneThousandTorn = ethers.utils.parseEther('1000')
torn = await torn.connect(miningPublicKey)
await torn.transfer(voterBob.address, tenThousandTorn)
await torn.transfer(voterBob.address, oneThousandTorn)
torn = await torn.connect(voterBob)
await torn.approve(governance.address, tenThousandTorn)
await torn.approve(governance.address, oneThousandTorn)
expect(await governance.torn()).to.equal(torn.address)
governance = await governance.connect(voterBob)
await governance.lockWithApproval(tenThousandTorn.sub(1))
await governance.lockWithApproval(oneThousandTorn.sub(1))
await expect(governance.propose(dummy.address, 'dummy')).to.be.revertedWith(
'Governance::propose: proposer votes below proposal threshold',
@ -921,7 +918,7 @@ describe('Governance tests', () => {
})
it('cannot initialize implementation contract', async () => {
const impl = await (await ethers.getContractFactory('NewImplementation')).deploy()
await expect(impl.initialize(signerArray[0].address)).to.be.revertedWith(
await expect(impl.initialize(signerArray[0].address + '000000000000000000000000')).to.be.revertedWith(
'Contract instance has already been initialized',
)
})
@ -936,7 +933,7 @@ describe('Governance tests', () => {
await ethers.provider.send('hardhat_reset', [
{
forking: {
jsonRpcUrl: `https://mainnet.infura.io/v3/${process.env.mainnet_rpc_key}`,
jsonRpcUrl: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY_MAINNET}`,
blockNumber: process.env.use_latest_block == 'true' ? undefined : 13042331,
},
},

View File

@ -788,7 +788,7 @@ describe('Start of tests', () => {
await ethers.provider.send('hardhat_reset', [
{
forking: {
jsonRpcUrl: `https://mainnet.infura.io/v3/${process.env.mainnet_rpc_key}`,
jsonRpcUrl: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY_MAINNET}`,
blockNumber: process.env.use_latest_block == 'true' ? undefined : 13211966,
},
},