diff --git a/contracts/v4-patch/PatchProposal.sol b/contracts/v4-patch/PatchProposal.sol index 158e6c4..75708a4 100644 --- a/contracts/v4-patch/PatchProposal.sol +++ b/contracts/v4-patch/PatchProposal.sol @@ -3,9 +3,11 @@ pragma solidity ^0.6.12; pragma experimental ABIEncoderV2; -import { LoopbackProxy } from "../v1/LoopbackProxy.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { LoopbackProxy } from "../v1/LoopbackProxy.sol"; +import { AdminUpgradeableProxy } from "./proxy/AdminUpgradeableProxy.sol"; + import { GovernancePatchUpgrade } from "./GovernancePatchUpgrade.sol"; import { TornadoStakingRewards } from "./TornadoStakingRewards.sol"; import { RelayerRegistry } from "./RelayerRegistry.sol"; @@ -55,8 +57,13 @@ contract PatchProposal { // Get the small amount of TORN left oldStaking.withdrawTorn(TORN.balanceOf(address(oldStaking))); - // And create a new staking contract - TornadoStakingRewards newStaking = TornadoStakingRewards(deployedStakingContractAddress); + // Just to make compiler stfu + bytes memory bempty; + + // And create a new staking contract proxy + TornadoStakingRewards newStaking = TornadoStakingRewards( + address(new AdminUpgradeableProxy(deployedStakingContractAddress, governanceProxyAddress, bempty)) + ); // Upgrade the registry proxy Proxy(registryProxyAddress).upgradeTo(deployedRelayerRegistryImplementationAddress); diff --git a/contracts/v4-patch/proxy/AdminUpgradeableProxy.sol b/contracts/v4-patch/proxy/AdminUpgradeableProxy.sol new file mode 100644 index 0000000..a69589a --- /dev/null +++ b/contracts/v4-patch/proxy/AdminUpgradeableProxy.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.12; + +import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol"; + +/** + * @dev TransparentUpgradeableProxy where admin is allowed to call implementation methods. + */ +contract AdminUpgradeableProxy is TransparentUpgradeableProxy { + /** + * @dev Initializes an upgradeable proxy backed by the implementation at `_logic`. + */ + constructor( + address _logic, + address _admin, + bytes memory _data + ) public payable TransparentUpgradeableProxy(_logic, _admin, _data) {} + + /** + * @dev Override to allow admin access the fallback function. + */ + function _beforeFallback() internal override {} +}