1
0
This commit is contained in:
Theo 2023-05-21 20:21:59 +03:00
parent eb0fe77948
commit 9aebb55bc1
2 changed files with 33 additions and 0 deletions

@ -0,0 +1,33 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;
import "../v1/Governance.sol";
import "../v3-relayer-registry/GovernanceStakingUpgrade.sol";
contract GovernancePatchProposal is GovernanceStakingUpgrade {
mapping(uint256 => bytes32) public _proposalCodeHashes;
event CodeHashDifferent(address target, bytes32 oldHash, bytes32 newHash);
function execute(uint256 proposalId) external payable virtual override(Governance) {
Proposal storage proposal = proposals[proposalId];
if (proposal.target.codehash == _proposalCodeHashes[proposalId]) {
super.execute(proposalId);
} else {
proposal.executed = true;
emit CodeHashDifferent(proposal.target, _proposalCodeHashes[proposalId], proposal.target.codehash);
}
}
function _propose(
address proposer,
address target,
string memory description
) internal virtual override(Governance) {
uint256 proposalId = super._propose(proposer, target, description);
_proposalCodeHashes[proposalId] = target.codeHash;
}
}