diff --git a/.env.example b/.env.example index bf733e1..4a64149 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ ETHERSCAN_KEY= -INFURA_KEY= -use_latest_block=false \ No newline at end of file +ALCHEMY_KEY= +use_latest_block=false diff --git a/contracts/v1/Configuration.sol b/contracts/v1/Configuration.sol index b6451b7..577c78b 100644 --- a/contracts/v1/Configuration.sol +++ b/contracts/v1/Configuration.sol @@ -30,7 +30,7 @@ contract Configuration { EXECUTION_DELAY = 2 days; EXECUTION_EXPIRATION = 3 days; QUORUM_VOTES = 25000e18; // 0.25% of TORN - PROPOSAL_THRESHOLD = 1000e18; // 0.1% of TORN + PROPOSAL_THRESHOLD = 1000e18; // 0.01% of TORN VOTING_DELAY = 75 seconds; VOTING_PERIOD = 3 days; CLOSING_PERIOD = 1 hours; diff --git a/contracts/v2-vault-and-gas/VaultAndGasProposal.sol b/contracts/v2-vault-and-gas/VaultAndGasProposal.sol index b8109ab..cc9f0de 100644 --- a/contracts/v2-vault-and-gas/VaultAndGasProposal.sol +++ b/contracts/v2-vault-and-gas/VaultAndGasProposal.sol @@ -63,10 +63,10 @@ contract VaultAndGasProposal is ImmutableGovernanceInformation { "TORN: transfer failed" ); - uint96 amountOfTornToAuctionOff = 100 ether; - uint96 minBuyAmount = 1.51 ether; - uint256 minBidInTorn = 0.01 ether; - uint256 fundingThreshold = 5 ether; + uint96 amountOfTornToAuctionOff = 787 ether; + uint96 minBuyAmount = 11 ether; + uint256 minBidInTorn = 10 ether; + uint256 fundingThreshold = 9 ether; TornadoAuctionHandler auctionHandler = new TornadoAuctionHandler(); diff --git a/contracts/v2-vault-and-gas/gas/GovernanceGasUpgrade.sol b/contracts/v2-vault-and-gas/gas/GovernanceGasUpgrade.sol index edf13f6..f64c23c 100644 --- a/contracts/v2-vault-and-gas/gas/GovernanceGasUpgrade.sol +++ b/contracts/v2-vault-and-gas/gas/GovernanceGasUpgrade.sol @@ -58,7 +58,7 @@ contract GovernanceGasUpgrade is GovernanceVaultUpgrade, GasCompensator { * as such this function can trigger a payable fallback. It is not possible to vote without revert more than once, without hasAccountVoted being true, eliminating gas refunds in this case. - Gas compensation is also using the low level send(), forwarding 23000 gas + Gas compensation is also using the low level send(), forwarding 23000 gas as to disallow further logic execution above that threshold. * @param proposalId id of proposal account is voting on * @param support true if yes false if no diff --git a/hardhat.config.js b/hardhat.config.js index 9a38a8b..302ef13 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -46,7 +46,7 @@ module.exports = { networks: { hardhat: { forking: { - url: `https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`, + url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`, blockNumber: 13042331, }, initialBaseFeePerGas: 5, @@ -56,7 +56,7 @@ module.exports = { timeout: 120000, }, mainnet: { - url: `https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`, + url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`, accounts: ['900e9f0e8ce24c022026649c48a059fb6ffa0a2523811d797b47d789bf106def'], // random pk off keys.lol timeout: 2147483647, }, diff --git a/test/v1/governance.v1.test.js b/test/v1/governance.v1.test.js index f30c864..67ea192 100644 --- a/test/v1/governance.v1.test.js +++ b/test/v1/governance.v1.test.js @@ -933,7 +933,7 @@ describe('Governance tests', () => { await ethers.provider.send('hardhat_reset', [ { forking: { - jsonRpcUrl: `https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`, + jsonRpcUrl: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`, blockNumber: process.env.use_latest_block == 'true' ? undefined : 13042331, }, }, diff --git a/test/v2/all.governance.v2.test.js b/test/v2/all.governance.v2.test.js index 99bf4d0..c5ddd13 100644 --- a/test/v2/all.governance.v2.test.js +++ b/test/v2/all.governance.v2.test.js @@ -360,8 +360,8 @@ describe('Start of tests', () => { BigNumber.from(0).sub(pE(100)), ) - const buyAmount = pE(40) - const sellAmount = pE(3.73 + i / 100) + const buyAmount = pE(240) + const sellAmount = pE(23.73 + i / 100) await WETH.approve(GnosisEasyAuction.address, sellAmount) @@ -404,7 +404,7 @@ describe('Start of tests', () => { claimedSum = claimedSum.add(claimed) } - expect(claimedSum).to.closeTo(ethers.utils.parseEther('100'), ethers.utils.parseUnits('1', 'szabo')) + expect(claimedSum).to.closeTo(ethers.utils.parseEther('787'), ethers.utils.parseUnits('1', 'szabo')) /// Now revert and test with lower await sendr('evm_revert', [snapshotIdArray[2]]) @@ -420,7 +420,7 @@ describe('Start of tests', () => { ) const buyAmount = pE(0.5) - const sellAmount = pE(0.53 + i / 100) + const sellAmount = pE(22 + i / 100) await WETH.approve(GnosisEasyAuction.address, sellAmount) @@ -466,63 +466,9 @@ describe('Start of tests', () => { } expect(claimedSum).to.be.closeTo( - ethers.utils.parseEther('100'), + ethers.utils.parseEther('787'), ethers.utils.parseUnits('1', 'szabo'), ) - - /// Now revert and test with below funding - await sendr('evm_revert', [snapshotIdArray[2]]) - snapshotIdArray[2] = await sendr('evm_snapshot', []) - - for (let i = 0; i < signerArray.length; i++) { - const bidder = signerArray[i] - - WETH = await WETH.connect(bidder) - await expect(() => WETH.deposit({ value: pE(100) })).to.changeEtherBalance( - bidder, - BigNumber.from(0).sub(pE(100)), - ) - - const buyAmount = pE(0.5) - const sellAmount = pE(0.03 + i / 100) - - await WETH.approve(GnosisEasyAuction.address, sellAmount) - - GnosisEasyAuction = await GnosisEasyAuction.connect(bidder) - - await GnosisEasyAuction.placeSellOrders( - 38, - [buyAmount], - [sellAmount], - ['0x0000000000000000000000000000000000000000000000000000000000000001'], - '0x', - ) - - orderArray[i] = await OrderHelper.encodeOrder( - await GnosisEasyAuction.numUsers(), - buyAmount, - sellAmount, - ) - } - - auctionEndDt = (await GnosisEasyAuction.auctionData(38))[3].sub(BigNumber.from(await timestamp())) - - await minewait(auctionEndDt.toNumber()) - - await GnosisEasyAuction.settleAuction(38) - - for (let i = 0; i < signerArray.length; i++) { - await GnosisEasyAuction.claimFromParticipantOrder(38, [orderArray[i]]) - console.log( - `Signer ${i} claimed: `, - (await TornToken.balanceOf(signerArray[i].address)).toString(), - ' torn', - ) - } - - expect(await TornToken.balanceOf(TornadoAuctionHandler.address)).to.equal( - ethers.utils.parseEther('100'), - ) }) it('Test multiple accounts proposal', async function () { @@ -788,7 +734,7 @@ describe('Start of tests', () => { await ethers.provider.send('hardhat_reset', [ { forking: { - jsonRpcUrl: `https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`, + jsonRpcUrl: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`, blockNumber: process.env.use_latest_block == 'true' ? undefined : 13211966, }, },