Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 6 from a total of 6 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
Amount
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Execute Emergenc... | 8885797 | 110 days ago | IN | 0 ETH | 0.00000364 | ||||
| Execute Emergenc... | 8885789 | 110 days ago | IN | 0 ETH | 0.00000639 | ||||
| Execute Emergenc... | 8885782 | 110 days ago | IN | 0 ETH | 0.00000551 | ||||
| Execute Emergenc... | 8885747 | 110 days ago | IN | 0 ETH | 0.00000233 | ||||
| Execute Emergenc... | 8048058 | 228 days ago | IN | 0 ETH | 0.00239127 | ||||
| Execute Emergenc... | 7619604 | 290 days ago | IN | 0 ETH | 0.00143499 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
To
|
Amount
|
||
|---|---|---|---|---|---|---|---|
| 0x6101e060 | 7589699 | 294 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
EmergencyUpgradeBoard
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import {IProtocolUpgradeHandler} from "./interfaces/IProtocolUpgradeHandler.sol";
/// @title Emergency Upgrade Board
/// @author Matter Labs
/// @custom:security-contact [email protected]
contract EmergencyUpgradeBoard is EIP712 {
using SignatureChecker for address;
/// @notice Address of the contract, which manages protocol upgrades.
IProtocolUpgradeHandler public immutable PROTOCOL_UPGRADE_HANDLER;
/// @notice The address of the Security Council.
address public immutable SECURITY_COUNCIL;
/// @notice The address of the guardians.
address public immutable GUARDIANS;
/// @notice The address of the ZK Foundation multisig.
address public immutable ZK_FOUNDATION_SAFE;
/// @dev EIP-712 TypeHash for the emergency protocol upgrade execution approved by the guardians.
bytes32 internal constant EXECUTE_EMERGENCY_UPGRADE_GUARDIANS_TYPEHASH =
keccak256("ExecuteEmergencyUpgradeGuardians(bytes32 id)");
/// @dev EIP-712 TypeHash for the emergency protocol upgrade execution approved by the Security Council.
bytes32 internal constant EXECUTE_EMERGENCY_UPGRADE_SECURITY_COUNCIL_TYPEHASH =
keccak256("ExecuteEmergencyUpgradeSecurityCouncil(bytes32 id)");
/// @dev EIP-712 TypeHash for the emergency protocol upgrade execution approved by the ZK Foundation.
bytes32 internal constant EXECUTE_EMERGENCY_UPGRADE_ZK_FOUNDATION_TYPEHASH =
keccak256("ExecuteEmergencyUpgradeZKFoundation(bytes32 id)");
/// @dev Initializes the Emergency Upgrade Board contract with setup for EIP-712.
/// @param _protocolUpgradeHandler The address of the protocol upgrade handler contract, responsible for executing the upgrades.
/// @param _securityCouncil The address of the Security Council multisig.
/// @param _guardians The address of the Guardians multisig.
/// @param _zkFoundation The address of the ZK Foundation Safe multisig.
constructor(
IProtocolUpgradeHandler _protocolUpgradeHandler,
address _securityCouncil,
address _guardians,
address _zkFoundation
) EIP712("EmergencyUpgradeBoard", "1") {
PROTOCOL_UPGRADE_HANDLER = _protocolUpgradeHandler;
SECURITY_COUNCIL = _securityCouncil;
GUARDIANS = _guardians;
ZK_FOUNDATION_SAFE = _zkFoundation;
}
/// @notice Executes an emergency protocol upgrade approved by the Security Council, Guardians and ZK Foundation.
/// @param _calls Array of `Call` structures specifying the calls to be made in the upgrade.
/// @param _salt A bytes32 value used for creating unique upgrade proposal hashes.
/// @param _guardiansSignatures Encoded signers & signatures from the guardians multisig, required to authorize the emergency upgrade.
/// @param _securityCouncilSignatures Encoded signers & signatures from the Security Council multisig, required to authorize the emergency upgrade.
/// @param _zkFoundationSignatures Signatures from the ZK Foundation multisig, required to authorize the emergency upgrade.
function executeEmergencyUpgrade(
IProtocolUpgradeHandler.Call[] calldata _calls,
bytes32 _salt,
bytes calldata _guardiansSignatures,
bytes calldata _securityCouncilSignatures,
bytes calldata _zkFoundationSignatures
) external {
IProtocolUpgradeHandler.UpgradeProposal memory upgradeProposal =
IProtocolUpgradeHandler.UpgradeProposal({calls: _calls, salt: _salt, executor: address(this)});
bytes32 id = keccak256(abi.encode(upgradeProposal));
bytes32 guardiansDigest =
_hashTypedDataV4(keccak256(abi.encode(EXECUTE_EMERGENCY_UPGRADE_GUARDIANS_TYPEHASH, id)));
require(
GUARDIANS.isValidERC1271SignatureNow(guardiansDigest, _guardiansSignatures), "Invalid guardians signatures"
);
bytes32 securityCouncilDigest =
_hashTypedDataV4(keccak256(abi.encode(EXECUTE_EMERGENCY_UPGRADE_SECURITY_COUNCIL_TYPEHASH, id)));
require(
SECURITY_COUNCIL.isValidERC1271SignatureNow(securityCouncilDigest, _securityCouncilSignatures),
"Invalid Security Council signatures"
);
bytes32 zkFoundationDigest =
_hashTypedDataV4(keccak256(abi.encode(EXECUTE_EMERGENCY_UPGRADE_ZK_FOUNDATION_TYPEHASH, id)));
require(
ZK_FOUNDATION_SAFE.isValidSignatureNow(zkFoundationDigest, _zkFoundationSignatures),
"Invalid ZK Foundation signatures"
);
PROTOCOL_UPGRADE_HANDLER.executeEmergencyUpgrade(upgradeProposal);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.20;
import {MessageHashUtils} from "./MessageHashUtils.sol";
import {ShortStrings, ShortString} from "../ShortStrings.sol";
import {IERC5267} from "../../interfaces/IERC5267.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
* encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
* does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
* produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
* separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
* separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
*
* @custom:oz-upgrades-unsafe-allow state-variable-immutable
*/
abstract contract EIP712 is IERC5267 {
using ShortStrings for *;
bytes32 private constant TYPE_HASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _cachedDomainSeparator;
uint256 private immutable _cachedChainId;
address private immutable _cachedThis;
bytes32 private immutable _hashedName;
bytes32 private immutable _hashedVersion;
ShortString private immutable _name;
ShortString private immutable _version;
string private _nameFallback;
string private _versionFallback;
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
_name = name.toShortStringWithFallback(_nameFallback);
_version = version.toShortStringWithFallback(_versionFallback);
_hashedName = keccak256(bytes(name));
_hashedVersion = keccak256(bytes(version));
_cachedChainId = block.chainid;
_cachedDomainSeparator = _buildDomainSeparator();
_cachedThis = address(this);
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
return _cachedDomainSeparator;
} else {
return _buildDomainSeparator();
}
}
function _buildDomainSeparator() private view returns (bytes32) {
return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
}
/**
* @dev See {IERC-5267}.
*/
function eip712Domain()
public
view
virtual
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
)
{
return (
hex"0f", // 01111
_EIP712Name(),
_EIP712Version(),
block.chainid,
address(this),
bytes32(0),
new uint256[](0)
);
}
/**
* @dev The name parameter for the EIP712 domain.
*
* NOTE: By default this function reads _name which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Name() internal view returns (string memory) {
return _name.toStringWithFallback(_nameFallback);
}
/**
* @dev The version parameter for the EIP712 domain.
*
* NOTE: By default this function reads _version which is an immutable value.
* It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
*/
// solhint-disable-next-line func-name-mixedcase
function _EIP712Version() internal view returns (string memory) {
return _version.toStringWithFallback(_versionFallback);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/SignatureChecker.sol)
pragma solidity ^0.8.20;
import {ECDSA} from "./ECDSA.sol";
import {IERC1271} from "../../interfaces/IERC1271.sol";
/**
* @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
* signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
* Argent and Safe Wallet (previously Gnosis Safe).
*/
library SignatureChecker {
/**
* @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
* signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
(address recovered, ECDSA.RecoverError error, ) = ECDSA.tryRecover(hash, signature);
return
(error == ECDSA.RecoverError.NoError && recovered == signer) ||
isValidERC1271SignatureNow(signer, hash, signature);
}
/**
* @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
* against the signer smart contract using ERC1271.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function isValidERC1271SignatureNow(
address signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
(bool success, bytes memory result) = signer.staticcall(
abi.encodeCall(IERC1271.isValidSignature, (hash, signature))
);
return (success &&
result.length >= 32 &&
abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
}
}// SPDX-License-Identifier: MIT pragma solidity 0.8.24; /// @author Matter Labs /// @custom:security-contact [email protected] interface IProtocolUpgradeHandler { /// @dev This enumeration includes the following states: /// @param None Default state, indicating the upgrade has not been set. /// @param LegalVetoPeriod The upgrade passed L2 voting process but it is waiting for the legal veto period. /// @param Waiting The upgrade passed Legal Veto period but it is waiting for the approval from guardians or Security Council. /// @param ExecutionPending The upgrade proposal is waiting for the delay period before being ready for execution. /// @param Ready The upgrade proposal is ready to be executed. /// @param Expired The upgrade proposal was expired. /// @param Done The upgrade has been successfully executed. enum UpgradeState { None, LegalVetoPeriod, Waiting, ExecutionPending, Ready, Expired, Done } /// @dev Represents the status of an upgrade process, including the creation timestamp and actions made by guardians and Security Council. /// @param creationTimestamp The timestamp (in seconds) when the upgrade state was created. /// @param securityCouncilApprovalTimestamp The timestamp (in seconds) when Security Council approved the upgrade. /// @param guardiansApproval Indicates whether the upgrade has been approved by the guardians. /// @param guardiansExtendedLegalVeto Indicates whether guardians extended the legal veto period. /// @param executed Indicates whether the proposal is executed or not. struct UpgradeStatus { uint48 creationTimestamp; uint48 securityCouncilApprovalTimestamp; bool guardiansApproval; bool guardiansExtendedLegalVeto; bool executed; } /// @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; } /// @dev This enumeration includes the following states: /// @param None Default state, indicating the freeze has not been happening in this upgrade cycle. /// @param Soft The protocol is/was frozen for the short time. /// @param Hard The protocol is/was frozen for the long time. /// @param AfterSoftFreeze The protocol was soft frozen, it can be hard frozen in this upgrade cycle. /// @param AfterHardFreeze The protocol was hard frozen, but now it can't be frozen until the upgrade. enum FreezeStatus { None, Soft, Hard, AfterSoftFreeze, AfterHardFreeze } function startUpgrade( uint256 _l2BatchNumber, uint256 _l2MessageIndex, uint16 _l2TxNumberInBatch, bytes32[] calldata _proof, UpgradeProposal calldata _proposal ) external; function extendLegalVeto(bytes32 _id) external; function approveUpgradeSecurityCouncil(bytes32 _id) external; function approveUpgradeGuardians(bytes32 _id) external; function execute(UpgradeProposal calldata _proposal) external payable; function executeEmergencyUpgrade(UpgradeProposal calldata _proposal) external payable; function softFreeze() external; function hardFreeze() external; function reinforceFreeze() external; function unfreeze() external; function reinforceFreezeOneChain(uint256 _chainId) external; function reinforceUnfreeze() external; function reinforceUnfreezeOneChain(uint256 _chainId) external; function upgradeState(bytes32 _id) external view returns (UpgradeState); function updateSecurityCouncil(address _newSecurityCouncil) external; function updateGuardians(address _newGuardians) external; function updateEmergencyUpgradeBoard(address _newEmergencyUpgradeBoard) external; /// @notice Emitted when the security council address is changed. event ChangeSecurityCouncil(address indexed _securityCouncilBefore, address indexed _securityCouncilAfter); /// @notice Emitted when the guardians address is changed. event ChangeGuardians(address indexed _guardiansBefore, address indexed _guardiansAfter); /// @notice Emitted when the emergency upgrade board address is changed. event ChangeEmergencyUpgradeBoard( address indexed _emergencyUpgradeBoardBefore, address indexed _emergencyUpgradeBoardAfter ); /// @notice Emitted when upgrade process on L1 is started. event UpgradeStarted(bytes32 indexed _id, UpgradeProposal _proposal); /// @notice Emitted when the legal veto period is extended. event UpgradeLegalVetoExtended(bytes32 indexed _id); /// @notice Emitted when Security Council approved the upgrade. event UpgradeApprovedBySecurityCouncil(bytes32 indexed _id); /// @notice Emitted when Guardians approved the upgrade. event UpgradeApprovedByGuardians(bytes32 indexed _id); /// @notice Emitted when the upgrade is executed. event UpgradeExecuted(bytes32 indexed _id); /// @notice Emitted when the emergency upgrade is executed. event EmergencyUpgradeExecuted(bytes32 indexed _id); /// @notice Emitted when the protocol became soft frozen. event SoftFreeze(uint256 _protocolFrozenUntil); /// @notice Emitted when the protocol became hard frozen. event HardFreeze(uint256 _protocolFrozenUntil); /// @notice Emitted when someone makes an attempt to freeze the protocol when it is frozen already. event ReinforceFreeze(); /// @notice Emitted when the protocol became active after the soft/hard freeze. event Unfreeze(); /// @notice Emitted when someone makes an attempt to freeze the specific chain when the protocol is frozen already. event ReinforceFreezeOneChain(uint256 _chainId); /// @notice Emitted when someone makes an attempt to unfreeze the protocol when it is unfrozen already. event ReinforceUnfreeze(); /// @notice Emitted when someone makes an attempt to unfreeze the specific chain when the protocol is unfrozen already. event ReinforceUnfreezeOneChain(uint256 _chainId); }
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)
pragma solidity ^0.8.20;
import {Strings} from "../Strings.sol";
/**
* @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
*
* The library provides methods for generating a hash of a message that conforms to the
* https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
* specifications.
*/
library MessageHashUtils {
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing a bytes32 `messageHash` with
* `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
*
* NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
* keccak256, although any bytes32 value can be safely used because the final digest will
* be re-hashed.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
}
}
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x45` (`personal_sign` messages).
*
* The digest is calculated by prefixing an arbitrary `message` with
* `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
*
* See {ECDSA-recover}.
*/
function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
return
keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
}
/**
* @dev Returns the keccak256 digest of an EIP-191 signed data with version
* `0x00` (data with intended validator).
*
* The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
* `validator` address. Then hashing the result.
*
* See {ECDSA-recover}.
*/
function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(hex"19_00", validator, data));
}
/**
* @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
*
* The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
* `\x19\x01` and hashing the result. It corresponds to the hash signed by the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
*
* See {ECDSA-recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, hex"19_01")
mstore(add(ptr, 0x02), domainSeparator)
mstore(add(ptr, 0x22), structHash)
digest := keccak256(ptr, 0x42)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
// | length | 0x BB |
type ShortString is bytes32;
/**
* @dev This library provides functions to convert short memory strings
* into a `ShortString` type that can be used as an immutable variable.
*
* Strings of arbitrary length can be optimized using this library if
* they are short enough (up to 31 bytes) by packing them with their
* length (1 byte) in a single EVM word (32 bytes). Additionally, a
* fallback mechanism can be used for every other case.
*
* Usage example:
*
* ```solidity
* contract Named {
* using ShortStrings for *;
*
* ShortString private immutable _name;
* string private _nameFallback;
*
* constructor(string memory contractName) {
* _name = contractName.toShortStringWithFallback(_nameFallback);
* }
*
* function name() external view returns (string memory) {
* return _name.toStringWithFallback(_nameFallback);
* }
* }
* ```
*/
library ShortStrings {
// Used as an identifier for strings longer than 31 bytes.
bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;
error StringTooLong(string str);
error InvalidShortString();
/**
* @dev Encode a string of at most 31 chars into a `ShortString`.
*
* This will trigger a `StringTooLong` error is the input string is too long.
*/
function toShortString(string memory str) internal pure returns (ShortString) {
bytes memory bstr = bytes(str);
if (bstr.length > 31) {
revert StringTooLong(str);
}
return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
}
/**
* @dev Decode a `ShortString` back to a "normal" string.
*/
function toString(ShortString sstr) internal pure returns (string memory) {
uint256 len = byteLength(sstr);
// using `new string(len)` would work locally but is not memory safe.
string memory str = new string(32);
/// @solidity memory-safe-assembly
assembly {
mstore(str, len)
mstore(add(str, 0x20), sstr)
}
return str;
}
/**
* @dev Return the length of a `ShortString`.
*/
function byteLength(ShortString sstr) internal pure returns (uint256) {
uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
if (result > 31) {
revert InvalidShortString();
}
return result;
}
/**
* @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
*/
function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
if (bytes(value).length < 32) {
return toShortString(value);
} else {
StorageSlot.getStringSlot(store).value = value;
return ShortString.wrap(FALLBACK_SENTINEL);
}
}
/**
* @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
*/
function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return toString(value);
} else {
return store;
}
}
/**
* @dev Return the length of a string that was encoded to `ShortString` or written to storage using
* {setWithFallback}.
*
* WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
* actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
*/
function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
return byteLength(value);
} else {
return bytes(store).length;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)
pragma solidity ^0.8.20;
interface IERC5267 {
/**
* @dev MAY be emitted to signal that the domain could have changed.
*/
event EIP712DomainChanged();
/**
* @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
* signature.
*/
function eip712Domain()
external
view
returns (
bytes1 fields,
string memory name,
string memory version,
uint256 chainId,
address verifyingContract,
bytes32 salt,
uint256[] memory extensions
);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError, bytes32) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS, s);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1271.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*/
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}{
"remappings": [
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false,
"libraries": {}
}Contract ABI
API[{"inputs":[{"internalType":"contract IProtocolUpgradeHandler","name":"_protocolUpgradeHandler","type":"address"},{"internalType":"address","name":"_securityCouncil","type":"address"},{"internalType":"address","name":"_guardians","type":"address"},{"internalType":"address","name":"_zkFoundation","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"inputs":[],"name":"GUARDIANS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROTOCOL_UPGRADE_HANDLER","outputs":[{"internalType":"contract IProtocolUpgradeHandler","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECURITY_COUNCIL","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ZK_FOUNDATION_SAFE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IProtocolUpgradeHandler.Call[]","name":"_calls","type":"tuple[]"},{"internalType":"bytes32","name":"_salt","type":"bytes32"},{"internalType":"bytes","name":"_guardiansSignatures","type":"bytes"},{"internalType":"bytes","name":"_securityCouncilSignatures","type":"bytes"},{"internalType":"bytes","name":"_zkFoundationSignatures","type":"bytes"}],"name":"executeEmergencyUpgrade","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6101e060405234801562000011575f80fd5b5060405162001483380380620014838339810160408190526200003491620001f6565b604080518082018252601581527f456d657267656e637955706772616465426f6172640000000000000000000000602080830191909152825180840190935260018352603160f81b90830152906200008d825f6200015b565b610120526200009e8160016200015b565b61014052815160208084019190912060e052815190820120610100524660a0526200012b60e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b03938416610160529183166101805282166101a052166101c05262000437565b5f6020835110156200017a57620001728362000193565b90506200018d565b81620001878482620002f9565b5060ff90505b92915050565b5f80829050601f81511115620001c9578260405163305a27a960e01b8152600401620001c09190620003c5565b60405180910390fd5b8051620001d68262000413565b179392505050565b6001600160a01b0381168114620001f3575f80fd5b50565b5f805f80608085870312156200020a575f80fd5b84516200021781620001de565b60208601519094506200022a81620001de565b60408601519093506200023d81620001de565b60608601519092506200025081620001de565b939692955090935050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806200028457607f821691505b602082108103620002a357634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115620002f457805f5260205f20601f840160051c81016020851015620002d05750805b601f840160051c820191505b81811015620002f1575f8155600101620002dc565b50505b505050565b81516001600160401b038111156200031557620003156200025b565b6200032d816200032684546200026f565b84620002a9565b602080601f83116001811462000363575f84156200034b5750858301515b5f19600386901b1c1916600185901b178555620003bd565b5f85815260208120601f198616915b82811015620003935788860151825594840194600190910190840162000372565b5085821015620003b157878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b5f602080835283518060208501525f5b81811015620003f357858101830151858201604001528201620003d5565b505f604082860101526040601f19601f8301168501019250505092915050565b80516020808301519190811015620002a3575f1960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c051610fb9620004ca5f395f818161012b015261048901525f818160ad015261028a01525f81816069015261038601525f818160ef015261051601525f6105c001525f61058f01525f6108c701525f61089f01525f6107fa01525f61082401525f61084e0152610fb95ff3fe608060405234801561000f575f80fd5b5060043610610060575f3560e01c806336086417146100645780633f6b9ddb146100a857806384b0196e146100cf578063b4c77c3b146100ea578063c03fd44b14610111578063c2646db414610126575b5f80fd5b61008b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b61008b7f000000000000000000000000000000000000000000000000000000000000000081565b6100d761014d565b60405161009f9796959493929190610ad9565b61008b7f000000000000000000000000000000000000000000000000000000000000000081565b61012461011f366004610bb5565b61018f565b005b61008b7f000000000000000000000000000000000000000000000000000000000000000081565b5f6060805f805f606061015e610588565b6101666105b9565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b5f60405180606001604052808b8b906101a89190610d14565b8152602001306001600160a01b031681526020018981525090505f816040516020016101d49190610e33565b6040516020818303038152906040528051906020012090505f6102477fca13e65539327d441ed2bdec279e457a1af26eb3e4dbe09fcd7a8633662af7e28360405160200161022c929190918252602082015260400190565b604051602081830303815290604052805190602001206105e6565b90506102b4818a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169392915050610618565b6103055760405162461bcd60e51b815260206004820152601c60248201527f496e76616c696420677561726469616e73207369676e6174757265730000000060448201526064015b60405180910390fd5b604080517fca6492c171331a4293d71e9e45f05ca3db6aaf73acc6e0cde07a1bdc2a119cdc60208201529081018390525f906103439060600161022c565b90506103b08189898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169392915050610618565b6104085760405162461bcd60e51b815260206004820152602360248201527f496e76616c696420536563757269747920436f756e63696c207369676e61747560448201526272657360e81b60648201526084016102fc565b604080517fbc65a4e7edaf75c145d74b7c4e65a168cf6bce5e78f11e27fcd63ed0c62afacf60208201529081018490525f906104469060600161022c565b90506104b38188888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693929150506106ef565b6104ff5760405162461bcd60e51b815260206004820181905260248201527f496e76616c6964205a4b20466f756e646174696f6e207369676e61747572657360448201526064016102fc565b604051632291ed1b60e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634523da369061054b908890600401610e33565b5f604051808303815f87803b158015610562575f80fd5b505af1158015610574573d5f803e3d5ffd5b505050505050505050505050505050505050565b60606105b47f00000000000000000000000000000000000000000000000000000000000000005f610744565b905090565b60606105b47f00000000000000000000000000000000000000000000000000000000000000006001610744565b5f6106126105f26107ee565b8360405161190160f01b8152600281019290925260228201526042902090565b92915050565b5f805f856001600160a01b03168585604051602401610638929190610ee5565b60408051601f198184030181529181526020820180516001600160e01b0316630b135d3f60e11b1790525161066d9190610f05565b5f60405180830381855afa9150503d805f81146106a5576040519150601f19603f3d011682016040523d82523d5f602084013e6106aa565b606091505b50915091508180156106be57506020815110155b80156106e557508051630b135d3f60e11b906106e39083016020908101908401610f20565b145b9695505050505050565b5f805f6106fc8585610917565b5090925090505f81600381111561071557610715610f37565b1480156107335750856001600160a01b0316826001600160a01b0316145b806106e557506106e5868686610618565b606060ff831461075e5761075783610960565b9050610612565b81805461076a90610f4b565b80601f016020809104026020016040519081016040528092919081815260200182805461079690610f4b565b80156107e15780601f106107b8576101008083540402835291602001916107e1565b820191905f5260205f20905b8154815290600101906020018083116107c457829003601f168201915b5050505050905092915050565b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561084657507f000000000000000000000000000000000000000000000000000000000000000046145b1561087057507f000000000000000000000000000000000000000000000000000000000000000090565b6105b4604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b5f805f835160410361094e576020840151604085015160608601515f1a6109408882858561099d565b955095509550505050610959565b505081515f91506002905b9250925092565b60605f61096c83610a65565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156109d657505f91506003905082610a5b565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610a27573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b038116610a5257505f925060019150829050610a5b565b92505f91508190505b9450945094915050565b5f60ff8216601f81111561061257604051632cd44ac360e21b815260040160405180910390fd5b5f5b83811015610aa6578181015183820152602001610a8e565b50505f910152565b5f8151808452610ac5816020860160208601610a8c565b601f01601f19169290920160200192915050565b60ff60f81b881681525f602060e06020840152610af960e084018a610aae565b8381036040850152610b0b818a610aae565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825260208088019350909101905f5b81811015610b5e57835183529284019291840191600101610b42565b50909c9b505050505050505050505050565b5f8083601f840112610b80575f80fd5b50813567ffffffffffffffff811115610b97575f80fd5b602083019150836020828501011115610bae575f80fd5b9250929050565b5f805f805f805f805f60a08a8c031215610bcd575f80fd5b893567ffffffffffffffff80821115610be4575f80fd5b818c0191508c601f830112610bf7575f80fd5b813581811115610c05575f80fd5b8d60208260051b8501011115610c19575f80fd5b60209283019b509950908b0135975060408b01359080821115610c3a575f80fd5b610c468d838e01610b70565b909850965060608c0135915080821115610c5e575f80fd5b610c6a8d838e01610b70565b909650945060808c0135915080821115610c82575f80fd5b50610c8f8c828d01610b70565b915080935050809150509295985092959850929598565b634e487b7160e01b5f52604160045260245ffd5b6040516060810167ffffffffffffffff81118282101715610cdd57610cdd610ca6565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d0c57610d0c610ca6565b604052919050565b5f67ffffffffffffffff80841115610d2e57610d2e610ca6565b8360051b6020610d3f818301610ce3565b868152918501918181019036841115610d56575f80fd5b865b84811015610e2757803586811115610d6e575f80fd5b88016060368290031215610d80575f80fd5b610d88610cba565b81356001600160a01b0381168114610d9e575f80fd5b8152818601358682015260408083013589811115610dba575f80fd5b9290920191601f3681850112610dce575f80fd5b83358a811115610de057610de0610ca6565b610df1818301601f19168a01610ce3565b91508082523689828701011115610e06575f80fd5b808986018a8401375f90820189015290820152845250918301918301610d58565b50979650505050505050565b5f60208083526080830184516060808487015282825180855260a08801915060a08160051b890101945085840193505f5b81811015610eb757888603609f19018352845180516001600160a01b031687528781015188880152604090810151908701859052610ea485880182610aae565b9650509386019391860191600101610e64565b50505050918501516001600160a01b0381166040860152915060408501516060850152809250505092915050565b828152604060208201525f610efd6040830184610aae565b949350505050565b5f8251610f16818460208701610a8c565b9190910192915050565b5f60208284031215610f30575f80fd5b5051919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c90821680610f5f57607f821691505b602082108103610f7d57634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212200c166ea6dd3ab3d912901bebe655c8ad3e6d871845812c00a96142ecd66cf65d64736f6c63430008180033000000000000000000000000e3a615778aeec76df1b368948a1d1614497db85800000000000000000000000025ab0397da109a50c8921a1d4a034e09736024690000000000000000000000003a8ac6a7a4a026f42f805b40bb992edf0165459500000000000000000000000046d3c220de912100de9ee5052511ad5fcb2c190b
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610060575f3560e01c806336086417146100645780633f6b9ddb146100a857806384b0196e146100cf578063b4c77c3b146100ea578063c03fd44b14610111578063c2646db414610126575b5f80fd5b61008b7f00000000000000000000000025ab0397da109a50c8921a1d4a034e097360246981565b6040516001600160a01b0390911681526020015b60405180910390f35b61008b7f0000000000000000000000003a8ac6a7a4a026f42f805b40bb992edf0165459581565b6100d761014d565b60405161009f9796959493929190610ad9565b61008b7f000000000000000000000000e3a615778aeec76df1b368948a1d1614497db85881565b61012461011f366004610bb5565b61018f565b005b61008b7f00000000000000000000000046d3c220de912100de9ee5052511ad5fcb2c190b81565b5f6060805f805f606061015e610588565b6101666105b9565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b5f60405180606001604052808b8b906101a89190610d14565b8152602001306001600160a01b031681526020018981525090505f816040516020016101d49190610e33565b6040516020818303038152906040528051906020012090505f6102477fca13e65539327d441ed2bdec279e457a1af26eb3e4dbe09fcd7a8633662af7e28360405160200161022c929190918252602082015260400190565b604051602081830303815290604052805190602001206105e6565b90506102b4818a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250506001600160a01b037f0000000000000000000000003a8ac6a7a4a026f42f805b40bb992edf01654595169392915050610618565b6103055760405162461bcd60e51b815260206004820152601c60248201527f496e76616c696420677561726469616e73207369676e6174757265730000000060448201526064015b60405180910390fd5b604080517fca6492c171331a4293d71e9e45f05ca3db6aaf73acc6e0cde07a1bdc2a119cdc60208201529081018390525f906103439060600161022c565b90506103b08189898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250506001600160a01b037f00000000000000000000000025ab0397da109a50c8921a1d4a034e0973602469169392915050610618565b6104085760405162461bcd60e51b815260206004820152602360248201527f496e76616c696420536563757269747920436f756e63696c207369676e61747560448201526272657360e81b60648201526084016102fc565b604080517fbc65a4e7edaf75c145d74b7c4e65a168cf6bce5e78f11e27fcd63ed0c62afacf60208201529081018490525f906104469060600161022c565b90506104b38188888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250506001600160a01b037f00000000000000000000000046d3c220de912100de9ee5052511ad5fcb2c190b1693929150506106ef565b6104ff5760405162461bcd60e51b815260206004820181905260248201527f496e76616c6964205a4b20466f756e646174696f6e207369676e61747572657360448201526064016102fc565b604051632291ed1b60e11b81526001600160a01b037f000000000000000000000000e3a615778aeec76df1b368948a1d1614497db8581690634523da369061054b908890600401610e33565b5f604051808303815f87803b158015610562575f80fd5b505af1158015610574573d5f803e3d5ffd5b505050505050505050505050505050505050565b60606105b47f456d657267656e637955706772616465426f61726400000000000000000000155f610744565b905090565b60606105b47f31000000000000000000000000000000000000000000000000000000000000016001610744565b5f6106126105f26107ee565b8360405161190160f01b8152600281019290925260228201526042902090565b92915050565b5f805f856001600160a01b03168585604051602401610638929190610ee5565b60408051601f198184030181529181526020820180516001600160e01b0316630b135d3f60e11b1790525161066d9190610f05565b5f60405180830381855afa9150503d805f81146106a5576040519150601f19603f3d011682016040523d82523d5f602084013e6106aa565b606091505b50915091508180156106be57506020815110155b80156106e557508051630b135d3f60e11b906106e39083016020908101908401610f20565b145b9695505050505050565b5f805f6106fc8585610917565b5090925090505f81600381111561071557610715610f37565b1480156107335750856001600160a01b0316826001600160a01b0316145b806106e557506106e5868686610618565b606060ff831461075e5761075783610960565b9050610612565b81805461076a90610f4b565b80601f016020809104026020016040519081016040528092919081815260200182805461079690610f4b565b80156107e15780601f106107b8576101008083540402835291602001916107e1565b820191905f5260205f20905b8154815290600101906020018083116107c457829003601f168201915b5050505050905092915050565b5f306001600160a01b037f0000000000000000000000000b2b3d1d87933c5009c49effbae279cdf39c6c961614801561084657507f0000000000000000000000000000000000000000000000000000000000aa36a746145b1561087057507fbbce6fcdaf849e4fdbaf13882a4b69d01607fce3e0dadfcb7eb628c9f810342190565b6105b4604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f09e7b74238054110bafcefc73054144d67fe22a2ed5c1eedf64ff5ea802611fd918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b5f805f835160410361094e576020840151604085015160608601515f1a6109408882858561099d565b955095509550505050610959565b505081515f91506002905b9250925092565b60605f61096c83610a65565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156109d657505f91506003905082610a5b565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610a27573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b038116610a5257505f925060019150829050610a5b565b92505f91508190505b9450945094915050565b5f60ff8216601f81111561061257604051632cd44ac360e21b815260040160405180910390fd5b5f5b83811015610aa6578181015183820152602001610a8e565b50505f910152565b5f8151808452610ac5816020860160208601610a8c565b601f01601f19169290920160200192915050565b60ff60f81b881681525f602060e06020840152610af960e084018a610aae565b8381036040850152610b0b818a610aae565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825260208088019350909101905f5b81811015610b5e57835183529284019291840191600101610b42565b50909c9b505050505050505050505050565b5f8083601f840112610b80575f80fd5b50813567ffffffffffffffff811115610b97575f80fd5b602083019150836020828501011115610bae575f80fd5b9250929050565b5f805f805f805f805f60a08a8c031215610bcd575f80fd5b893567ffffffffffffffff80821115610be4575f80fd5b818c0191508c601f830112610bf7575f80fd5b813581811115610c05575f80fd5b8d60208260051b8501011115610c19575f80fd5b60209283019b509950908b0135975060408b01359080821115610c3a575f80fd5b610c468d838e01610b70565b909850965060608c0135915080821115610c5e575f80fd5b610c6a8d838e01610b70565b909650945060808c0135915080821115610c82575f80fd5b50610c8f8c828d01610b70565b915080935050809150509295985092959850929598565b634e487b7160e01b5f52604160045260245ffd5b6040516060810167ffffffffffffffff81118282101715610cdd57610cdd610ca6565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610d0c57610d0c610ca6565b604052919050565b5f67ffffffffffffffff80841115610d2e57610d2e610ca6565b8360051b6020610d3f818301610ce3565b868152918501918181019036841115610d56575f80fd5b865b84811015610e2757803586811115610d6e575f80fd5b88016060368290031215610d80575f80fd5b610d88610cba565b81356001600160a01b0381168114610d9e575f80fd5b8152818601358682015260408083013589811115610dba575f80fd5b9290920191601f3681850112610dce575f80fd5b83358a811115610de057610de0610ca6565b610df1818301601f19168a01610ce3565b91508082523689828701011115610e06575f80fd5b808986018a8401375f90820189015290820152845250918301918301610d58565b50979650505050505050565b5f60208083526080830184516060808487015282825180855260a08801915060a08160051b890101945085840193505f5b81811015610eb757888603609f19018352845180516001600160a01b031687528781015188880152604090810151908701859052610ea485880182610aae565b9650509386019391860191600101610e64565b50505050918501516001600160a01b0381166040860152915060408501516060850152809250505092915050565b828152604060208201525f610efd6040830184610aae565b949350505050565b5f8251610f16818460208701610a8c565b9190910192915050565b5f60208284031215610f30575f80fd5b5051919050565b634e487b7160e01b5f52602160045260245ffd5b600181811c90821680610f5f57607f821691505b602082108103610f7d57634e487b7160e01b5f52602260045260245ffd5b5091905056fea26469706673582212200c166ea6dd3ab3d912901bebe655c8ad3e6d871845812c00a96142ecd66cf65d64736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e3a615778aeec76df1b368948a1d1614497db85800000000000000000000000025ab0397da109a50c8921a1d4a034e09736024690000000000000000000000003a8ac6a7a4a026f42f805b40bb992edf0165459500000000000000000000000046d3c220de912100de9ee5052511ad5fcb2c190b
-----Decoded View---------------
Arg [0] : _protocolUpgradeHandler (address): 0xe3a615778aeEC76df1B368948a1D1614497Db858
Arg [1] : _securityCouncil (address): 0x25Ab0397DA109A50C8921A1d4a034e0973602469
Arg [2] : _guardians (address): 0x3A8Ac6A7a4A026F42f805B40bB992edF01654595
Arg [3] : _zkFoundation (address): 0x46d3c220de912100DE9Ee5052511ad5FCb2C190b
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000e3a615778aeec76df1b368948a1d1614497db858
Arg [1] : 00000000000000000000000025ab0397da109a50c8921a1d4a034e0973602469
Arg [2] : 0000000000000000000000003a8ac6a7a4a026f42f805b40bb992edf01654595
Arg [3] : 00000000000000000000000046d3c220de912100de9ee5052511ad5fcb2c190b
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.