proposal-22-governance-and-.../test/MockProposal.sol

42 lines
1.5 KiB
Solidity
Raw Permalink Normal View History

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
import { Parameters } from "@proprietary/Parameters.sol";
import { GovernancePatchUpgrade } from "@root/v4-patch/GovernancePatchUpgrade.sol";
import { PatchProposal, PatchProposalContractsFactory } from "@root/v4-patch/PatchProposal.sol";
import { TornadoStakingRewards } from "@root/v4-patch/TornadoStakingRewards.sol";
import { ProposalUtils } from "./ProposalUtils.sol";
import { Test } from "@forge-std/Test.sol";
contract MockProposal is Parameters, Test, ProposalUtils {
modifier executeCurrentProposalBefore() {
createAndExecuteProposal();
_;
}
modifier executeAttackerProposalBefore() {
waitUntilExecutable(ATTACKER_PROPOSAL_ID);
governance.execute(ATTACKER_PROPOSAL_ID);
_;
}
function createAndExecuteProposal() public {
address patchProposalFactoryAddress = address(new PatchProposalContractsFactory());
address proposalAddress = address(new PatchProposal(patchProposalFactoryAddress));
proposeAndExecute(proposalAddress);
}
function getRelayerRegistryProxyAddress() internal view returns (address) {
TornadoStakingRewards actualStakingContract = TornadoStakingRewards(getStakingProxyAddress());
return actualStakingContract.relayerRegistry();
}
function getStakingProxyAddress() internal view returns (address) {
return address(governance.Staking());
}
}