Compare commits

..

No commits in common. "bca893268635db0d35a15ba3dac099118fc168af" and "baf416acaf53dde46643fedcf6a348ca1aedc949" have entirely different histories.

11 changed files with 2 additions and 50 deletions

@ -5,8 +5,7 @@
"author": "Theo",
"license": "MIT",
"scripts": {
"test": "forge test -vvv --fork-url https://rpc.mevblocker.io --fork-block-number 17336117 --no-match-contract TestRelayerBalance",
"testWithGas": "forge test -vvv --fork-url https://rpc.mevblocker.io --fork-block-number 17336117 --no-match-contract TestRelayerBalance --gas-report",
"test": "forge test -vvv --fork-url https://rpc.mevblocker.io --fork-block-number 17336117 --no-match-contract TestRelayerBalance --gas-report",
"relayerBalancesSum": "forge test -vvv --fork-url https://rpc.mevblocker.io --fork-block-number 17304722 --match-contract TestRelayerBalance --gas-report"
},
"dependencies": {

@ -1,5 +1,5 @@
@proprietary/=src/proprietary/
@interfaces/=test/forge/interfaces/
@interfaces/=test/interfaces/
@root/=src/
@forge-std/=lib/forge-std/src/

@ -1,47 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import { console2 } from "@forge-std/console2.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { MockProposal } from "./MockProposal.sol";
import { Mock } from "./Mock.sol";
import { Parameters } from "@proprietary/Parameters.sol";
import { GovernancePatchUpgrade } from "@root/v4-patch/GovernancePatchUpgrade.sol";
contract DummyProposal is Parameters, Mock {
address private fundingAddress;
uint256 private fundingAmount;
constructor(address _fundingAddress, uint256 _fundingAmount) public {
fundingAddress = _fundingAddress;
fundingAmount = _fundingAmount;
}
function executeProposal() public {
// Easy-to-check after execution
IERC20(_tokenAddress).transfer(TEST_ADDRESS_ONE, 1_000_000 ether);
}
}
contract TestGovernanceProtection is MockProposal {
function testNewDummyProposal() public executeAttackerProposalBefore executeCurrentProposalBefore {
IERC20 TORN = IERC20(_tokenAddress);
uint256 amountToTransfer = 1_000_000 ether;
uint256 testAccountBalanceBeforeDummyProposal = TORN.balanceOf(TEST_ADDRESS_ONE);
console2.log("Account balance before dummy proposal exectuion: %s TORN", testAccountBalanceBeforeDummyProposal / _tornDecimals);
vm.warp(block.timestamp + PROPOSAL_EXECUTION_MAX_DURATION);
proposeAndExecute(address(new DummyProposal(TEST_ADDRESS_ONE, amountToTransfer)));
uint256 testAccountBalanceAfterDummyProposal = TORN.balanceOf(TEST_ADDRESS_ONE);
console2.log("Account balance after dummy proposal exectuion: %s TORN", testAccountBalanceAfterDummyProposal / _tornDecimals);
require(
testAccountBalanceAfterDummyProposal - testAccountBalanceBeforeDummyProposal == amountToTransfer,
"Dummy proposal executed incorrectly"
);
}
}