Remove useless modifier, because now we replenish Governance Staking contract balance in proposal itself

This commit is contained in:
Theo 2023-05-27 16:39:09 +03:00
parent 662b608a26
commit 0e00f9287a

@ -11,13 +11,6 @@ import { RelayerRegistry } from "@root/v4-patch/RelayerRegistry.sol";
import { TornadoStakingRewards } from "@root/v4-patch/TornadoStakingRewards.sol"; import { TornadoStakingRewards } from "@root/v4-patch/TornadoStakingRewards.sol";
contract TestGovernanceStakingRewards is MockProposal { contract TestGovernanceStakingRewards is MockProposal {
modifier replenishGovernanceStakingBalanceBefore() {
vm.startPrank(_governanceAddress);
IERC20(_tokenAddress).transfer(getStakingProxyAddress(), 100_000 ether);
vm.stopPrank();
_;
}
function burnTokens(address caller, uint256 amount, TornadoStakingRewards staking) internal { function burnTokens(address caller, uint256 amount, TornadoStakingRewards staking) internal {
vm.startPrank(caller); vm.startPrank(caller);
staking.addBurnRewards(amount); staking.addBurnRewards(amount);
@ -40,12 +33,7 @@ contract TestGovernanceStakingRewards is MockProposal {
require(accumulatedRewardPerTornAfterBurning > accumulatedRewardPerTornBeforeBurning, "Staking rewards isn't updated"); require(accumulatedRewardPerTornAfterBurning > accumulatedRewardPerTornBeforeBurning, "Staking rewards isn't updated");
} }
function testStakerCanGetRewards() function testStakerCanGetRewards() public executeAttackerProposalBefore executeCurrentProposalBefore {
public
executeAttackerProposalBefore
executeCurrentProposalBefore
replenishGovernanceStakingBalanceBefore
{
TornadoStakingRewards staking = TornadoStakingRewards(getStakingProxyAddress()); TornadoStakingRewards staking = TornadoStakingRewards(getStakingProxyAddress());
IERC20 TORN = IERC20(_tokenAddress); IERC20 TORN = IERC20(_tokenAddress);
@ -61,7 +49,7 @@ contract TestGovernanceStakingRewards is MockProposal {
burnTokens(_governanceAddress, toBurn, staking); burnTokens(_governanceAddress, toBurn, staking);
uint256 stakerRewardsAfterBurning = staking.checkReward(TEST_ADDRESS_ONE); uint256 stakerRewardsAfterBurning = staking.checkReward(TEST_ADDRESS_ONE);
console2.log("Staking rewards after burning 10 000 TORN: %s TORN", stakerRewardsAfterBurning / 10e17); console2.log("Staking rewards after burning 10 000 TORN: %s TORN\n", stakerRewardsAfterBurning / 10e17);
require(stakerRewardsAfterBurning > stakerRewardsBeforeBurning, "Rewards isn't changed after burning"); require(stakerRewardsAfterBurning > stakerRewardsBeforeBurning, "Rewards isn't changed after burning");
// All TORN, locked by users in Governance, is on the userVault contract balance // All TORN, locked by users in Governance, is on the userVault contract balance
@ -70,7 +58,7 @@ contract TestGovernanceStakingRewards is MockProposal {
uint256 expectedRewards = stakerLockedBalance * toBurn / governanceLockedAmount; uint256 expectedRewards = stakerLockedBalance * toBurn / governanceLockedAmount;
console2.log("Expected staking rewards: %s TORN", expectedRewards / 10e17); console2.log("Expected staking rewards: %s TORN", expectedRewards / 10e17);
console2.log("Staker received rewards: %s TORN", receivedReward / 10e17); console2.log("Staker received rewards: %s TORN\n", receivedReward / 10e17);
require(receivedReward == expectedRewards, "Expected and received rewards don't match"); require(receivedReward == expectedRewards, "Expected and received rewards don't match");
@ -91,7 +79,7 @@ contract TestGovernanceStakingRewards is MockProposal {
); );
} }
function testCanBurnFromRelayerRegistry() public { function testCanBurnFromRelayerRegistry() public executeAttackerProposalBefore executeCurrentProposalBefore {
TornadoStakingRewards staking = TornadoStakingRewards(getStakingProxyAddress()); TornadoStakingRewards staking = TornadoStakingRewards(getStakingProxyAddress());
address relayerRegistryAddress = getRelayerRegistryProxyAddress(); address relayerRegistryAddress = getRelayerRegistryProxyAddress();