Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ZkLink
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.0;
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {AddressAliasHelper} from "./zksync/l1-contracts/vendor/AddressAliasHelper.sol";
import {IZkLink} from "./interfaces/IZkLink.sol";
import {IL2Gateway} from "./interfaces/IL2Gateway.sol";
import {IMailbox, TxStatus} from "./zksync/l1-contracts/zksync/interfaces/IMailbox.sol";
import {IAdmin} from "./zksync/l1-contracts/zksync/interfaces/IAdmin.sol";
import {IZkSync} from "./zksync/l1-contracts/zksync/interfaces/IZkSync.sol";
import {Merkle} from "./zksync/l1-contracts/zksync/libraries/Merkle.sol";
import {TransactionValidator} from "./zksync/l1-contracts/zksync/libraries/TransactionValidator.sol";
import {L2Log, L2Message, PubdataPricingMode, FeeParams, SecondaryChainSyncStatus} from "./zksync/l1-contracts/zksync/Storage.sol";
import {UncheckedMath} from "./zksync/l1-contracts/common/libraries/UncheckedMath.sol";
import {UnsafeBytes} from "./zksync/l1-contracts/common/libraries/UnsafeBytes.sol";
import {REQUIRED_L2_GAS_PRICE_PER_PUBDATA, MAX_NEW_FACTORY_DEPS, L1_GAS_PER_PUBDATA_BYTE, L2_L1_LOGS_TREE_DEFAULT_LEAF_HASH} from "./zksync/l1-contracts/zksync/Config.sol";
import {L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, L2_BOOTLOADER_ADDRESS, L2_ETH_TOKEN_SYSTEM_CONTRACT_ADDR} from "./zksync/l1-contracts/common/L2ContractAddresses.sol";
import {IGetters} from "./zksync/l1-contracts/zksync/interfaces/IGetters.sol";
/// @title ZkLink contract
/// @author zk.link
contract ZkLink is
IZkLink,
IMailbox,
IAdmin,
IGetters,
OwnableUpgradeable,
UUPSUpgradeable,
ReentrancyGuardUpgradeable,
PausableUpgradeable
{
using UncheckedMath for uint256;
/// @dev The forward request type hash
bytes32 public constant FORWARD_REQUEST_TYPE_HASH =
keccak256(
"ForwardL2Request(address gateway,bool isContractCall,address sender,uint256 txId,address contractAddressL2,uint256 l2Value,bytes32 l2CallDataHash,uint256 l2GasLimit,uint256 l2GasPricePerPubdata,bytes32 factoryDepsHash,address refundRecipient)"
);
/// @dev The length of withdraw message sent to secondary chain
uint256 private constant L2_WITHDRAW_MESSAGE_LENGTH = 108;
/// @dev Whether eth is the gas token
bool public immutable IS_ETH_GAS_TOKEN;
/// @notice The gateway is used for communicating with L1
IL2Gateway public gateway;
/// @notice List of permitted validators
mapping(address validatorAddress => bool isValidator) public validators;
/// @dev The white list allow to send request L2 request
mapping(address contractAddress => bool isPermitToSendL2Request) public allowLists;
/// @dev Gas price of primary chain
uint256 public txGasPrice;
/// @dev Fee params used to derive gasPrice for the L1->L2 transactions. For L2 transactions,
/// the bootloader gives enough freedom to the operator.
FeeParams public feeParams;
/// @dev The total number of priority operations that were added to the priority queue
uint256 public totalPriorityTxs;
/// @dev The total number of synced priority operations
uint256 public totalSyncedPriorityTxs;
/// @dev The sync status for each priority operation
mapping(uint256 priorityOpId => SecondaryChainSyncStatus) public priorityOpSyncStatus;
/// @notice Total number of executed batches i.e. batches[totalBatchesExecuted] points at the latest executed batch
/// (batch 0 is genesis)
uint256 public totalBatchesExecuted;
/// @dev Stored root hashes of L2 -> L1 logs
mapping(uint256 batchNumber => bytes32 l2LogsRootHash) public l2LogsRootHashes;
/// @dev Stored the l2 tx hash map from secondary chain to primary chain
mapping(bytes32 l2TxHash => bytes32 primaryChainL2TxHash) public l2TxHashMap;
/// @dev The total forward fee payed to validator
uint256 public totalValidatorForwardFee;
/// @dev The total forward fee withdrawn by validator
uint256 public totalValidatorForwardFeeWithdrawn;
/// @dev A mapping L2 batch number => message number => flag.
/// @dev The L2 -> L1 log is sent for every withdrawal, so this mapping is serving as
/// a flag to indicate that the message was already processed.
/// @dev Used to indicate that eth withdrawal was already processed
mapping(uint256 l2BatchNumber => mapping(uint256 l2ToL1MessageNumber => bool isFinalized))
public isEthWithdrawalFinalized;
/// @dev The forward fee allocator
address public forwardFeeAllocator;
/// @dev The range batch root hash of [fromBatchNumber, toBatchNumber]
/// The key is keccak256(abi.encodePacked(fromBatchNumber, toBatchNumber))
mapping(bytes32 range => bytes32 rangeBatchRootHash) public rangeBatchRootHashes;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
/// @notice Gateway init
event InitGateway(IL2Gateway indexed gateway);
/// @notice Contract's permit status changed
event ContractAllowStatusUpdate(address indexed contractAddress, bool isPermit);
/// @notice Tx gas price changed
event TxGasPriceUpdate(uint256 oldTxGasPrice, uint256 newTxGasPrice);
/// @notice Validator's status changed
event ValidatorStatusUpdate(address indexed validatorAddress, bool isActive);
/// @notice Fee params for L1->L2 transactions changed
event NewFeeParams(FeeParams oldFeeParams, FeeParams newFeeParams);
/// @notice New priority request event. Emitted when a request is placed into the priority queue
event NewPriorityRequest(uint256 priorityOpId, ForwardL2Request l2Request);
/// @notice Emitted send sync status to primary chain.
event SyncL2Requests(uint256 totalSyncedPriorityTxs, bytes32 syncHash, uint256 forwardEthAmount);
/// @notice Emitted when receive batch root from primary chain.
event SyncBatchRoot(uint256 batchNumber, bytes32 l2LogsRootHash, uint256 forwardEthAmount);
/// @notice Emitted when receive range batch root hash from primary chain.
event SyncRangeBatchRoot(
uint256 fromBatchNumber,
uint256 toBatchNumber,
bytes32 rangeBatchRootHash,
uint256 forwardEthAmount
);
/// @notice Emitted when open range batch root hash.
event OpenRangeBatchRoot(uint256 fromBatchNumber, uint256 toBatchNumber);
/// @notice Emitted when receive l2 tx hash from primary chain.
event SyncL2TxHash(bytes32 l2TxHash, bytes32 primaryChainL2TxHash);
/// @notice Emitted when validator withdraw forward fee
event WithdrawForwardFee(address indexed receiver, uint256 amount);
/// @notice Emitted when the withdrawal is finalized on L1 and funds are released.
/// @param to The address to which the funds were sent
/// @param amount The amount of funds that were sent
event EthWithdrawalFinalized(address indexed to, uint256 amount);
/// @notice Forward fee allocator changed
event ForwardFeeAllocatorUpdate(address oldAllocator, address newAllocator);
/// @notice Check if msg sender is gateway
modifier onlyGateway() {
require(msg.sender == address(gateway), "Not gateway");
_;
}
/// @notice Checks if validator is active
modifier onlyValidator() {
require(validators[msg.sender], "Not validator"); // validator is not active
_;
}
/// @notice Checks if msg sender is forward fee allocator
modifier onlyForwardFeeAllocator() {
require(msg.sender == forwardFeeAllocator, "Not forward fee allocator");
_;
}
constructor(bool _isEthGasToken) {
IS_ETH_GAS_TOKEN = _isEthGasToken;
_disableInitializers();
}
function initialize() external initializer {
__Ownable_init_unchained();
__UUPSUpgradeable_init_unchained();
__ReentrancyGuard_init_unchained();
__Pausable_init_unchained();
}
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {
// can only called by owner
}
/// @dev Pause the contract, can only be called by the owner
function pause() external onlyOwner {
_pause();
}
/// @dev Unpause the contract, can only be called by the owner
function unpause() external onlyOwner {
_unpause();
}
function getGateway() external view returns (IL2Gateway) {
return gateway;
}
function getGovernor() external view returns (address) {
return owner();
}
function getTotalBatchesExecuted() external view returns (uint256) {
return totalBatchesExecuted;
}
function getTotalPriorityTxs() external view returns (uint256) {
return totalPriorityTxs;
}
function isValidator(address _address) external view returns (bool) {
return validators[_address];
}
function l2LogsRootHash(uint256 _batchNumber) external view returns (bytes32 merkleRoot) {
return l2LogsRootHashes[_batchNumber];
}
function getPriorityTxMaxGasLimit() public pure returns (uint256) {
return 72000000;
}
/// @dev Init gateway, can only be called by the owner
function setGateway(IL2Gateway _gateway) external onlyOwner {
require(address(gateway) == address(0), "Duplicate init gateway");
require(address(_gateway) != address(0), "Invalid gateway");
gateway = _gateway;
emit InitGateway(_gateway);
}
/// @dev Update the permit status of contract, can only be called by the owner
function setAllowList(address _contractAddress, bool _permitted) external onlyOwner {
if (allowLists[_contractAddress] != _permitted) {
allowLists[_contractAddress] = _permitted;
emit ContractAllowStatusUpdate(_contractAddress, _permitted);
}
}
/// @dev Update the tx gas price
function setTxGasPrice(uint256 _newTxGasPrice) external onlyOwner {
uint256 oldTxGasPrice = txGasPrice;
if (oldTxGasPrice != _newTxGasPrice) {
txGasPrice = _newTxGasPrice;
emit TxGasPriceUpdate(oldTxGasPrice, _newTxGasPrice);
}
}
function setValidator(address _validator, bool _active) external onlyGateway {
if (validators[_validator] != _active) {
validators[_validator] = _active;
emit ValidatorStatusUpdate(_validator, _active);
}
}
/// @dev https://github.com/matter-labs/era-contracts/blob/e0a33ce73c4decd381446a6eb812b14c2ff69c47/l1-contracts/contracts/zksync/facets/Admin.sol#L88
function changeFeeParams(FeeParams calldata _newFeeParams) external onlyGateway {
// Double checking that the new fee params are valid, i.e.
// the maximal pubdata per batch is not less than the maximal pubdata per priority transaction.
require(_newFeeParams.maxPubdataPerBatch >= _newFeeParams.priorityTxMaxPubdata, "n6");
FeeParams memory oldFeeParams = feeParams;
feeParams = _newFeeParams;
emit NewFeeParams(oldFeeParams, _newFeeParams);
}
/// @dev Update the forward fee allocator
function setForwardFeeAllocator(address _newForwardFeeAllocator) external onlyOwner {
require(_newForwardFeeAllocator != address(0), "Invalid allocator");
address oldAllocator = forwardFeeAllocator;
if (oldAllocator != _newForwardFeeAllocator) {
forwardFeeAllocator = _newForwardFeeAllocator;
emit ForwardFeeAllocatorUpdate(oldAllocator, _newForwardFeeAllocator);
}
}
function l2TransactionBaseCost(
uint256 _gasPrice,
uint256 _l2GasLimit,
uint256 _l2GasPerPubdataByteLimit
) public view returns (uint256) {
uint256 l2GasPrice = _deriveL2GasPrice(_gasPrice, _l2GasPerPubdataByteLimit);
return l2GasPrice * _l2GasLimit;
}
function requestL2Transaction(
address _contractL2,
uint256 _l2Value,
bytes calldata _calldata,
uint256 _l2GasLimit,
uint256 _l2GasPerPubdataByteLimit,
bytes[] calldata _factoryDeps,
address _refundRecipient
) external payable nonReentrant whenNotPaused returns (bytes32 canonicalTxHash) {
// Disable l2 value if eth is not the gas token
if (!IS_ETH_GAS_TOKEN) {
require(_l2Value == 0, "Not allow l2 value");
}
// Change the sender address if it is a smart contract to prevent address collision between L1 and L2.
// Please note, currently zkSync address derivation is different from Ethereum one, but it may be changed in the future.
address sender = msg.sender;
bool isContractCall = false;
// solhint-disable-next-line avoid-tx-origin
if (sender != tx.origin) {
// Check contract call is allowed for safe reasons
require(allowLists[sender], "Not allow to send L2 request");
sender = AddressAliasHelper.applyL1ToL2Alias(msg.sender);
isContractCall = true;
} else {
// Temporarily prohibit contract calls from EOA address for safe reasons
require(_calldata.length == 0, "Not allow to call contract");
}
// Enforcing that `_l2GasPerPubdataByteLimit` equals to a certain constant number. This is needed
// to ensure that users do not get used to using "exotic" numbers for _l2GasPerPubdataByteLimit, e.g. 1-2, etc.
// VERY IMPORTANT: nobody should rely on this constant to be fixed and every contract should give their users the ability to provide the
// ability to provide `_l2GasPerPubdataByteLimit` for each independent transaction.
// CHANGING THIS CONSTANT SHOULD BE A CLIENT-SIDE CHANGE.
require(_l2GasPerPubdataByteLimit == REQUIRED_L2_GAS_PRICE_PER_PUBDATA, "Invalid l2GasPerPubdataByteLimit");
require(_factoryDeps.length <= MAX_NEW_FACTORY_DEPS, "Invalid factoryDeps");
// Checking that the user provided enough ether to pay for the transaction.
uint256 l2GasPrice = _deriveL2GasPrice(txGasPrice, _l2GasPerPubdataByteLimit);
uint256 baseCost = l2GasPrice * _l2GasLimit;
require(msg.value == baseCost + _l2Value, "Invalid msg value"); // The `msg.value` doesn't cover the transaction cost
totalValidatorForwardFee = totalValidatorForwardFee + baseCost;
// If the `_refundRecipient` is not provided, we use the `sender` as the recipient.
address refundRecipient = _refundRecipient == address(0) ? sender : _refundRecipient;
// If the `_refundRecipient` is a smart contract, we apply the L1 to L2 alias to prevent foot guns.
if (refundRecipient.code.length > 0) {
refundRecipient = AddressAliasHelper.applyL1ToL2Alias(refundRecipient);
}
// Build l2 request params
uint256 _totalPriorityTxs = totalPriorityTxs;
ForwardL2Request memory request = ForwardL2Request(
gateway.getRemoteGateway(),
isContractCall,
sender,
_totalPriorityTxs,
_contractL2,
_l2Value,
_calldata,
_l2GasLimit,
_l2GasPerPubdataByteLimit,
_factoryDeps,
refundRecipient
);
// Validate l2 transaction
{
L2CanonicalTransaction memory transaction = _serializeL2Transaction(request);
bytes memory transactionEncoding = abi.encode(transaction);
TransactionValidator.validateL1ToL2Transaction(
transaction,
transactionEncoding,
getPriorityTxMaxGasLimit(),
feeParams.priorityTxMaxPubdata
);
}
canonicalTxHash = hashForwardL2Request(request);
// Accumulate sync status
SecondaryChainSyncStatus memory syncStatus;
if (_totalPriorityTxs == 0) {
syncStatus.hash = canonicalTxHash;
syncStatus.amount = _l2Value;
} else {
syncStatus = priorityOpSyncStatus[_totalPriorityTxs - 1];
syncStatus.hash = keccak256(abi.encodePacked(syncStatus.hash, canonicalTxHash));
syncStatus.amount = syncStatus.amount + _l2Value;
}
priorityOpSyncStatus[_totalPriorityTxs] = syncStatus;
totalPriorityTxs = _totalPriorityTxs + 1;
emit NewPriorityRequest(request.txId, request);
}
function finalizeEthWithdrawal(
uint256 _l2BatchNumber,
uint256 _l2MessageIndex,
uint16 _l2TxNumberInBatch,
bytes calldata _message,
bytes32[] calldata _merkleProof
) external nonReentrant {
require(IS_ETH_GAS_TOKEN, "Not allow eth withdraw");
require(!isEthWithdrawalFinalized[_l2BatchNumber][_l2MessageIndex], "jj");
L2Message memory l2ToL1Message = L2Message({
txNumberInBatch: _l2TxNumberInBatch,
sender: L2_ETH_TOKEN_SYSTEM_CONTRACT_ADDR,
data: _message
});
(address _l1Gateway, uint256 _amount, address _l1WithdrawReceiver) = _parseL2WithdrawalMessage(_message);
require(_l1Gateway == gateway.getRemoteGateway(), "rg");
bool proofValid = proveL2MessageInclusion(_l2BatchNumber, _l2MessageIndex, l2ToL1Message, _merkleProof);
require(proofValid, "pi"); // Failed to verify that withdrawal was actually initialized on L2
isEthWithdrawalFinalized[_l2BatchNumber][_l2MessageIndex] = true;
_withdrawFunds(_l1WithdrawReceiver, _amount);
emit EthWithdrawalFinalized(_l1WithdrawReceiver, _amount);
}
function proveL2MessageInclusion(
uint256 _batchNumber,
uint256 _index,
L2Message memory _message,
bytes32[] calldata _proof
) public view returns (bool) {
return _proveL2LogInclusion(_batchNumber, _index, _L2MessageToLog(_message), _proof);
}
function proveL1ToL2TransactionStatus(
bytes32 _l2TxHash,
uint256 _l2BatchNumber,
uint256 _l2MessageIndex,
uint16 _l2TxNumberInBatch,
bytes32[] calldata _merkleProof,
TxStatus _status
) public view returns (bool) {
// Get l2 tx hash on primary chain
bytes32 primaryChainL2TxHash = l2TxHashMap[_l2TxHash];
require(primaryChainL2TxHash != bytes32(0), "Invalid l2 tx hash");
// Bootloader sends an L2 -> L1 log only after processing the L1 -> L2 transaction.
// Thus, we can verify that the L1 -> L2 transaction was included in the L2 batch with specified status.
//
// The semantics of such L2 -> L1 log is always:
// - sender = L2_BOOTLOADER_ADDRESS
// - key = hash(L1ToL2Transaction)
// - value = status of the processing transaction (1 - success & 0 - fail)
// - isService = true (just a conventional value)
// - l2ShardId = 0 (means that L1 -> L2 transaction was processed in a rollup shard, other shards are not available yet anyway)
// - txNumberInBatch = number of transaction in the batch
L2Log memory l2Log = L2Log({
l2ShardId: 0,
isService: true,
txNumberInBatch: _l2TxNumberInBatch,
sender: L2_BOOTLOADER_ADDRESS,
key: primaryChainL2TxHash,
value: bytes32(uint256(_status))
});
return _proveL2LogInclusion(_l2BatchNumber, _l2MessageIndex, l2Log, _merkleProof);
}
function syncL2Requests(uint256 _newTotalSyncedPriorityTxs) external payable onlyValidator {
// Check newTotalSyncedPriorityTxs
require(
_newTotalSyncedPriorityTxs <= totalPriorityTxs && _newTotalSyncedPriorityTxs > totalSyncedPriorityTxs,
"Invalid sync point"
);
// Forward eth amount is the difference of two accumulate amount
SecondaryChainSyncStatus memory lastSyncStatus;
if (totalSyncedPriorityTxs > 0) {
lastSyncStatus = priorityOpSyncStatus[totalSyncedPriorityTxs - 1];
}
SecondaryChainSyncStatus memory currentSyncStatus = priorityOpSyncStatus[_newTotalSyncedPriorityTxs - 1];
uint256 forwardAmount = currentSyncStatus.amount - lastSyncStatus.amount;
// Update synced priority txs
totalSyncedPriorityTxs = _newTotalSyncedPriorityTxs;
// Send sync status to L1 gateway
bytes memory callData = abi.encodeCall(
IZkSync.syncL2Requests,
(gateway.getRemoteGateway(), _newTotalSyncedPriorityTxs, currentSyncStatus.hash, forwardAmount)
);
gateway.sendMessage{value: msg.value + forwardAmount}(forwardAmount, callData);
emit SyncL2Requests(_newTotalSyncedPriorityTxs, currentSyncStatus.hash, forwardAmount);
}
function syncBatchRoot(
uint256 _batchNumber,
bytes32 _l2LogsRootHash,
uint256 _forwardEthAmount
) external payable onlyGateway {
require(msg.value == _forwardEthAmount, "Invalid forward amount");
// Allows repeated sending of the forward amount of the batch
if (_batchNumber > totalBatchesExecuted) {
totalBatchesExecuted = _batchNumber;
}
l2LogsRootHashes[_batchNumber] = _l2LogsRootHash;
emit SyncBatchRoot(_batchNumber, _l2LogsRootHash, _forwardEthAmount);
}
function syncRangeBatchRoot(
uint256 _fromBatchNumber,
uint256 _toBatchNumber,
bytes32 _rangeBatchRootHash,
uint256 _forwardEthAmount
) external payable onlyGateway {
require(_toBatchNumber >= _fromBatchNumber, "Invalid range");
require(msg.value == _forwardEthAmount, "Invalid forward amount");
bytes32 range = keccak256(abi.encodePacked(_fromBatchNumber, _toBatchNumber));
rangeBatchRootHashes[range] = _rangeBatchRootHash;
emit SyncRangeBatchRoot(_fromBatchNumber, _toBatchNumber, _rangeBatchRootHash, _forwardEthAmount);
}
/// @dev Unzip the root hashes in the range
/// @param _fromBatchNumber The batch number from
/// @param _toBatchNumber The batch number to
/// @param _l2LogsRootHashes The l2LogsRootHash list in the range [`_fromBatchNumber`, `_toBatchNumber`]
function openRangeBatchRootHash(
uint256 _fromBatchNumber,
uint256 _toBatchNumber,
bytes32[] calldata _l2LogsRootHashes
) external onlyValidator {
require(_toBatchNumber >= _fromBatchNumber, "Invalid range");
bytes32 range = keccak256(abi.encodePacked(_fromBatchNumber, _toBatchNumber));
bytes32 rangeBatchRootHash = rangeBatchRootHashes[range];
require(rangeBatchRootHash != bytes32(0), "Range batch root hash not exist");
uint256 rootHashesLength = _l2LogsRootHashes.length;
require(rootHashesLength == _toBatchNumber - _fromBatchNumber + 1, "Invalid root hashes length");
bytes32 _rangeBatchRootHash = _l2LogsRootHashes[0];
l2LogsRootHashes[_fromBatchNumber] = _rangeBatchRootHash;
unchecked {
for (uint256 i = 1; i < rootHashesLength; ++i) {
bytes32 _l2LogsRootHash = _l2LogsRootHashes[i];
l2LogsRootHashes[_fromBatchNumber + i] = _l2LogsRootHash;
_rangeBatchRootHash = Merkle._efficientHash(_rangeBatchRootHash, _l2LogsRootHash);
}
}
require(_rangeBatchRootHash == rangeBatchRootHash, "Incorrect root hash");
delete rangeBatchRootHashes[range];
if (_toBatchNumber > totalBatchesExecuted) {
totalBatchesExecuted = _toBatchNumber;
}
emit OpenRangeBatchRoot(_fromBatchNumber, _toBatchNumber);
}
function syncL2TxHash(bytes32 _l2TxHash, bytes32 _primaryChainL2TxHash) external onlyGateway {
l2TxHashMap[_l2TxHash] = _primaryChainL2TxHash;
emit SyncL2TxHash(_l2TxHash, _primaryChainL2TxHash);
}
function withdrawForwardFee(address _receiver, uint256 _amount) external nonReentrant onlyForwardFeeAllocator {
require(_amount > 0, "Invalid amount");
uint256 newWithdrawnFee = totalValidatorForwardFeeWithdrawn + _amount;
require(totalValidatorForwardFee >= newWithdrawnFee, "Withdraw exceed");
// Update withdrawn fee
totalValidatorForwardFeeWithdrawn = newWithdrawnFee;
// solhint-disable-next-line avoid-low-level-calls
(bool success, ) = _receiver.call{value: _amount}("");
require(success, "Withdraw failed");
emit WithdrawForwardFee(_receiver, _amount);
}
/// @notice Derives the price for L2 gas in ETH to be paid.
/// @dev https://github.com/matter-labs/era-contracts/blob/e0a33ce73c4decd381446a6eb812b14c2ff69c47/l1-contracts/contracts/zksync/facets/Mailbox.sol#L147
/// @param _l1GasPrice The gas price on L1.
/// @param _gasPerPubdata The price for each pubdata byte in L2 gas
/// @return The price of L2 gas in ETH
function _deriveL2GasPrice(uint256 _l1GasPrice, uint256 _gasPerPubdata) internal view returns (uint256) {
FeeParams memory _feeParams = feeParams;
uint256 pubdataPriceETH;
if (_feeParams.pubdataPricingMode == PubdataPricingMode.Rollup) {
pubdataPriceETH = L1_GAS_PER_PUBDATA_BYTE * _l1GasPrice;
}
uint256 batchOverheadETH = uint256(_feeParams.batchOverheadL1Gas) * _l1GasPrice;
uint256 fullPubdataPriceETH = pubdataPriceETH + batchOverheadETH / uint256(_feeParams.maxPubdataPerBatch);
uint256 l2GasPrice = _feeParams.minimalL2GasPrice + batchOverheadETH / uint256(_feeParams.maxL2GasPerBatch);
uint256 minL2GasPriceETH = (fullPubdataPriceETH + _gasPerPubdata - 1) / _gasPerPubdata;
return Math.max(l2GasPrice, minL2GasPriceETH);
}
function _serializeL2Transaction(
ForwardL2Request memory _request
) internal pure returns (L2CanonicalTransaction memory transaction) {
transaction = L2CanonicalTransaction({
txType: uint256(0),
from: uint256(0),
to: uint256(0),
gasLimit: _request.l2GasLimit, // Used in validate l2 transaction
gasPerPubdataByteLimit: _request.l2GasPricePerPubdata, // Used in validate l2 transaction
maxFeePerGas: uint256(0),
maxPriorityFeePerGas: uint256(0),
paymaster: uint256(0),
nonce: uint256(0),
value: uint256(0),
reserved: [uint256(0), uint256(0), uint256(0), uint256(0)],
data: _request.l2CallData, // Length used in validate l2 transaction
signature: new bytes(0),
factoryDeps: new uint256[](_request.factoryDeps.length), // Length used in validate l2 transaction
paymasterInput: new bytes(0),
reservedDynamic: new bytes(0)
});
}
/// @dev Convert arbitrary-length message to the raw l2 log
function _L2MessageToLog(L2Message memory _message) internal pure returns (L2Log memory) {
return
L2Log({
l2ShardId: 0,
isService: true,
txNumberInBatch: _message.txNumberInBatch,
sender: L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR,
key: bytes32(uint256(uint160(_message.sender))),
value: keccak256(_message.data)
});
}
/// @dev Prove that a specific L2 log was sent in a specific L2 batch number
function _proveL2LogInclusion(
uint256 _batchNumber,
uint256 _index,
L2Log memory _log,
bytes32[] calldata _proof
) internal view returns (bool) {
require(_batchNumber <= totalBatchesExecuted, "xx");
bytes32 hashedLog = keccak256(
abi.encodePacked(_log.l2ShardId, _log.isService, _log.txNumberInBatch, _log.sender, _log.key, _log.value)
);
// Check that hashed log is not the default one,
// otherwise it means that the value is out of range of sent L2 -> L1 logs
require(hashedLog != L2_L1_LOGS_TREE_DEFAULT_LEAF_HASH, "tw");
// It is ok to not check length of `_proof` array, as length
// of leaf preimage (which is `L2_TO_L1_LOG_SERIALIZE_SIZE`) is not
// equal to the length of other nodes preimages (which are `2 * 32`)
bytes32 calculatedRootHash = Merkle.calculateRoot(_proof, _index, hashedLog);
bytes32 actualRootHash = l2LogsRootHashes[_batchNumber];
return actualRootHash == calculatedRootHash;
}
/// @dev Decode the withdraw message that came from L2
function _parseL2WithdrawalMessage(
bytes memory _message
) internal pure returns (address l1Gateway, uint256 amount, address l1Receiver) {
// We check that the message is long enough to read the data.
// Please note that there are two versions of the message:
// 1. The message that is sent by `withdraw(address _l1Receiver)`
// It should be equal to the length of the bytes4 function signature + address l1Receiver + uint256 amount = 4 + 20 + 32 = 56 (bytes).
// 2. The message that is sent by `withdrawWithMessage(address _l1Receiver, bytes calldata _additionalData)`
// It should be equal to the length of the following:
// bytes4 function signature + address l1Gateway + uint256 amount + address l2Sender + bytes _additionalData
// (where the _additionalData = abi.encode(l1Receiver))
// = 4 + 20 + 32 + 20 + 32 == 108 (bytes).
require(_message.length == L2_WITHDRAW_MESSAGE_LENGTH, "pm");
(uint32 functionSignature, uint256 offset) = UnsafeBytes.readUint32(_message, 0);
require(bytes4(functionSignature) == this.finalizeEthWithdrawal.selector, "is");
(l1Gateway, offset) = UnsafeBytes.readAddress(_message, offset);
(amount, offset) = UnsafeBytes.readUint256(_message, offset);
// The additional data is l1 receiver address
(l1Receiver, offset) = UnsafeBytes.readAddress(_message, offset + 32);
}
/// @notice Transfer ether from the contract to the receiver
/// @dev Reverts only if the transfer call failed
function _withdrawFunds(address _to, uint256 _amount) internal {
bool callSuccess;
// Low-level assembly call, to avoid any memory copying (save gas)
assembly {
callSuccess := call(gas(), _to, _amount, 0, 0, 0, 0)
}
require(callSuccess, "pz");
}
function hashForwardL2Request(ForwardL2Request memory _request) internal pure returns (bytes32) {
return
keccak256(
abi.encode(
FORWARD_REQUEST_TYPE_HASH,
_request.gateway,
_request.isContractCall,
_request.sender,
_request.txId,
_request.contractAddressL2,
_request.l2Value,
keccak256(_request.l2CallData),
_request.l2GasLimit,
_request.l2GasPricePerPubdata,
keccak256(abi.encode(_request.factoryDeps)),
_request.refundRecipient
)
);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822ProxiableUpgradeable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*
* _Available since v4.8.3._
*/
interface IERC1967Upgradeable {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeaconUpgradeable {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/IERC1967Upgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import {Initializable} from "../utils/Initializable.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*
* _Available since v4.1._
*/
abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
function __ERC1967Upgrade_init() internal onlyInitializing {
}
function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
}
/**
* @dev Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Perform implementation upgrade
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Perform implementation upgrade with additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
_upgradeTo(newImplementation);
if (data.length > 0 || forceCall) {
AddressUpgradeable.functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
/**
* @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
* not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.0;
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import {Initializable} from "./Initializable.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*
* _Available since v4.1._
*/
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
_;
}
function __UUPSUpgradeable_init() internal onlyInitializing {
}
function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
}
/**
* @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
return _IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeTo(address newImplementation) public virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data, true);
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal override onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuardUpgradeable is Initializable {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
function __ReentrancyGuard_init() internal onlyInitializing {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal onlyInitializing {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.0;
/**
* @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(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlotUpgradeable {
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 v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @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 up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (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; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
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.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 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.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
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 (rounding == Rounding.Up && 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 down.
*
* 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* 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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.0;
interface IGateway {
/// @return Remote gateway
function getRemoteGateway() external view returns (address);
}// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.0;
import {IGateway} from "./IGateway.sol";
interface IL2Gateway is IGateway {
/// @notice Emit when sending a message
event L2GatewayMessageSent(uint256 value, bytes callData);
/// @notice Send message to remote gateway
/// @param _value The msg value
/// @param _callData The call data
function sendMessage(uint256 _value, bytes calldata _callData) external payable;
}// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.0;
/// @title ZkLink interface contract
/// @author zk.link
interface IZkLink {
/// @notice Send l2 requests sync status to primary chain
/// @param _newTotalSyncedPriorityTxs New sync point
function syncL2Requests(uint256 _newTotalSyncedPriorityTxs) external payable;
/// @notice Receive batch root from primary chain
/// @param _batchNumber The batch number
/// @param _l2LogsRootHash The L2 to L1 log root hash
/// @param _forwardEthAmount The forward eth amount
function syncBatchRoot(uint256 _batchNumber, bytes32 _l2LogsRootHash, uint256 _forwardEthAmount) external payable;
/// @notice Receive range batch root hash from primary chain
/// @param _fromBatchNumber The batch number from
/// @param _toBatchNumber The batch number to
/// @param _rangeBatchRootHash The accumulation hash of l2LogsRootHash in the range [`_fromBatchNumber`, `_toBatchNumber`]
/// @param _forwardEthAmount The forward eth amount
function syncRangeBatchRoot(
uint256 _fromBatchNumber,
uint256 _toBatchNumber,
bytes32 _rangeBatchRootHash,
uint256 _forwardEthAmount
) external payable;
/// @notice Receive l2 tx hash from primary chain
/// @param _l2TxHash The l2 tx hash on local chain
/// @param _primaryChainL2TxHash The l2 tx hash on primary chain
function syncL2TxHash(bytes32 _l2TxHash, bytes32 _primaryChainL2TxHash) external;
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @dev The address of the L2 deployer system contract. address constant L2_DEPLOYER_SYSTEM_CONTRACT_ADDR = address(0x8006); /// @dev The special reserved L2 address. It is located in the system contracts space but doesn't have deployed /// bytecode. /// @dev The L2 deployer system contract allows changing bytecodes on any address if the `msg.sender` is this address. /// @dev So, whenever the governor wants to redeploy system contracts, it just initiates the L1 upgrade call deployer /// system contract /// via the L1 -> L2 transaction with `sender == L2_FORCE_DEPLOYER_ADDR`. For more details see the /// `diamond-initializers` contracts. address constant L2_FORCE_DEPLOYER_ADDR = address(0x8007); /// @dev The address of the special smart contract that can send arbitrary length message as an L2 log address constant L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR = address(0x8008); /// @dev The formal address of the initial program of the system: the bootloader address constant L2_BOOTLOADER_ADDRESS = address(0x8001); /// @dev The address of the eth token system contract address constant L2_ETH_TOKEN_SYSTEM_CONTRACT_ADDR = address(0x800a); /// @dev The address of the known code storage system contract address constant L2_KNOWN_CODE_STORAGE_SYSTEM_CONTRACT_ADDR = address(0x8004); /// @dev The address of the context system contract address constant L2_SYSTEM_CONTEXT_SYSTEM_CONTRACT_ADDR = address(0x800b);
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @author Matter Labs * @custom:security-contact [email protected] * @notice The library for unchecked math. */ library UncheckedMath { function uncheckedInc(uint256 _number) internal pure returns (uint256) { unchecked { return _number + 1; } } function uncheckedAdd(uint256 _lhs, uint256 _rhs) internal pure returns (uint256) { unchecked { return _lhs + _rhs; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @author Matter Labs * @custom:security-contact [email protected] * @dev The library provides a set of functions that help read data from an "abi.encodePacked" byte array. * @dev Each of the functions accepts the `bytes memory` and the offset where data should be read and returns a value of a certain type. * * @dev WARNING! * 1) Functions don't check the length of the bytes array, so it can go out of bounds. * The user of the library must check for bytes length before using any functions from the library! * * 2) Read variables are not cleaned up - https://docs.soliditylang.org/en/v0.8.16/internals/variable_cleanup.html. * Using data in inline assembly can lead to unexpected behavior! */ library UnsafeBytes { function readUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32 result, uint256 offset) { assembly { offset := add(_start, 4) result := mload(add(_bytes, offset)) } } function readAddress(bytes memory _bytes, uint256 _start) internal pure returns (address result, uint256 offset) { assembly { offset := add(_start, 20) result := mload(add(_bytes, offset)) } } function readUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256 result, uint256 offset) { assembly { offset := add(_start, 32) result := mload(add(_bytes, offset)) } } function readBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32 result, uint256 offset) { assembly { offset := add(_start, 32) result := mload(add(_bytes, offset)) } } // Original source code: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol#L228 // Get slice from bytes arrays // Returns the newly created 'bytes memory' // NOTE: theoretically possible overflow of (_start + _length) function slice(bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory) { require(_bytes.length >= (_start + _length), "Z"); // bytes length is less then start byte + length bytes bytes memory tempBytes = new bytes(_length); if (_length != 0) { assembly { let slice_curr := add(tempBytes, 0x20) let slice_end := add(slice_curr, _length) for { let array_current := add(_bytes, add(_start, 0x20)) } lt(slice_curr, slice_end) { slice_curr := add(slice_curr, 0x20) array_current := add(array_current, 0x20) } { mstore(slice_curr, mload(array_current)) } } } return tempBytes; } }
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright 2019-2021, Offchain Labs, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
pragma solidity ^0.8.0;
library AddressAliasHelper {
uint160 internal constant OFFSET = uint160(0x1111000000000000000000000000000000001111);
/// @notice Utility function converts the address that submitted a tx
/// to the inbox on L1 to the msg.sender viewed on L2
/// @param l1Address the address in the L1 that triggered the tx to L2
/// @return l2Address L2 address as viewed in msg.sender
function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {
unchecked {
l2Address = address(uint160(l1Address) + OFFSET);
}
}
/// @notice Utility function that converts the msg.sender viewed on L2 to the
/// address that submitted a tx to the inbox on L1
/// @param l2Address L2 address as viewed in msg.sender
/// @return l1Address the address in the L1 that triggered the tx to L2
function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {
unchecked {
l1Address = address(uint160(l2Address) - OFFSET);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @dev `keccak256("")`
bytes32 constant EMPTY_STRING_KECCAK = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
/// @dev Bytes in raw L2 log
/// @dev Equal to the bytes size of the tuple - (uint8 ShardId, bool isService, uint16 txNumberInBatch, address sender,
/// bytes32 key, bytes32 value)
uint256 constant L2_TO_L1_LOG_SERIALIZE_SIZE = 88;
/// @dev The maximum length of the bytes array with L2 -> L1 logs
uint256 constant MAX_L2_TO_L1_LOGS_COMMITMENT_BYTES = 4 + L2_TO_L1_LOG_SERIALIZE_SIZE * 512;
/// @dev The value of default leaf hash for L2 -> L1 logs Merkle tree
/// @dev An incomplete fixed-size tree is filled with this value to be a full binary tree
/// @dev Actually equal to the `keccak256(new bytes(L2_TO_L1_LOG_SERIALIZE_SIZE))`
bytes32 constant L2_L1_LOGS_TREE_DEFAULT_LEAF_HASH = 0x72abee45b59e344af8a6e520241c4744aff26ed411f4c4b00f8af09adada43ba;
// TODO: change constant to the real root hash of empty Merkle tree (SMA-184)
bytes32 constant DEFAULT_L2_LOGS_TREE_ROOT_HASH = bytes32(0);
/// @dev Denotes the type of the zkSync transaction that came from L1.
uint256 constant PRIORITY_OPERATION_L2_TX_TYPE = 255;
/// @dev Denotes the type of the zkSync transaction that is used for system upgrades.
uint256 constant SYSTEM_UPGRADE_L2_TX_TYPE = 254;
/// @dev The maximal allowed difference between protocol versions in an upgrade. The 100 gap is needed
/// in case a protocol version has been tested on testnet, but then not launched on mainnet, e.g.
/// due to a bug found.
uint256 constant MAX_ALLOWED_PROTOCOL_VERSION_DELTA = 100;
/// @dev The amount of time in seconds the validator has to process the priority transaction
/// NOTE: The constant is set to zero for the Alpha release period
uint256 constant PRIORITY_EXPIRATION = 0 days;
/// @dev Timestamp - seconds since unix epoch.
uint256 constant COMMIT_TIMESTAMP_NOT_OLDER = 3 days;
/// @dev Maximum available error between real commit batch timestamp and analog used in the verifier (in seconds)
/// @dev Must be used cause miner's `block.timestamp` value can differ on some small value (as we know - 12 seconds)
uint256 constant COMMIT_TIMESTAMP_APPROXIMATION_DELTA = 1 hours;
/// @dev Shift to apply to verify public input before verifying.
uint256 constant PUBLIC_INPUT_SHIFT = 32;
/// @dev The maximum number of L2 gas that a user can request for an L2 transaction
uint256 constant MAX_GAS_PER_TRANSACTION = 80000000;
/// @dev Even though the price for 1 byte of pubdata is 16 L1 gas, we have a slightly increased
/// value.
uint256 constant L1_GAS_PER_PUBDATA_BYTE = 17;
/// @dev The intrinsic cost of the L1->l2 transaction in computational L2 gas
uint256 constant L1_TX_INTRINSIC_L2_GAS = 167157;
/// @dev The intrinsic cost of the L1->l2 transaction in pubdata
uint256 constant L1_TX_INTRINSIC_PUBDATA = 88;
/// @dev The minimal base price for L1 transaction
uint256 constant L1_TX_MIN_L2_GAS_BASE = 173484;
/// @dev The number of L2 gas the transaction starts costing more with each 544 bytes of encoding
uint256 constant L1_TX_DELTA_544_ENCODING_BYTES = 1656;
/// @dev The number of L2 gas an L1->L2 transaction gains with each new factory dependency
uint256 constant L1_TX_DELTA_FACTORY_DEPS_L2_GAS = 2473;
/// @dev The number of L2 gas an L1->L2 transaction gains with each new factory dependency
uint256 constant L1_TX_DELTA_FACTORY_DEPS_PUBDATA = 64;
/// @dev The number of pubdata an L1->L2 transaction requires with each new factory dependency
uint256 constant MAX_NEW_FACTORY_DEPS = 32;
/// @dev The L2 gasPricePerPubdata required to be used in bridges.
uint256 constant REQUIRED_L2_GAS_PRICE_PER_PUBDATA = 800;
/// @dev The mask which should be applied to the packed batch and L2 block timestamp in order
/// to obtain the L2 block timestamp. Applying this mask is equivalent to calculating modulo 2**128
uint256 constant PACKED_L2_BLOCK_TIMESTAMP_MASK = 0xffffffffffffffffffffffffffffffff;
/// @dev The overhead for a transaction slot in L2 gas.
/// It is roughly equal to 80kk/MAX_TRANSACTIONS_IN_BATCH, i.e. how many gas would an L1->L2 transaction
/// need to pay to compensate for the batch being closed.
/// @dev It is expected that the L1 contracts will enforce that the L2 gas price will be high enough to compensate
/// the operator in case the batch is closed because of tx slots filling up.
uint256 constant TX_SLOT_OVERHEAD_L2_GAS = 10000;
/// @dev The overhead for each byte of the bootloader memory that the encoding of the transaction.
/// It is roughly equal to 80kk/BOOTLOADER_MEMORY_FOR_TXS, i.e. how many gas would an L1->L2 transaction
/// need to pay to compensate for the batch being closed.
/// @dev It is expected that the L1 contracts will enforce that the L2 gas price will be high enough to compensate
/// the operator in case the batch is closed because of the memory for transactions being filled up.
uint256 constant MEMORY_OVERHEAD_GAS = 10;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {FeeParams} from "../Storage.sol";
import {IL2Gateway} from "../../../../interfaces/IL2Gateway.sol";
/// @title The interface of the Admin Contract that controls access rights for contract management.
/// @author Matter Labs
/// @custom:security-contact [email protected]
interface IAdmin {
/// @notice Init gateway
/// @param _gateway The gateway on local chain
function setGateway(IL2Gateway _gateway) external;
/// @notice Change validator status (active or not active)
/// @param _validator Validator address
/// @param _active Active flag
function setValidator(address _validator, bool _active) external;
/// @notice Change the fee params for L1->L2 transactions
/// @param _newFeeParams The new fee params
function changeFeeParams(FeeParams calldata _newFeeParams) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IL2Gateway} from "../../../../interfaces/IL2Gateway.sol";
/// @title The interface of the Getters Contract that implements functions for getting contract state from outside the blockchain.
/// @author Matter Labs
/// @custom:security-contact [email protected]
interface IGetters {
/*//////////////////////////////////////////////////////////////
CUSTOM GETTERS
//////////////////////////////////////////////////////////////*/
/// @return The gateway on local chain
function getGateway() external view returns (IL2Gateway);
/// @return The address of the current governor
function getGovernor() external view returns (address);
/// @return The total number of batches that were committed & verified & executed
function getTotalBatchesExecuted() external view returns (uint256);
/// @return The total number of priority operations that were added to the priority queue, including all processed ones
function getTotalPriorityTxs() external view returns (uint256);
/// @return Whether the address has a validator access
function isValidator(address _address) external view returns (bool);
/// @return merkleRoot Merkle root of the tree with L2 logs for the selected batch
function l2LogsRootHash(uint256 _batchNumber) external view returns (bytes32 merkleRoot);
/// @return The maximum number of L2 gas that a user can request for L1 -> L2 transactions
function getPriorityTxMaxGasLimit() external view returns (uint256);
/// @return Whether a withdrawal has been finalized.
/// @param _l2BatchNumber The L2 batch number within which the withdrawal happened.
/// @param _l2MessageIndex The index of the L2->L1 message denoting the withdrawal.
function isEthWithdrawalFinalized(uint256 _l2BatchNumber, uint256 _l2MessageIndex) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {L2Message} from "../Storage.sol";
/// @dev The enum that represents the transaction execution status
/// @param Failure The transaction execution failed
/// @param Success The transaction execution succeeded
enum TxStatus {
Failure,
Success
}
/// @title The interface of the zkSync Mailbox contract that provides interfaces for L1 <-> L2 interaction.
/// @author Matter Labs
/// @custom:security-contact [email protected]
interface IMailbox {
/// @dev Structure that includes all fields of the L2 transaction
/// @dev The hash of this structure is the "canonical L2 transaction hash" and can be used as a unique identifier of a tx
/// @param txType The tx type number, depending on which the L2 transaction can be interpreted differently
/// @param from The sender's address. `uint256` type for possible address format changes and maintaining backward compatibility
/// @param to The recipient's address. `uint256` type for possible address format changes and maintaining backward compatibility
/// @param gasLimit The L2 gas limit for L2 transaction. Analog to the `gasLimit` on an L1 transactions
/// @param gasPerPubdataByteLimit Maximum number of L2 gas that will cost one byte of pubdata (every piece of data that will be stored on L1 as calldata)
/// @param maxFeePerGas The absolute maximum sender willing to pay per unit of L2 gas to get the transaction included in a batch. Analog to the EIP-1559 `maxFeePerGas` on an L1 transactions
/// @param maxPriorityFeePerGas The additional fee that is paid directly to the validator to incentivize them to include the transaction in a batch. Analog to the EIP-1559 `maxPriorityFeePerGas` on an L1 transactions
/// @param paymaster The address of the EIP-4337 paymaster, that will pay fees for the transaction. `uint256` type for possible address format changes and maintaining backward compatibility
/// @param nonce The nonce of the transaction. For L1->L2 transactions it is the priority operation Id.
/// @param value The value to pass with the transaction
/// @param reserved The fixed-length fields for usage in a future extension of transaction formats
/// @param data The calldata that is transmitted for the transaction call
/// @param signature An abstract set of bytes that are used for transaction authorization
/// @param factoryDeps The set of L2 bytecode hashes whose preimages were shown on L1
/// @param paymasterInput The arbitrary-length data that is used as a calldata to the paymaster pre-call
/// @param reservedDynamic The arbitrary-length field for usage in a future extension of transaction formats
struct L2CanonicalTransaction {
uint256 txType;
uint256 from;
uint256 to;
uint256 gasLimit;
uint256 gasPerPubdataByteLimit;
uint256 maxFeePerGas;
uint256 maxPriorityFeePerGas;
uint256 paymaster;
uint256 nonce;
uint256 value;
// In the future, we might want to add some
// new fields to the struct. The `txData` struct
// is to be passed to account and any changes to its structure
// would mean a breaking change to these accounts. To prevent this,
// we should keep some fields as "reserved".
// It is also recommended that their length is fixed, since
// it would allow easier proof integration (in case we will need
// some special circuit for preprocessing transactions).
uint256[4] reserved;
bytes data;
bytes signature;
uint256[] factoryDeps;
bytes paymasterInput;
// Reserved dynamic type for the future use-case. Using it should be avoided,
// But it is still here, just in case we want to enable some additional functionality.
bytes reservedDynamic;
}
/// @dev Internal structure that contains the parameters for the forwardRequestL2Transaction
/// @param gateway The secondary chain gateway;
/// @param isContractCall It's true when the request come from a contract.
/// @param sender The sender's address.
/// @param txId The id of the priority transaction.
/// @param contractAddressL2 The address of the contract on L2 to call.
/// @param l2Value The msg.value of the L2 transaction.
/// @param l2CallData The call data of the L2 transaction.
/// @param l2GasLimit The limit of the L2 gas for the L2 transaction
/// @param l2GasPrice The price of the L2 gas in Wei to be used for this transaction.
/// @param l2GasPricePerPubdata The price for a single pubdata byte in L2 gas.
/// @param refundRecipient The recipient of the refund for the transaction on L2. If the transaction fails, then
/// this address will receive the `l2Value`.
struct ForwardL2Request {
address gateway;
bool isContractCall;
address sender;
uint256 txId;
address contractAddressL2;
uint256 l2Value;
bytes l2CallData;
uint256 l2GasLimit;
uint256 l2GasPricePerPubdata;
bytes[] factoryDeps;
address refundRecipient;
}
/// @notice Prove that a specific arbitrary-length message was sent in a specific L2 batch number
/// @param _l2BatchNumber The executed L2 batch number in which the message appeared
/// @param _index The position in the L2 logs Merkle tree of the l2Log that was sent with the message
/// @param _message Information about the sent message: sender address, the message itself, tx index in the L2 batch where the message was sent
/// @param _proof Merkle proof for inclusion of L2 log that was sent with the message
/// @return Whether the proof is valid
function proveL2MessageInclusion(
uint256 _l2BatchNumber,
uint256 _index,
L2Message calldata _message,
bytes32[] calldata _proof
) external view returns (bool);
/// @notice Prove that the L1 -> L2 transaction was processed with the specified status.
/// @param _l2TxHash The L2 canonical transaction hash
/// @param _l2BatchNumber The L2 batch number where the transaction was processed
/// @param _l2MessageIndex The position in the L2 logs Merkle tree of the l2Log that was sent with the message
/// @param _l2TxNumberInBatch The L2 transaction number in the batch, in which the log was sent
/// @param _merkleProof The Merkle proof of the processing L1 -> L2 transaction
/// @param _status The execution status of the L1 -> L2 transaction (true - success & 0 - fail)
/// @return Whether the proof is correct and the transaction was actually executed with provided status
/// NOTE: It may return `false` for incorrect proof, but it doesn't mean that the L1 -> L2 transaction has an opposite status!
function proveL1ToL2TransactionStatus(
bytes32 _l2TxHash,
uint256 _l2BatchNumber,
uint256 _l2MessageIndex,
uint16 _l2TxNumberInBatch,
bytes32[] calldata _merkleProof,
TxStatus _status
) external view returns (bool);
/// @notice Request execution of L2 transaction from L1.
/// @param _contractL2 The L2 receiver address
/// @param _l2Value `msg.value` of L2 transaction
/// @param _calldata The input of the L2 transaction
/// @param _l2GasLimit Maximum amount of L2 gas that transaction can consume during execution on L2
/// @param _l2GasPerPubdataByteLimit The maximum amount L2 gas that the operator may charge the user for single byte of pubdata.
/// @param _factoryDeps An array of L2 bytecodes that will be marked as known on L2
/// @param _refundRecipient The address on L2 that will receive the refund for the transaction.
/// @dev If the L2 deposit finalization transaction fails, the `_refundRecipient` will receive the `_l2Value`.
/// Please note, the contract may change the refund recipient's address to eliminate sending funds to addresses out of control.
/// - If `_refundRecipient` is a contract on L1, the refund will be sent to the aliased `_refundRecipient`.
/// - If `_refundRecipient` is set to `address(0)` and the sender has NO deployed bytecode on L1, the refund will be sent to the `msg.sender` address.
/// - If `_refundRecipient` is set to `address(0)` and the sender has deployed bytecode on L1, the refund will be sent to the aliased `msg.sender` address.
/// @dev The address aliasing of L1 contracts as refund recipient on L2 is necessary to guarantee that the funds are controllable,
/// since address aliasing to the from address for the L2 tx will be applied if the L1 `msg.sender` is a contract.
/// Without address aliasing for L1 contracts as refund recipients they would not be able to make proper L2 tx requests
/// through the Mailbox to use or withdraw the funds from L2, and the funds would be lost.
/// @return canonicalTxHash The hash of the requested L2 transaction. This hash can be used to follow the transaction status
function requestL2Transaction(
address _contractL2,
uint256 _l2Value,
bytes calldata _calldata,
uint256 _l2GasLimit,
uint256 _l2GasPerPubdataByteLimit,
bytes[] calldata _factoryDeps,
address _refundRecipient
) external payable returns (bytes32 canonicalTxHash);
/// @notice Finalize the withdrawal and release funds
/// @param _l2BatchNumber The L2 batch number where the withdrawal was processed
/// @param _l2MessageIndex The position in the L2 logs Merkle tree of the l2Log that was sent with the message
/// @param _l2TxNumberInBatch The L2 transaction number in a batch, in which the log was sent
/// @param _message The L2 withdraw data, stored in an L2 -> L1 message
/// @param _merkleProof The Merkle proof of the inclusion L2 -> L1 message about withdrawal initialization
function finalizeEthWithdrawal(
uint256 _l2BatchNumber,
uint256 _l2MessageIndex,
uint16 _l2TxNumberInBatch,
bytes calldata _message,
bytes32[] calldata _merkleProof
) external;
/// @notice Estimates the cost in Ether of requesting execution of an L2 transaction from L1
/// @param _gasPrice expected L1 gas price at which the user requests the transaction execution
/// @param _l2GasLimit Maximum amount of L2 gas that transaction can consume during execution on L2
/// @param _l2GasPerPubdataByteLimit The maximum amount of L2 gas that the operator may charge the user for a single byte of pubdata.
/// @return The estimated ETH spent on L2 gas for the transaction
function l2TransactionBaseCost(
uint256 _gasPrice,
uint256 _l2GasLimit,
uint256 _l2GasPerPubdataByteLimit
) external view returns (uint256);
}// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.0;
interface IZkSync {
/// @notice Update secondary chain status
/// @param _gateway The secondary chain gateway
/// @param _active Active flag
function setSecondaryChainGateway(address _gateway, bool _active) external;
/// @notice Receive sync status from secondary chain
/// @param _secondaryChainGateway The secondary chain gateway address
/// @param _newTotalSyncedPriorityTxs New sync point
/// @param _syncHash New sync hash
/// @param _forwardEthAmount The difference eth amount between two sync points
function syncL2Requests(
address _secondaryChainGateway,
uint256 _newTotalSyncedPriorityTxs,
bytes32 _syncHash,
uint256 _forwardEthAmount
) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {UncheckedMath} from "../../common/libraries/UncheckedMath.sol";
/// @author Matter Labs
/// @custom:security-contact [email protected]
library Merkle {
using UncheckedMath for uint256;
/// @dev Calculate Merkle root by the provided Merkle proof.
/// NOTE: When using this function, check that the _path length is equal to the tree height to prevent shorter/longer paths attack
/// @param _path Merkle path from the leaf to the root
/// @param _index Leaf index in the tree
/// @param _itemHash Hash of leaf content
/// @return The Merkle root
function calculateRoot(
bytes32[] calldata _path,
uint256 _index,
bytes32 _itemHash
) internal pure returns (bytes32) {
uint256 pathLength = _path.length;
require(pathLength > 0, "xc");
require(pathLength < 256, "bt");
require(_index < (1 << pathLength), "px");
bytes32 currentHash = _itemHash;
for (uint256 i; i < pathLength; i = i.uncheckedInc()) {
currentHash = (_index % 2 == 0)
? _efficientHash(currentHash, _path[i])
: _efficientHash(_path[i], currentHash);
_index /= 2;
}
return currentHash;
}
/// @dev Keccak hash of the concatenation of two 32-byte words
function _efficientHash(bytes32 _lhs, bytes32 _rhs) internal pure returns (bytes32 result) {
assembly {
mstore(0x00, _lhs)
mstore(0x20, _rhs)
result := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {IMailbox} from "../interfaces/IMailbox.sol";
import {TX_SLOT_OVERHEAD_L2_GAS, MEMORY_OVERHEAD_GAS, L1_TX_INTRINSIC_L2_GAS, L1_TX_DELTA_544_ENCODING_BYTES, L1_TX_DELTA_FACTORY_DEPS_L2_GAS, L1_TX_MIN_L2_GAS_BASE, L1_TX_INTRINSIC_PUBDATA, L1_TX_DELTA_FACTORY_DEPS_PUBDATA, MAX_GAS_PER_TRANSACTION} from "../Config.sol";
/// @title zkSync Library for validating L1 -> L2 transactions
/// @author Matter Labs
/// @custom:security-contact [email protected]
library TransactionValidator {
/// @dev Used to validate key properties of an L1->L2 transaction
/// @param _transaction The transaction to validate
/// @param _encoded The abi encoded bytes of the transaction
/// @param _priorityTxMaxGasLimit The max gas limit, generally provided from Storage.sol
/// @param _priorityTxMaxPubdata The maximal amount of pubdata that a single L1->L2 transaction can emit
function validateL1ToL2Transaction(
IMailbox.L2CanonicalTransaction memory _transaction,
bytes memory _encoded,
uint256 _priorityTxMaxGasLimit,
uint256 _priorityTxMaxPubdata
) internal pure {
uint256 l2GasForTxBody = getTransactionBodyGasLimit(_transaction.gasLimit, _encoded.length);
// Ensuring that the transaction is provable
require(l2GasForTxBody <= _priorityTxMaxGasLimit, "ui");
// Ensuring that the transaction cannot output more pubdata than is processable
require(l2GasForTxBody / _transaction.gasPerPubdataByteLimit <= _priorityTxMaxPubdata, "uk");
// Ensuring that the transaction covers the minimal costs for its processing:
// hashing its content, publishing the factory dependencies, etc.
require(
getMinimalPriorityTransactionGasLimit(
_encoded.length,
_transaction.factoryDeps.length,
_transaction.gasPerPubdataByteLimit
) <= l2GasForTxBody,
"up"
);
}
/// @dev Used to validate upgrade transactions
/// @param _transaction The transaction to validate
function validateUpgradeTransaction(IMailbox.L2CanonicalTransaction memory _transaction) internal pure {
// Restrict from to be within system contract range (0...2^16 - 1)
require(_transaction.from <= type(uint16).max, "ua");
require(_transaction.to <= type(uint160).max, "ub");
require(_transaction.paymaster == 0, "uc");
require(_transaction.value == 0, "ud");
require(_transaction.maxFeePerGas == 0, "uq");
require(_transaction.maxPriorityFeePerGas == 0, "ux");
require(_transaction.reserved[0] == 0, "ue");
require(_transaction.reserved[1] <= type(uint160).max, "uf");
require(_transaction.reserved[2] == 0, "ug");
require(_transaction.reserved[3] == 0, "uo");
require(_transaction.signature.length == 0, "uh");
require(_transaction.paymasterInput.length == 0, "ul");
require(_transaction.reservedDynamic.length == 0, "um");
}
/// @dev Calculates the approximate minimum gas limit required for executing a priority transaction.
/// @param _encodingLength The length of the priority transaction encoding in bytes.
/// @param _numberOfFactoryDependencies The number of new factory dependencies that will be added.
/// @param _l2GasPricePerPubdata The L2 gas price for publishing the priority transaction on L2.
/// @return The minimum gas limit required to execute the priority transaction.
/// Note: The calculation includes the main cost of the priority transaction, however, in reality, the operator can spend a little more gas on overheads.
function getMinimalPriorityTransactionGasLimit(
uint256 _encodingLength,
uint256 _numberOfFactoryDependencies,
uint256 _l2GasPricePerPubdata
) internal pure returns (uint256) {
uint256 costForComputation;
{
// Adding the intrinsic cost for the transaction, i.e. auxiliary prices which cannot be easily accounted for
costForComputation = L1_TX_INTRINSIC_L2_GAS;
// Taking into account the hashing costs that depend on the length of the transaction
// Note that L1_TX_DELTA_544_ENCODING_BYTES is the delta in the price for every 544 bytes of
// the transaction's encoding. It is taken as LCM between 136 and 32 (the length for each keccak256 round
// and the size of each new encoding word).
costForComputation += Math.ceilDiv(_encodingLength * L1_TX_DELTA_544_ENCODING_BYTES, 544);
// Taking into the account the additional costs of providing new factory dependencies
costForComputation += _numberOfFactoryDependencies * L1_TX_DELTA_FACTORY_DEPS_L2_GAS;
// There is a minimal amount of computational L2 gas that the transaction should cover
costForComputation = Math.max(costForComputation, L1_TX_MIN_L2_GAS_BASE);
}
uint256 costForPubdata = 0;
{
// Adding the intrinsic cost for the transaction, i.e. auxiliary prices which cannot be easily accounted for
costForPubdata = L1_TX_INTRINSIC_PUBDATA * _l2GasPricePerPubdata;
// Taking into the account the additional costs of providing new factory dependencies
costForPubdata += _numberOfFactoryDependencies * L1_TX_DELTA_FACTORY_DEPS_PUBDATA * _l2GasPricePerPubdata;
}
return costForComputation + costForPubdata;
}
/// @notice Based on the full L2 gas limit (that includes the batch overhead) and other
/// properties of the transaction, returns the l2GasLimit for the body of the transaction (the actual execution).
/// @param _totalGasLimit The L2 gas limit that includes both the overhead for processing the batch
/// and the L2 gas needed to process the transaction itself (i.e. the actual l2GasLimit that will be used for the transaction).
/// @param _encodingLength The length of the ABI-encoding of the transaction.
function getTransactionBodyGasLimit(
uint256 _totalGasLimit,
uint256 _encodingLength
) internal pure returns (uint256 txBodyGasLimit) {
uint256 overhead = getOverheadForTransaction(_encodingLength);
require(_totalGasLimit >= overhead, "my"); // provided gas limit doesn't cover transaction overhead
unchecked {
// We enforce the fact that `_totalGasLimit >= overhead` explicitly above.
txBodyGasLimit = _totalGasLimit - overhead;
}
}
/// @notice Based on the total L2 gas limit and several other parameters of the transaction
/// returns the part of the L2 gas that will be spent on the batch's overhead.
/// @dev The details of how this function works can be checked in the documentation
/// of the fee model of zkSync. The appropriate comments are also present
/// in the Rust implementation description of function `get_maximal_allowed_overhead`.
/// @param _encodingLength The length of the binary encoding of the transaction in bytes
function getOverheadForTransaction(
uint256 _encodingLength
) internal pure returns (uint256 batchOverheadForTransaction) {
// The overhead from taking up the transaction's slot
batchOverheadForTransaction = TX_SLOT_OVERHEAD_L2_GAS;
// The overhead for occupying the bootloader memory can be derived from encoded_len
uint256 overheadForLength = MEMORY_OVERHEAD_GAS * _encodingLength;
batchOverheadForTransaction = Math.max(batchOverheadForTransaction, overheadForLength);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @dev The log passed from L2
/// @param l2ShardId The shard identifier, 0 - rollup, 1 - porter. All other values are not used but are reserved for
/// the future
/// @param isService A boolean flag that is part of the log along with `key`, `value`, and `sender` address.
/// This field is required formally but does not have any special meaning.
/// @param txNumberInBatch The L2 transaction number in the batch, in which the log was sent
/// @param sender The L2 address which sent the log
/// @param key The 32 bytes of information that was sent in the log
/// @param value The 32 bytes of information that was sent in the log
// Both `key` and `value` are arbitrary 32-bytes selected by the log sender
struct L2Log {
uint8 l2ShardId;
bool isService;
uint16 txNumberInBatch;
address sender;
bytes32 key;
bytes32 value;
}
/// @dev An arbitrary length message passed from L2
/// @notice Under the hood it is `L2Log` sent from the special system L2 contract
/// @param txNumberInBatch The L2 transaction number in the batch, in which the message was sent
/// @param sender The address of the L2 account from which the message was passed
/// @param data An arbitrary length message
struct L2Message {
uint16 txNumberInBatch;
address sender;
bytes data;
}
/// @notice The struct that describes whether users will be charged for pubdata for L1->L2 transactions.
/// @param Rollup The users are charged for pubdata & it is priced based on the gas price on Ethereum.
/// @param Validium The pubdata is considered free with regard to the L1 gas price.
enum PubdataPricingMode {
Rollup,
Validium
}
/// @notice The fee params for L1->L2 transactions for the network.
/// @param pubdataPricingMode How the users will charged for pubdata in L1->L2 transactions.
/// @param batchOverheadL1Gas The amount of L1 gas required to process the batch (except for the calldata).
/// @param maxPubdataPerBatch The maximal number of pubdata that can be emitted per batch.
/// @param priorityTxMaxPubdata The maximal amount of pubdata a priority transaction is allowed to publish.
/// It can be slightly less than maxPubdataPerBatch in order to have some margin for the bootloader execution.
/// @param minimalL2GasPrice The minimal L2 gas price to be used by L1->L2 transactions. It should represent
/// the price that a single unit of compute costs.
struct FeeParams {
PubdataPricingMode pubdataPricingMode;
uint32 batchOverheadL1Gas;
uint32 maxPubdataPerBatch;
uint32 maxL2GasPerBatch;
uint32 priorityTxMaxPubdata;
uint64 minimalL2GasPrice;
}
/// @dev The sync status for priority op of secondary chain
/// @param hash The cumulative canonicalTxHash
/// @param amount The cumulative l2 value
struct SecondaryChainSyncStatus {
bytes32 hash;
uint256 amount;
}{
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"bool","name":"_isEthGasToken","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"contractAddress","type":"address"},{"indexed":false,"internalType":"bool","name":"isPermit","type":"bool"}],"name":"ContractAllowStatusUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EthWithdrawalFinalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAllocator","type":"address"},{"indexed":false,"internalType":"address","name":"newAllocator","type":"address"}],"name":"ForwardFeeAllocatorUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IL2Gateway","name":"gateway","type":"address"}],"name":"InitGateway","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"enum PubdataPricingMode","name":"pubdataPricingMode","type":"uint8"},{"internalType":"uint32","name":"batchOverheadL1Gas","type":"uint32"},{"internalType":"uint32","name":"maxPubdataPerBatch","type":"uint32"},{"internalType":"uint32","name":"maxL2GasPerBatch","type":"uint32"},{"internalType":"uint32","name":"priorityTxMaxPubdata","type":"uint32"},{"internalType":"uint64","name":"minimalL2GasPrice","type":"uint64"}],"indexed":false,"internalType":"struct FeeParams","name":"oldFeeParams","type":"tuple"},{"components":[{"internalType":"enum PubdataPricingMode","name":"pubdataPricingMode","type":"uint8"},{"internalType":"uint32","name":"batchOverheadL1Gas","type":"uint32"},{"internalType":"uint32","name":"maxPubdataPerBatch","type":"uint32"},{"internalType":"uint32","name":"maxL2GasPerBatch","type":"uint32"},{"internalType":"uint32","name":"priorityTxMaxPubdata","type":"uint32"},{"internalType":"uint64","name":"minimalL2GasPrice","type":"uint64"}],"indexed":false,"internalType":"struct FeeParams","name":"newFeeParams","type":"tuple"}],"name":"NewFeeParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"priorityOpId","type":"uint256"},{"components":[{"internalType":"address","name":"gateway","type":"address"},{"internalType":"bool","name":"isContractCall","type":"bool"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"txId","type":"uint256"},{"internalType":"address","name":"contractAddressL2","type":"address"},{"internalType":"uint256","name":"l2Value","type":"uint256"},{"internalType":"bytes","name":"l2CallData","type":"bytes"},{"internalType":"uint256","name":"l2GasLimit","type":"uint256"},{"internalType":"uint256","name":"l2GasPricePerPubdata","type":"uint256"},{"internalType":"bytes[]","name":"factoryDeps","type":"bytes[]"},{"internalType":"address","name":"refundRecipient","type":"address"}],"indexed":false,"internalType":"struct IMailbox.ForwardL2Request","name":"l2Request","type":"tuple"}],"name":"NewPriorityRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fromBatchNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toBatchNumber","type":"uint256"}],"name":"OpenRangeBatchRoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"batchNumber","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"l2LogsRootHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"forwardEthAmount","type":"uint256"}],"name":"SyncBatchRoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalSyncedPriorityTxs","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"syncHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"forwardEthAmount","type":"uint256"}],"name":"SyncL2Requests","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"l2TxHash","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"primaryChainL2TxHash","type":"bytes32"}],"name":"SyncL2TxHash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fromBatchNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toBatchNumber","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"rangeBatchRootHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"forwardEthAmount","type":"uint256"}],"name":"SyncRangeBatchRoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldTxGasPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTxGasPrice","type":"uint256"}],"name":"TxGasPriceUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"validatorAddress","type":"address"},{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"ValidatorStatusUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawForwardFee","type":"event"},{"inputs":[],"name":"FORWARD_REQUEST_TYPE_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IS_ETH_GAS_TOKEN","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"allowLists","outputs":[{"internalType":"bool","name":"isPermitToSendL2Request","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"enum PubdataPricingMode","name":"pubdataPricingMode","type":"uint8"},{"internalType":"uint32","name":"batchOverheadL1Gas","type":"uint32"},{"internalType":"uint32","name":"maxPubdataPerBatch","type":"uint32"},{"internalType":"uint32","name":"maxL2GasPerBatch","type":"uint32"},{"internalType":"uint32","name":"priorityTxMaxPubdata","type":"uint32"},{"internalType":"uint64","name":"minimalL2GasPrice","type":"uint64"}],"internalType":"struct FeeParams","name":"_newFeeParams","type":"tuple"}],"name":"changeFeeParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeParams","outputs":[{"internalType":"enum PubdataPricingMode","name":"pubdataPricingMode","type":"uint8"},{"internalType":"uint32","name":"batchOverheadL1Gas","type":"uint32"},{"internalType":"uint32","name":"maxPubdataPerBatch","type":"uint32"},{"internalType":"uint32","name":"maxL2GasPerBatch","type":"uint32"},{"internalType":"uint32","name":"priorityTxMaxPubdata","type":"uint32"},{"internalType":"uint64","name":"minimalL2GasPrice","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_l2BatchNumber","type":"uint256"},{"internalType":"uint256","name":"_l2MessageIndex","type":"uint256"},{"internalType":"uint16","name":"_l2TxNumberInBatch","type":"uint16"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"finalizeEthWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"forwardFeeAllocator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gateway","outputs":[{"internalType":"contract IL2Gateway","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGateway","outputs":[{"internalType":"contract IL2Gateway","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGovernor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPriorityTxMaxGasLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTotalBatchesExecuted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalPriorityTxs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"l2BatchNumber","type":"uint256"},{"internalType":"uint256","name":"l2ToL1MessageNumber","type":"uint256"}],"name":"isEthWithdrawalFinalized","outputs":[{"internalType":"bool","name":"isFinalized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"isValidator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_batchNumber","type":"uint256"}],"name":"l2LogsRootHash","outputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchNumber","type":"uint256"}],"name":"l2LogsRootHashes","outputs":[{"internalType":"bytes32","name":"l2LogsRootHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gasPrice","type":"uint256"},{"internalType":"uint256","name":"_l2GasLimit","type":"uint256"},{"internalType":"uint256","name":"_l2GasPerPubdataByteLimit","type":"uint256"}],"name":"l2TransactionBaseCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"l2TxHash","type":"bytes32"}],"name":"l2TxHashMap","outputs":[{"internalType":"bytes32","name":"primaryChainL2TxHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromBatchNumber","type":"uint256"},{"internalType":"uint256","name":"_toBatchNumber","type":"uint256"},{"internalType":"bytes32[]","name":"_l2LogsRootHashes","type":"bytes32[]"}],"name":"openRangeBatchRootHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"priorityOpId","type":"uint256"}],"name":"priorityOpSyncStatus","outputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_l2TxHash","type":"bytes32"},{"internalType":"uint256","name":"_l2BatchNumber","type":"uint256"},{"internalType":"uint256","name":"_l2MessageIndex","type":"uint256"},{"internalType":"uint16","name":"_l2TxNumberInBatch","type":"uint16"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"},{"internalType":"enum TxStatus","name":"_status","type":"uint8"}],"name":"proveL1ToL2TransactionStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_batchNumber","type":"uint256"},{"internalType":"uint256","name":"_index","type":"uint256"},{"components":[{"internalType":"uint16","name":"txNumberInBatch","type":"uint16"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct L2Message","name":"_message","type":"tuple"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"proveL2MessageInclusion","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"range","type":"bytes32"}],"name":"rangeBatchRootHashes","outputs":[{"internalType":"bytes32","name":"rangeBatchRootHash","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contractL2","type":"address"},{"internalType":"uint256","name":"_l2Value","type":"uint256"},{"internalType":"bytes","name":"_calldata","type":"bytes"},{"internalType":"uint256","name":"_l2GasLimit","type":"uint256"},{"internalType":"uint256","name":"_l2GasPerPubdataByteLimit","type":"uint256"},{"internalType":"bytes[]","name":"_factoryDeps","type":"bytes[]"},{"internalType":"address","name":"_refundRecipient","type":"address"}],"name":"requestL2Transaction","outputs":[{"internalType":"bytes32","name":"canonicalTxHash","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_contractAddress","type":"address"},{"internalType":"bool","name":"_permitted","type":"bool"}],"name":"setAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newForwardFeeAllocator","type":"address"}],"name":"setForwardFeeAllocator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IL2Gateway","name":"_gateway","type":"address"}],"name":"setGateway","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newTxGasPrice","type":"uint256"}],"name":"setTxGasPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_validator","type":"address"},{"internalType":"bool","name":"_active","type":"bool"}],"name":"setValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_batchNumber","type":"uint256"},{"internalType":"bytes32","name":"_l2LogsRootHash","type":"bytes32"},{"internalType":"uint256","name":"_forwardEthAmount","type":"uint256"}],"name":"syncBatchRoot","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newTotalSyncedPriorityTxs","type":"uint256"}],"name":"syncL2Requests","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_l2TxHash","type":"bytes32"},{"internalType":"bytes32","name":"_primaryChainL2TxHash","type":"bytes32"}],"name":"syncL2TxHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromBatchNumber","type":"uint256"},{"internalType":"uint256","name":"_toBatchNumber","type":"uint256"},{"internalType":"bytes32","name":"_rangeBatchRootHash","type":"bytes32"},{"internalType":"uint256","name":"_forwardEthAmount","type":"uint256"}],"name":"syncRangeBatchRoot","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"totalBatchesExecuted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPriorityTxs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSyncedPriorityTxs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalValidatorForwardFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalValidatorForwardFeeWithdrawn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"txGasPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"validators","outputs":[{"internalType":"bool","name":"isValidator","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawForwardFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60c0346200013e57601f620040b838819003918201601f19168301916001600160401b0383118484101762000143578084926020946040528339810103126200013e575180151581036200013e573060805260a05260005460ff8160081c16620000e95760ff80821603620000ad575b604051613f5e90816200015a823960805181818161068601528181610b3e0152610c9b015260a0518181816111b7015281816114910152611e560152f35b60ff90811916176000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160ff8152a1386200006f565b60405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001257600080fd5b60003560e01c8062e969a814610338578063042901c7146103335780630ec6b0b71461032e578063116191b6146103105780631dd26496146103295780632425b3a4146103245780633659cfe61461031f57806336e2e3f31461031a5780633f4ba83a1461031557806342bf3cc1146103105780634623c91d1461030b5780634ecf53e9146103065780634f1ef286146103015780634fc07d75146102b157806351ef251b1461029d57806352d1902d146102fc578063534ca054146102f75780635a425fcd146102f25780635a9f55b0146102ed5780635c975abb146102e85780635e78d327146102e3578063637c9d9d146102de57806363b434941461028e57806364bf8d66146102d95780636c0960f9146102d4578063715018a6146102cf5780637666f125146102ca5780637adbe273146102c55780638129fc1c146102c057806383864ac4146102a25780638456cb59146102bb5780638aa50991146102b65780638da5cb5b146102b157806390646b4a146102ac5780639242164f146102a75780639cd939e4146102a2578063a1954fc51461029d578063af32a0a714610298578063b473318e14610293578063b8c2f66f1461028e578063ba745e5314610289578063bc5455d014610284578063bd7c54121461027f578063be3bc8ea1461027a578063ca98ef4f14610275578063cfe6128214610270578063e0a1bf721461026b578063e4948f4314610266578063eb67241914610261578063f2fde38b1461025c578063fa52c7d8146102575763facd743b1461025757600080fd5b612247565b6121b6565b611dd9565b611d24565b611cb7565b611b7d565b611b5e565b611953565b611913565b6118a8565b611889565b611040565b611855565b611836565b610c69565b61159e565b6117c8565b6116d7565b610c40565b611625565b6115cb565b6114b6565b611479565b6113fd565b61139c565b611144565b61105f565b611013565b610f75565b610f52565b610f25565b610d6c565b610d4d565b610c88565b610afd565b61092f565b61089e565b610511565b6107e2565b6107ac565b61065f565b610576565b61053b565b6104f2565b6103f3565b61034d565b600091031261034857565b600080fd5b346103485760003660031901126103485760206040517fe0aaca1722ef50bb0c9b032e5b16ce2b79fa9f23638835456b27fd6894f8292c8152f35b6064359061ffff8216820361034857565b6044359061ffff8216820361034857565b359061ffff8216820361034857565b9181601f84011215610348578235916001600160401b038311610348576020808501948460051b01011161034857565b6002111561034857565b346103485760c03660031901126103485761040c610388565b6084356001600160401b0381116103485761042b9036906004016103b9565b60a4359291610439846103e9565b6004356000526101376020526040600020549283156104b857846104a2946104636104b4976117a8565b61048561046e610a12565b60008152600160208201529361ffff166040850152565b6180016060840152608083015260a0820152604435602435613895565b60405190151581529081906020820190565b0390f35b60405162461bcd60e51b8152602060048201526012602482015271092dcecc2d8d2c840d86440e8f040d0c2e6d60731b6044820152606490fd5b3461034857600036600319011261034857602060405163044aa2008152f35b346103485760003660031901126103485761012d546040516001600160a01b039091168152602090f35b346103485760003660031901126103485761013b546040516001600160a01b039091168152602090f35b6001600160a01b0381160361034857565b346103485760203660031901126103485760043561059381610565565b61059b61228a565b6001600160a01b039080821680156106265761013b546001600160a01b0316928316036105c457005b61013b80546001600160a01b0319166001600160a01b0383161790557f98ac3b973026c0d730e72f023f161bebb4ba504d9b1c6b83d849d3cbaf7f51f491604080516001600160a01b039283168152929091166020830152819081015b0390a1005b60405162461bcd60e51b815260206004820152601160248201527024b73b30b634b21030b63637b1b0ba37b960791b6044820152606490fd5b346103485760203660031901126103485760043561067c81610565565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691906106b53084141561232b565b6106d2600080516020613f0983398151915293828554161461238c565b6106da61228a565b6106e26123ed565b9061070e7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1690565b1561072157505061071f91506124dd565b005b6020600491604094939451928380926352d1902d60e01b825286165afa6000918161077c575b506107695760405162461bcd60e51b8152806107656004820161248e565b0390fd5b61071f936107779114612430565b61256d565b61079e91925060203d81116107a5575b61079681836109f1565b810190612415565b9038610747565b503d61078c565b34610348576020366003190112610348576004356000526101346020526040806000206001815491015482519182526020820152f35b34610348576000366003190112610348576107fb61228a565b60fb5460ff81161561083a5760ff191660fb557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b60409060031901126103485760043561088e81610565565b9060243580151581036103485790565b34610348576108ac36610876565b61012d5490916001600160a01b03916108c89083163314612914565b16908160005261012e60205260406000209060ff82541681151580911515036108ed57005b6109266020927f065b77b53864e46fda3d8986acb51696223d6dde7ced42441eb150bae6d48136949060ff801983541691151516179055565b604051908152a2005b346103485760203660031901126103485760043561094c81610565565b60018060a01b031660005261012f602052602060ff604060002054166040519015158152f35b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161099b57604052565b610972565b606081019081106001600160401b0382111761099b57604052565b60c081019081106001600160401b0382111761099b57604052565b604081019081106001600160401b0382111761099b57604052565b90601f801991011681019081106001600160401b0382111761099b57604052565b60405190610a1f826109bb565b565b60405190610a1f826109a0565b6040519061016082018281106001600160401b0382111761099b57604052565b6040519061020082018281106001600160401b0382111761099b57604052565b60405190608082018281106001600160401b0382111761099b57604052565b6001600160401b03811161099b57601f01601f191660200190565b929192610ab482610a8d565b91610ac260405193846109f1565b829481845281830111610348578281602093846000960137010152565b9080601f8301121561034857816020610afa93359101610aa8565b90565b604036600319011261034857600435610b1581610565565b6024356001600160401b03811161034857610b34903690600401610adf565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116929190610b6e3085141561232b565b610b8b600080516020613f0983398151915294828654161461238c565b610b9361228a565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610bc957505061071f91506124dd565b6020600491604094939451928380926352d1902d60e01b825286165afa60009181610c20575b50610c0d5760405162461bcd60e51b8152806107656004820161248e565b61071f93610c1b9114612430565b612629565b610c3991925060203d81116107a55761079681836109f1565b9038610bef565b34610348576000366003190112610348576033546040516001600160a01b039091168152602090f35b3461034857600036600319011261034857602061013254604051908152f35b34610348576000366003190112610348577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163003610ce257604051600080516020613f098339815191528152602090f35b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608490fd5b3461034857600036600319011261034857602061013054604051908152f35b34610348576060366003190112610348576004356024356044356001600160401b03811161034857610da29036906004016103b9565b9290923360005261012e602052610dc060ff6040600020541661327a565b610dcc82841015613353565b6040805160208101848152918101859052610df481606081015b03601f1981018352826109f1565b51902093610e0d8560005261013c602052604060002090565b5491610e1a83151561338f565b610e36610e2f610e2a8688613002565b612d79565b82146133db565b610e408183613427565b359182610e5886600052610136602052604060002090565b5560019081925b808410610edf577fddf6b2cf5bdb04a03cb3f7663b72571336626b1e586a3a047942e4860cf7e12b88886000610eab8d610e9a8c8c14613456565b60005261013c602052604060002090565b55610135548211610ed0575b6040805191825260208201929092529081908101610621565b610eda8261013555565b610eb7565b9091610f1b8495610ef283968587613446565b359081610f0c898c01600052610136602052604060002090565b55600052602052604060002090565b9401929190610e5f565b34610348576020366003190112610348576004356000526101376020526020604060002054604051908152f35b3461034857600036600319011261034857602060ff60fb54166040519015158152f35b6060366003190112610348577fab53214e3a56f049923c5f5532ea4657bba51b870850593c4dc0eceb3b61feed60043560243590610621604435610fc560018060a01b0361012d54163314612914565b610fd081341461330e565b826101358054821161100b575b5060005261013660205283604060002055604051938493846040919493926060820195825260208201520152565b558238610fdd565b346103485760203660031901126103485760043560005261013c6020526020604060002054604051908152f35b3461034857600036600319011261034857602061013554604051908152f35b346103485760c03660031901126103485761108660018060a01b0361012d54163314612914565b6044356110928161294e565b60843561109e8161294e565b63ffffffff8091169116106110ed577fc8b245ac8b138b17b6b1dbbbb8860adc66b373afa000d99f3cdc775d8ae0bbed6106216110d961295c565b6110e16129dd565b60405191829182612ad7565b60405162461bcd60e51b8152602060048201526002602482015261371b60f11b6044820152606490fd5b9181601f84011215610348578235916001600160401b038311610348576020838186019501011161034857565b346103485760a036600319011261034857602435600435611163610399565b916001600160401b039160643583811161034857611185903690600401611117565b929091608435948511610348576112556112506111a7600497369089016103b9565b9590966111b261314c565b6111db7f00000000000000000000000000000000000000000000000000000000000000006131a2565b61121c61121761121361120c896111fd8a60005261013a602052604060002090565b90600052602052604060002090565b5460ff1690565b1590565b6131e7565b611231611227610a21565b61ffff909b168b52565b61800a60208b0152611244368284610aa8565b60408b01523691610aa8565b6139d2565b9491959097602061127d61127161012d5460018060a01b031690565b6001600160a01b031690565b60405163388e611f60e11b8152998a9182905afa968715611397577f26464d64ddb13f6d187de632d165bd1065382ec0b66c25c648957116e7bc25c898600098611341575b506112fe61132196946111fd946112f761131498956112f26113039660018060a01b039e8f809116911614613218565b6137e2565b8786613895565b613249565b60005261013a602052604060002090565b805460ff19166001179055565b61132b8482613a91565b6040519384521691602090a261071f600160c955565b61130391985061132196946111fd946112f761131498956112f261137e6112fe9660203d8111611390575b61137681836109f1565b810190612de2565b9d9650509598505094509496506112c2565b503d61136c565b612424565b34610348576000806003193601126113fa576113b661228a565b603380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b346103485761140b36610876565b9061141461228a565b60018060a01b0316908160005261012f60205260406000209060ff825416811515809115150361144057005b6109266020927f1f8e549bdb5108ba50ebcc80bb64a20ea98bfbd9378a87380d29f3c87cdcbb2c949060ff801983541691151516179055565b346103485760003660031901126103485760206040517f000000000000000000000000000000000000000000000000000000000000000015158152f35b34610348576000806003193601126113fa5780546114eb60ff8260081c161580928193611590575b8115611570575b50612781565b806114fe600160ff196000541617600055565b611557575b61150b6127e4565b6115125780f35b61152261ff001960005416600055565b604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989080602081015b0390a180f35b61156b61010061ff00196000541617600055565b611503565b303b15915081611582575b50386114e5565b6001915060ff16143861157b565b600160ff82161091506114de565b34610348576020366003190112610348576004356000526101366020526020604060002054604051908152f35b34610348576000366003190112610348576115e461228a565b6115ec612892565b600160ff1960fb54161760fb557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b6080366003190112610348577f427754a95a2d34153366ec8bcea3939ce044aaf5c185a86149c9f6d80c4402b960806004356024356044356064359161167760018060a01b0361012d54163314612914565b61168384821015613353565b61168e83341461330e565b60408051602081018681529181018390526116ac8160608101610de6565b51902060005261013c60205281604060002055604051938452602084015260408301526060820152a1005b34610348576020366003190112610348576004356116f481610565565b6116fc61228a565b61012d546001600160a01b0390811661176a57611743908216916117218315156128d6565b61012d80546001600160a01b0319166001600160a01b03909216919091179055565b7f860df2b5ed762095deab38be8b5aa5acfbfa8d4d209e083fa00246d31b715e29600080a2005b60405162461bcd60e51b81526020600482015260166024820152754475706c696361746520696e6974206761746577617960501b6044820152606490fd5b600211156117b257565b634e487b7160e01b600052602160045260246000fd5b346103485760003660031901126103485760c0610131546001600160401b0360ff821691604051926117f9816117a8565b835263ffffffff808260081c166020850152808260281c166040850152808260481c1660608501528160681c16608084015260881c1660a0820152f35b3461034857600036600319011261034857602061013854604051908152f35b3461034857606036600319011261034857602061188160243561187c604435600435613534565b612c00565b604051908152f35b3461034857600036600319011261034857602061013354604051908152f35b34610348576020366003190112610348576004356118c461228a565b6101309081548181036118d357005b817f208ba37ba4e5fc3f236a9c289aa28898330c1f2ec9102d54821a1ffb59e8f1d793556106216040519283928360209093929193604081019481520152565b346103485760403660031901126103485760043560005261013a6020526040600020602435600052602052602060ff604060002054166040519015158152f35b602080600319360112610348576004359060009133835261012e825261197f60ff60408520541661327a565b6101325481111580611b52575b611995906132b6565b61199d612fda565b906101335480611b39575b506119e06119d16119cc6119bb84612ff3565b600052610134602052604060002090565b61300f565b92848085015191015190613002565b916119eb8261013355565b61012d54611a01906001600160a01b0316611271565b60405163388e611f60e11b815290948082600481895afa9081156113975787928392611b16575b5083516040516318d0d57560e01b928101929092526001600160a01b03909216602482015260448101859052606481019190915260848101859052611a708160a48101610de6565b611a7a8534612d95565b95803b15611b1257611aa39160405197888094819363e289adcd60e01b83528a600484016132f7565b03925af1908115611397577fba9fdc955504f0973215993a882822edf5e2b4561df97340b4d5632e64e24a0f9461155192611af9575b505192604051938493846040919493926060820195825260208201520152565b80611b06611b0c92610988565b8061033d565b38611ad9565b8280fd5b819250611b3290611a70923d85116113905761137681836109f1565b9190611a28565b611b4b9192506119bb6119cc91612ff3565b90386119a8565b5061013354811161198c565b3461034857600036600319011261034857602061013954604051908152f35b3461034857604036600319011261034857600435611b9a81610565565b602435611ba561314c565b61013b546001600160a01b039081163303611c72578115611c3c577f8f37daeecdc35f2a03da8794b025ea44e3f7c6f4e2265630836db89ff3f2f2b790611c07611bf28461013954612d95565b611c0181610138541015613498565b61013955565b600093611c238580808088865af1611c1d61267c565b506134d6565b6040519384521691602090a2611c39600160c955565b80f35b60405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606490fd5b60405162461bcd60e51b815260206004820152601960248201527f4e6f7420666f72776172642066656520616c6c6f6361746f72000000000000006044820152606490fd5b34610348576040366003190112610348577fdfb8da952dba6c9ec993b8f2ca8cc6ac22596f6e179520fea3fc78202e87090c6040600435602435611d0760018060a01b0361012d54163314612914565b8160005261013760205280836000205582519182526020820152a1005b3461034857600319608036820112610348576044356001600160401b03918282116103485760609082360301126103485760405190611d62826109a0565b611d6e816004016103aa565b82526024810135611d7e81610565565b6020830152604481013590838211610348576004611d9f9236920101610adf565b604082015260643591821161034857611dce6104a291611dc66104b49436906004016103b9565b9290916137e2565b602435600435613895565b60e036600319011261034857600435611df181610565565b602435906001600160401b0360443581811161034857611e15903690600401611117565b90916064359360843560a43592831161034857611e37879336906004016103b9565b60c43592611e4484610565565b611e4c61314c565b611e54612892565b7f0000000000000000000000000000000000000000000000000000000000000000156121a7575b33986000328b14612193575089611eb5611eb061120c60049a9b9c9d60018060a01b031660005261012f602052604060002090565b612ca0565b61111161111160901b01016001600160a01b0316996001995b611edb6103208514612cec565b611f24611f1e60209b611ef08d891115612d37565b611f15611f0e611f078861187c8b61013054613534565b9283612d95565b3414612da2565b61013854612d95565b61013855565b6001600160a01b039680881661218d57508b965b87803b612176575b50506101325461012d54909c90611f5f906001600160a01b0316611271565b9b8b60409d8e519c8d809263388e611f60e11b82525afa9a8b156113975760009b612157575b50611f8e610a2e565b6001600160a01b03909b168b5215158a8c01526001600160a01b0316898c0152606089018c81526001600160a01b0390981660808a01528c60a08a01523690611fd692610aa8565b60c088015260e08701526101008601523690611ff192612e0e565b6101208401526001600160a01b031661014083015261200f82613717565b8451908161201f82878301612ed9565b0391601f1992838101825261203490826109f1565b6101315460681c63ffffffff1663ffffffff169061205192613dcb565b8461205b84613adc565b968792612066612fda565b6104b49a7fbf5630c2adfa5e47b882a9ead657ffc6a22ce010513a3efac7245066bcad17dd986120d1966120cb96610e2a95876120fb57505083528201525b6120ba83600052610134602052604060002090565b906020600191805184550151910155565b61013255565b516120e0845192839283613082565b0390a16120ed600160c955565b519081529081906020820190565b61215093929550612141612135916121186119cc6119bb8c612ff3565b978851945193849187830196879091604092825260208201520190565b039081018352826109f1565b51902084528301918251612d95565b90526120a5565b61216f919b508c8d3d106113905761137681836109f1565b9938611f85565b811661111161111160901b01011696503880611f40565b96611f38565b98886121a26004999a15612c54565b611ece565b6121b18615612c13565b611e7b565b34610348576020366003190112610348576004356121d381610565565b6121db61228a565b6001600160a01b038116156121f35761071f906122e2565b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b346103485760203660031901126103485760043561226481610565565b60018060a01b031660005261012e602052602060ff604060002054166040519015158152f35b6033546001600160a01b0316330361229e57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603380546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b1561233257565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b1561239357565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b604051602081018181106001600160401b0382111761099b5760405260008152906000368137565b90816020910312610348575190565b6040513d6000823e3d90fd5b1561243757565b60405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b60809060208152602e60208201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960408201526d6f6e206973206e6f74205555505360901b60608201520190565b803b1561251257600080516020613f0983398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b90612577826124dd565b6001600160a01b0382167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2805115801590612621575b6125b9575050565b61261e91600080604051936125cd856109a0565b602785527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c6020860152660819985a5b195960ca1b6040860152602081519101845af461261861267c565b916126ac565b50565b5060006125b1565b90612633826124dd565b6001600160a01b0382167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2805115801590612674576125b9575050565b5060016125b1565b3d156126a7573d9061268d82610a8d565b9161269b60405193846109f1565b82523d6000602084013e565b606090565b9192901561270e57508151156126c0575090565b3b156126c95790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156127215750805190602001fd5b60405162461bcd60e51b8152602060048201529081906107659060248301905b919082519283825260005b84811061276d575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520161274c565b1561278857565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b6127f560ff60005460081c16612832565b6127fe336122e2565b61282660ff60005460081c1661281381612832565b61281c81612832565b600160c955612832565b60ff1960fb541660fb55565b1561283957565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b60ff60fb541661289e57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b156128dd57565b60405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206761746577617960881b6044820152606490fd5b1561291b57565b60405162461bcd60e51b815260206004820152600b60248201526a4e6f74206761746577617960a81b6044820152606490fd5b63ffffffff81160361034857565b60405190612969826109bb565b8160a06001600160401b036101315460ff8116612985816117a8565b845263ffffffff808260081c166020860152808260281c166040860152808260481c1660608601528160681c16608085015260881c16910152565b6001600160401b0381160361034857565b60a435610afa816129c0565b6004356129e9816103e9565b6129f2816117a8565b6101319081546cffffffff000000000000000000602435612a128161294e565b68ffffffff000000000060443591612a298361294e565b64ffffffff0060643595612a3c8761294e565b60ff608435612a4a8161294e565b63ffffffff60681b9060681b1698169070ffffffffffffffffffffffffffffffffff1916179160081b16179160281b16179160481b1617179055610a1f612a8f6129d1565b610131805467ffffffffffffffff60881b191660889290921b67ffffffffffffffff60881b16919091179055565b60843590610a1f8261294e565b60a43590610a1f826129c0565b815161018082019392610a1f9291612aee816117a8565b82526001600160401b0360a063ffffffff9283602082015116602086015283604082015116604086015283606082015116606086015283608082015116608086015201511660a0830152600435612b44816103e9565b612b4d816117a8565b60c083015280602435612b5f8161294e565b1660e083015280604435612b728161294e565b16610100830152606435612b858161294e565b16610120820152612ba5612b97612abd565b63ffffffff16610140830152565b610160612bb0612aca565b6001600160401b0316910152565b634e487b7160e01b600052601160045260246000fd5b9081605802916058830403612be557565b612bbe565b908160061b9180830460401490151715612be557565b81810292918115918404141715612be557565b15612c1a57565b60405162461bcd60e51b81526020600482015260126024820152714e6f7420616c6c6f77206c322076616c756560701b6044820152606490fd5b15612c5b57565b60405162461bcd60e51b815260206004820152601a60248201527f4e6f7420616c6c6f7720746f2063616c6c20636f6e74726163740000000000006044820152606490fd5b15612ca757565b60405162461bcd60e51b815260206004820152601c60248201527f4e6f7420616c6c6f7720746f2073656e64204c322072657175657374000000006044820152606490fd5b15612cf357565b606460405162461bcd60e51b815260206004820152602060248201527f496e76616c6964206c3247617350657250756264617461427974654c696d69746044820152fd5b15612d3e57565b60405162461bcd60e51b8152602060048201526013602482015272496e76616c696420666163746f72794465707360681b6044820152606490fd5b9060018201809211612be557565b9060208201809211612be557565b91908201809211612be557565b15612da957565b60405162461bcd60e51b8152602060048201526011602482015270496e76616c6964206d73672076616c756560781b6044820152606490fd5b908160209103126103485751610afa81610565565b6001600160401b03811161099b5760051b60200190565b92919092612e1b84612df7565b91612e2960405193846109f1565b829480845260208094019060051b8301928284116103485780915b848310612e5357505050505050565b82356001600160401b038111610348578691612e728684938601610adf565b815201920191612e44565b6000915b60048310612e8e57505050565b600190825181526020809101920192019190612e81565b90815180825260208080930193019160005b828110612ec5575050505090565b835185529381019392810192600101612eb7565b90610afa916020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e082015260e0820151610100908183015282015161012090818301528201516101409081830152820151612f5b6101609182840190612e7d565b82015190610260612f796101e0938285850152610280840190612741565b92612fca612fb4612f9e61018088015196601f19978888830301610200890152612741565b6101a08801518787830301610220880152612ea5565b6101c08701518686830301610240870152612741565b9401519282850301910152612741565b60405190612fe7826109d6565b60006020838281520152565b600019810191908211612be557565b91908203918211612be557565b9060405161301c816109d6565b602060018294805484520154910152565b90815180825260208092019182818360051b85019501936000915b8483106130585750505050505090565b909192939495848061307283856001950387528a51612741565b9801930193019194939290613048565b90815260406020820181905282516001600160a01b031690820152610afa9060208301511515606082015260408301516001600160a01b03166080820152606083015160a082015260808301516001600160a01b031660c082015260a083015160e082015261018060c084015161313b61016061310c6101009382858801526101a0870190612741565b9060e088015193610120948588015288015193610140948588015288015190603f19878403019087015261302d565b9401516001600160a01b0316910152565b600260c9541461315d57600260c955565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b156131a957565b60405162461bcd60e51b81526020600482015260166024820152754e6f7420616c6c6f772065746820776974686472617760501b6044820152606490fd5b156131ee57565b60405162461bcd60e51b8152602060048201526002602482015261353560f11b6044820152606490fd5b1561321f57565b60405162461bcd60e51b8152602060048201526002602482015261726760f01b6044820152606490fd5b1561325057565b60405162461bcd60e51b8152602060048201526002602482015261706960f01b6044820152606490fd5b1561328157565b60405162461bcd60e51b815260206004820152600d60248201526c2737ba103b30b634b230ba37b960991b6044820152606490fd5b156132bd57565b60405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a59081cde5b98c81c1bda5b9d60721b6044820152606490fd5b604090610afa939281528160208201520190612741565b1561331557565b60405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a5908199bdc9dd85c9908185b5bdd5b9d60521b6044820152606490fd5b1561335a57565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642072616e676560981b6044820152606490fd5b1561339657565b60405162461bcd60e51b815260206004820152601f60248201527f52616e676520626174636820726f6f742068617368206e6f74206578697374006044820152606490fd5b156133e257565b60405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420726f6f7420686173686573206c656e6774680000000000006044820152606490fd5b90156134305790565b634e487b7160e01b600052603260045260246000fd5b91908110156134305760051b0190565b1561345d57565b60405162461bcd60e51b8152602060048201526013602482015272092dcc6dee4e4cac6e840e4dedee840d0c2e6d606b1b6044820152606490fd5b1561349f57565b60405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc8195e18d95959608a1b6044820152606490fd5b156134dd57565b60405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc819985a5b1959608a1b6044820152606490fd5b811561351e570490565b634e487b7160e01b600052601260045260246000fd5b61353c61295c565b91600091835161354b816117a8565b613554816117a8565b1561360e575b906136036135fe826135f8876001600160401b036135f16135c26135956136089a61187c63ffffffff610afa9f602001511663ffffffff1690565b9a6135bc6135b66135ad604088015163ffffffff1690565b63ffffffff1690565b8d613514565b90612d95565b996135eb6135ad60606135df60a08801516001600160401b031690565b96015163ffffffff1690565b90613514565b9116612d95565b95612d95565b612ff3565b613514565b9061363b565b80925060110290601182048303612be557909161355a565b6202a5ac80821115613636575090565b905090565b9080821115613636575090565b60405190608082018281106001600160401b0382111761099b576040526080368337565b613674610a4e565b90600080835280602084015280604084015260609080828501528060808501528060a08501528060c08501528060e0850152806101008501526101208401526136bb613648565b6101408401528061016084015280610180840152806101a0840152806101c08401526101e0830152565b906136ef82612df7565b6136fc60405191826109f1565b828152809261370d601f1991612df7565b0190602036910137565b60409061372261366c565b5060e0810151906101008082015191613739610a6e565b600090818152816020820152818782015281606082015260c08301519161375e6123ed565b938161377061012080930151516136e5565b966137796123ed565b986137826123ed565b9a8361378c610a4e565b9d8e828152826020820152015260608d015260808c01528160a08c01528160c08c01528160e08c01528a01528801526101408701526101608601526101808501526101a08401526101c08301526101e082015290565b60a0906040516137f1816109bb565b6000928184809352826020820152826040820152826060820152826080820152015261ffff81511690604060018060a01b03602083015116910151602081519101209160405193613841856109bb565b84526001602085015260408401526180086060840152608083015260a082015290565b1561386b57565b60405162461bcd60e51b8152602060048201526002602482015261747760f01b6044820152606490fd5b9392906101355485116139a8576139a393836138b5613991955160ff1690565b9061395c6138c66020830151151590565b610de66138d8604085015161ffff1690565b60608501519094906001600160a01b0316608082015160a09092015160405160f898891b6001600160f81b0319166020820190815295151590981b602189015260f09690961b6001600160f01b031916602288015260601b6bffffffffffffffffffffffff1916602487015260388601526058850193909352929182906078820190565b5190209261398c7f72abee45b59e344af8a6e520241c4744aff26ed411f4c4b00f8af09adada43ba851415613864565b613c6c565b91600052610136602052604060002090565b541490565b60405162461bcd60e51b81526020600482015260026024820152610f0f60f31b6044820152606490fd5b606c815103613a675760048101516393f69f0760e01b60e09190911b6001600160e01b03191601613a3d57613a2491613a3982613a15613a2c9460188091015191565b60208184018101519297910190565b949094612d87565b6014908181019201015191565b5090565b60405162461bcd60e51b8152602060048201526002602482015261697360f01b6044820152606490fd5b60405162461bcd60e51b8152602060048201526002602482015261706d60f01b6044820152606490fd5b600080809381935af115613aa157565b60405162461bcd60e51b8152602060048201526002602482015261383d60f11b6044820152606490fd5b906020610afa92818152019061302d565b80516001600160a01b03166020820151151560408301519092906001600160a01b0316606082015160808301519093906001600160a01b031660a08401519360c08101518051906020012060e0820151610100830151916101208401519760405198896020810191613b4e9083613acb565b0399601f199a8b81018252613b6390826109f1565b51902061014095860151604080517fe0aaca1722ef50bb0c9b032e5b16ce2b79fa9f23638835456b27fd6894f8292c602082019081526001600160a01b039b8c16928201929092529d151560608f015299891660808e015260a08d019b909b5295871660c08c015260e08b01526101008a0152610120890152908701526101608601529092166101808401526101a09081018352909190613c0490826109f1565b51902090565b15613c1157565b60405162461bcd60e51b8152602060048201526002602482015261189d60f21b6044820152606490fd5b15613c4257565b60405162461bcd60e51b81526020600482015260026024820152610e0f60f31b6044820152606490fd5b9092918315613d0e57919092613c856101008210613c0a565b600191613c9583831b8510613c3b565b9360009182915b818310613cac5750505050505090565b9091929380959681881615600014613ceb57613cdd90613ccd868686613446565b3590600052602052604060002090565b96811c959493019190613c9c565b613d0990613cfa868686613446565b35600052602052604060002090565b613cdd565b60405162461bcd60e51b8152602060048201526002602482015261786360f01b6044820152606490fd5b15613d3f57565b60405162461bcd60e51b8152602060048201526002602482015261756960f01b6044820152606490fd5b15613d7057565b60405162461bcd60e51b8152602060048201526002602482015261756b60f01b6044820152606490fd5b15613da157565b60405162461bcd60e51b8152602060048201526002602482015261075760f41b6044820152606490fd5b91606083015192825180600a0290600a820403612be5576127109080821115613e6d5750915b828510613e43576101a0613e3c93610a1f960394613e1563044aa200871115613d38565b613e2f6080850193613e28855189613514565b1115613d69565b5192015151905191613e75565b1115613d9a565b60405162461bcd60e51b81526020600482015260026024820152616d7960f01b6044820152606490fd5b905091613df1565b91909161067890818102918183041490151715612be55780613ee657506000915b62028cf5928301809311612be5576109a990818102918183041481151715612be5576135bc613ed3613ece6135bc94610afa97612d95565b613626565b9361187c613ee082612bd4565b93612bea565b6000198101908111612be557610220900460018101809111612be55791613e9656fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220f42e546edc0a3e2057edd3c8154e7514c4f6b11e329b2f6d23afafda79a41e6064736f6c634300081200330000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c8062e969a814610338578063042901c7146103335780630ec6b0b71461032e578063116191b6146103105780631dd26496146103295780632425b3a4146103245780633659cfe61461031f57806336e2e3f31461031a5780633f4ba83a1461031557806342bf3cc1146103105780634623c91d1461030b5780634ecf53e9146103065780634f1ef286146103015780634fc07d75146102b157806351ef251b1461029d57806352d1902d146102fc578063534ca054146102f75780635a425fcd146102f25780635a9f55b0146102ed5780635c975abb146102e85780635e78d327146102e3578063637c9d9d146102de57806363b434941461028e57806364bf8d66146102d95780636c0960f9146102d4578063715018a6146102cf5780637666f125146102ca5780637adbe273146102c55780638129fc1c146102c057806383864ac4146102a25780638456cb59146102bb5780638aa50991146102b65780638da5cb5b146102b157806390646b4a146102ac5780639242164f146102a75780639cd939e4146102a2578063a1954fc51461029d578063af32a0a714610298578063b473318e14610293578063b8c2f66f1461028e578063ba745e5314610289578063bc5455d014610284578063bd7c54121461027f578063be3bc8ea1461027a578063ca98ef4f14610275578063cfe6128214610270578063e0a1bf721461026b578063e4948f4314610266578063eb67241914610261578063f2fde38b1461025c578063fa52c7d8146102575763facd743b1461025757600080fd5b612247565b6121b6565b611dd9565b611d24565b611cb7565b611b7d565b611b5e565b611953565b611913565b6118a8565b611889565b611040565b611855565b611836565b610c69565b61159e565b6117c8565b6116d7565b610c40565b611625565b6115cb565b6114b6565b611479565b6113fd565b61139c565b611144565b61105f565b611013565b610f75565b610f52565b610f25565b610d6c565b610d4d565b610c88565b610afd565b61092f565b61089e565b610511565b6107e2565b6107ac565b61065f565b610576565b61053b565b6104f2565b6103f3565b61034d565b600091031261034857565b600080fd5b346103485760003660031901126103485760206040517fe0aaca1722ef50bb0c9b032e5b16ce2b79fa9f23638835456b27fd6894f8292c8152f35b6064359061ffff8216820361034857565b6044359061ffff8216820361034857565b359061ffff8216820361034857565b9181601f84011215610348578235916001600160401b038311610348576020808501948460051b01011161034857565b6002111561034857565b346103485760c03660031901126103485761040c610388565b6084356001600160401b0381116103485761042b9036906004016103b9565b60a4359291610439846103e9565b6004356000526101376020526040600020549283156104b857846104a2946104636104b4976117a8565b61048561046e610a12565b60008152600160208201529361ffff166040850152565b6180016060840152608083015260a0820152604435602435613895565b60405190151581529081906020820190565b0390f35b60405162461bcd60e51b8152602060048201526012602482015271092dcecc2d8d2c840d86440e8f040d0c2e6d60731b6044820152606490fd5b3461034857600036600319011261034857602060405163044aa2008152f35b346103485760003660031901126103485761012d546040516001600160a01b039091168152602090f35b346103485760003660031901126103485761013b546040516001600160a01b039091168152602090f35b6001600160a01b0381160361034857565b346103485760203660031901126103485760043561059381610565565b61059b61228a565b6001600160a01b039080821680156106265761013b546001600160a01b0316928316036105c457005b61013b80546001600160a01b0319166001600160a01b0383161790557f98ac3b973026c0d730e72f023f161bebb4ba504d9b1c6b83d849d3cbaf7f51f491604080516001600160a01b039283168152929091166020830152819081015b0390a1005b60405162461bcd60e51b815260206004820152601160248201527024b73b30b634b21030b63637b1b0ba37b960791b6044820152606490fd5b346103485760203660031901126103485760043561067c81610565565b6001600160a01b037f000000000000000000000000e71a6cfb42d0398f6d6aed8a19987c83bbe3b86e811691906106b53084141561232b565b6106d2600080516020613f0983398151915293828554161461238c565b6106da61228a565b6106e26123ed565b9061070e7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1690565b1561072157505061071f91506124dd565b005b6020600491604094939451928380926352d1902d60e01b825286165afa6000918161077c575b506107695760405162461bcd60e51b8152806107656004820161248e565b0390fd5b61071f936107779114612430565b61256d565b61079e91925060203d81116107a5575b61079681836109f1565b810190612415565b9038610747565b503d61078c565b34610348576020366003190112610348576004356000526101346020526040806000206001815491015482519182526020820152f35b34610348576000366003190112610348576107fb61228a565b60fb5460ff81161561083a5760ff191660fb557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b60409060031901126103485760043561088e81610565565b9060243580151581036103485790565b34610348576108ac36610876565b61012d5490916001600160a01b03916108c89083163314612914565b16908160005261012e60205260406000209060ff82541681151580911515036108ed57005b6109266020927f065b77b53864e46fda3d8986acb51696223d6dde7ced42441eb150bae6d48136949060ff801983541691151516179055565b604051908152a2005b346103485760203660031901126103485760043561094c81610565565b60018060a01b031660005261012f602052602060ff604060002054166040519015158152f35b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161099b57604052565b610972565b606081019081106001600160401b0382111761099b57604052565b60c081019081106001600160401b0382111761099b57604052565b604081019081106001600160401b0382111761099b57604052565b90601f801991011681019081106001600160401b0382111761099b57604052565b60405190610a1f826109bb565b565b60405190610a1f826109a0565b6040519061016082018281106001600160401b0382111761099b57604052565b6040519061020082018281106001600160401b0382111761099b57604052565b60405190608082018281106001600160401b0382111761099b57604052565b6001600160401b03811161099b57601f01601f191660200190565b929192610ab482610a8d565b91610ac260405193846109f1565b829481845281830111610348578281602093846000960137010152565b9080601f8301121561034857816020610afa93359101610aa8565b90565b604036600319011261034857600435610b1581610565565b6024356001600160401b03811161034857610b34903690600401610adf565b6001600160a01b037f000000000000000000000000e71a6cfb42d0398f6d6aed8a19987c83bbe3b86e8116929190610b6e3085141561232b565b610b8b600080516020613f0983398151915294828654161461238c565b610b9361228a565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615610bc957505061071f91506124dd565b6020600491604094939451928380926352d1902d60e01b825286165afa60009181610c20575b50610c0d5760405162461bcd60e51b8152806107656004820161248e565b61071f93610c1b9114612430565b612629565b610c3991925060203d81116107a55761079681836109f1565b9038610bef565b34610348576000366003190112610348576033546040516001600160a01b039091168152602090f35b3461034857600036600319011261034857602061013254604051908152f35b34610348576000366003190112610348577f000000000000000000000000e71a6cfb42d0398f6d6aed8a19987c83bbe3b86e6001600160a01b03163003610ce257604051600080516020613f098339815191528152602090f35b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608490fd5b3461034857600036600319011261034857602061013054604051908152f35b34610348576060366003190112610348576004356024356044356001600160401b03811161034857610da29036906004016103b9565b9290923360005261012e602052610dc060ff6040600020541661327a565b610dcc82841015613353565b6040805160208101848152918101859052610df481606081015b03601f1981018352826109f1565b51902093610e0d8560005261013c602052604060002090565b5491610e1a83151561338f565b610e36610e2f610e2a8688613002565b612d79565b82146133db565b610e408183613427565b359182610e5886600052610136602052604060002090565b5560019081925b808410610edf577fddf6b2cf5bdb04a03cb3f7663b72571336626b1e586a3a047942e4860cf7e12b88886000610eab8d610e9a8c8c14613456565b60005261013c602052604060002090565b55610135548211610ed0575b6040805191825260208201929092529081908101610621565b610eda8261013555565b610eb7565b9091610f1b8495610ef283968587613446565b359081610f0c898c01600052610136602052604060002090565b55600052602052604060002090565b9401929190610e5f565b34610348576020366003190112610348576004356000526101376020526020604060002054604051908152f35b3461034857600036600319011261034857602060ff60fb54166040519015158152f35b6060366003190112610348577fab53214e3a56f049923c5f5532ea4657bba51b870850593c4dc0eceb3b61feed60043560243590610621604435610fc560018060a01b0361012d54163314612914565b610fd081341461330e565b826101358054821161100b575b5060005261013660205283604060002055604051938493846040919493926060820195825260208201520152565b558238610fdd565b346103485760203660031901126103485760043560005261013c6020526020604060002054604051908152f35b3461034857600036600319011261034857602061013554604051908152f35b346103485760c03660031901126103485761108660018060a01b0361012d54163314612914565b6044356110928161294e565b60843561109e8161294e565b63ffffffff8091169116106110ed577fc8b245ac8b138b17b6b1dbbbb8860adc66b373afa000d99f3cdc775d8ae0bbed6106216110d961295c565b6110e16129dd565b60405191829182612ad7565b60405162461bcd60e51b8152602060048201526002602482015261371b60f11b6044820152606490fd5b9181601f84011215610348578235916001600160401b038311610348576020838186019501011161034857565b346103485760a036600319011261034857602435600435611163610399565b916001600160401b039160643583811161034857611185903690600401611117565b929091608435948511610348576112556112506111a7600497369089016103b9565b9590966111b261314c565b6111db7f00000000000000000000000000000000000000000000000000000000000000016131a2565b61121c61121761121361120c896111fd8a60005261013a602052604060002090565b90600052602052604060002090565b5460ff1690565b1590565b6131e7565b611231611227610a21565b61ffff909b168b52565b61800a60208b0152611244368284610aa8565b60408b01523691610aa8565b6139d2565b9491959097602061127d61127161012d5460018060a01b031690565b6001600160a01b031690565b60405163388e611f60e11b8152998a9182905afa968715611397577f26464d64ddb13f6d187de632d165bd1065382ec0b66c25c648957116e7bc25c898600098611341575b506112fe61132196946111fd946112f761131498956112f26113039660018060a01b039e8f809116911614613218565b6137e2565b8786613895565b613249565b60005261013a602052604060002090565b805460ff19166001179055565b61132b8482613a91565b6040519384521691602090a261071f600160c955565b61130391985061132196946111fd946112f761131498956112f261137e6112fe9660203d8111611390575b61137681836109f1565b810190612de2565b9d9650509598505094509496506112c2565b503d61136c565b612424565b34610348576000806003193601126113fa576113b661228a565b603380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b346103485761140b36610876565b9061141461228a565b60018060a01b0316908160005261012f60205260406000209060ff825416811515809115150361144057005b6109266020927f1f8e549bdb5108ba50ebcc80bb64a20ea98bfbd9378a87380d29f3c87cdcbb2c949060ff801983541691151516179055565b346103485760003660031901126103485760206040517f000000000000000000000000000000000000000000000000000000000000000115158152f35b34610348576000806003193601126113fa5780546114eb60ff8260081c161580928193611590575b8115611570575b50612781565b806114fe600160ff196000541617600055565b611557575b61150b6127e4565b6115125780f35b61152261ff001960005416600055565b604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989080602081015b0390a180f35b61156b61010061ff00196000541617600055565b611503565b303b15915081611582575b50386114e5565b6001915060ff16143861157b565b600160ff82161091506114de565b34610348576020366003190112610348576004356000526101366020526020604060002054604051908152f35b34610348576000366003190112610348576115e461228a565b6115ec612892565b600160ff1960fb54161760fb557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b6080366003190112610348577f427754a95a2d34153366ec8bcea3939ce044aaf5c185a86149c9f6d80c4402b960806004356024356044356064359161167760018060a01b0361012d54163314612914565b61168384821015613353565b61168e83341461330e565b60408051602081018681529181018390526116ac8160608101610de6565b51902060005261013c60205281604060002055604051938452602084015260408301526060820152a1005b34610348576020366003190112610348576004356116f481610565565b6116fc61228a565b61012d546001600160a01b0390811661176a57611743908216916117218315156128d6565b61012d80546001600160a01b0319166001600160a01b03909216919091179055565b7f860df2b5ed762095deab38be8b5aa5acfbfa8d4d209e083fa00246d31b715e29600080a2005b60405162461bcd60e51b81526020600482015260166024820152754475706c696361746520696e6974206761746577617960501b6044820152606490fd5b600211156117b257565b634e487b7160e01b600052602160045260246000fd5b346103485760003660031901126103485760c0610131546001600160401b0360ff821691604051926117f9816117a8565b835263ffffffff808260081c166020850152808260281c166040850152808260481c1660608501528160681c16608084015260881c1660a0820152f35b3461034857600036600319011261034857602061013854604051908152f35b3461034857606036600319011261034857602061188160243561187c604435600435613534565b612c00565b604051908152f35b3461034857600036600319011261034857602061013354604051908152f35b34610348576020366003190112610348576004356118c461228a565b6101309081548181036118d357005b817f208ba37ba4e5fc3f236a9c289aa28898330c1f2ec9102d54821a1ffb59e8f1d793556106216040519283928360209093929193604081019481520152565b346103485760403660031901126103485760043560005261013a6020526040600020602435600052602052602060ff604060002054166040519015158152f35b602080600319360112610348576004359060009133835261012e825261197f60ff60408520541661327a565b6101325481111580611b52575b611995906132b6565b61199d612fda565b906101335480611b39575b506119e06119d16119cc6119bb84612ff3565b600052610134602052604060002090565b61300f565b92848085015191015190613002565b916119eb8261013355565b61012d54611a01906001600160a01b0316611271565b60405163388e611f60e11b815290948082600481895afa9081156113975787928392611b16575b5083516040516318d0d57560e01b928101929092526001600160a01b03909216602482015260448101859052606481019190915260848101859052611a708160a48101610de6565b611a7a8534612d95565b95803b15611b1257611aa39160405197888094819363e289adcd60e01b83528a600484016132f7565b03925af1908115611397577fba9fdc955504f0973215993a882822edf5e2b4561df97340b4d5632e64e24a0f9461155192611af9575b505192604051938493846040919493926060820195825260208201520152565b80611b06611b0c92610988565b8061033d565b38611ad9565b8280fd5b819250611b3290611a70923d85116113905761137681836109f1565b9190611a28565b611b4b9192506119bb6119cc91612ff3565b90386119a8565b5061013354811161198c565b3461034857600036600319011261034857602061013954604051908152f35b3461034857604036600319011261034857600435611b9a81610565565b602435611ba561314c565b61013b546001600160a01b039081163303611c72578115611c3c577f8f37daeecdc35f2a03da8794b025ea44e3f7c6f4e2265630836db89ff3f2f2b790611c07611bf28461013954612d95565b611c0181610138541015613498565b61013955565b600093611c238580808088865af1611c1d61267c565b506134d6565b6040519384521691602090a2611c39600160c955565b80f35b60405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606490fd5b60405162461bcd60e51b815260206004820152601960248201527f4e6f7420666f72776172642066656520616c6c6f6361746f72000000000000006044820152606490fd5b34610348576040366003190112610348577fdfb8da952dba6c9ec993b8f2ca8cc6ac22596f6e179520fea3fc78202e87090c6040600435602435611d0760018060a01b0361012d54163314612914565b8160005261013760205280836000205582519182526020820152a1005b3461034857600319608036820112610348576044356001600160401b03918282116103485760609082360301126103485760405190611d62826109a0565b611d6e816004016103aa565b82526024810135611d7e81610565565b6020830152604481013590838211610348576004611d9f9236920101610adf565b604082015260643591821161034857611dce6104a291611dc66104b49436906004016103b9565b9290916137e2565b602435600435613895565b60e036600319011261034857600435611df181610565565b602435906001600160401b0360443581811161034857611e15903690600401611117565b90916064359360843560a43592831161034857611e37879336906004016103b9565b60c43592611e4484610565565b611e4c61314c565b611e54612892565b7f0000000000000000000000000000000000000000000000000000000000000001156121a7575b33986000328b14612193575089611eb5611eb061120c60049a9b9c9d60018060a01b031660005261012f602052604060002090565b612ca0565b61111161111160901b01016001600160a01b0316996001995b611edb6103208514612cec565b611f24611f1e60209b611ef08d891115612d37565b611f15611f0e611f078861187c8b61013054613534565b9283612d95565b3414612da2565b61013854612d95565b61013855565b6001600160a01b039680881661218d57508b965b87803b612176575b50506101325461012d54909c90611f5f906001600160a01b0316611271565b9b8b60409d8e519c8d809263388e611f60e11b82525afa9a8b156113975760009b612157575b50611f8e610a2e565b6001600160a01b03909b168b5215158a8c01526001600160a01b0316898c0152606089018c81526001600160a01b0390981660808a01528c60a08a01523690611fd692610aa8565b60c088015260e08701526101008601523690611ff192612e0e565b6101208401526001600160a01b031661014083015261200f82613717565b8451908161201f82878301612ed9565b0391601f1992838101825261203490826109f1565b6101315460681c63ffffffff1663ffffffff169061205192613dcb565b8461205b84613adc565b968792612066612fda565b6104b49a7fbf5630c2adfa5e47b882a9ead657ffc6a22ce010513a3efac7245066bcad17dd986120d1966120cb96610e2a95876120fb57505083528201525b6120ba83600052610134602052604060002090565b906020600191805184550151910155565b61013255565b516120e0845192839283613082565b0390a16120ed600160c955565b519081529081906020820190565b61215093929550612141612135916121186119cc6119bb8c612ff3565b978851945193849187830196879091604092825260208201520190565b039081018352826109f1565b51902084528301918251612d95565b90526120a5565b61216f919b508c8d3d106113905761137681836109f1565b9938611f85565b811661111161111160901b01011696503880611f40565b96611f38565b98886121a26004999a15612c54565b611ece565b6121b18615612c13565b611e7b565b34610348576020366003190112610348576004356121d381610565565b6121db61228a565b6001600160a01b038116156121f35761071f906122e2565b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b346103485760203660031901126103485760043561226481610565565b60018060a01b031660005261012e602052602060ff604060002054166040519015158152f35b6033546001600160a01b0316330361229e57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603380546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b1561233257565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b1561239357565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b604051602081018181106001600160401b0382111761099b5760405260008152906000368137565b90816020910312610348575190565b6040513d6000823e3d90fd5b1561243757565b60405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b60809060208152602e60208201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960408201526d6f6e206973206e6f74205555505360901b60608201520190565b803b1561251257600080516020613f0983398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b90612577826124dd565b6001600160a01b0382167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2805115801590612621575b6125b9575050565b61261e91600080604051936125cd856109a0565b602785527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c6020860152660819985a5b195960ca1b6040860152602081519101845af461261861267c565b916126ac565b50565b5060006125b1565b90612633826124dd565b6001600160a01b0382167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b600080a2805115801590612674576125b9575050565b5060016125b1565b3d156126a7573d9061268d82610a8d565b9161269b60405193846109f1565b82523d6000602084013e565b606090565b9192901561270e57508151156126c0575090565b3b156126c95790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156127215750805190602001fd5b60405162461bcd60e51b8152602060048201529081906107659060248301905b919082519283825260005b84811061276d575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520161274c565b1561278857565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b6127f560ff60005460081c16612832565b6127fe336122e2565b61282660ff60005460081c1661281381612832565b61281c81612832565b600160c955612832565b60ff1960fb541660fb55565b1561283957565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b60ff60fb541661289e57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b156128dd57565b60405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206761746577617960881b6044820152606490fd5b1561291b57565b60405162461bcd60e51b815260206004820152600b60248201526a4e6f74206761746577617960a81b6044820152606490fd5b63ffffffff81160361034857565b60405190612969826109bb565b8160a06001600160401b036101315460ff8116612985816117a8565b845263ffffffff808260081c166020860152808260281c166040860152808260481c1660608601528160681c16608085015260881c16910152565b6001600160401b0381160361034857565b60a435610afa816129c0565b6004356129e9816103e9565b6129f2816117a8565b6101319081546cffffffff000000000000000000602435612a128161294e565b68ffffffff000000000060443591612a298361294e565b64ffffffff0060643595612a3c8761294e565b60ff608435612a4a8161294e565b63ffffffff60681b9060681b1698169070ffffffffffffffffffffffffffffffffff1916179160081b16179160281b16179160481b1617179055610a1f612a8f6129d1565b610131805467ffffffffffffffff60881b191660889290921b67ffffffffffffffff60881b16919091179055565b60843590610a1f8261294e565b60a43590610a1f826129c0565b815161018082019392610a1f9291612aee816117a8565b82526001600160401b0360a063ffffffff9283602082015116602086015283604082015116604086015283606082015116606086015283608082015116608086015201511660a0830152600435612b44816103e9565b612b4d816117a8565b60c083015280602435612b5f8161294e565b1660e083015280604435612b728161294e565b16610100830152606435612b858161294e565b16610120820152612ba5612b97612abd565b63ffffffff16610140830152565b610160612bb0612aca565b6001600160401b0316910152565b634e487b7160e01b600052601160045260246000fd5b9081605802916058830403612be557565b612bbe565b908160061b9180830460401490151715612be557565b81810292918115918404141715612be557565b15612c1a57565b60405162461bcd60e51b81526020600482015260126024820152714e6f7420616c6c6f77206c322076616c756560701b6044820152606490fd5b15612c5b57565b60405162461bcd60e51b815260206004820152601a60248201527f4e6f7420616c6c6f7720746f2063616c6c20636f6e74726163740000000000006044820152606490fd5b15612ca757565b60405162461bcd60e51b815260206004820152601c60248201527f4e6f7420616c6c6f7720746f2073656e64204c322072657175657374000000006044820152606490fd5b15612cf357565b606460405162461bcd60e51b815260206004820152602060248201527f496e76616c6964206c3247617350657250756264617461427974654c696d69746044820152fd5b15612d3e57565b60405162461bcd60e51b8152602060048201526013602482015272496e76616c696420666163746f72794465707360681b6044820152606490fd5b9060018201809211612be557565b9060208201809211612be557565b91908201809211612be557565b15612da957565b60405162461bcd60e51b8152602060048201526011602482015270496e76616c6964206d73672076616c756560781b6044820152606490fd5b908160209103126103485751610afa81610565565b6001600160401b03811161099b5760051b60200190565b92919092612e1b84612df7565b91612e2960405193846109f1565b829480845260208094019060051b8301928284116103485780915b848310612e5357505050505050565b82356001600160401b038111610348578691612e728684938601610adf565b815201920191612e44565b6000915b60048310612e8e57505050565b600190825181526020809101920192019190612e81565b90815180825260208080930193019160005b828110612ec5575050505090565b835185529381019392810192600101612eb7565b90610afa916020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260c082015160e082015260e0820151610100908183015282015161012090818301528201516101409081830152820151612f5b6101609182840190612e7d565b82015190610260612f796101e0938285850152610280840190612741565b92612fca612fb4612f9e61018088015196601f19978888830301610200890152612741565b6101a08801518787830301610220880152612ea5565b6101c08701518686830301610240870152612741565b9401519282850301910152612741565b60405190612fe7826109d6565b60006020838281520152565b600019810191908211612be557565b91908203918211612be557565b9060405161301c816109d6565b602060018294805484520154910152565b90815180825260208092019182818360051b85019501936000915b8483106130585750505050505090565b909192939495848061307283856001950387528a51612741565b9801930193019194939290613048565b90815260406020820181905282516001600160a01b031690820152610afa9060208301511515606082015260408301516001600160a01b03166080820152606083015160a082015260808301516001600160a01b031660c082015260a083015160e082015261018060c084015161313b61016061310c6101009382858801526101a0870190612741565b9060e088015193610120948588015288015193610140948588015288015190603f19878403019087015261302d565b9401516001600160a01b0316910152565b600260c9541461315d57600260c955565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b156131a957565b60405162461bcd60e51b81526020600482015260166024820152754e6f7420616c6c6f772065746820776974686472617760501b6044820152606490fd5b156131ee57565b60405162461bcd60e51b8152602060048201526002602482015261353560f11b6044820152606490fd5b1561321f57565b60405162461bcd60e51b8152602060048201526002602482015261726760f01b6044820152606490fd5b1561325057565b60405162461bcd60e51b8152602060048201526002602482015261706960f01b6044820152606490fd5b1561328157565b60405162461bcd60e51b815260206004820152600d60248201526c2737ba103b30b634b230ba37b960991b6044820152606490fd5b156132bd57565b60405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a59081cde5b98c81c1bda5b9d60721b6044820152606490fd5b604090610afa939281528160208201520190612741565b1561331557565b60405162461bcd60e51b8152602060048201526016602482015275125b9d985b1a5908199bdc9dd85c9908185b5bdd5b9d60521b6044820152606490fd5b1561335a57565b60405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642072616e676560981b6044820152606490fd5b1561339657565b60405162461bcd60e51b815260206004820152601f60248201527f52616e676520626174636820726f6f742068617368206e6f74206578697374006044820152606490fd5b156133e257565b60405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420726f6f7420686173686573206c656e6774680000000000006044820152606490fd5b90156134305790565b634e487b7160e01b600052603260045260246000fd5b91908110156134305760051b0190565b1561345d57565b60405162461bcd60e51b8152602060048201526013602482015272092dcc6dee4e4cac6e840e4dedee840d0c2e6d606b1b6044820152606490fd5b1561349f57565b60405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc8195e18d95959608a1b6044820152606490fd5b156134dd57565b60405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc819985a5b1959608a1b6044820152606490fd5b811561351e570490565b634e487b7160e01b600052601260045260246000fd5b61353c61295c565b91600091835161354b816117a8565b613554816117a8565b1561360e575b906136036135fe826135f8876001600160401b036135f16135c26135956136089a61187c63ffffffff610afa9f602001511663ffffffff1690565b9a6135bc6135b66135ad604088015163ffffffff1690565b63ffffffff1690565b8d613514565b90612d95565b996135eb6135ad60606135df60a08801516001600160401b031690565b96015163ffffffff1690565b90613514565b9116612d95565b95612d95565b612ff3565b613514565b9061363b565b80925060110290601182048303612be557909161355a565b6202a5ac80821115613636575090565b905090565b9080821115613636575090565b60405190608082018281106001600160401b0382111761099b576040526080368337565b613674610a4e565b90600080835280602084015280604084015260609080828501528060808501528060a08501528060c08501528060e0850152806101008501526101208401526136bb613648565b6101408401528061016084015280610180840152806101a0840152806101c08401526101e0830152565b906136ef82612df7565b6136fc60405191826109f1565b828152809261370d601f1991612df7565b0190602036910137565b60409061372261366c565b5060e0810151906101008082015191613739610a6e565b600090818152816020820152818782015281606082015260c08301519161375e6123ed565b938161377061012080930151516136e5565b966137796123ed565b986137826123ed565b9a8361378c610a4e565b9d8e828152826020820152015260608d015260808c01528160a08c01528160c08c01528160e08c01528a01528801526101408701526101608601526101808501526101a08401526101c08301526101e082015290565b60a0906040516137f1816109bb565b6000928184809352826020820152826040820152826060820152826080820152015261ffff81511690604060018060a01b03602083015116910151602081519101209160405193613841856109bb565b84526001602085015260408401526180086060840152608083015260a082015290565b1561386b57565b60405162461bcd60e51b8152602060048201526002602482015261747760f01b6044820152606490fd5b9392906101355485116139a8576139a393836138b5613991955160ff1690565b9061395c6138c66020830151151590565b610de66138d8604085015161ffff1690565b60608501519094906001600160a01b0316608082015160a09092015160405160f898891b6001600160f81b0319166020820190815295151590981b602189015260f09690961b6001600160f01b031916602288015260601b6bffffffffffffffffffffffff1916602487015260388601526058850193909352929182906078820190565b5190209261398c7f72abee45b59e344af8a6e520241c4744aff26ed411f4c4b00f8af09adada43ba851415613864565b613c6c565b91600052610136602052604060002090565b541490565b60405162461bcd60e51b81526020600482015260026024820152610f0f60f31b6044820152606490fd5b606c815103613a675760048101516393f69f0760e01b60e09190911b6001600160e01b03191601613a3d57613a2491613a3982613a15613a2c9460188091015191565b60208184018101519297910190565b949094612d87565b6014908181019201015191565b5090565b60405162461bcd60e51b8152602060048201526002602482015261697360f01b6044820152606490fd5b60405162461bcd60e51b8152602060048201526002602482015261706d60f01b6044820152606490fd5b600080809381935af115613aa157565b60405162461bcd60e51b8152602060048201526002602482015261383d60f11b6044820152606490fd5b906020610afa92818152019061302d565b80516001600160a01b03166020820151151560408301519092906001600160a01b0316606082015160808301519093906001600160a01b031660a08401519360c08101518051906020012060e0820151610100830151916101208401519760405198896020810191613b4e9083613acb565b0399601f199a8b81018252613b6390826109f1565b51902061014095860151604080517fe0aaca1722ef50bb0c9b032e5b16ce2b79fa9f23638835456b27fd6894f8292c602082019081526001600160a01b039b8c16928201929092529d151560608f015299891660808e015260a08d019b909b5295871660c08c015260e08b01526101008a0152610120890152908701526101608601529092166101808401526101a09081018352909190613c0490826109f1565b51902090565b15613c1157565b60405162461bcd60e51b8152602060048201526002602482015261189d60f21b6044820152606490fd5b15613c4257565b60405162461bcd60e51b81526020600482015260026024820152610e0f60f31b6044820152606490fd5b9092918315613d0e57919092613c856101008210613c0a565b600191613c9583831b8510613c3b565b9360009182915b818310613cac5750505050505090565b9091929380959681881615600014613ceb57613cdd90613ccd868686613446565b3590600052602052604060002090565b96811c959493019190613c9c565b613d0990613cfa868686613446565b35600052602052604060002090565b613cdd565b60405162461bcd60e51b8152602060048201526002602482015261786360f01b6044820152606490fd5b15613d3f57565b60405162461bcd60e51b8152602060048201526002602482015261756960f01b6044820152606490fd5b15613d7057565b60405162461bcd60e51b8152602060048201526002602482015261756b60f01b6044820152606490fd5b15613da157565b60405162461bcd60e51b8152602060048201526002602482015261075760f41b6044820152606490fd5b91606083015192825180600a0290600a820403612be5576127109080821115613e6d5750915b828510613e43576101a0613e3c93610a1f960394613e1563044aa200871115613d38565b613e2f6080850193613e28855189613514565b1115613d69565b5192015151905191613e75565b1115613d9a565b60405162461bcd60e51b81526020600482015260026024820152616d7960f01b6044820152606490fd5b905091613df1565b91909161067890818102918183041490151715612be55780613ee657506000915b62028cf5928301809311612be5576109a990818102918183041481151715612be5576135bc613ed3613ece6135bc94610afa97612d95565b613626565b9361187c613ee082612bd4565b93612bea565b6000198101908111612be557610220900460018101809111612be55791613e9656fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220f42e546edc0a3e2057edd3c8154e7514c4f6b11e329b2f6d23afafda79a41e6064736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _isEthGasToken (bool): True
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 32 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.