mirror of
https://github.com/tornadocash/nova-upgrade-proposal.git
synced 2024-11-22 09:36:51 +01:00
47 lines
1.3 KiB
Solidity
47 lines
1.3 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.6.12;
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
import { ImmutableGovernanceInformation } from "tornado-governance/contracts/v2-vault-and-gas/ImmutableGovernanceInformation.sol";
|
|
|
|
interface IUpgradeableProxy {
|
|
function upgradeTo(address newImplementation) external;
|
|
}
|
|
|
|
interface IAMB {
|
|
function requireToPassMessage(
|
|
address _contract,
|
|
bytes calldata _data,
|
|
uint256 _gas
|
|
) external returns (bytes32);
|
|
}
|
|
|
|
contract NovaUpgradeProposal is ImmutableGovernanceInformation {
|
|
event MessagePassed(bytes32 msgId);
|
|
|
|
address public immutable novaProxy;
|
|
address public immutable newNovaImpl;
|
|
IAMB public immutable bridge;
|
|
uint256 public immutable gasLimit;
|
|
|
|
constructor(
|
|
address _novaProxy,
|
|
address _newNovaImpl,
|
|
address _bridge,
|
|
uint256 _gasLimit
|
|
) public {
|
|
novaProxy = _novaProxy;
|
|
newNovaImpl = _newNovaImpl;
|
|
bridge = IAMB(_bridge);
|
|
gasLimit = _gasLimit;
|
|
}
|
|
|
|
function executeProposal() external {
|
|
bytes4 methodSelector = IUpgradeableProxy(address(0)).upgradeTo.selector;
|
|
bytes memory data = abi.encodeWithSelector(methodSelector, newNovaImpl);
|
|
bytes32 msgId = bridge.requireToPassMessage(novaProxy, data, gasLimit);
|
|
emit MessagePassed(msgId);
|
|
}
|
|
}
|