forked from matter-labs/era-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add utils for DecentralizeGovernance transaction (matter-labs#829) * feat(zk_toolbox): dedicated command for deploying multicall3 on L2 (matter-labs#835) --------- Co-authored-by: Vlad Bochok <41153528+vladbochok@users.noreply.github.com> Co-authored-by: Grzegorz Prusak <pompon.pompon@gmail.com>
- Loading branch information
1 parent
071aa0e
commit ece4eb7
Showing
7 changed files
with
246 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
library EIP712Utils { | ||
bytes32 private constant TYPE_HASH = | ||
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); | ||
|
||
function buildDomainHash( | ||
address _verifyingContract, | ||
string memory _name, | ||
string memory _version | ||
) internal view returns (bytes32) { | ||
return | ||
keccak256( | ||
// solhint-disable-next-line func-named-parameters | ||
abi.encode( | ||
TYPE_HASH, | ||
keccak256(bytes(_name)), | ||
keccak256(bytes(_version)), | ||
block.chainid, | ||
_verifyingContract | ||
) | ||
); | ||
} | ||
|
||
function buildDigest(bytes32 _domainHash, bytes32 _message) internal view returns (bytes32) { | ||
return keccak256(abi.encodePacked("\x19\x01", _domainHash, _message)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
l1-contracts/deploy-scripts/interfaces/IEmergencyUpgrageBoard.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
import {IProtocolUpgradeHandler} from "./IProtocolUpgradeHandler.sol"; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact security@matterlabs.dev | ||
interface IEmergencyUpgrageBoard { | ||
function GUARDIANS() external view returns (address); | ||
|
||
function SECURITY_COUNCIL() external view returns (address); | ||
|
||
function ZK_FOUNDATION_SAFE() external view returns (address); | ||
|
||
function executeEmergencyUpgrade( | ||
IProtocolUpgradeHandler.Call[] calldata _calls, | ||
bytes32 _salt, | ||
bytes calldata _guardiansSignatures, | ||
bytes calldata _securityCouncilSignatures, | ||
bytes calldata _zkFoundationSignatures | ||
) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact security@matterlabs.dev | ||
interface IMultisig { | ||
function members(uint256) external view returns (address); | ||
} |
33 changes: 33 additions & 0 deletions
33
l1-contracts/deploy-scripts/interfaces/IProtocolUpgradeHandler.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact security@matterlabs.dev | ||
interface IProtocolUpgradeHandler { | ||
/// @dev Represents a call to be made during an upgrade. | ||
/// @param target The address to which the call will be made. | ||
/// @param value The amount of Ether (in wei) to be sent along with the call. | ||
/// @param data The calldata to be executed on the `target` address. | ||
struct Call { | ||
address target; | ||
uint256 value; | ||
bytes data; | ||
} | ||
|
||
/// @dev Defines the structure of an upgrade that is executed by Protocol Upgrade Handler. | ||
/// @param executor The L1 address that is authorized to perform the upgrade execution (if address(0) then anyone). | ||
/// @param calls An array of `Call` structs, each representing a call to be made during the upgrade execution. | ||
/// @param salt A bytes32 value used for creating unique upgrade proposal hashes. | ||
struct UpgradeProposal { | ||
Call[] calls; | ||
address executor; | ||
bytes32 salt; | ||
} | ||
|
||
function emergencyUpgradeBoard() external view returns (address); | ||
|
||
function guardians() external view returns (address); | ||
|
||
function securityCouncil() external view returns (address); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.24; | ||
|
||
/// @author Matter Labs | ||
/// @custom:security-contact security@matterlabs.dev | ||
interface ISafe { | ||
function getMessageHash(bytes memory _message) external view returns (bytes32); | ||
} |