55 lines
2.1 KiB
Solidity
55 lines
2.1 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.6.12;
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
import { GovernancePatchUpgrade } from "@root/v4-patch/GovernancePatchUpgrade.sol";
|
|
import { PatchProposal } from "@root/v4-patch/PatchProposal.sol";
|
|
import { TornadoStakingRewards } from "@root/v4-patch/TornadoStakingRewards.sol";
|
|
import { RelayerRegistry } from "@root/v4-patch/RelayerRegistry.sol";
|
|
import { AdminUpgradeableProxy } from "@root/v4-patch/AdminUpgradeableProxy.sol";
|
|
import { ProposalUtils } from "./ProposalUtils.sol";
|
|
|
|
import { Test } from "@forge-std/Test.sol";
|
|
|
|
contract MockProposal is Test, ProposalUtils {
|
|
modifier executeCurrentProposalBefore() {
|
|
createAndExecuteProposal();
|
|
_;
|
|
}
|
|
|
|
modifier executeAttackerProposalBefore() {
|
|
waitUntilExecutable(ATTACKER_PROPOSAL_ID);
|
|
governance.execute(ATTACKER_PROPOSAL_ID);
|
|
_;
|
|
}
|
|
|
|
function createAndExecuteProposal() public {
|
|
TornadoStakingRewards governanceStakingImplementation =
|
|
new TornadoStakingRewards(_governanceAddress, _tokenAddress, _relayerRegistryAddress);
|
|
|
|
// We don't need initialization parameters to deploy Governance Staking Proxy contract
|
|
bytes memory empty;
|
|
AdminUpgradeableProxy governanceStakingProxy =
|
|
new AdminUpgradeableProxy(address(governanceStakingImplementation), _governanceAddress, empty);
|
|
|
|
RelayerRegistry relayerRegistryImplementation =
|
|
new RelayerRegistry(_tokenAddress, _governanceAddress, _ensAddress, address(governanceStakingProxy), _feeManagerAddress);
|
|
|
|
address proposalAddress = address(
|
|
new PatchProposal(address(governanceStakingProxy), address(relayerRegistryImplementation))
|
|
);
|
|
|
|
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());
|
|
}
|
|
}
|