Sepolia Testnet

Contract

0x99B88a393e3bBd007afc4eaCF33BD04F641C5a34

Overview

ETH Balance

0 ETH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Deploy Lockbox67092722024-09-17 13:01:00154 days ago1726578060IN
0x99B88a39...F641C5a34
0 ETH0.005025786.72156653
Deploy XERC2067092702024-09-17 13:00:36154 days ago1726578036IN
0x99B88a39...F641C5a34
0 ETH0.015154386.9503719
Deploy Lockbox66724472024-09-11 13:45:36160 days ago1726062336IN
0x99B88a39...F641C5a34
0 ETH0.0230190630.78608649
Deploy XERC2066724452024-09-11 13:45:12160 days ago1726062312IN
0x99B88a39...F641C5a34
0 ETH0.0705287329.84704119
Deploy Lockbox66699532024-09-11 2:58:12160 days ago1726023492IN
0x99B88a39...F641C5a34
0 ETH0.005656557.56517132
Deploy XERC2066699512024-09-11 2:57:48160 days ago1726023468IN
0x99B88a39...F641C5a34
0 ETH0.016709897.66281953
Deploy XERC2066668922024-09-10 13:43:12161 days ago1725975792IN
0x99B88a39...F641C5a34
0 ETH0.0606029623.32547614
Deploy XERC2066668662024-09-10 13:37:12161 days ago1725975432IN
0x99B88a39...F641C5a34
0 ETH0.0587335824.31702417
Deploy Lockbox66626262024-09-09 19:23:36161 days ago1725909816IN
0x99B88a39...F641C5a34
0 ETH0.003840535.13640054
Deploy XERC2066625642024-09-09 19:08:12161 days ago1725908892IN
0x99B88a39...F641C5a34
0 ETH0.011691154.94755039
Deploy Lockbox66333782024-09-04 20:53:12166 days ago1725483192IN
0x99B88a39...F641C5a34
0 ETH0.00744249.95359214
Deploy XERC2066333762024-09-04 20:52:48166 days ago1725483168IN
0x99B88a39...F641C5a34
0 ETH0.020432269.37100752
Deploy XERC2066271432024-09-03 20:03:36167 days ago1725393816IN
0x99B88a39...F641C5a34
0 ETH0.018512288.49048124
Deploy Lockbox66198442024-09-02 16:13:24168 days ago1725293604IN
0x99B88a39...F641C5a34
0 ETH0.006437568.60971446
Deploy XERC2066198422024-09-02 16:13:00168 days ago1725293580IN
0x99B88a39...F641C5a34
0 ETH0.02385068.74287671
Deploy Lockbox66014112024-08-30 17:32:36171 days ago1725039156IN
0x99B88a39...F641C5a34
0 ETH0.00851511.38811608
Deploy Lockbox66014112024-08-30 17:32:36171 days ago1725039156IN
0x99B88a39...F641C5a34
0 ETH0.0085148711.38811608
Deploy XERC2066014102024-08-30 17:32:12171 days ago1725039132IN
0x99B88a39...F641C5a34
0 ETH0.0237377110.88509605
Deploy XERC2066014102024-08-30 17:32:12171 days ago1725039132IN
0x99B88a39...F641C5a34
0 ETH0.0237337910.88509605
Deploy XERC2066013522024-08-30 17:19:24171 days ago1725038364IN
0x99B88a39...F641C5a34
0 ETH0.0300002113.7590814
Deploy XERC2066013212024-08-30 17:11:00171 days ago1725037860IN
0x99B88a39...F641C5a34
0 ETH0.029405813.48638813
Deploy Lockbox66013032024-08-30 17:05:48171 days ago1725037548IN
0x99B88a39...F641C5a34
0 ETH0.0081003210.83351318
Deploy XERC2066012962024-08-30 17:04:12171 days ago1725037452IN
0x99B88a39...F641C5a34
0 ETH0.0249284611.43301016
Deploy XERC2066012822024-08-30 17:01:00171 days ago1725037260IN
0x99B88a39...F641C5a34
0 ETH0.0222916410.2236783
Deploy XERC2066012612024-08-30 16:55:24171 days ago1725036924IN
0x99B88a39...F641C5a34
0 ETH0.017846128.18490676
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
67092722024-09-17 13:01:00154 days ago1726578060
0x99B88a39...F641C5a34
 Contract Creation0 ETH
67092702024-09-17 13:00:36154 days ago1726578036
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66724472024-09-11 13:45:36160 days ago1726062336
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66724452024-09-11 13:45:12160 days ago1726062312
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66699532024-09-11 2:58:12160 days ago1726023492
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66699512024-09-11 2:57:48160 days ago1726023468
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66668922024-09-10 13:43:12161 days ago1725975792
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66668662024-09-10 13:37:12161 days ago1725975432
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66626262024-09-09 19:23:36161 days ago1725909816
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66625642024-09-09 19:08:12161 days ago1725908892
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66333782024-09-04 20:53:12166 days ago1725483192
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66333762024-09-04 20:52:48166 days ago1725483168
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66271432024-09-03 20:03:36167 days ago1725393816
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66198442024-09-02 16:13:24168 days ago1725293604
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66198422024-09-02 16:13:00168 days ago1725293580
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66014112024-08-30 17:32:36171 days ago1725039156
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66014112024-08-30 17:32:36171 days ago1725039156
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66014102024-08-30 17:32:12171 days ago1725039132
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66014102024-08-30 17:32:12171 days ago1725039132
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66013522024-08-30 17:19:24171 days ago1725038364
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66013212024-08-30 17:11:00171 days ago1725037860
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66013032024-08-30 17:05:48171 days ago1725037548
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66012962024-08-30 17:04:12171 days ago1725037452
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66012822024-08-30 17:01:00171 days ago1725037260
0x99B88a39...F641C5a34
 Contract Creation0 ETH
66012612024-08-30 16:55:24171 days ago1725036924
0x99B88a39...F641C5a34
 Contract Creation0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
XERC20Factory

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 10000 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 28 : XERC20Factory.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.4 <0.9.0;

import {XERC20} from '../contracts/XERC20.sol';
import {IXERC20Factory} from '../interfaces/IXERC20Factory.sol';
import {XERC20Lockbox} from '../contracts/XERC20Lockbox.sol';
import {CREATE3} from 'isolmate/utils/CREATE3.sol';
import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';

contract XERC20Factory is IXERC20Factory {
  using EnumerableSet for EnumerableSet.AddressSet;

  /**
   * @notice Address of the xerc20 maps to the address of its lockbox if it has one
   */
  mapping(address => address) internal _lockboxRegistry;

  /**
   * @notice The set of registered lockboxes
   */
  EnumerableSet.AddressSet internal _lockboxRegistryArray;

  /**
   * @notice The set of registered XERC20 tokens
   */
  EnumerableSet.AddressSet internal _xerc20RegistryArray;

  /**
   * @notice Deploys an XERC20 contract using CREATE3
   * @dev _limits and _minters must be the same length
   * @param _name The name of the token
   * @param _symbol The symbol of the token
   * @param _minterLimits The array of limits that you are adding (optional, can be an empty array)
   * @param _burnerLimits The array of limits that you are adding (optional, can be an empty array)
   * @param _bridges The array of bridges that you are adding (optional, can be an empty array)
   * @param _initialSupply The initial supply of the token
   * @param _owner The owner of the token, zero address if the owner is the sender
   * @return _xerc20 The address of the xerc20
   */
  function deployXERC20(
    string memory _name,
    string memory _symbol,
    uint256[] memory _minterLimits,
    uint256[] memory _burnerLimits,
    address[] memory _bridges,
    uint256 _initialSupply,
    address _owner
  ) external returns (address _xerc20) {
    _xerc20 = _deployXERC20(_name, _symbol, _minterLimits, _burnerLimits, _bridges, _initialSupply, _owner);

    emit XERC20Deployed(_xerc20);
  }

  /**
   * @notice Deploys an XERC20Lockbox contract using CREATE3
   *
   * @dev When deploying a lockbox for the gas token of the chain, then, the base token needs to be address(0)
   * @param _xerc20 The address of the xerc20 that you want to deploy a lockbox for
   * @param _baseToken The address of the base token that you want to lock
   * @param _isNative Whether or not the base token is the native (gas) token of the chain. Eg: MATIC for polygon chain
   * @return _lockbox The address of the lockbox
   */
  function deployLockbox(
    address _xerc20,
    address _baseToken,
    bool _isNative
  ) external returns (address payable _lockbox) {
    if ((_baseToken == address(0) && !_isNative) || (_isNative && _baseToken != address(0))) {
      revert IXERC20Factory_BadTokenAddress();
    }

    if (XERC20(_xerc20).owner() != msg.sender) revert IXERC20Factory_NotOwner();
    if (_lockboxRegistry[_xerc20] != address(0)) revert IXERC20Factory_LockboxAlreadyDeployed();

    _lockbox = _deployLockbox(_xerc20, _baseToken, _isNative);

    emit LockboxDeployed(_lockbox);
  }

  /**
   * @notice Deploys an XERC20 contract using CREATE3
   * @dev _limits and _minters must be the same length
   * @param _name The name of the token
   * @param _symbol The symbol of the token
   * @param _minterLimits The array of limits that you are adding (optional, can be an empty array)
   * @param _burnerLimits The array of limits that you are adding (optional, can be an empty array)
   * @param _bridges The array of burners that you are adding (optional, can be an empty array)
   * @param _initialSupply The initial supply of the token
   * @param _owner The owner of the token, zero address if the owner is the sender
   * @return _xerc20 The address of the xerc20
   */
  function _deployXERC20(
    string memory _name,
    string memory _symbol,
    uint256[] memory _minterLimits,
    uint256[] memory _burnerLimits,
    address[] memory _bridges,
    uint256 _initialSupply,
    address _owner
  ) internal returns (address _xerc20) {
    uint256 _bridgesLength = _bridges.length;
    if (_minterLimits.length != _bridgesLength || _burnerLimits.length != _bridgesLength) {
      revert IXERC20Factory_InvalidLength();
    }
    bytes32 _salt = keccak256(abi.encodePacked(_name, _symbol, msg.sender));
    bytes memory _creation = type(XERC20).creationCode;
    bytes memory _bytecode = abi.encodePacked(_creation, abi.encode(_name, _symbol, address(this), _initialSupply));

    _xerc20 = CREATE3.deploy(_salt, _bytecode, 0);

    EnumerableSet.add(_xerc20RegistryArray, _xerc20);

    for (uint256 _i; _i < _bridgesLength; ++_i) {
      XERC20(_xerc20).setLimits(_bridges[_i], _minterLimits[_i], _burnerLimits[_i]);
    }

    if (_initialSupply > 0) {
      XERC20(_xerc20).transfer(msg.sender, _initialSupply);
    }

    XERC20(_xerc20).transferOwnership(_owner != address(0) ? _owner : msg.sender);
  }

  /**
   * @notice Deploys an XERC20Lockbox contract using CREATE3
   *
   * @dev When deploying a lockbox for the gas token of the chain, then, the base token needs to be address(0)
   * @param _xerc20 The address of the xerc20 that you want to deploy a lockbox for
   * @param _baseToken The address of the base token that you want to lock
   * @param _isNative Whether or not the base token is the native (gas) token of the chain. Eg: MATIC for polygon chain
   * @return _lockbox The address of the lockbox
   */
  function _deployLockbox(
    address _xerc20,
    address _baseToken,
    bool _isNative
  ) internal returns (address payable _lockbox) {
    bytes32 _salt = keccak256(abi.encodePacked(_xerc20, _baseToken, msg.sender));
    bytes memory _creation = type(XERC20Lockbox).creationCode;
    bytes memory _bytecode = abi.encodePacked(_creation, abi.encode(_xerc20, _baseToken, _isNative));

    _lockbox = payable(CREATE3.deploy(_salt, _bytecode, 0));

    XERC20(_xerc20).setLockbox(address(_lockbox));
    EnumerableSet.add(_lockboxRegistryArray, _lockbox);
    _lockboxRegistry[_xerc20] = _lockbox;
  }
}

File 2 of 28 : XERC20.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.4 <0.9.0;

import {IXERC20} from '../interfaces/IXERC20.sol';
import {ERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {ERC20Permit} from '@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol';
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';

contract XERC20 is ERC20, Ownable, IXERC20, ERC20Permit {
  /**
   * @notice The duration it takes for the limits to fully replenish
   */
  uint256 private constant _DURATION = 1 days;

  /**
   * @notice The address of the factory which deployed this contract
   */
  address public immutable FACTORY;

  /**
   * @notice The address of the lockbox contract
   */
  address public lockbox;

  /**
   * @notice Maps bridge address to bridge configurations
   */
  mapping(address => Bridge) public bridges;

  /**
   * @notice Constructs the initial config of the XERC20
   *
   * @param _name The name of the token
   * @param _symbol The symbol of the token
   * @param _factory The factory which deployed this contract
   * @param _factory The factory which deployed this contract
   * @param _initialSupply The initial supply of the token
   */
  constructor(
    string memory _name,
    string memory _symbol,
    address _factory,
    uint256 _initialSupply
  ) ERC20(_name, _symbol) ERC20Permit(_name) {
    _transferOwnership(_factory);

    if (_initialSupply > 0) {
      _mint(_factory, _initialSupply);
    }

    FACTORY = _factory;
  }

  /**
   * @notice Mints tokens for a user
   * @dev Can only be called by a bridge
   * @param _user The address of the user who needs tokens minted
   * @param _amount The amount of tokens being minted
   */
  function mint(address _user, uint256 _amount) public {
    _mintWithCaller(msg.sender, _user, _amount);
  }

  /**
   * @notice Burns tokens for a user
   * @dev Can only be called by a bridge
   * @param _user The address of the user who needs tokens burned
   * @param _amount The amount of tokens being burned
   */
  function burn(address _user, uint256 _amount) public {
    if (msg.sender != _user) {
      _spendAllowance(_user, msg.sender, _amount);
    }

    _burnWithCaller(msg.sender, _user, _amount);
  }

  /**
   * @notice Sets the lockbox address
   *
   * @param _lockbox The address of the lockbox
   */
  function setLockbox(address _lockbox) public {
    if (msg.sender != FACTORY) revert IXERC20_NotFactory();
    lockbox = _lockbox;

    emit LockboxSet(_lockbox);
  }

  /**
   * @notice Updates the limits of any bridge
   * @dev Can only be called by the owner
   * @param _bridge The address of the bridge we are setting the limits too
   * @param _mintingLimit The updated minting limit we are setting to the bridge
   * @param _burningLimit The updated burning limit we are setting to the bridge
   */
  function setLimits(address _bridge, uint256 _mintingLimit, uint256 _burningLimit) external onlyOwner {
    _setLimits(_bridge, _mintingLimit, _burningLimit);
  }

  /**
   * @notice Updates the limits of many bridges
   * @dev Can only be called by the owner
   * @param _bridges The address of the bridge we are setting the limits too
   * @param _mintingLimits The updated minting limit we are setting to the bridge
   * @param _burningLimits The updated burning limit we are setting to the bridge
   */
  function setLimitsBatch(
    address[] memory _bridges,
    uint256[] memory _mintingLimits,
    uint256[] memory _burningLimits
  ) external onlyOwner {
    if (_bridges.length != _mintingLimits.length || _bridges.length != _burningLimits.length) {
      revert IXERC20_InvalidLength();
    }
    for (uint256 _i = 0; _i < _bridges.length; _i++) {
      _setLimits(_bridges[_i], _mintingLimits[_i], _burningLimits[_i]);
    }
  }

  /**
   * @notice Returns the max limit of a bridge
   *
   * @param _bridge the bridge we are viewing the limits of
   * @return _limit The limit the bridge has
   */
  function mintingMaxLimitOf(address _bridge) public view returns (uint256 _limit) {
    _limit = bridges[_bridge].minterParams.maxLimit;
  }

  /**
   * @notice Returns the max limit of a bridge
   *
   * @param _bridge the bridge we are viewing the limits of
   * @return _limit The limit the bridge has
   */
  function burningMaxLimitOf(address _bridge) public view returns (uint256 _limit) {
    _limit = bridges[_bridge].burnerParams.maxLimit;
  }

  /**
   * @notice Returns the current limit of a bridge
   *
   * @param _bridge the bridge we are viewing the limits of
   * @return _limit The limit the bridge has
   */
  function mintingCurrentLimitOf(address _bridge) public view returns (uint256 _limit) {
    _limit = _getCurrentLimit(
      bridges[_bridge].minterParams.currentLimit,
      bridges[_bridge].minterParams.maxLimit,
      bridges[_bridge].minterParams.timestamp,
      bridges[_bridge].minterParams.ratePerSecond
    );
  }

  /**
   * @notice Returns the current limit of a bridge
   *
   * @param _bridge the bridge we are viewing the limits of
   * @return _limit The limit the bridge has
   */
  function burningCurrentLimitOf(address _bridge) public view returns (uint256 _limit) {
    _limit = _getCurrentLimit(
      bridges[_bridge].burnerParams.currentLimit,
      bridges[_bridge].burnerParams.maxLimit,
      bridges[_bridge].burnerParams.timestamp,
      bridges[_bridge].burnerParams.ratePerSecond
    );
  }

  /**
   * @notice Updates the limits of any bridge
   * @param _mintingLimit The updated minting limit we are setting to the bridge
   * @param _burningLimit The updated burning limit we are setting to the bridge
   * @param _bridge The address of the bridge we are setting the limits too
   */
  function _setLimits(address _bridge, uint256 _mintingLimit, uint256 _burningLimit) internal {
    if (_mintingLimit > (type(uint256).max / 2) || _burningLimit > (type(uint256).max / 2)) {
      revert IXERC20_LimitsTooHigh();
    }

    _changeMinterLimit(_bridge, _mintingLimit);
    _changeBurnerLimit(_bridge, _burningLimit);
    emit BridgeLimitsSet(_mintingLimit, _burningLimit, _bridge);
  }

  /**
   * @notice Uses the limit of any bridge
   * @param _bridge The address of the bridge who is being changed
   * @param _change The change in the limit
   */
  function _useMinterLimits(address _bridge, uint256 _change) internal {
    uint256 _currentLimit = mintingCurrentLimitOf(_bridge);
    bridges[_bridge].minterParams.timestamp = block.timestamp;
    bridges[_bridge].minterParams.currentLimit = _currentLimit - _change;
  }

  /**
   * @notice Uses the limit of any bridge
   * @param _bridge The address of the bridge who is being changed
   * @param _change The change in the limit
   */
  function _useBurnerLimits(address _bridge, uint256 _change) internal {
    uint256 _currentLimit = burningCurrentLimitOf(_bridge);
    bridges[_bridge].burnerParams.timestamp = block.timestamp;
    bridges[_bridge].burnerParams.currentLimit = _currentLimit - _change;
  }

  /**
   * @notice Updates the limit of any bridge
   * @dev Can only be called by the owner
   * @param _bridge The address of the bridge we are setting the limit too
   * @param _limit The updated limit we are setting to the bridge
   */
  function _changeMinterLimit(address _bridge, uint256 _limit) internal {
    uint256 _oldLimit = bridges[_bridge].minterParams.maxLimit;
    uint256 _currentLimit = mintingCurrentLimitOf(_bridge);
    bridges[_bridge].minterParams.maxLimit = _limit;

    bridges[_bridge].minterParams.currentLimit = _calculateNewCurrentLimit(_limit, _oldLimit, _currentLimit);

    bridges[_bridge].minterParams.ratePerSecond = _limit / _DURATION;
    bridges[_bridge].minterParams.timestamp = block.timestamp;
  }

  /**
   * @notice Updates the limit of any bridge
   * @dev Can only be called by the owner
   * @param _bridge The address of the bridge we are setting the limit too
   * @param _limit The updated limit we are setting to the bridge
   */
  function _changeBurnerLimit(address _bridge, uint256 _limit) internal {
    uint256 _oldLimit = bridges[_bridge].burnerParams.maxLimit;
    uint256 _currentLimit = burningCurrentLimitOf(_bridge);
    bridges[_bridge].burnerParams.maxLimit = _limit;

    bridges[_bridge].burnerParams.currentLimit = _calculateNewCurrentLimit(_limit, _oldLimit, _currentLimit);

    bridges[_bridge].burnerParams.ratePerSecond = _limit / _DURATION;
    bridges[_bridge].burnerParams.timestamp = block.timestamp;
  }

  /**
   * @notice Updates the current limit
   *
   * @param _limit The new limit
   * @param _oldLimit The old limit
   * @param _currentLimit The current limit
   * @return _newCurrentLimit The new current limit
   */
  function _calculateNewCurrentLimit(
    uint256 _limit,
    uint256 _oldLimit,
    uint256 _currentLimit
  ) internal pure returns (uint256 _newCurrentLimit) {
    uint256 _difference;

    if (_oldLimit > _limit) {
      _difference = _oldLimit - _limit;
      _newCurrentLimit = _currentLimit > _difference ? _currentLimit - _difference : 0;
    } else {
      _difference = _limit - _oldLimit;
      _newCurrentLimit = _currentLimit + _difference;
    }
  }

  /**
   * @notice Gets the current limit
   *
   * @param _currentLimit The current limit
   * @param _maxLimit The max limit
   * @param _timestamp The timestamp of the last update
   * @param _ratePerSecond The rate per second
   * @return _limit The current limit
   */
  function _getCurrentLimit(
    uint256 _currentLimit,
    uint256 _maxLimit,
    uint256 _timestamp,
    uint256 _ratePerSecond
  ) internal view returns (uint256 _limit) {
    _limit = _currentLimit;
    if (_limit == _maxLimit) {
      return _limit;
    } else if (_timestamp + _DURATION <= block.timestamp) {
      _limit = _maxLimit;
    } else if (_timestamp + _DURATION > block.timestamp) {
      uint256 _timePassed = block.timestamp - _timestamp;
      uint256 _calculatedLimit = _limit + (_timePassed * _ratePerSecond);
      _limit = _calculatedLimit > _maxLimit ? _maxLimit : _calculatedLimit;
    }
  }

  /**
   * @notice Internal function for burning tokens
   *
   * @param _caller The caller address
   * @param _user The user address
   * @param _amount The amount to burn
   */
  function _burnWithCaller(address _caller, address _user, uint256 _amount) internal {
    if (_caller != lockbox) {
      uint256 _currentLimit = burningCurrentLimitOf(_caller);
      if (_currentLimit < _amount) revert IXERC20_NotHighEnoughLimits();
      _useBurnerLimits(_caller, _amount);
    }
    _burn(_user, _amount);
  }

  /**
   * @notice Internal function for minting tokens
   *
   * @param _caller The caller address
   * @param _user The user address
   * @param _amount The amount to mint
   */
  function _mintWithCaller(address _caller, address _user, uint256 _amount) internal {
    if (_caller != lockbox) {
      uint256 _currentLimit = mintingCurrentLimitOf(_caller);
      if (_currentLimit < _amount) revert IXERC20_NotHighEnoughLimits();
      _useMinterLimits(_caller, _amount);
    }
    _mint(_user, _amount);
  }
}

File 3 of 28 : IXERC20Factory.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.4 <0.9.0;

interface IXERC20Factory {
  /**
   * @notice Emitted when a new XERC20 is deployed
   *
   * @param _xerc20 The address of the xerc20
   */
  event XERC20Deployed(address _xerc20);

  /**
   * @notice Emitted when a new XERC20Lockbox is deployed
   *
   * @param _lockbox The address of the lockbox
   */
  event LockboxDeployed(address _lockbox);

  /**
   * @notice Reverts when a non-owner attempts to call
   */
  error IXERC20Factory_NotOwner();

  /**
   * @notice Reverts when a lockbox is trying to be deployed from a malicious address
   */
  error IXERC20Factory_BadTokenAddress();

  /**
   * @notice Reverts when a lockbox is already deployed
   */
  error IXERC20Factory_LockboxAlreadyDeployed();

  /**
   * @notice Reverts when a the length of arrays sent is incorrect
   */
  error IXERC20Factory_InvalidLength();

  /**
   * @notice Deploys an XERC20 contract using CREATE3
   * @dev _limits and _minters must be the same length
   * @param _name The name of the token
   * @param _symbol The symbol of the token
   * @param _minterLimits The array of minter limits that you are adding (optional, can be an empty array)
   * @param _burnerLimits The array of burning limits that you are adding (optional, can be an empty array)
   * @param _bridges The array of burners that you are adding (optional, can be an empty array)
   * @param _initialSupply The initial supply of the token
   * @param _owner The owner of the token, zero address if the owner is the sender
   * @return _xerc20 The address of the xerc20
   */
  function deployXERC20(
    string memory _name,
    string memory _symbol,
    uint256[] memory _minterLimits,
    uint256[] memory _burnerLimits,
    address[] memory _bridges,
    uint256 _initialSupply,
    address _owner
  ) external returns (address _xerc20);

  /**
   * @notice Deploys an XERC20Lockbox contract using CREATE3
   *
   * @param _xerc20 The address of the xerc20 that you want to deploy a lockbox for
   * @param _baseToken The address of the base token that you want to lock
   * @param _isNative Whether or not the base token is native
   * @return _lockbox The address of the lockbox
   */
  function deployLockbox(
    address _xerc20,
    address _baseToken,
    bool _isNative
  ) external returns (address payable _lockbox);
}

File 4 of 28 : XERC20Lockbox.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.4 <0.9.0;

import {IXERC20} from '../interfaces/IXERC20.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import {SafeCast} from '@openzeppelin/contracts/utils/math/SafeCast.sol';
import {IXERC20Lockbox} from '../interfaces/IXERC20Lockbox.sol';

contract XERC20Lockbox is IXERC20Lockbox {
  using SafeERC20 for IERC20;
  using SafeCast for uint256;

  /**
   * @notice The XERC20 token of this contract
   */
  IXERC20 public immutable XERC20;

  /**
   * @notice The ERC20 token of this contract
   */
  IERC20 public immutable ERC20;

  /**
   * @notice Whether the ERC20 token is the native gas token of this chain
   */
  bool public immutable IS_NATIVE;

  /**
   * @notice Constructor
   *
   * @param _xerc20 The address of the XERC20 contract
   * @param _erc20 The address of the ERC20 contract
   * @param _isNative Whether the ERC20 token is the native gas token of this chain or not
   */
  constructor(address _xerc20, address _erc20, bool _isNative) {
    XERC20 = IXERC20(_xerc20);
    ERC20 = IERC20(_erc20);
    IS_NATIVE = _isNative;
  }

  /**
   * @notice Deposit native tokens into the lockbox
   */
  function depositNative() public payable {
    if (!IS_NATIVE) revert IXERC20Lockbox_NotNative();

    _deposit(msg.sender, msg.value);
  }

  /**
   * @notice Deposit ERC20 tokens into the lockbox
   *
   * @param _amount The amount of tokens to deposit
   */
  function deposit(uint256 _amount) external {
    if (IS_NATIVE) revert IXERC20Lockbox_Native();

    _deposit(msg.sender, _amount);
  }

  /**
   * @notice Deposit ERC20 tokens into the lockbox, and send the XERC20 to a user
   *
   * @param _to The user to send the XERC20 to
   * @param _amount The amount of tokens to deposit
   */
  function depositTo(address _to, uint256 _amount) external {
    if (IS_NATIVE) revert IXERC20Lockbox_Native();

    _deposit(_to, _amount);
  }

  /**
   * @notice Deposit the native asset into the lockbox, and send the XERC20 to a user
   *
   * @param _to The user to send the XERC20 to
   */
  function depositNativeTo(address _to) public payable {
    if (!IS_NATIVE) revert IXERC20Lockbox_NotNative();

    _deposit(_to, msg.value);
  }

  /**
   * @notice Withdraw ERC20 tokens from the lockbox
   *
   * @param _amount The amount of tokens to withdraw
   */
  function withdraw(uint256 _amount) external {
    _withdraw(msg.sender, _amount);
  }

  /**
   * @notice Withdraw tokens from the lockbox
   *
   * @param _to The user to withdraw to
   * @param _amount The amount of tokens to withdraw
   */
  function withdrawTo(address _to, uint256 _amount) external {
    _withdraw(_to, _amount);
  }

  /**
   * @notice Withdraw tokens from the lockbox
   *
   * @param _to The user to withdraw to
   * @param _amount The amount of tokens to withdraw
   */
  function _withdraw(address _to, uint256 _amount) internal {
    emit Withdraw(_to, _amount);

    XERC20.burn(msg.sender, _amount);

    if (IS_NATIVE) {
      (bool _success,) = payable(_to).call{value: _amount}('');
      if (!_success) revert IXERC20Lockbox_WithdrawFailed();
    } else {
      ERC20.safeTransfer(_to, _amount);
    }
  }

  /**
   * @notice Deposit tokens into the lockbox
   *
   * @param _to The address to send the XERC20 to
   * @param _amount The amount of tokens to deposit
   */
  function _deposit(address _to, uint256 _amount) internal {
    if (!IS_NATIVE) {
      ERC20.safeTransferFrom(msg.sender, address(this), _amount);
    }

    XERC20.mint(_to, _amount);
    emit Deposit(_to, _amount);
  }

  /**
   * @notice Fallback function to deposit native tokens
   */
  receive() external payable {
    depositNative();
  }
}

File 5 of 28 : CREATE3.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {Bytes32AddressLib} from "./Bytes32AddressLib.sol";

/// @notice Deploy to deterministic addresses without an initcode factor.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/CREATE3.sol)
/// @author Modified from 0xSequence (https://github.com/0xSequence/create3/blob/master/contracts/Create3.sol)
library CREATE3 {
    using Bytes32AddressLib for bytes32;

    //--------------------------------------------------------------------------------//
    // Opcode     | Opcode + Arguments    | Description      | Stack View             //
    //--------------------------------------------------------------------------------//
    // 0x36       |  0x36                 | CALLDATASIZE     | size                   //
    // 0x3d       |  0x3d                 | RETURNDATASIZE   | 0 size                 //
    // 0x3d       |  0x3d                 | RETURNDATASIZE   | 0 0 size               //
    // 0x37       |  0x37                 | CALLDATACOPY     |                        //
    // 0x36       |  0x36                 | CALLDATASIZE     | size                   //
    // 0x3d       |  0x3d                 | RETURNDATASIZE   | 0 size                 //
    // 0x34       |  0x34                 | CALLVALUE        | value 0 size           //
    // 0xf0       |  0xf0                 | CREATE           | newContract            //
    //--------------------------------------------------------------------------------//
    // Opcode     | Opcode + Arguments    | Description      | Stack View             //
    //--------------------------------------------------------------------------------//
    // 0x67       |  0x67XXXXXXXXXXXXXXXX | PUSH8 bytecode   | bytecode               //
    // 0x3d       |  0x3d                 | RETURNDATASIZE   | 0 bytecode             //
    // 0x52       |  0x52                 | MSTORE           |                        //
    // 0x60       |  0x6008               | PUSH1 08         | 8                      //
    // 0x60       |  0x6018               | PUSH1 18         | 24 8                   //
    // 0xf3       |  0xf3                 | RETURN           |                        //
    //--------------------------------------------------------------------------------//
    bytes internal constant PROXY_BYTECODE = hex"67_36_3d_3d_37_36_3d_34_f0_3d_52_60_08_60_18_f3";

    bytes32 internal constant PROXY_BYTECODE_HASH = keccak256(PROXY_BYTECODE);

    function deploy(
        bytes32 salt,
        bytes memory creationCode,
        uint256 value
    ) internal returns (address deployed) {
        bytes memory proxyChildBytecode = PROXY_BYTECODE;

        address proxy;
        assembly {
            // Deploy a new contract with our pre-made bytecode via CREATE2.
            // We start 32 bytes into the code to avoid copying the byte length.
            proxy := create2(0, add(proxyChildBytecode, 32), mload(proxyChildBytecode), salt)
        }
        require(proxy != address(0), "DEPLOYMENT_FAILED");

        deployed = getDeployed(salt);
        (bool success, ) = proxy.call{value: value}(creationCode);
        require(success && deployed.code.length != 0, "INITIALIZATION_FAILED");
    }

    function getDeployed(bytes32 salt) internal view returns (address) {
        address proxy = keccak256(
            abi.encodePacked(
                // Prefix:
                bytes1(0xFF),
                // Creator:
                address(this),
                // Salt:
                salt,
                // Bytecode hash:
                PROXY_BYTECODE_HASH
            )
        ).fromLast20Bytes();

        return
            keccak256(
                abi.encodePacked(
                    // 0xd6 = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x01)
                    // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex)
                    hex"d6_94",
                    proxy,
                    hex"01" // Nonce of the proxy contract (1)
                )
            ).fromLast20Bytes();
    }
}

File 6 of 28 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 7 of 28 : IXERC20.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.4 <0.9.0;

interface IXERC20 {
  /**
   * @notice Emits when a lockbox is set
   *
   * @param _lockbox The address of the lockbox
   */
  event LockboxSet(address _lockbox);

  /**
   * @notice Emits when a limit is set
   *
   * @param _mintingLimit The updated minting limit we are setting to the bridge
   * @param _burningLimit The updated burning limit we are setting to the bridge
   * @param _bridge The address of the bridge we are setting the limit too
   */
  event BridgeLimitsSet(uint256 _mintingLimit, uint256 _burningLimit, address indexed _bridge);

  /**
   * @notice Reverts when a user with too low of a limit tries to call mint/burn
   */
  error IXERC20_NotHighEnoughLimits();

  /**
   * @notice Reverts when caller is not the factory
   */
  error IXERC20_NotFactory();

  /**
   * @notice Reverts when limits are too high
   */
  error IXERC20_LimitsTooHigh();

  /**
   * @notice Reverts when a the length of arrays sent is incorrect
   */
  error IXERC20_InvalidLength();

  /**
   * @notice Contains the full minting and burning data for a particular bridge
   *
   * @param minterParams The minting parameters for the bridge
   * @param burnerParams The burning parameters for the bridge
   */
  struct Bridge {
    BridgeParameters minterParams;
    BridgeParameters burnerParams;
  }

  /**
   * @notice Contains the mint or burn parameters for a bridge
   *
   * @param timestamp The timestamp of the last mint/burn
   * @param ratePerSecond The rate per second of the bridge
   * @param maxLimit The max limit of the bridge
   * @param currentLimit The current limit of the bridge
   */
  struct BridgeParameters {
    uint256 timestamp;
    uint256 ratePerSecond;
    uint256 maxLimit;
    uint256 currentLimit;
  }

  /**
   * @notice Sets the lockbox address
   *
   * @param _lockbox The address of the lockbox
   */
  function setLockbox(address _lockbox) external;

  /**
   * @notice Updates the limits of any bridge
   * @dev Can only be called by the owner
   * @param _mintingLimit The updated minting limit we are setting to the bridge
   * @param _burningLimit The updated burning limit we are setting to the bridge
   * @param _bridge The address of the bridge we are setting the limits too
   */
  function setLimits(address _bridge, uint256 _mintingLimit, uint256 _burningLimit) external;

  /**
   * @notice Returns the max limit of a minter
   *
   * @param _minter The minter we are viewing the limits of
   *  @return _limit The limit the minter has
   */
  function mintingMaxLimitOf(address _minter) external view returns (uint256 _limit);

  /**
   * @notice Returns the max limit of a bridge
   *
   * @param _bridge the bridge we are viewing the limits of
   * @return _limit The limit the bridge has
   */
  function burningMaxLimitOf(address _bridge) external view returns (uint256 _limit);

  /**
   * @notice Returns the current limit of a minter
   *
   * @param _minter The minter we are viewing the limits of
   * @return _limit The limit the minter has
   */
  function mintingCurrentLimitOf(address _minter) external view returns (uint256 _limit);

  /**
   * @notice Returns the current limit of a bridge
   *
   * @param _bridge the bridge we are viewing the limits of
   * @return _limit The limit the bridge has
   */
  function burningCurrentLimitOf(address _bridge) external view returns (uint256 _limit);

  /**
   * @notice Mints tokens for a user
   * @dev Can only be called by a minter
   * @param _user The address of the user who needs tokens minted
   * @param _amount The amount of tokens being minted
   */
  function mint(address _user, uint256 _amount) external;

  /**
   * @notice Burns tokens for a user
   * @dev Can only be called by a minter
   * @param _user The address of the user who needs tokens burned
   * @param _amount The amount of tokens being burned
   */
  function burn(address _user, uint256 _amount) external;
}

File 8 of 28 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}

File 9 of 28 : ERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)

pragma solidity ^0.8.0;

import "./IERC20Permit.sol";
import "../ERC20.sol";
import "../../../utils/cryptography/ECDSA.sol";
import "../../../utils/cryptography/EIP712.sol";
import "../../../utils/Counters.sol";

/**
 * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private constant _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    /**
     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.
     * However, to ensure consistency with the upgradeable transpiler, we will continue
     * to reserve a slot.
     * @custom:oz-renamed-from _PERMIT_TYPEHASH
     */
    // solhint-disable-next-line var-name-mixedcase
    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSA.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

File 10 of 28 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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 Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _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);
    }
}

File 11 of 28 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 12 of 28 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 13 of 28 : IXERC20Lockbox.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.4 <0.9.0;

interface IXERC20Lockbox {
  /**
   * @notice Emitted when tokens are deposited into the lockbox
   *
   * @param _sender The address of the user who deposited
   * @param _amount The amount of tokens deposited
   */
  event Deposit(address _sender, uint256 _amount);

  /**
   * @notice Emitted when tokens are withdrawn from the lockbox
   *
   * @param _sender The address of the user who withdrew
   * @param _amount The amount of tokens withdrawn
   */
  event Withdraw(address _sender, uint256 _amount);

  /**
   * @notice Reverts when a user tries to deposit native tokens on a non-native lockbox
   */
  error IXERC20Lockbox_NotNative();

  /**
   * @notice Reverts when a user tries to deposit non-native tokens on a native lockbox
   */
  error IXERC20Lockbox_Native();

  /**
   * @notice Reverts when a user tries to withdraw and the call fails
   */
  error IXERC20Lockbox_WithdrawFailed();

  /**
   * @notice Deposit ERC20 tokens into the lockbox
   *
   * @param _amount The amount of tokens to deposit
   */
  function deposit(uint256 _amount) external;

  /**
   * @notice Deposit ERC20 tokens into the lockbox, and send the XERC20 to a user
   *
   * @param _user The user to send the XERC20 to
   * @param _amount The amount of tokens to deposit
   */
  function depositTo(address _user, uint256 _amount) external;

  /**
   * @notice Deposit the native asset into the lockbox, and send the XERC20 to a user
   *
   * @param _user The user to send the XERC20 to
   */
  function depositNativeTo(address _user) external payable;

  /**
   * @notice Withdraw ERC20 tokens from the lockbox
   *
   * @param _amount The amount of tokens to withdraw
   */
  function withdraw(uint256 _amount) external;

  /**
   * @notice Withdraw ERC20 tokens from the lockbox
   *
   * @param _user The user to withdraw to
   * @param _amount The amount of tokens to withdraw
   */
  function withdrawTo(address _user, uint256 _amount) external;
}

File 14 of 28 : Bytes32AddressLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Library for converting between addresses and bytes32 values.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/Bytes32AddressLib.sol)
library Bytes32AddressLib {
    function fromLast20Bytes(bytes32 bytesValue) internal pure returns (address) {
        return address(uint160(uint256(bytesValue)));
    }

    function fillLast12Bytes(address addressValue) internal pure returns (bytes32) {
        return bytes32(bytes20(addressValue));
    }
}

File 15 of 28 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

File 16 of 28 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 17 of 28 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 18 of 28 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 19 of 28 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

File 20 of 28 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}

File 21 of 28 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 22 of 28 : Address.sol
// 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 Address {
    /**
     * @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);
        }
    }
}

File 23 of 28 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 24 of 28 : ShortStrings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

File 25 of 28 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

File 26 of 28 : Math.sol
// 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);
        }
    }
}

File 27 of 28 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 28 of 28 : StorageSlot.sol
// 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 StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/ds-test/src/",
    "prb/test/=lib/prb-test/src/",
    "forge-std/=lib/forge-std/src/",
    "isolmate/=lib/isolmate/src/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "permit2/=lib/permit2/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-gas-snapshot/=lib/permit2/lib/forge-gas-snapshot/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "prb-test/=lib/prb-test/src/",
    "solmate/=lib/permit2/lib/solmate/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract ABI

[{"inputs":[],"name":"IXERC20Factory_BadTokenAddress","type":"error"},{"inputs":[],"name":"IXERC20Factory_InvalidLength","type":"error"},{"inputs":[],"name":"IXERC20Factory_LockboxAlreadyDeployed","type":"error"},{"inputs":[],"name":"IXERC20Factory_NotOwner","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_lockbox","type":"address"}],"name":"LockboxDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_xerc20","type":"address"}],"name":"XERC20Deployed","type":"event"},{"inputs":[{"internalType":"address","name":"_xerc20","type":"address"},{"internalType":"address","name":"_baseToken","type":"address"},{"internalType":"bool","name":"_isNative","type":"bool"}],"name":"deployLockbox","outputs":[{"internalType":"address payable","name":"_lockbox","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256[]","name":"_minterLimits","type":"uint256[]"},{"internalType":"uint256[]","name":"_burnerLimits","type":"uint256[]"},{"internalType":"address[]","name":"_bridges","type":"address[]"},{"internalType":"uint256","name":"_initialSupply","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"name":"deployXERC20","outputs":[{"internalType":"address","name":"_xerc20","type":"address"}],"stateMutability":"nonpayable","type":"function"}]

60808060405234610016576148b6908161001c8239f35b600080fdfe608080604052600490813610156200001657600080fd5b6000803560e01c928363601bfce714620000435750505063e8d6fa5a146200003d57600080fd5b6200055c565b34620002dc5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620002dc578035906200008282620002e0565b602435926200009184620002e0565b60443594620000a08662000315565b73ffffffffffffffffffffffffffffffffffffffff9081861615878180620002d2575b8215620002b5575b50506200028e577f8da5cb5b00000000000000000000000000000000000000000000000000000000815260208185818589165afa92831562000288579262000251575b503391160362000229576200017e620001656200014b8473ffffffffffffffffffffffffffffffffffffffff166000526000602052604060002090565b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b6200020157620001fd6200019485858562000a76565b60405173ffffffffffffffffffffffffffffffffffffffff821681527f8f55df877018036ba60e0c8d614d17acb62151f4ef20eca328d017e53e9afe0b90602090a160405173ffffffffffffffffffffffffffffffffffffffff90911681529081906020820190565b0390f35b6040517f32a2e634000000000000000000000000000000000000000000000000000000008152fd5b6040517f15e0db8e000000000000000000000000000000000000000000000000000000008152fd5b620002779192506020903d6020116200027f575b62000270826200034f565b016200065f565b90866200010e565b3d915062000265565b6200069b565b807f10968fb400000000000000000000000000000000000000000000000000000000859252fd5b90915081620002c8575b508789620000cb565b90501588620002bf565b81159250620000c3565b5080fd5b73ffffffffffffffffffffffffffffffffffffffff811603620002ff57565b600080fd5b60c435906200031382620002e0565b565b80151503620002ff57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f601f199101166080016080811067ffffffffffffffff8211176200037457604052565b62000320565b67ffffffffffffffff81116200037457604052565b6080810190811067ffffffffffffffff8211176200037457604052565b6040810190811067ffffffffffffffff8211176200037457604052565b90601f601f19910116810190811067ffffffffffffffff8211176200037457604052565b90620003136040519283620003c9565b67ffffffffffffffff81116200037457601f01601f191660200190565b81601f82011215620002ff578035906200043482620003fd565b92620004446040519485620003c9565b82845260208383010111620002ff57816000926020809301838601378301015290565b67ffffffffffffffff8111620003745760051b60200190565b9080601f83011215620002ff5760209082356200049d8162000467565b93620004ad6040519586620003c9565b81855260208086019260051b820101928311620002ff57602001905b828210620004d8575050505090565b81358152908301908301620004c9565b9080601f83011215620002ff576020908235620005058162000467565b93620005156040519586620003c9565b81855260208086019260051b820101928311620002ff57602001905b82821062000540575050505090565b83809183356200055081620002e0565b81520191019062000531565b34620002ff5760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620002ff5767ffffffffffffffff60048035828111620002ff57620005b190369083016200041a565b602435838111620002ff57620005cb90369084016200041a565b90604435848111620002ff57620005e6903690850162000480565b606435858111620002ff5762000600903690860162000480565b608435958611620002ff57620006226200063895620001fd97369101620004e8565b916200062d62000304565b9460a43594620006a7565b60405173ffffffffffffffffffffffffffffffffffffffff90911681529081906020820190565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff806020910112620002ff576080516200069881620002e0565b90565b6040513d6000823e3d90fd5b96959291939485518086511480159062000a20575b620009f657620007726200075860409a6200076c8c518d6200075f6020998a926200074a84860186620006f233868c8562000c9c565b039662000708601f1998898101835282620003c9565b519020976200073d8d612b439762000722818a01620003ed565b98808a5262001182828b013985519687943092860162000d1d565b03868101845283620003c9565b519687938c85019062000a51565b9062000a51565b03908101845283620003c9565b62000eb4565b9573ffffffffffffffffffffffffffffffffffffffff9485881698620007988a62001089565b5060005b8481106200091b575050505050806200089c575b50508116156200089357915b803b15620002ff5784517ff2fde38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9390931660048401526000908390602490829084905af190811562000288577fb2d2c1a40f75a86848f6e380ec14bfa3648bd79422df7a4645e184d5aac8b0f492620008709262000875575b50935173ffffffffffffffffffffffffffffffffffffffff851681529081906020820190565b0390a1565b80620008856200088c926200037a565b8062000a6a565b386200084a565b503391620007bc565b87517fa9059cbb0000000000000000000000000000000000000000000000000000000081523360048201526024810191909152818160448160008a5af18015620002885715620007b057816200090a92903d1062000913575b620009018183620003c9565b81019062000db6565b503880620007b0565b503d620008f5565b620009456200092b828462000d9b565b5173ffffffffffffffffffffffffffffffffffffffff1690565b9062000952818662000d9b565b516200095f828662000d9b565b518d3b15620002ff578f517fa08d565400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9094166004850152602484019190915260448301526000828d8183816064810103925af19182156200028857600192620009df575b50016200079c565b8062000885620009ef926200037a565b38620009d7565b60046040517f932db747000000000000000000000000000000000000000000000000000000008152fd5b508084511415620006bc565b60005b83811062000a405750506000910152565b818101518382015260200162000a2f565b9062000a666020928281519485920162000a2c565b0190565b6000910312620002ff57565b92916200075862000b83926200076c6200016593604051906200075f602083018362000ae78c88339185919092603c937fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009283809260601b16855260601b16601484015260601b1660288201520190565b039362000afd601f1995868101835282620003c9565b5190209462000b728b62000b65610bbc9562000b1c60208801620003ed565b9680885262003cc5602089013960405194859360208501919392604091606084019573ffffffffffffffffffffffffffffffffffffffff80921685521660208401521515910152565b03858101835282620003c9565b604051968793602085019062000a51565b9173ffffffffffffffffffffffffffffffffffffffff9081811691841690823b15620002ff576040517f435350b700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152926000908490602490829084905af19081156200028857620003139362000c459262000c85575b5062000c1e8362001108565b5073ffffffffffffffffffffffffffffffffffffffff166000526000602052604060002090565b9073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b806200088562000c95926200037a565b3862000c12565b6014939262000cea6020809362000cdb7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000968281519485920162000a2c565b01918281519485920162000a2c565b019160601b1681520190565b90601f19601f60209362000d168151809281875287808801910162000a2c565b0116010190565b9062000d6160609362000d5273ffffffffffffffffffffffffffffffffffffffff939897969860808652608086019062000cf6565b90848203602086015262000cf6565b951660408201520152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b805182101562000db05760209160051b010190565b62000d6c565b90816020910312620002ff5751620006988162000315565b604051906040820182811067ffffffffffffffff8211176200037457604052601082527f67363d3d37363d34f03d5260086018f3000000000000000000000000000000006020830152565b3d1562000e49573d9062000e2d82620003fd565b9162000e3d6040519384620003c9565b82523d6000602084013e565b606090565b1562000e5657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f494e495449414c495a4154494f4e5f4641494c454400000000000000000000006044820152fd5b919062000ec062000dce565b9280845160208096016000f59073ffffffffffffffffffffffffffffffffffffffff8216156200102b5791600092918362000ffb819462000f0062000dce565b898151910120604051908a8201927fff0000000000000000000000000000000000000000000000000000000000000084523060601b6021840152603583015260558201526055815262000f53816200038f565b5190206040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008a8201927fd694000000000000000000000000000000000000000000000000000000000000845260601b1660228201527f010000000000000000000000000000000000000000000000000000000000000060368201526017815262000fdf81620003ac565b51902073ffffffffffffffffffffffffffffffffffffffff1690565b9683519301915af16200100d62000e19565b508062001020575b620003139062000e4e565b50813b151562001015565b606485604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152601160248201527f4445504c4f594d454e545f4641494c45440000000000000000000000000000006044820152fd5b806000526004602052604060002054156000146200110257600354680100000000000000008110156200037457600181018060035581101562000db05781907fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0155600354906000526004602052604060002055600190565b50600090565b806000526002602052604060002054156000146200110257600154680100000000000000008110156200037457600181018060015581101562000db05781907fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6015560015490600052600260205260406000205560019056fe6101806040818152346200053f5762002b43803803809162000022828662000544565b843982016080838203126200053f5782516001600160401b0392908381116200053f5782620000539186016200058d565b9060209283860151908582116200053f57620000719187016200058d565b81860151909590936001600160a01b038516918286036200053f5760600151835197848901898110898211176200043e578552600197888a52838a0198603160f81b8a528751908282116200043e5760038054928284811c9416801562000534575b888510146200051e57601f93848111620004d3575b508088858211600114620004605760009162000454575b5060001982841b1c191690831b1781555b8451908482116200043e5760049586548481811c9116801562000433575b8a8210146200041e57858111620003d3575b50889085841160011462000368579383949184926000956200035c575b50501b92600019911b1c19161783555b6200017833620005e8565b620001838862000631565b996101209a8b52620001958c620007d9565b98610140998a528681519101209b8c60e052519020906101009b828d524660a052885192878401917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f83528a85015260608401524660808401523060a084015260a0835260c0830193838510908511176200034757838952825190206080523060c052620002238a620005e8565b846200028d575b505050505050506101609283525192612212948562000931863960805185611a93015260a05185611b5f015260c05185611a64015260e05185611ae201525184611b0801525183610bf001525182610c1a015251818181610ec2015261116e0152f35b8615620003065750505060025490828201809211620002f1575060025560008381528083528481208054830190558451918252917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a3388080808080806200022a565b601190634e487b7160e01b6000525260246000fd5b610104606493927f45524332303a206d696e7420746f20746865207a65726f206164647265737300928862461bcd60e51b865260c483015260e48201520152fd5b604185634e487b7160e01b6000525260246000fd5b0151935038806200015d565b9190601f1984169288600052848b6000209460005b8d89838310620003bb5750505010620003a0575b50505050811b0183556200016d565b01519060f884600019921b161c191690553880808062000391565b8686015189559097019694850194889350016200037d565b87600052896000208680860160051c8201928c871062000414575b0160051c019085905b8281106200040757505062000140565b60008155018590620003f7565b92508192620003ee565b602288634e487b7160e01b6000525260246000fd5b90607f16906200012e565b634e487b7160e01b600052604160045260246000fd5b90508b015138620000ff565b8492508c90601f198316856000528b600020928c6000915b838310620004b157505050831162000498575b5050811b01815562000110565b8d015160001983861b60f8161c1916905538806200048b565b948482949597989293960151815501940192019086949392918f8d9062000478565b82600052886000208580840160051c8201928b851062000514575b0160051c019084905b82811062000507575050620000e8565b60008155018490620004f7565b92508192620004ee565b634e487b7160e01b600052602260045260246000fd5b93607f1693620000d3565b600080fd5b601f909101601f19168101906001600160401b038211908210176200043e57604052565b60005b8381106200057c5750506000910152565b81810151838201526020016200056b565b81601f820112156200053f5780516001600160401b0381116200043e5760405192620005c4601f8301601f19166020018562000544565b818452602082840101116200053f57620005e5916020808501910162000568565b90565b600580546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b805160209081811015620006af5750601f8251116200066d57808251920151908083106200065e57501790565b82600019910360031b1b161790565b604490620006a19260405193849263305a27a960e01b84528060048501528251928391826024870152868601910162000568565b601f01601f19168101030190fd5b906001600160401b0382116200043e57600654926001938481811c91168015620007ce575b838210146200051e57601f811162000794575b5081601f84116001146200072857509282939183926000946200071c575b50501b916000199060031b1c19161760065560ff90565b01519250388062000705565b919083601f198116600660005284600020946000905b888383106200077957505050106200075f575b505050811b0160065560ff90565b015160001960f88460031b161c1916905538808062000751565b8587015188559096019594850194879350908101906200073e565b600660005284601f84600020920160051c820191601f860160051c015b828110620007c1575050620006e7565b60008155018590620007b1565b90607f1690620006d4565b805160209081811015620008065750601f8251116200066d57808251920151908083106200065e57501790565b906001600160401b0382116200043e57600754926001938481811c9116801562000925575b838210146200051e57601f8111620008eb575b5081601f84116001146200087f575092829391839260009462000873575b50501b916000199060031b1c19161760075560ff90565b0151925038806200085c565b919083601f198116600760005284600020946000905b88838310620008d05750505010620008b6575b505050811b0160075560ff90565b015160001960f88460031b161c19169055388080620008a8565b85870151885590960195948501948793509081019062000895565b600760005284601f84600020920160051c820191601f860160051c015b828110620009185750506200083e565b6000815501859062000908565b90607f16906200082b56fe6080604081815260048036101561001557600080fd5b600092833560e01c90816306fdde031461124e57508063095ea7b3146112245780630c05f82c146111ee57806318160ddd146111cf57806323b872dd146111925780632dd3100014611141578063313ce567146111255780633644e5151461110857806339509351146110ac57806340c10f1914610f6a578063435350b714610e8f578063651fd26814610e6957806366cc570214610e3457806370a0823114610df1578063715018a614610d715780637ecebe0014610d2d57806384b0196e14610bd95780638da5cb5b14610ba457806395d89b4114610a97578063998955d314610a6a5780639dc29fac1461086f578063a08d56541461083d578063a457c2d714610770578063a9059cbb1461073f578063c1eb7137146106f8578063ced67f0c14610650578063d505accf14610455578063d5b4c456146102ca578063dd62ed3e146102705763f2fde38b1461016d57600080fd5b3461026c57602060031936011261026c576101866113a2565b9061018f611c12565b73ffffffffffffffffffffffffffffffffffffffff809216928315610203575050600554827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b5050346102c657806003193601126102c6578060209261028e6113a2565b6102966113ca565b73ffffffffffffffffffffffffffffffffffffffff91821683526001865283832091168252845220549051908152f35b5080fd5b509190346102c65760606003193601126102c657823567ffffffffffffffff9384821161045157366023830112156104515781810135610309816114bc565b9261031685519485611438565b8184526020916024602086019160051b8301019136831161044d57602401905b82821061041d57505050506024358581116104195761035890369083016114d4565b946044359081116104195761037090369083016114d4565b92610379611c12565b8251865181149081159161040d575b506103e7575050825b81518110156103e357806103dd73ffffffffffffffffffffffffffffffffffffffff6103bf60019486611645565b51166103cb8389611645565b516103d68488611645565b5191611e6f565b01610391565b8380f35b517ff0aa5bcf000000000000000000000000000000000000000000000000000000008152fd5b90508451141538610388565b8480fd5b813573ffffffffffffffffffffffffffffffffffffffff81168103610449578152908301908301610336565b8880fd5b8780fd5b8380fd5b508290346102c65760e06003193601126102c6576104716113a2565b6104796113ca565b906044359260643560843560ff8116810361064c578142116106095773ffffffffffffffffffffffffffffffffffffffff90818516928389526008602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff8211176105dd578b525190206105859161057d9161053c611a4d565b908c51917f190100000000000000000000000000000000000000000000000000000000000083526002830152602282015260c43591604260a4359220611fb5565b919091612051565b160361059a5750610597939450611688565b80f35b606490602087519162461bcd60e51b8352820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b60248b6041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60648360208a519162461bcd60e51b8352820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8680fd5b50903461026c57602060031936011261026c57806106d06106a96106f6936101009673ffffffffffffffffffffffffffffffffffffffff61068f6113a2565b168152600b60205220946106a286611479565b9501611479565b91518094606080918051845260208101516020850152604081015160408501520151910152565b80516080840152602081015160a0840152604081015160c08401526060015160e0830152565bf35b5050346102c65760206003193601126102c65760068160209373ffffffffffffffffffffffffffffffffffffffff61072e6113a2565b168152600b85522001549051908152f35b5050346102c657806003193601126102c65760209061076961075f6113a2565b602435903361188c565b5160018152f35b50823461083a578260031936011261083a5761078a6113a2565b918360243592338152600160205281812073ffffffffffffffffffffffffffffffffffffffff861682526020522054908282106107d1576020856107698585038733611688565b608490602086519162461bcd60e51b8352820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152fd5b80fd5b833461083a57606060031936011261083a5761059761085a6113a2565b610862611c12565b6044359060243590611e6f565b508290346102c657826003193601126102c65761088a6113a2565b906024359073ffffffffffffffffffffffffffffffffffffffff8084169383853303610a58575b5050600a541633036109ed575b82156109845782845283602052848420549082821061091b57508184957fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef936020938688528785520381872055816002540360025551908152a380f35b608490602087519162461bcd60e51b8352820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b608490602086519162461bcd60e51b8352820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b816109f733611604565b10610a3157610a1d82610a0933611604565b338752600b60205242848989200155611b85565b338552600b602052600786862001556108be565b84517f0b6842aa000000000000000000000000000000000000000000000000000000008152fd5b610a639133906117c9565b86836108b1565b5050346102c65760206003193601126102c657602090610a90610a8b6113a2565b611604565b9051908152f35b50903461026c578260031936011261026c578051838194908454610aba81611534565b9182855260209660019288600182169182600014610b5c575050600114610b01575b8588610afd89610aee848a0385611438565b51928284938452830190611344565b0390f35b815286935091907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b828410610b445750505082010181610aee610afd38610adc565b8054848a018601528895508794909301928101610b2a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168882015294151560051b87019094019450859350610aee9250610afd9150389050610adc565b5050346102c657816003193601126102c65760209073ffffffffffffffffffffffffffffffffffffffff600554169051908152f35b50903461026c578260031936011261026c57610c147f0000000000000000000000000000000000000000000000000000000000000000611c77565b92610c3e7f0000000000000000000000000000000000000000000000000000000000000000611daf565b90825192602092602085019585871067ffffffffffffffff881117610d015750926020610cb7838896610caa998b9996528686528151998a997f0f000000000000000000000000000000000000000000000000000000000000008b5260e0868c015260e08b0190611344565b91898303908a0152611344565b924660608801523060808801528460a088015286840360c088015251928381520193925b828110610cea57505050500390f35b835185528695509381019392810192600101610cdb565b8360416024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b5050346102c65760206003193601126102c6578060209273ffffffffffffffffffffffffffffffffffffffff610d616113a2565b1681526008845220549051908152f35b833461083a578060031936011261083a57610d8a611c12565b8073ffffffffffffffffffffffffffffffffffffffff6005547fffffffffffffffffffffffff00000000000000000000000000000000000000008116600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5050346102c65760206003193601126102c6578060209273ffffffffffffffffffffffffffffffffffffffff610e256113a2565b16815280845220549051908152f35b5050346102c657816003193601126102c65760209073ffffffffffffffffffffffffffffffffffffffff600a54169051908152f35b5050346102c65760206003193601126102c657602090610a90610e8a6113a2565b6115c3565b503461026c57602060031936011261026c57610ea96113a2565b73ffffffffffffffffffffffffffffffffffffffff91827f0000000000000000000000000000000000000000000000000000000000000000163303610f435750916020917ffa2e15ea41196e438f0593ecdd6036acd83bdfcd39d627b77c17eab43f376a39931690817fffffffffffffffffffffffff0000000000000000000000000000000000000000600a541617600a5551908152a180f35b83517f2029e525000000000000000000000000000000000000000000000000000000008152fd5b50903461026c578060031936011261026c57610f846113a2565b906024359173ffffffffffffffffffffffffffffffffffffffff9081600a54163303611042575b1692831561100057506020827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92610fe68795600254611587565b60025585855284835280852082815401905551908152a380f35b6020606492519162461bcd60e51b8352820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b8361104c336115c3565b10611084576110708461105e336115c3565b338952600b60205242868a2055611b85565b338752600b60205260038488200155610fab565b8483517f0b6842aa000000000000000000000000000000000000000000000000000000008152fd5b5050346102c657806003193601126102c6576107696020926111016110cf6113a2565b913381526001865284812073ffffffffffffffffffffffffffffffffffffffff84168252865284602435912054611587565b9033611688565b5050346102c657816003193601126102c657602090610a90611a4d565b5050346102c657816003193601126102c6576020905160128152f35b5050346102c657816003193601126102c6576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5050346102c65760606003193601126102c6576020906107696111b36113a2565b6111bb6113ca565b604435916111ca8333836117c9565b61188c565b5050346102c657816003193601126102c6576020906002549051908152f35b5050346102c65760206003193601126102c65760028160209373ffffffffffffffffffffffffffffffffffffffff61072e6113a2565b5050346102c657806003193601126102c6576020906107696112446113a2565b6024359033611688565b8484346102c657816003193601126102c657828260035461126e81611534565b90818452602095600191876001821691826000146112ff5750506001146112a3575b505050610afd9291610aee910385611438565b9190869350600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8284106112e75750505082010181610aee610afd611290565b8054848a0186015288955087949093019281016112ce565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168782015293151560051b86019093019350849250610aee9150610afd9050611290565b919082519283825260005b84811061138e5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b60208183018101518483018201520161134f565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036113c557565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff821682036113c557565b6040810190811067ffffffffffffffff82111761140957604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761140957604052565b906040516080810181811067ffffffffffffffff821117611409576040526060600382948054845260018101546020850152600281015460408501520154910152565b67ffffffffffffffff81116114095760051b60200190565b9080601f830112156113c55760209082356114ee816114bc565b936114fc6040519586611438565b81855260208086019260051b8201019283116113c557602001905b828210611525575050505090565b81358152908301908301611517565b90600182811c9216801561157d575b602083101461154e57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691611543565b9190820180921161159457565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff16600052600b602052611601604060002060038101549060028101546001825492015492611b92565b90565b73ffffffffffffffffffffffffffffffffffffffff16600052600b602052611601604060002060078101549060068101546005600483015492015492611b92565b80518210156116595760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561176057169182156116f65760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b9073ffffffffffffffffffffffffffffffffffffffff80831660005260016020526040600020908216600052602052604060002054927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff840361182d575b50505050565b8084106118485761183f930391611688565b38808080611827565b606460405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b73ffffffffffffffffffffffffffffffffffffffff8091169182156119e357169182156119795760008281528060205260408120549180831061190f57604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220818154019055604051908152a3565b608460405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480611b5c575b15611ab5577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176114095760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000004614611a8c565b9190820391821161159457565b909193928194838314600014611ba85750505050565b62015180810180821161159457421080611bc55750929450505050565b611bcf5750505050565b611bde91929394955042611b85565b81810291818304149015171561159457611bf791611587565b81811115611c0b57505b9038808080611827565b9050611c01565b73ffffffffffffffffffffffffffffffffffffffff600554163303611c3357565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff8114611ccd5760ff811690601f8211611ca35760405191611c99836113ed565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600654816000611ce083611534565b80835292602090600190818116908115611d6c5750600114611d0b575b505061160192500382611438565b91509260066000527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f936000925b828410611d5457506116019450505081016020013880611cfd565b85548785018301529485019486945092810192611d39565b9050602093506116019592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201013880611cfd565b60ff8114611dd15760ff811690601f8211611ca35760405191611c99836113ed565b50604051600754816000611de483611534565b80835292602090600190818116908115611d6c5750600114611e0e57505061160192500382611438565b91509260076000527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688936000925b828410611e5757506116019450505081016020013880611cfd565b85548785018301529485019486945092810192611e3c565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808311908115611fab575b50611f81577f93f3bbfe8cfb354ec059175107653f49f6eb479a8622a7d83866ea015435c9449173ffffffffffffffffffffffffffffffffffffffff8216936000858152602090600b825260409485611f5a611f1660028386200154611f00856115c3565b908c8752600b885289600286892001558961219c565b928a8552600b8652828520936003850155611f4460066201518095868b046001820155428155015491611604565b908b8652600b875287600685882001558761219c565b92898152600b855220916007830155830460058201556004429101558351928352820152a2565b60046040517ff5964809000000000000000000000000000000000000000000000000000000008152fd5b9050831138611e9b565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116120455791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa1561203857815173ffffffffffffffffffffffffffffffffffffffff811615612032579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b600581101561216d57806120625750565b600181036120ae57606460405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b600281036120fa57606460405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b60031461210357565b608460405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b909190808311156121c9576121b19192611b85565b808211156121c25761160191611b85565b5050600090565b611601926121d691611b85565b9061158756fea2646970667358221220773b59d8a6fa53d7508a09f1ec67fbfe200492fb7715e2cb9cef6e8197e10dcc64736f6c6343000817003360e0346100e657601f610bbc38819003918201601f19168301916001600160401b038311848410176100eb578084926060946040528339810103126100e65761004781610101565b604061005560208401610101565b9201519182151583036100e6576001600160a01b039182166080521660a05260c052604051610aa6908161011682396080518181816101ed015281816104c7015261068e015260a0518181816101540152818161060d01526107e2015260c05181818160b3015281816101910152818161022901528181610296015281816103280152818161054001526106520152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100e65756fe60406080815260049081361015610028575b5050361561001e57600080fd5b610026610326565b005b600091823560e01c8063205c2878146102d95780632e1a7d4d146102bb578063479d39761461027e5780638ca4180814610211578063b20a0fb9146101c0578063b6b55f251461017c578063cc4aa20414610127578063db6b5246146101105763ffaad6a5146100985750610011565b3461010c578160031936011261010c576100b06102fe565b917f00000000000000000000000000000000000000000000000000000000000000006100e657836100e36024358561064f565b80f35b517f46e927a0000000000000000000000000000000000000000000000000000000008152fd5b8280fd5b8380600319360112610124576100e3610326565b80fd5b5050346101785781600319360112610178576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5080fd5b50903461010c57602060031936011261010c577f00000000000000000000000000000000000000000000000000000000000000006100e657506100e390353361064f565b5050346101785781600319360112610178576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50602060031936011261010c576102266102fe565b917f00000000000000000000000000000000000000000000000000000000000000001561025857836100e3348561064f565b517f8467cb4b000000000000000000000000000000000000000000000000000000008152fd5b505034610178578160031936011261017857602090517f000000000000000000000000000000000000000000000000000000000000000015158152f35b838234610178576020600319360112610178576100e3903533610464565b50503461017857600319360112610124576100e36102f56102fe565b60243590610464565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361032157565b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000001561035857610356343361064f565b565b60046040517f8467cb4b000000000000000000000000000000000000000000000000000000008152fd5b67ffffffffffffffff811161039657604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761039657604052565b3d1561045f573d9067ffffffffffffffff8211610396576040519161045360207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601846103c5565b82523d6000602084013e565b606090565b6040805173ffffffffffffffffffffffffffffffffffffffff83168152602081018490529192917f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243649190a173ffffffffffffffffffffffffffffffffffffffff807f00000000000000000000000000000000000000000000000000000000000000001692833b15610321576040517f9dc29fac0000000000000000000000000000000000000000000000000000000081523360048201526024810184905260009485908290604490829084905af1801561064457610631575b507f0000000000000000000000000000000000000000000000000000000000000000156105a757839283928392165af1610575610406565b501561057d57565b60046040517fab8a5c34000000000000000000000000000000000000000000000000000000008152fd5b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff91909116602482015260448082019390935291825250610356915061060b6064826103c5565b7f000000000000000000000000000000000000000000000000000000000000000061080b565b61063d90949194610382565b923861053d565b6040513d87823e3d90fd5b907f000000000000000000000000000000000000000000000000000000000000000015610782575b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691823b15610321576040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052926000908490604490829084905af1928315610776577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c93610767575b506040805173ffffffffffffffffffffffffffffffffffffffff9290921682526020820192909252a1565b61077090610382565b3861073c565b6040513d6000823e3d90fd5b6040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523060448201528160648201526064815260a081019080821067ffffffffffffffff83111761039657610806916040527f000000000000000000000000000000000000000000000000000000000000000061080b565b610677565b73ffffffffffffffffffffffffffffffffffffffff1690604051604081019080821067ffffffffffffffff8311176103965761088b916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1610885610406565b9161094e565b80519182159184831561092a575b5050509050156108a65750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b91938180945001031261017857820151908115158203610124575080388084610899565b919290156109c95750815115610962575090565b3b1561096b5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156109dc5750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610a59575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610a1856fea2646970667358221220854e935ffeeaee078e2f081dc07c7fd4fba18edee098a19f78119a18710d49a864736f6c63430008170033a2646970667358221220f4d8da8dedda289a72e89a9737d707f796f24310385b891b9e4f2130aba107a164736f6c63430008170033

Deployed Bytecode

0x608080604052600490813610156200001657600080fd5b6000803560e01c928363601bfce714620000435750505063e8d6fa5a146200003d57600080fd5b6200055c565b34620002dc5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620002dc578035906200008282620002e0565b602435926200009184620002e0565b60443594620000a08662000315565b73ffffffffffffffffffffffffffffffffffffffff9081861615878180620002d2575b8215620002b5575b50506200028e577f8da5cb5b00000000000000000000000000000000000000000000000000000000815260208185818589165afa92831562000288579262000251575b503391160362000229576200017e620001656200014b8473ffffffffffffffffffffffffffffffffffffffff166000526000602052604060002090565b5473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1690565b6200020157620001fd6200019485858562000a76565b60405173ffffffffffffffffffffffffffffffffffffffff821681527f8f55df877018036ba60e0c8d614d17acb62151f4ef20eca328d017e53e9afe0b90602090a160405173ffffffffffffffffffffffffffffffffffffffff90911681529081906020820190565b0390f35b6040517f32a2e634000000000000000000000000000000000000000000000000000000008152fd5b6040517f15e0db8e000000000000000000000000000000000000000000000000000000008152fd5b620002779192506020903d6020116200027f575b62000270826200034f565b016200065f565b90866200010e565b3d915062000265565b6200069b565b807f10968fb400000000000000000000000000000000000000000000000000000000859252fd5b90915081620002c8575b508789620000cb565b90501588620002bf565b81159250620000c3565b5080fd5b73ffffffffffffffffffffffffffffffffffffffff811603620002ff57565b600080fd5b60c435906200031382620002e0565b565b80151503620002ff57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f601f199101166080016080811067ffffffffffffffff8211176200037457604052565b62000320565b67ffffffffffffffff81116200037457604052565b6080810190811067ffffffffffffffff8211176200037457604052565b6040810190811067ffffffffffffffff8211176200037457604052565b90601f601f19910116810190811067ffffffffffffffff8211176200037457604052565b90620003136040519283620003c9565b67ffffffffffffffff81116200037457601f01601f191660200190565b81601f82011215620002ff578035906200043482620003fd565b92620004446040519485620003c9565b82845260208383010111620002ff57816000926020809301838601378301015290565b67ffffffffffffffff8111620003745760051b60200190565b9080601f83011215620002ff5760209082356200049d8162000467565b93620004ad6040519586620003c9565b81855260208086019260051b820101928311620002ff57602001905b828210620004d8575050505090565b81358152908301908301620004c9565b9080601f83011215620002ff576020908235620005058162000467565b93620005156040519586620003c9565b81855260208086019260051b820101928311620002ff57602001905b82821062000540575050505090565b83809183356200055081620002e0565b81520191019062000531565b34620002ff5760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112620002ff5767ffffffffffffffff60048035828111620002ff57620005b190369083016200041a565b602435838111620002ff57620005cb90369084016200041a565b90604435848111620002ff57620005e6903690850162000480565b606435858111620002ff5762000600903690860162000480565b608435958611620002ff57620006226200063895620001fd97369101620004e8565b916200062d62000304565b9460a43594620006a7565b60405173ffffffffffffffffffffffffffffffffffffffff90911681529081906020820190565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff806020910112620002ff576080516200069881620002e0565b90565b6040513d6000823e3d90fd5b96959291939485518086511480159062000a20575b620009f657620007726200075860409a6200076c8c518d6200075f6020998a926200074a84860186620006f233868c8562000c9c565b039662000708601f1998898101835282620003c9565b519020976200073d8d612b439762000722818a01620003ed565b98808a5262001182828b013985519687943092860162000d1d565b03868101845283620003c9565b519687938c85019062000a51565b9062000a51565b03908101845283620003c9565b62000eb4565b9573ffffffffffffffffffffffffffffffffffffffff9485881698620007988a62001089565b5060005b8481106200091b575050505050806200089c575b50508116156200089357915b803b15620002ff5784517ff2fde38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9390931660048401526000908390602490829084905af190811562000288577fb2d2c1a40f75a86848f6e380ec14bfa3648bd79422df7a4645e184d5aac8b0f492620008709262000875575b50935173ffffffffffffffffffffffffffffffffffffffff851681529081906020820190565b0390a1565b80620008856200088c926200037a565b8062000a6a565b386200084a565b503391620007bc565b87517fa9059cbb0000000000000000000000000000000000000000000000000000000081523360048201526024810191909152818160448160008a5af18015620002885715620007b057816200090a92903d1062000913575b620009018183620003c9565b81019062000db6565b503880620007b0565b503d620008f5565b620009456200092b828462000d9b565b5173ffffffffffffffffffffffffffffffffffffffff1690565b9062000952818662000d9b565b516200095f828662000d9b565b518d3b15620002ff578f517fa08d565400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9094166004850152602484019190915260448301526000828d8183816064810103925af19182156200028857600192620009df575b50016200079c565b8062000885620009ef926200037a565b38620009d7565b60046040517f932db747000000000000000000000000000000000000000000000000000000008152fd5b508084511415620006bc565b60005b83811062000a405750506000910152565b818101518382015260200162000a2f565b9062000a666020928281519485920162000a2c565b0190565b6000910312620002ff57565b92916200075862000b83926200076c6200016593604051906200075f602083018362000ae78c88339185919092603c937fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009283809260601b16855260601b16601484015260601b1660288201520190565b039362000afd601f1995868101835282620003c9565b5190209462000b728b62000b65610bbc9562000b1c60208801620003ed565b9680885262003cc5602089013960405194859360208501919392604091606084019573ffffffffffffffffffffffffffffffffffffffff80921685521660208401521515910152565b03858101835282620003c9565b604051968793602085019062000a51565b9173ffffffffffffffffffffffffffffffffffffffff9081811691841690823b15620002ff576040517f435350b700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152926000908490602490829084905af19081156200028857620003139362000c459262000c85575b5062000c1e8362001108565b5073ffffffffffffffffffffffffffffffffffffffff166000526000602052604060002090565b9073ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffff0000000000000000000000000000000000000000825416179055565b806200088562000c95926200037a565b3862000c12565b6014939262000cea6020809362000cdb7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000968281519485920162000a2c565b01918281519485920162000a2c565b019160601b1681520190565b90601f19601f60209362000d168151809281875287808801910162000a2c565b0116010190565b9062000d6160609362000d5273ffffffffffffffffffffffffffffffffffffffff939897969860808652608086019062000cf6565b90848203602086015262000cf6565b951660408201520152565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b805182101562000db05760209160051b010190565b62000d6c565b90816020910312620002ff5751620006988162000315565b604051906040820182811067ffffffffffffffff8211176200037457604052601082527f67363d3d37363d34f03d5260086018f3000000000000000000000000000000006020830152565b3d1562000e49573d9062000e2d82620003fd565b9162000e3d6040519384620003c9565b82523d6000602084013e565b606090565b1562000e5657565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f494e495449414c495a4154494f4e5f4641494c454400000000000000000000006044820152fd5b919062000ec062000dce565b9280845160208096016000f59073ffffffffffffffffffffffffffffffffffffffff8216156200102b5791600092918362000ffb819462000f0062000dce565b898151910120604051908a8201927fff0000000000000000000000000000000000000000000000000000000000000084523060601b6021840152603583015260558201526055815262000f53816200038f565b5190206040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008a8201927fd694000000000000000000000000000000000000000000000000000000000000845260601b1660228201527f010000000000000000000000000000000000000000000000000000000000000060368201526017815262000fdf81620003ac565b51902073ffffffffffffffffffffffffffffffffffffffff1690565b9683519301915af16200100d62000e19565b508062001020575b620003139062000e4e565b50813b151562001015565b606485604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152601160248201527f4445504c4f594d454e545f4641494c45440000000000000000000000000000006044820152fd5b806000526004602052604060002054156000146200110257600354680100000000000000008110156200037457600181018060035581101562000db05781907fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0155600354906000526004602052604060002055600190565b50600090565b806000526002602052604060002054156000146200110257600154680100000000000000008110156200037457600181018060015581101562000db05781907fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6015560015490600052600260205260406000205560019056fe6101806040818152346200053f5762002b43803803809162000022828662000544565b843982016080838203126200053f5782516001600160401b0392908381116200053f5782620000539186016200058d565b9060209283860151908582116200053f57620000719187016200058d565b81860151909590936001600160a01b038516918286036200053f5760600151835197848901898110898211176200043e578552600197888a52838a0198603160f81b8a528751908282116200043e5760038054928284811c9416801562000534575b888510146200051e57601f93848111620004d3575b508088858211600114620004605760009162000454575b5060001982841b1c191690831b1781555b8451908482116200043e5760049586548481811c9116801562000433575b8a8210146200041e57858111620003d3575b50889085841160011462000368579383949184926000956200035c575b50501b92600019911b1c19161783555b6200017833620005e8565b620001838862000631565b996101209a8b52620001958c620007d9565b98610140998a528681519101209b8c60e052519020906101009b828d524660a052885192878401917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f83528a85015260608401524660808401523060a084015260a0835260c0830193838510908511176200034757838952825190206080523060c052620002238a620005e8565b846200028d575b505050505050506101609283525192612212948562000931863960805185611a93015260a05185611b5f015260c05185611a64015260e05185611ae201525184611b0801525183610bf001525182610c1a015251818181610ec2015261116e0152f35b8615620003065750505060025490828201809211620002f1575060025560008381528083528481208054830190558451918252917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a3388080808080806200022a565b601190634e487b7160e01b6000525260246000fd5b610104606493927f45524332303a206d696e7420746f20746865207a65726f206164647265737300928862461bcd60e51b865260c483015260e48201520152fd5b604185634e487b7160e01b6000525260246000fd5b0151935038806200015d565b9190601f1984169288600052848b6000209460005b8d89838310620003bb5750505010620003a0575b50505050811b0183556200016d565b01519060f884600019921b161c191690553880808062000391565b8686015189559097019694850194889350016200037d565b87600052896000208680860160051c8201928c871062000414575b0160051c019085905b8281106200040757505062000140565b60008155018590620003f7565b92508192620003ee565b602288634e487b7160e01b6000525260246000fd5b90607f16906200012e565b634e487b7160e01b600052604160045260246000fd5b90508b015138620000ff565b8492508c90601f198316856000528b600020928c6000915b838310620004b157505050831162000498575b5050811b01815562000110565b8d015160001983861b60f8161c1916905538806200048b565b948482949597989293960151815501940192019086949392918f8d9062000478565b82600052886000208580840160051c8201928b851062000514575b0160051c019084905b82811062000507575050620000e8565b60008155018490620004f7565b92508192620004ee565b634e487b7160e01b600052602260045260246000fd5b93607f1693620000d3565b600080fd5b601f909101601f19168101906001600160401b038211908210176200043e57604052565b60005b8381106200057c5750506000910152565b81810151838201526020016200056b565b81601f820112156200053f5780516001600160401b0381116200043e5760405192620005c4601f8301601f19166020018562000544565b818452602082840101116200053f57620005e5916020808501910162000568565b90565b600580546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b805160209081811015620006af5750601f8251116200066d57808251920151908083106200065e57501790565b82600019910360031b1b161790565b604490620006a19260405193849263305a27a960e01b84528060048501528251928391826024870152868601910162000568565b601f01601f19168101030190fd5b906001600160401b0382116200043e57600654926001938481811c91168015620007ce575b838210146200051e57601f811162000794575b5081601f84116001146200072857509282939183926000946200071c575b50501b916000199060031b1c19161760065560ff90565b01519250388062000705565b919083601f198116600660005284600020946000905b888383106200077957505050106200075f575b505050811b0160065560ff90565b015160001960f88460031b161c1916905538808062000751565b8587015188559096019594850194879350908101906200073e565b600660005284601f84600020920160051c820191601f860160051c015b828110620007c1575050620006e7565b60008155018590620007b1565b90607f1690620006d4565b805160209081811015620008065750601f8251116200066d57808251920151908083106200065e57501790565b906001600160401b0382116200043e57600754926001938481811c9116801562000925575b838210146200051e57601f8111620008eb575b5081601f84116001146200087f575092829391839260009462000873575b50501b916000199060031b1c19161760075560ff90565b0151925038806200085c565b919083601f198116600760005284600020946000905b88838310620008d05750505010620008b6575b505050811b0160075560ff90565b015160001960f88460031b161c19169055388080620008a8565b85870151885590960195948501948793509081019062000895565b600760005284601f84600020920160051c820191601f860160051c015b828110620009185750506200083e565b6000815501859062000908565b90607f16906200082b56fe6080604081815260048036101561001557600080fd5b600092833560e01c90816306fdde031461124e57508063095ea7b3146112245780630c05f82c146111ee57806318160ddd146111cf57806323b872dd146111925780632dd3100014611141578063313ce567146111255780633644e5151461110857806339509351146110ac57806340c10f1914610f6a578063435350b714610e8f578063651fd26814610e6957806366cc570214610e3457806370a0823114610df1578063715018a614610d715780637ecebe0014610d2d57806384b0196e14610bd95780638da5cb5b14610ba457806395d89b4114610a97578063998955d314610a6a5780639dc29fac1461086f578063a08d56541461083d578063a457c2d714610770578063a9059cbb1461073f578063c1eb7137146106f8578063ced67f0c14610650578063d505accf14610455578063d5b4c456146102ca578063dd62ed3e146102705763f2fde38b1461016d57600080fd5b3461026c57602060031936011261026c576101866113a2565b9061018f611c12565b73ffffffffffffffffffffffffffffffffffffffff809216928315610203575050600554827fffffffffffffffffffffffff0000000000000000000000000000000000000000821617600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b8280fd5b5050346102c657806003193601126102c6578060209261028e6113a2565b6102966113ca565b73ffffffffffffffffffffffffffffffffffffffff91821683526001865283832091168252845220549051908152f35b5080fd5b509190346102c65760606003193601126102c657823567ffffffffffffffff9384821161045157366023830112156104515781810135610309816114bc565b9261031685519485611438565b8184526020916024602086019160051b8301019136831161044d57602401905b82821061041d57505050506024358581116104195761035890369083016114d4565b946044359081116104195761037090369083016114d4565b92610379611c12565b8251865181149081159161040d575b506103e7575050825b81518110156103e357806103dd73ffffffffffffffffffffffffffffffffffffffff6103bf60019486611645565b51166103cb8389611645565b516103d68488611645565b5191611e6f565b01610391565b8380f35b517ff0aa5bcf000000000000000000000000000000000000000000000000000000008152fd5b90508451141538610388565b8480fd5b813573ffffffffffffffffffffffffffffffffffffffff81168103610449578152908301908301610336565b8880fd5b8780fd5b8380fd5b508290346102c65760e06003193601126102c6576104716113a2565b6104796113ca565b906044359260643560843560ff8116810361064c578142116106095773ffffffffffffffffffffffffffffffffffffffff90818516928389526008602052898920908154916001830190558a519060208201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98452868d840152858a1660608401528a608084015260a083015260c082015260c0815260e0810181811067ffffffffffffffff8211176105dd578b525190206105859161057d9161053c611a4d565b908c51917f190100000000000000000000000000000000000000000000000000000000000083526002830152602282015260c43591604260a4359220611fb5565b919091612051565b160361059a5750610597939450611688565b80f35b606490602087519162461bcd60e51b8352820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152fd5b60248b6041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60648360208a519162461bcd60e51b8352820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152fd5b8680fd5b50903461026c57602060031936011261026c57806106d06106a96106f6936101009673ffffffffffffffffffffffffffffffffffffffff61068f6113a2565b168152600b60205220946106a286611479565b9501611479565b91518094606080918051845260208101516020850152604081015160408501520151910152565b80516080840152602081015160a0840152604081015160c08401526060015160e0830152565bf35b5050346102c65760206003193601126102c65760068160209373ffffffffffffffffffffffffffffffffffffffff61072e6113a2565b168152600b85522001549051908152f35b5050346102c657806003193601126102c65760209061076961075f6113a2565b602435903361188c565b5160018152f35b50823461083a578260031936011261083a5761078a6113a2565b918360243592338152600160205281812073ffffffffffffffffffffffffffffffffffffffff861682526020522054908282106107d1576020856107698585038733611688565b608490602086519162461bcd60e51b8352820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152fd5b80fd5b833461083a57606060031936011261083a5761059761085a6113a2565b610862611c12565b6044359060243590611e6f565b508290346102c657826003193601126102c65761088a6113a2565b906024359073ffffffffffffffffffffffffffffffffffffffff8084169383853303610a58575b5050600a541633036109ed575b82156109845782845283602052848420549082821061091b57508184957fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef936020938688528785520381872055816002540360025551908152a380f35b608490602087519162461bcd60e51b8352820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152fd5b608490602086519162461bcd60e51b8352820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152fd5b816109f733611604565b10610a3157610a1d82610a0933611604565b338752600b60205242848989200155611b85565b338552600b602052600786862001556108be565b84517f0b6842aa000000000000000000000000000000000000000000000000000000008152fd5b610a639133906117c9565b86836108b1565b5050346102c65760206003193601126102c657602090610a90610a8b6113a2565b611604565b9051908152f35b50903461026c578260031936011261026c578051838194908454610aba81611534565b9182855260209660019288600182169182600014610b5c575050600114610b01575b8588610afd89610aee848a0385611438565b51928284938452830190611344565b0390f35b815286935091907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b828410610b445750505082010181610aee610afd38610adc565b8054848a018601528895508794909301928101610b2a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168882015294151560051b87019094019450859350610aee9250610afd9150389050610adc565b5050346102c657816003193601126102c65760209073ffffffffffffffffffffffffffffffffffffffff600554169051908152f35b50903461026c578260031936011261026c57610c147f0000000000000000000000000000000000000000000000000000000000000000611c77565b92610c3e7f0000000000000000000000000000000000000000000000000000000000000000611daf565b90825192602092602085019585871067ffffffffffffffff881117610d015750926020610cb7838896610caa998b9996528686528151998a997f0f000000000000000000000000000000000000000000000000000000000000008b5260e0868c015260e08b0190611344565b91898303908a0152611344565b924660608801523060808801528460a088015286840360c088015251928381520193925b828110610cea57505050500390f35b835185528695509381019392810192600101610cdb565b8360416024927f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b5050346102c65760206003193601126102c6578060209273ffffffffffffffffffffffffffffffffffffffff610d616113a2565b1681526008845220549051908152f35b833461083a578060031936011261083a57610d8a611c12565b8073ffffffffffffffffffffffffffffffffffffffff6005547fffffffffffffffffffffffff00000000000000000000000000000000000000008116600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b5050346102c65760206003193601126102c6578060209273ffffffffffffffffffffffffffffffffffffffff610e256113a2565b16815280845220549051908152f35b5050346102c657816003193601126102c65760209073ffffffffffffffffffffffffffffffffffffffff600a54169051908152f35b5050346102c65760206003193601126102c657602090610a90610e8a6113a2565b6115c3565b503461026c57602060031936011261026c57610ea96113a2565b73ffffffffffffffffffffffffffffffffffffffff91827f0000000000000000000000000000000000000000000000000000000000000000163303610f435750916020917ffa2e15ea41196e438f0593ecdd6036acd83bdfcd39d627b77c17eab43f376a39931690817fffffffffffffffffffffffff0000000000000000000000000000000000000000600a541617600a5551908152a180f35b83517f2029e525000000000000000000000000000000000000000000000000000000008152fd5b50903461026c578060031936011261026c57610f846113a2565b906024359173ffffffffffffffffffffffffffffffffffffffff9081600a54163303611042575b1692831561100057506020827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92610fe68795600254611587565b60025585855284835280852082815401905551908152a380f35b6020606492519162461bcd60e51b8352820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152fd5b8361104c336115c3565b10611084576110708461105e336115c3565b338952600b60205242868a2055611b85565b338752600b60205260038488200155610fab565b8483517f0b6842aa000000000000000000000000000000000000000000000000000000008152fd5b5050346102c657806003193601126102c6576107696020926111016110cf6113a2565b913381526001865284812073ffffffffffffffffffffffffffffffffffffffff84168252865284602435912054611587565b9033611688565b5050346102c657816003193601126102c657602090610a90611a4d565b5050346102c657816003193601126102c6576020905160128152f35b5050346102c657816003193601126102c6576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5050346102c65760606003193601126102c6576020906107696111b36113a2565b6111bb6113ca565b604435916111ca8333836117c9565b61188c565b5050346102c657816003193601126102c6576020906002549051908152f35b5050346102c65760206003193601126102c65760028160209373ffffffffffffffffffffffffffffffffffffffff61072e6113a2565b5050346102c657806003193601126102c6576020906107696112446113a2565b6024359033611688565b8484346102c657816003193601126102c657828260035461126e81611534565b90818452602095600191876001821691826000146112ff5750506001146112a3575b505050610afd9291610aee910385611438565b9190869350600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8284106112e75750505082010181610aee610afd611290565b8054848a0186015288955087949093019281016112ce565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168782015293151560051b86019093019350849250610aee9150610afd9050611290565b919082519283825260005b84811061138e5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8460006020809697860101520116010190565b60208183018101518483018201520161134f565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036113c557565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff821682036113c557565b6040810190811067ffffffffffffffff82111761140957604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761140957604052565b906040516080810181811067ffffffffffffffff821117611409576040526060600382948054845260018101546020850152600281015460408501520154910152565b67ffffffffffffffff81116114095760051b60200190565b9080601f830112156113c55760209082356114ee816114bc565b936114fc6040519586611438565b81855260208086019260051b8201019283116113c557602001905b828210611525575050505090565b81358152908301908301611517565b90600182811c9216801561157d575b602083101461154e57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b91607f1691611543565b9190820180921161159457565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff16600052600b602052611601604060002060038101549060028101546001825492015492611b92565b90565b73ffffffffffffffffffffffffffffffffffffffff16600052600b602052611601604060002060078101549060068101546005600483015492015492611b92565b80518210156116595760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff80911691821561176057169182156116f65760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b608460405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152fd5b9073ffffffffffffffffffffffffffffffffffffffff80831660005260016020526040600020908216600052602052604060002054927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff840361182d575b50505050565b8084106118485761183f930391611688565b38808080611827565b606460405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152fd5b73ffffffffffffffffffffffffffffffffffffffff8091169182156119e357169182156119795760008281528060205260408120549180831061190f57604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220818154019055604051908152a3565b608460405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152fd5b608460405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480611b5c575b15611ab5577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815260c0810181811067ffffffffffffffff8211176114095760405251902090565b507f00000000000000000000000000000000000000000000000000000000000000004614611a8c565b9190820391821161159457565b909193928194838314600014611ba85750505050565b62015180810180821161159457421080611bc55750929450505050565b611bcf5750505050565b611bde91929394955042611b85565b81810291818304149015171561159457611bf791611587565b81811115611c0b57505b9038808080611827565b9050611c01565b73ffffffffffffffffffffffffffffffffffffffff600554163303611c3357565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60ff8114611ccd5760ff811690601f8211611ca35760405191611c99836113ed565b8252602082015290565b60046040517fb3512b0c000000000000000000000000000000000000000000000000000000008152fd5b50604051600654816000611ce083611534565b80835292602090600190818116908115611d6c5750600114611d0b575b505061160192500382611438565b91509260066000527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f936000925b828410611d5457506116019450505081016020013880611cfd565b85548785018301529485019486945092810192611d39565b9050602093506116019592507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b8201013880611cfd565b60ff8114611dd15760ff811690601f8211611ca35760405191611c99836113ed565b50604051600754816000611de483611534565b80835292602090600190818116908115611d6c5750600114611e0e57505061160192500382611438565b91509260076000527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688936000925b828410611e5757506116019450505081016020013880611cfd565b85548785018301529485019486945092810192611e3c565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808311908115611fab575b50611f81577f93f3bbfe8cfb354ec059175107653f49f6eb479a8622a7d83866ea015435c9449173ffffffffffffffffffffffffffffffffffffffff8216936000858152602090600b825260409485611f5a611f1660028386200154611f00856115c3565b908c8752600b885289600286892001558961219c565b928a8552600b8652828520936003850155611f4460066201518095868b046001820155428155015491611604565b908b8652600b875287600685882001558761219c565b92898152600b855220916007830155830460058201556004429101558351928352820152a2565b60046040517ff5964809000000000000000000000000000000000000000000000000000000008152fd5b9050831138611e9b565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116120455791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa1561203857815173ffffffffffffffffffffffffffffffffffffffff811615612032579190565b50600190565b50604051903d90823e3d90fd5b50505050600090600390565b600581101561216d57806120625750565b600181036120ae57606460405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152fd5b600281036120fa57606460405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152fd5b60031461210357565b608460405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b909190808311156121c9576121b19192611b85565b808211156121c25761160191611b85565b5050600090565b611601926121d691611b85565b9061158756fea2646970667358221220773b59d8a6fa53d7508a09f1ec67fbfe200492fb7715e2cb9cef6e8197e10dcc64736f6c6343000817003360e0346100e657601f610bbc38819003918201601f19168301916001600160401b038311848410176100eb578084926060946040528339810103126100e65761004781610101565b604061005560208401610101565b9201519182151583036100e6576001600160a01b039182166080521660a05260c052604051610aa6908161011682396080518181816101ed015281816104c7015261068e015260a0518181816101540152818161060d01526107e2015260c05181818160b3015281816101910152818161022901528181610296015281816103280152818161054001526106520152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100e65756fe60406080815260049081361015610028575b5050361561001e57600080fd5b610026610326565b005b600091823560e01c8063205c2878146102d95780632e1a7d4d146102bb578063479d39761461027e5780638ca4180814610211578063b20a0fb9146101c0578063b6b55f251461017c578063cc4aa20414610127578063db6b5246146101105763ffaad6a5146100985750610011565b3461010c578160031936011261010c576100b06102fe565b917f00000000000000000000000000000000000000000000000000000000000000006100e657836100e36024358561064f565b80f35b517f46e927a0000000000000000000000000000000000000000000000000000000008152fd5b8280fd5b8380600319360112610124576100e3610326565b80fd5b5050346101785781600319360112610178576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5080fd5b50903461010c57602060031936011261010c577f00000000000000000000000000000000000000000000000000000000000000006100e657506100e390353361064f565b5050346101785781600319360112610178576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50602060031936011261010c576102266102fe565b917f00000000000000000000000000000000000000000000000000000000000000001561025857836100e3348561064f565b517f8467cb4b000000000000000000000000000000000000000000000000000000008152fd5b505034610178578160031936011261017857602090517f000000000000000000000000000000000000000000000000000000000000000015158152f35b838234610178576020600319360112610178576100e3903533610464565b50503461017857600319360112610124576100e36102f56102fe565b60243590610464565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361032157565b600080fd5b7f00000000000000000000000000000000000000000000000000000000000000001561035857610356343361064f565b565b60046040517f8467cb4b000000000000000000000000000000000000000000000000000000008152fd5b67ffffffffffffffff811161039657604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761039657604052565b3d1561045f573d9067ffffffffffffffff8211610396576040519161045360207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601846103c5565b82523d6000602084013e565b606090565b6040805173ffffffffffffffffffffffffffffffffffffffff83168152602081018490529192917f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243649190a173ffffffffffffffffffffffffffffffffffffffff807f00000000000000000000000000000000000000000000000000000000000000001692833b15610321576040517f9dc29fac0000000000000000000000000000000000000000000000000000000081523360048201526024810184905260009485908290604490829084905af1801561064457610631575b507f0000000000000000000000000000000000000000000000000000000000000000156105a757839283928392165af1610575610406565b501561057d57565b60046040517fab8a5c34000000000000000000000000000000000000000000000000000000008152fd5b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff91909116602482015260448082019390935291825250610356915061060b6064826103c5565b7f000000000000000000000000000000000000000000000000000000000000000061080b565b61063d90949194610382565b923861053d565b6040513d87823e3d90fd5b907f000000000000000000000000000000000000000000000000000000000000000015610782575b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691823b15610321576040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8216600482015260248101839052926000908490604490829084905af1928315610776577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c93610767575b506040805173ffffffffffffffffffffffffffffffffffffffff9290921682526020820192909252a1565b61077090610382565b3861073c565b6040513d6000823e3d90fd5b6040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523060448201528160648201526064815260a081019080821067ffffffffffffffff83111761039657610806916040527f000000000000000000000000000000000000000000000000000000000000000061080b565b610677565b73ffffffffffffffffffffffffffffffffffffffff1690604051604081019080821067ffffffffffffffff8311176103965761088b916040526020938482527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858301526000808587829751910182855af1610885610406565b9161094e565b80519182159184831561092a575b5050509050156108a65750565b608490604051907f08c379a00000000000000000000000000000000000000000000000000000000082526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b91938180945001031261017857820151908115158203610124575080388084610899565b919290156109c95750815115610962575090565b3b1561096b5790565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156109dc5750805190602001fd5b604051907f08c379a000000000000000000000000000000000000000000000000000000000825281602080600483015282519283602484015260005b848110610a59575050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f836000604480968601015201168101030190fd5b818101830151868201604401528593508201610a1856fea2646970667358221220854e935ffeeaee078e2f081dc07c7fd4fba18edee098a19f78119a18710d49a864736f6c63430008170033a2646970667358221220f4d8da8dedda289a72e89a9737d707f796f24310385b891b9e4f2130aba107a164736f6c63430008170033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.