Merge pull request #5 from tornadocash/temp

make it identical to mainnet; fix CI
This commit is contained in:
Alexey Pertsev 2021-11-19 18:06:10 +01:00 committed by GitHub
commit 88b7e9ffe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 71 deletions

View File

@ -1,3 +1,3 @@
ETHERSCAN_KEY=
INFURA_KEY=
use_latest_block=false
ALCHEMY_KEY=
use_latest_block=false

View File

@ -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;

View File

@ -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();

View File

@ -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

View File

@ -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,
},

View File

@ -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,
},
},

View File

@ -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,
},
},