1
0

Use AdminUpgradeableProxy for Staking

Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
AlienTornadosaurusHex 2023-05-26 00:48:44 +00:00
parent 5544eca83b
commit d23fa9dd08
2 changed files with 34 additions and 3 deletions

@ -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);

@ -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 {}
}