Sepolia Testnet

Contract

0x1f4fC50336FDf97E68C0a190B90596CD57c201E4

Overview

ETH Balance

0 ETH

Token Holdings

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Deposit63722022024-07-25 7:44:242 mins ago1721893464IN
0x1f4fC503...D57c201E4
0 ETH0.0042428334.6014783
Deposit63721862024-07-25 7:39:127 mins ago1721893152IN
0x1f4fC503...D57c201E4
0 ETH0.0034394626.02365221
Deposit63721272024-07-25 7:24:0023 mins ago1721892240IN
0x1f4fC503...D57c201E4
0 ETH0.0032023826.11636586
Deposit63721152024-07-25 7:21:1225 mins ago1721892072IN
0x1f4fC503...D57c201E4
0 ETH0.0038804928.76404096
Deposit63721082024-07-25 7:19:4827 mins ago1721891988IN
0x1f4fC503...D57c201E4
0 ETH0.0011207529.16797934
Deposit63721072024-07-25 7:19:3627 mins ago1721891976IN
0x1f4fC503...D57c201E4
0 ETH0.0039391529.80230992
Deposit63720512024-07-25 7:06:3640 mins ago1721891196IN
0x1f4fC503...D57c201E4
0 ETH0.0076017556.35770933
Deposit63720412024-07-25 7:04:1242 mins ago1721891052IN
0x1f4fC503...D57c201E4
0 ETH0.0078035657.83844206
Deposit63720382024-07-25 7:03:3643 mins ago1721891016IN
0x1f4fC503...D57c201E4
0 ETH0.0077805363.45240625
Deposit63720252024-07-25 7:00:1246 mins ago1721890812IN
0x1f4fC503...D57c201E4
0 ETH0.0083828562.13200791
Deposit63719192024-07-25 6:32:481 hr ago1721889168IN
0x1f4fC503...D57c201E4
0 ETH0.0062186246.09531493
Deposit63719132024-07-25 6:30:481 hr ago1721889048IN
0x1f4fC503...D57c201E4
0 ETH0.0055904242.30138299
Deposit63719072024-07-25 6:28:481 hr ago1721888928IN
0x1f4fC503...D57c201E4
0 ETH0.0056489240.42688374
Deposit63718992024-07-25 6:27:001 hr ago1721888820IN
0x1f4fC503...D57c201E4
0 ETH0.005134641.87414431
Deposit63718882024-07-25 6:24:241 hr ago1721888664IN
0x1f4fC503...D57c201E4
0 ETH0.0054368840.30069895
Deposit63718432024-07-25 6:11:481 hr ago1721887908IN
0x1f4fC503...D57c201E4
0 ETH0.0037184230.3248087
Deposit63718242024-07-25 6:06:481 hr ago1721887608IN
0x1f4fC503...D57c201E4
0 ETH0.0039627529.98086861
Deposit63717842024-07-25 5:56:481 hr ago1721887008IN
0x1f4fC503...D57c201E4
0 ETH0.0034944128.49789098
Deposit63717612024-07-25 5:50:481 hr ago1721886648IN
0x1f4fC503...D57c201E4
0 ETH0.0044366533.5662448
Deposit63717372024-07-25 5:43:482 hrs ago1721886228IN
0x1f4fC503...D57c201E4
0 ETH0.0034620225.66212683
Deposit63717312024-07-25 5:42:002 hrs ago1721886120IN
0x1f4fC503...D57c201E4
0 ETH0.0034798325.79186184
Deposit63717302024-07-25 5:41:482 hrs ago1721886108IN
0x1f4fC503...D57c201E4
0 ETH0.0029452324.01917755
Deposit63716712024-07-25 5:26:242 hrs ago1721885184IN
0x1f4fC503...D57c201E4
0 ETH0.0029339523.92717714
Deposit63716322024-07-25 5:17:122 hrs ago1721884632IN
0x1f4fC503...D57c201E4
0 ETH0.0037841128.63128875
Deposit63716052024-07-25 5:11:122 hrs ago1721884272IN
0x1f4fC503...D57c201E4
0 ETH0.0037577930.64586492
View all transactions

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MultiSigPoolV5

Compiler Version
v0.8.2+commit.661d1103

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 17 : MultiSigPoolV5.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

import "../interfaces/IAggregationRouterV5.sol";
import "../interfaces/IWETH.sol";
import "../interfaces/IStarkEx.sol";
import "../interfaces/IFactRegister.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

/**
 *
 * MultiSigPool
 * ============
 *
 * Basic multi-signer wallet designed for use in a co-signing environment where 2 signatures are require to move funds.
 * Typically used in a 2-of-3 signing configuration. Uses ecrecover to allow for 2 signatures in a single transaction.
 *
 * The signatures are created on the operation hash and passed to withdrawETH/withdrawERC20
 * The signer is determined by ECDSA.recover().
 *
 * The signature is created with ethereumjs-util.ecsign(operationHash).
 * Like the eth_sign RPC call, it packs the values as a 65-byte array of [r, s, v].
 * Unlike eth_sign, the message is not prefixed.
 *
 */
contract MultiSigPoolV5 is ReentrancyGuard {
  using SafeERC20 for IERC20;
  using SafeMath for uint256;

  // Events
  event Deposit(address from, address token, uint256 spentAmount, uint256 swapReturnAmount, uint256 starkKey, uint256 positionId);
  event WithdrawETH(uint256 orderId, address to, uint256 amount);
  event WithdrawERC20(uint256 orderId, address token, address to, uint256 amount);

  // Public fields
  address immutable public USDT_ADDRESS;                  // USDT contract address
  address immutable public STARKEX_ADDRESS;               // stark exchange adress
  address immutable public FACT_ADDRESS;                  // stark external fact contract address
  address immutable public AGGREGATION_ROUTER_V5_ADDRESS; // 1inch AggregationRouterV5  address
  address[] public signers;                               // The addresses that can co-sign transactions on the wallet
  mapping(uint256 => order) orders;                       // history orders
  uint256 public ASSET_TYPE;                              // stark exchange defined USDT

  IERC20 private constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
  IERC20 private constant ZERO_ADDRESS = IERC20(address(0));

  struct order{
    address to;     // The address the transaction was sent to
    uint256 amount; // Amount of Wei sent to the address
    address token;  // The address of the ERC20 token contract, 0 means ETH
    bool executed;  // If the order was executed
  }

  /**
   * Set up a simple 2-3 multi-sig wallet by specifying the signers allowed to be used on this wallet.
   * 2 signers will be require to send a transaction from this wallet.
   * Note: The sender is NOT automatically added to the list of signers.
   * Signers CANNOT be changed once they are set
   *
   * @param allowedSigners      An array of signers on the wallet
   * @param usdt                The USDT contract address
   * @param aggregationRouterV5 The 1inch exchange router address
   * @param starkex             The stark exchange address
   * @param fact                The stark fact address
   */
  constructor(address[] memory allowedSigners, address usdt,address aggregationRouterV5,address starkex, address fact, uint256 assetType) {
    require(allowedSigners.length == 3, "invalid allSigners length");
    require(allowedSigners[0] != allowedSigners[1], "must be different signers");
    require(allowedSigners[0] != allowedSigners[2], "must be different signers");
    require(allowedSigners[1] != allowedSigners[2], "must be different signers");
    require(usdt != address(0), "invalid usdt address");
    require(aggregationRouterV5 != address(0), "invalid 1inch address");

    signers = allowedSigners;
    USDT_ADDRESS = usdt;
    AGGREGATION_ROUTER_V5_ADDRESS = aggregationRouterV5;
    STARKEX_ADDRESS = starkex;
    FACT_ADDRESS = fact;
    ASSET_TYPE = assetType;
  }

  /**
   * Gets called when a transaction is received without calling a method
   */
  receive() external payable { }

  /**
    * @notice Make a deposit to the Starkware Layer2, after converting funds to USDT.
    *  Funds will be transferred from the sender and USDT will be deposited into this wallet, and 
    *  generate a deposit event specified by the starkKey and positionId.
    *
    * @param  token          The ERC20 token to convert from
    * @param  amount         The amount in Wei to deposit.
    * @param  starkKey       The starkKey of the L2 account to deposit into.
    * @param  positionId     The positionId of the L2 account to deposit into.
    * @param  exchangeData   Trade parameters for the exchange.
    */
  function deposit(
    IERC20 token,
    uint256 amount,
    uint256 starkKey,
    uint256 positionId,
    bytes calldata exchangeData
  ) public payable nonReentrant returns (uint256) {
    uint256 returnAmount;
    uint256 beforeSwapBalance = IERC20(USDT_ADDRESS).balanceOf(address(this));

    if (address(token) == USDT_ADDRESS){   // deposit USDT 
      token.safeTransferFrom(msg.sender, address(this), amount);
      returnAmount = amount;
    } else {
      (, IAggregationRouterV5.SwapDescription memory desc, ,) = abi.decode(exchangeData[4:], (address, IAggregationRouterV5.SwapDescription, bytes, bytes));
      require(token == desc.srcToken, "mismatch token and desc.srcToken");
      require(USDT_ADDRESS == address(desc.dstToken), "invalid desc.dstToken");
      require(amount == desc.amount, "mismatch amount and desc.amount");
      require(address(this) == desc.dstReceiver, "invalid desc.dstReceiver");

      bool isNativeToken = isNative(desc.srcToken);
      if (!isNativeToken) {  // deposit other ERC20 tokens 
        desc.srcToken.safeTransferFrom(msg.sender, address(this), desc.amount);

        // safeApprove requires unsetting the allowance first.
        desc.srcToken.safeApprove(AGGREGATION_ROUTER_V5_ADDRESS, 0);
        desc.srcToken.safeApprove(AGGREGATION_ROUTER_V5_ADDRESS, desc.amount);
      }

      // Swap token
      (bool success, bytes memory returndata)= AGGREGATION_ROUTER_V5_ADDRESS.call{value:msg.value}(exchangeData);
      require(success, "exchange failed");

      (returnAmount, ) = abi.decode(returndata, (uint256, uint256));
      require(returnAmount >= desc.minReturnAmount, "received USDT less than minReturnAmount");
    }

    uint256 afterSwapBalance = IERC20(USDT_ADDRESS).balanceOf(address(this));
    require (afterSwapBalance == beforeSwapBalance.add(returnAmount),"swap incorrect");

    emit Deposit(
      msg.sender,
      address(token),
      amount,
      returnAmount,
      starkKey,
      positionId
    );

    // ethereum deposit to starkex directly
    if (block.chainid == 1 || block.chainid == 5 || block.chainid == 11155111){
      // safeApprove requires unsetting the allowance first.
      IERC20(USDT_ADDRESS).safeApprove(STARKEX_ADDRESS, 0);
      IERC20(USDT_ADDRESS).safeApprove(STARKEX_ADDRESS, returnAmount);

      // deposit to starkex
      IStarkEx starkEx = IStarkEx(STARKEX_ADDRESS);
      starkEx.depositERC20(starkKey, ASSET_TYPE, positionId, returnAmount);
      return returnAmount;
    }

    return returnAmount;
  }

  /**
   * Withdraw ETHER from this wallet using 2 signers.
   *
   * @param  to         the destination address to send an outgoing transaction
   * @param  amount     the amount in Wei to be sent
   * @param  expireTime the number of seconds since 1970 for which this transaction is valid
   * @param  orderId    the unique order id 
   * @param  allSigners all signers who sign the tx
   * @param  signatures the signatures of tx
   */
  function withdrawETH(
    address payable to,
    uint256 amount,
    uint256 expireTime,
    uint256 orderId,
    address[] memory allSigners,
    bytes[] memory signatures
  ) public nonReentrant {
    require(allSigners.length >= 2, "invalid allSigners length");
    require(allSigners.length == signatures.length, "invalid signatures length");
    require(allSigners[0] != allSigners[1],"can not be same signer"); // must be different signer
    require(expireTime >= block.timestamp,"expired transaction");

    bytes32 operationHash = keccak256(abi.encodePacked("ETHER", to, amount, expireTime, orderId, address(this), block.chainid));
    operationHash = ECDSA.toEthSignedMessageHash(operationHash);
    
    for (uint8 index = 0; index < allSigners.length; index++) {
      address signer = ECDSA.recover(operationHash, signatures[index]);
      require(signer == allSigners[index], "invalid signer");
      require(isAllowedSigner(signer), "not allowed signer");
    }

    // Try to insert the order ID. Will revert if the order id was invalid
    tryInsertOrderId(orderId, to, amount, address(0));

    // send ETHER
    require(address(this).balance >= amount, "Address: insufficient balance");
    (bool success, ) = to.call{value: amount}("");
    require(success, "Address: unable to send value, recipient may have reverted");

    emit WithdrawETH(orderId, to, amount);
  }
  
  /**
   * Withdraw ERC20 from this wallet using 2 signers.
   *
   * @param  to         the destination address to send an outgoing transactioni
   * @param  amount     the amount in Wei to be sent
   * @param  token      the address of the erc20 token contract
   * @param  expireTime the number of seconds since 1970 for which this transaction is valid
   * @param  orderId    the unique order id 
   * @param  allSigners all signer who sign the tx
   * @param  signatures the signatures of tx
   */
  function withdrawErc20(
    address to,
    uint256 amount,
    address token,
    uint256 expireTime,
    uint256 orderId,
    address[] memory allSigners,
    bytes[] memory signatures
  ) public nonReentrant {
    require(allSigners.length >=2, "invalid allSigners length");
    require(allSigners.length == signatures.length, "invalid signatures length");
    require(allSigners[0] != allSigners[1],"can not be same signer"); // must be different signer
    require(expireTime >= block.timestamp,"expired transaction");

    bytes32 operationHash = keccak256(abi.encodePacked("ERC20", to, amount, token, expireTime, orderId, address(this), block.chainid));
    operationHash = ECDSA.toEthSignedMessageHash(operationHash);

    for (uint8 index = 0; index < allSigners.length; index++) {
      address signer = ECDSA.recover(operationHash, signatures[index]);
      require(signer == allSigners[index], "invalid signer");
      require(isAllowedSigner(signer),"not allowed signer");
    }

    // Try to insert the order ID. Will revert if the order id was invalid
    tryInsertOrderId(orderId, to, amount, token);

    // Success, send ERC20 token
    IERC20(token).safeTransfer(to, amount);
    emit WithdrawERC20(orderId, token, to, amount);
  }

  /**
   * Withdraw ERC20 from this wallet using 2 signers.
   * The function only can be called when user make a fast withdraw.
   *
   * @param  to         the destination address to send an outgoing transaction
   * @param  amount     the amount in wei to be sent
   * @param  token      the address of the erc20 token contract
   * @param  salt       salt amount to generate fact
   * @param  expireTime the number of seconds since 1970 for which this transaction is valid
   * @param  orderId    the unique order id 
   * @param  allSigners all signer who sign the tx
   * @param  signatures the signatures of tx
   */
  function factTransferErc20(
    address to,
    address token,
    uint256 amount,
    uint256 salt,
    uint256 expireTime,
    uint256 orderId,
    address[] memory allSigners,
    bytes[] memory signatures
  ) public nonReentrant {
    require(token == USDT_ADDRESS,"invalid token");
    require(allSigners.length >=2, "invalid allSigners length");
    require(allSigners.length == signatures.length, "invalid signatures length");
    require(allSigners[0] != allSigners[1],"can not be same signer"); // must be different signer
    require(expireTime >= block.timestamp,"expired transaction");

    bytes32 operationHash = keccak256(abi.encodePacked("FAST",to, amount, token, expireTime, salt, orderId, address(this), block.chainid));
    operationHash = ECDSA.toEthSignedMessageHash(operationHash);

    for (uint8 index = 0; index < allSigners.length; index++) {
      address signer = ECDSA.recover(operationHash, signatures[index]);
      require(signer == allSigners[index], "invalid signer");
      require(isAllowedSigner(signer),"not allowed signer");
    }

    // Try to insert the order ID. Will revert if the order id was invalid
    tryInsertOrderId(orderId, to, amount, token);

    // check fact 
    bytes32 transferFact =  keccak256(abi.encodePacked(to, amount, token, salt));
    IFactRegister factAddress = IFactRegister(FACT_ADDRESS);
    require(!factAddress.isValid(transferFact),"fact already isValid");

    // safeApprove requires unsetting the allowance first.
    IERC20(token).safeApprove(FACT_ADDRESS, 0);
    IERC20(token).safeApprove(FACT_ADDRESS, amount);
  
    factAddress.transferERC20(to, token, amount, salt);
    emit WithdrawERC20(orderId, token, to, amount);
  }

  function isNative(IERC20 token_) internal pure returns (bool) {
    return (token_ == ZERO_ADDRESS || token_ == ETH_ADDRESS);
  }

  /**
   * Determine if an address is a signer on this wallet
   *
   * @param signer address to check
   */
  function isAllowedSigner(address signer) public view returns (bool) {
    // Iterate through all signers on the wallet and
    for (uint i = 0; i < signers.length; i++) {
      if (signers[i] == signer) {
        return true;
      }
    }
    return false;
  }
  
  /**
   * Verify that the order id has not been used before and inserts it. Throws if the order ID was not accepted.
   *
   * @param orderId   the unique order id 
   * @param to        the destination address to send an outgoing transaction
   * @param amount     the amount in Wei to be sent
   * @param token     the address of the ERC20 contract
   */
  function tryInsertOrderId(
      uint256 orderId, 
      address to,
      uint256 amount, 
      address token
    ) internal {
    if (orders[orderId].executed) {
        // This order ID has been excuted before. Disallow!
        revert("repeated order");
    }

    orders[orderId].executed = true;
    orders[orderId].to = to;
    orders[orderId].amount = amount;
    orders[orderId].token = token;
  }

   /**
   * calcSigHash is a helper function that to help you generate the sighash needed for withdrawal.
   *
   * @param to          The destination address
   * @param amount      The amount in Wei to be sent
   * @param token       The address of the ERC20 contract
   * @param expireTime  the number of seconds since 1970 for which this transaction is valid
   * @param orderId     The unique order id 
   * @param isFact      If fact withdraw calc sighash
   * @param salt        The salt amount to generate fact
   * @param chainId     The chain id
   * 
   */

  function calcSigHash(
    address to,
    uint256 amount,
    address token,
    uint256 expireTime,
    uint256 orderId,
    bool isFact,
    uint256 salt,
    uint256 chainId) public view returns (bytes32) {
    bytes32 operationHash;

    if (isFact) {
      operationHash = keccak256(abi.encodePacked("FAST", to, amount, token, expireTime, salt, orderId, address(this), chainId));
    } else if (token == address(0)) {
      operationHash = keccak256(abi.encodePacked("ETHER", to, amount, expireTime, orderId, address(this), chainId));
    } else {
      operationHash = keccak256(abi.encodePacked("ERC20", to, amount, token, expireTime, orderId, address(this), chainId));
    }
    return operationHash;
  }
}

File 2 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)

pragma solidity ^0.8.0;

import "../token/ERC20/IERC20.sol";

File 3 of 17 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 4 of 17 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    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 5 of 17 : 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 6 of 17 : 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 7 of 17 : 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 8 of 17 : 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 9 of 17 : 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 10 of 17 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 11 of 17 : 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 12 of 17 : 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 13 of 17 : IAggregationExecutorV5.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IAggregationExecutor {
    function callBytes(bytes calldata data) external payable;
}

File 14 of 17 : IAggregationRouterV5.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/interfaces/IERC20.sol";
import "./IAggregationExecutorV5.sol";

interface IAggregationRouterV5 {
    struct SwapDescription {
      IERC20 srcToken;
      IERC20 dstToken;
      address payable srcReceiver;
      address payable dstReceiver;
      uint256 amount;
      uint256 minReturnAmount;
      uint256 flags;
    }

   function swap(
        IAggregationExecutor executor,
        SwapDescription calldata desc,
        bytes calldata permit,
        bytes calldata data
    )
        external
        payable
        returns (
            uint256 returnAmount,
            uint256 spentAmount
        );
}

File 15 of 17 : IFactRegister.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IFactRegister {
    function isValid(bytes32 fact) external view returns (bool);

    function transferERC20(
        address recipient,
        address erc20,
        uint256 amount,
        uint256 salt
    ) external;
}

File 16 of 17 : IStarkEx.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

interface IStarkEx  {
    function getEthKey(
        uint256 starkKey
    ) external view returns (address);

    function isMsgSenderKeyOwner(
        uint256 ownerKey
    ) external view returns (bool);

    function registerEthAddress(
        address ethKey,
        uint256 starkKey,
        bytes calldata starkSignature
    ) external;

    function depositERC20(
        uint256 starkKey,
        uint256 assetType,
        uint256 vaultId,
        uint256 quantizedAmount
    ) external;

    function getWithdrawalBalance(
        uint256 starkKey,
        uint256 assetId
    ) external view returns (uint256 balance);

    function withdraw(
        uint256 starkKey, 
        uint256 assetId
    ) external;

    function forcedWithdrawalRequest(
        uint256 starkKey,
        uint256 vaultId,
        uint256 quantizedAmount,
        bool premiumCost
    ) external;
}

File 17 of 17 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IWETH {
    function deposit() external payable;
    function approve(address to, uint256 value) external returns (bool);
    function transfer(address to, uint256 value) external returns (bool);
    function withdraw(uint256) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address[]","name":"allowedSigners","type":"address[]"},{"internalType":"address","name":"usdt","type":"address"},{"internalType":"address","name":"aggregationRouterV5","type":"address"},{"internalType":"address","name":"starkex","type":"address"},{"internalType":"address","name":"fact","type":"address"},{"internalType":"uint256","name":"assetType","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"spentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"swapReturnAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"starkKey","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"positionId","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawETH","type":"event"},{"inputs":[],"name":"AGGREGATION_ROUTER_V5_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ASSET_TYPE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FACT_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STARKEX_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDT_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"expireTime","type":"uint256"},{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"bool","name":"isFact","type":"bool"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"chainId","type":"uint256"}],"name":"calcSigHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"starkKey","type":"uint256"},{"internalType":"uint256","name":"positionId","type":"uint256"},{"internalType":"bytes","name":"exchangeData","type":"bytes"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"expireTime","type":"uint256"},{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"address[]","name":"allSigners","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"}],"name":"factTransferErc20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"isAllowedSigner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"signers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"expireTime","type":"uint256"},{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"address[]","name":"allSigners","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"expireTime","type":"uint256"},{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"address[]","name":"allSigners","type":"address[]"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"}],"name":"withdrawErc20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101006040523480156200001257600080fd5b5060405162002ed238038062002ed2833981016040819052620000359162000418565b60016000558551600314620000915760405162461bcd60e51b815260206004820152601960248201527f696e76616c696420616c6c5369676e657273206c656e6774680000000000000060448201526064015b60405180910390fd5b85600181518110620000b357634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031686600081518110620000e657634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415620001365760405162461bcd60e51b8152602060048201526019602482015260008051602062002eb2833981519152604482015260640162000088565b856002815181106200015857634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316866000815181106200018b57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415620001db5760405162461bcd60e51b8152602060048201526019602482015260008051602062002eb2833981519152604482015260640162000088565b85600281518110620001fd57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316866001815181106200023057634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03161415620002805760405162461bcd60e51b8152602060048201526019602482015260008051602062002eb2833981519152604482015260640162000088565b6001600160a01b038516620002d85760405162461bcd60e51b815260206004820152601460248201527f696e76616c696420757364742061646472657373000000000000000000000000604482015260640162000088565b6001600160a01b038416620003305760405162461bcd60e51b815260206004820152601560248201527f696e76616c69642031696e636820616464726573730000000000000000000000604482015260640162000088565b8551620003459060019060208901906200037a565b506001600160601b0319606095861b811660805293851b841660e05291841b831660a05290921b1660c0526003555062000555565b828054828255906000526020600020908101928215620003d2579160200282015b82811115620003d257825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906200039b565b50620003e0929150620003e4565b5090565b5b80821115620003e05760008155600101620003e5565b80516001600160a01b03811681146200041357600080fd5b919050565b60008060008060008060c0878903121562000431578182fd5b86516001600160401b038082111562000448578384fd5b818901915089601f8301126200045c578384fd5b81516020828211156200047357620004736200053f565b808202604051601f19603f830116810181811086821117156200049a576200049a6200053f565b604052838152828101945085830182870184018f1015620004b9578889fd5b8896505b84871015620004e657620004d181620003fb565b865260019690960195948301948301620004bd565b509a50620004f890508b8201620003fb565b9850505050506200050c60408801620003fb565b93506200051c60608801620003fb565b92506200052c60808801620003fb565b915060a087015190509295509295509295565b634e487b7160e01b600052604160045260246000fd5b60805160601c60a05160601c60c05160601c60e05160601c6128a76200060b600039600081816101f401528181610d1901528181610d580152610d8201526000818161018a0152818161146901528181611540015261157501526000818161015601528181611055015281816110aa01526110fe01526000818161022801528181610a4401528181610ac201528181610bad01528181610eda0152818161103301528181611088015261119401526128a76000f3fe6080604052600436106100ab5760003560e01c80638815eb39116100645780638815eb39146101cc5780639fdd761d146101e2578063c189205814610216578063cabb9e7a1461024a578063cfe96c841461027a578063f13b49751461028d576100b2565b80631025e095146100b757806312a5a096146100d95780632079fb9a1461010c578063391cdc0814610144578063496eff7b146101785780636b1430d6146101ac576100b2565b366100b257005b600080fd5b3480156100c357600080fd5b506100d76100d2366004612276565b6102ad565b005b3480156100e557600080fd5b506100f96100f4366004612319565b610544565b6040519081526020015b60405180910390f35b34801561011857600080fd5b5061012c61012736600461244a565b6105f5565b6040516001600160a01b039091168152602001610103565b34801561015057600080fd5b5061012c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561018457600080fd5b5061012c7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b857600080fd5b506100d76101c736600461213a565b61061f565b3480156101d857600080fd5b506100f960035481565b3480156101ee57600080fd5b5061012c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561022257600080fd5b5061012c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561025657600080fd5b5061026a61026536600461201b565b61099d565b6040519015158152602001610103565b6100f96102883660046123ae565b610a18565b34801561029957600080fd5b506100d76102a83660046121c9565b61118a565b6102b5611673565b6002825110156102e05760405162461bcd60e51b81526004016102d790612692565b60405180910390fd5b80518251146103015760405162461bcd60e51b81526004016102d790612607565b8160018151811061032257634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03168260008151811061035457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156103835760405162461bcd60e51b81526004016102d7906126f6565b428410156103a35760405162461bcd60e51b81526004016102d7906126c9565b6000878787878730466040516020016103c29796959493929190612579565b6040516020818303038152906040528051906020012090506103e3816116cd565b905060005b83518160ff1610156104bf57600061042a83858460ff168151811061041d57634e487b7160e01b600052603260045260246000fd5b6020026020010151611700565b9050848260ff168151811061044f57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316816001600160a01b0316146104875760405162461bcd60e51b81526004016102d79061263e565b6104908161099d565b6104ac5760405162461bcd60e51b81526004016102d790612666565b50806104b781612802565b9150506103e8565b506104cc84898989611724565b6104e06001600160a01b03871689896117d8565b604080518581526001600160a01b0388811660208301528a16818301526060810189905290517ff8eff9ed148da048feccebca2617170aec98bea5840b0b0be8a289ec03c375fd9181900360800190a15061053b6001600055565b50505050505050565b60008084156105895789898989878a308960405160200161056c98979695949392919061251a565b6040516020818303038152906040528051906020012090506105e8565b6001600160a01b0388166105b25789898888308760405160200161056c969594939291906124c9565b898989898930886040516020016105cf9796959493929190612579565b6040516020818303038152906040528051906020012090505b9998505050505050505050565b6001818154811061060557600080fd5b6000918252602090912001546001600160a01b0316905081565b610627611673565b6002825110156106495760405162461bcd60e51b81526004016102d790612692565b805182511461066a5760405162461bcd60e51b81526004016102d790612607565b8160018151811061068b57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316826000815181106106bd57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156106ec5760405162461bcd60e51b81526004016102d7906126f6565b4284101561070c5760405162461bcd60e51b81526004016102d7906126c9565b6000868686863046604051602001610729969594939291906124c9565b60405160208183030381529060405280519060200120905061074a816116cd565b905060005b83518160ff16101561081957600061078483858460ff168151811061041d57634e487b7160e01b600052603260045260246000fd5b9050848260ff16815181106107a957634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316816001600160a01b0316146107e15760405162461bcd60e51b81526004016102d79061263e565b6107ea8161099d565b6108065760405162461bcd60e51b81526004016102d790612666565b508061081181612802565b91505061074f565b506108278488886000611724565b854710156108775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102d7565b6000876001600160a01b03168760405160006040518083038185875af1925050503d80600081146108c4576040519150601f19603f3d011682016040523d82523d6000602084013e6108c9565b606091505b50509050806109405760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016102d7565b604080518681526001600160a01b038a1660208201529081018890527f4d7574efc376e1ee5e6eacc9b23ed30ae9f40acfddb028be515fb99a14e2290c9060600160405180910390a150506109956001600055565b505050505050565b6000805b600154811015610a0d57826001600160a01b0316600182815481106109d657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156109fb576001915050610a13565b80610a05816127e7565b9150506109a1565b50600090505b919050565b6000610a22611673565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b158015610a8657600080fd5b505afa158015610a9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abe9190612462565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316896001600160a01b03161415610b1757610b0f6001600160a01b038a1633308b611840565b879150610ec2565b6000610b26856004818961277b565b810190610b339190612037565b505091505080600001516001600160a01b03168a6001600160a01b031614610b9d5760405162461bcd60e51b815260206004820181905260248201527f6d69736d6174636820746f6b656e20616e6420646573632e737263546f6b656e60448201526064016102d7565b80602001516001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610c1a5760405162461bcd60e51b815260206004820152601560248201527434b73b30b634b2103232b9b1973239ba2a37b5b2b760591b60448201526064016102d7565b80608001518914610c6d5760405162461bcd60e51b815260206004820152601f60248201527f6d69736d6174636820616d6f756e7420616e6420646573632e616d6f756e740060448201526064016102d7565b80606001516001600160a01b0316306001600160a01b031614610cd25760405162461bcd60e51b815260206004820152601860248201527f696e76616c696420646573632e6473745265636569766572000000000000000060448201526064016102d7565b6000610ce1826000015161187e565b905080610d7d5760808201518251610d08916001600160a01b039091169033903090611840565b8151610d3f906001600160a01b03167f000000000000000000000000000000000000000000000000000000000000000060006118b8565b60808201518251610d7d916001600160a01b03909116907f0000000000000000000000000000000000000000000000000000000000000000906118b8565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316348a8a604051610dbb92919061249d565b60006040518083038185875af1925050503d8060008114610df8576040519150601f19603f3d011682016040523d82523d6000602084013e610dfd565b606091505b509150915081610e415760405162461bcd60e51b815260206004820152600f60248201526e195e18da185b99d94819985a5b1959608a1b60448201526064016102d7565b80806020019051810190610e55919061247a565b5060a0850151909650861015610ebd5760405162461bcd60e51b815260206004820152602760248201527f72656365697665642055534454206c657373207468616e206d696e52657475726044820152661b905b5bdd5b9d60ca1b60648201526084016102d7565b505050505b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b158015610f2457600080fd5b505afa158015610f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5c9190612462565b9050610f6882846119dc565b8114610fa75760405162461bcd60e51b815260206004820152600e60248201526d1cddd85c081a5b98dbdc9c9958dd60921b60448201526064016102d7565b604080513381526001600160a01b038c1660208201529081018a9052606081018490526080810189905260a081018890527f5f971bd00bf3ffbca8a6d72cdd4fd92cfd4f62636161921d1e5a64f0b64ccb6d9060c00160405180910390a146600114806110145750466005145b8061102157504662aa36a7145b156111705761107b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000060006118b8565b6110cf6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f0000000000000000000000000000000000000000000000000000000000000000856118b8565b6003546040516327b45c2160e21b8152600481018a9052602481019190915260448101889052606481018490527f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03821690639ed1708490608401600060405180830381600087803b15801561114c57600080fd5b505af1158015611160573d6000803e3d6000fd5b5050505083945050505050611176565b50909150505b6111806001600055565b9695505050505050565b611192611673565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316876001600160a01b0316146112035760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b2103a37b5b2b760991b60448201526064016102d7565b6002825110156112255760405162461bcd60e51b81526004016102d790612692565b80518251146112465760405162461bcd60e51b81526004016102d790612607565b8160018151811061126757634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03168260008151811061129957634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156112c85760405162461bcd60e51b81526004016102d7906126f6565b428410156112e85760405162461bcd60e51b81526004016102d7906126c9565b6000888789878988304660405160200161130998979695949392919061251a565b60405160208183030381529060405280519060200120905061132a816116cd565b905060005b83518160ff1610156113f957600061136483858460ff168151811061041d57634e487b7160e01b600052603260045260246000fd5b9050848260ff168151811061138957634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316816001600160a01b0316146113c15760405162461bcd60e51b81526004016102d79061263e565b6113ca8161099d565b6113e65760405162461bcd60e51b81526004016102d790612666565b50806113f181612802565b91505061132f565b50611406848a898b611724565b6040516001600160601b031960608b811b82166020840152603483018a90528a901b1660548201526068810187905260009060880160408051808303601f19018152908290528051602090910120636a93856760e01b82526004820181905291507f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03821690636a9385679060240160206040518083038186803b1580156114b557600080fd5b505afa1580156114c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ed9190612392565b156115315760405162461bcd60e51b8152602060048201526014602482015273199858dd08185b1c9958591e481a5cd5985b1a5960621b60448201526064016102d7565b6115666001600160a01b038b167f000000000000000000000000000000000000000000000000000000000000000060006118b8565b61159a6001600160a01b038b167f00000000000000000000000000000000000000000000000000000000000000008b6118b8565b604051630ab4574d60e31b81526001600160a01b038c811660048301528b81166024830152604482018b9052606482018a90528216906355a2ba6890608401600060405180830381600087803b1580156115f357600080fd5b505af1158015611607573d6000803e3d6000fd5b5050604080518981526001600160a01b038e811660208301528f1681830152606081018d905290517ff8eff9ed148da048feccebca2617170aec98bea5840b0b0be8a289ec03c375fd9350908190036080019150a15050506116696001600055565b5050505050505050565b600260005414156116c65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102d7565b6002600055565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b600080600061170f85856119ef565b9150915061171c81611a35565b509392505050565b60008481526002602081905260409091200154600160a01b900460ff161561177f5760405162461bcd60e51b815260206004820152600e60248201526d3932b832b0ba32b21037b93232b960911b60448201526064016102d7565b6000938452600260208190526040909420938401805485546001600160a01b039586166001600160a01b031991821617875560019690960193909355921660ff60a01b19909116600160a01b1792909216919091179055565b6040516001600160a01b03831660248201526044810182905261183b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611bc0565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526118789085906323b872dd60e01b90608401611804565b50505050565b60006001600160a01b03821615806118b257506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b92915050565b8015806119415750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561190757600080fd5b505afa15801561191b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193f9190612462565b155b6119ac5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016102d7565b6040516001600160a01b03831660248201526044810182905261183b90849063095ea7b360e01b90606401611804565b60006119e882846127a3565b9392505050565b600080825160411415611a265760208301516040840151606085015160001a611a1a87828585611c95565b94509450505050611a2e565b506000905060025b9250929050565b6000816004811115611a5757634e487b7160e01b600052602160045260246000fd5b1415611a6257611bbd565b6001816004811115611a8457634e487b7160e01b600052602160045260246000fd5b1415611ad25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016102d7565b6002816004811115611af457634e487b7160e01b600052602160045260246000fd5b1415611b425760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016102d7565b6003816004811115611b6457634e487b7160e01b600052602160045260246000fd5b1415611bbd5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016102d7565b50565b6000611c15826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d599092919063ffffffff16565b9050805160001480611c36575080806020019051810190611c369190612392565b61183b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102d7565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611ccc5750600090506003611d50565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611d20573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611d4957600060019250925050611d50565b9150600090505b94509492505050565b6060611d688484600085611d70565b949350505050565b606082471015611dd15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016102d7565b600080866001600160a01b03168587604051611ded91906124ad565b60006040518083038185875af1925050503d8060008114611e2a576040519150601f19603f3d011682016040523d82523d6000602084013e611e2f565b606091505b5091509150611e4087838387611e4b565b979650505050505050565b60608315611eb7578251611eb0576001600160a01b0385163b611eb05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102d7565b5081611d68565b611d688383815115611ecc5781518083602001fd5b8060405162461bcd60e51b81526004016102d791906125d4565b600082601f830112611ef6578081fd5b81356020611f0b611f0683612757565b612726565b8281528181019085830183850287018401881015611f27578586fd5b855b85811015611f4e578135611f3c8161284e565b84529284019290840190600101611f29565b5090979650505050505050565b600082601f830112611f6b578081fd5b81356020611f7b611f0683612757565b82815281810190858301855b85811015611f4e57611f9e898684358b0101611fb0565b84529284019290840190600101611f87565b600082601f830112611fc0578081fd5b813567ffffffffffffffff811115611fda57611fda612838565b611fed601f8201601f1916602001612726565b818152846020838601011115612001578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561202c578081fd5b81356119e88161284e565b60008060008084860361014081121561204e578384fd5b85356120598161284e565b945060e0601f198201121561206c578384fd5b5061207760e0612726565b60208601356120858161284e565b815260408601356120958161284e565b602082015260608601356120a88161284e565b604082015260808601356120bb8161284e565b8060608301525060a0860135608082015260c086013560a082015260e086013560c08201528093505061010085013567ffffffffffffffff808211156120ff578384fd5b61210b88838901611fb0565b9350610120870135915080821115612121578283fd5b5061212e87828801611fb0565b91505092959194509250565b60008060008060008060c08789031215612152578182fd5b863561215d8161284e565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff8082111561218e578384fd5b61219a8a838b01611ee6565b935060a08901359150808211156121af578283fd5b506121bc89828a01611f5b565b9150509295509295509295565b600080600080600080600080610100898b0312156121e5578182fd5b88356121f08161284e565b975060208901356122008161284e565b965060408901359550606089013594506080890135935060a0890135925060c089013567ffffffffffffffff80821115612238578384fd5b6122448c838d01611ee6565b935060e08b0135915080821115612259578283fd5b506122668b828c01611f5b565b9150509295985092959890939650565b600080600080600080600060e0888a031215612290578081fd5b873561229b8161284e565b96506020880135955060408801356122b28161284e565b9450606088013593506080880135925060a088013567ffffffffffffffff808211156122dc578283fd5b6122e88b838c01611ee6565b935060c08a01359150808211156122fd578283fd5b5061230a8a828b01611f5b565b91505092959891949750929550565b600080600080600080600080610100898b031215612335578182fd5b88356123408161284e565b97506020890135965060408901356123578161284e565b9550606089013594506080890135935060a089013561237581612863565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156123a3578081fd5b81516119e881612863565b60008060008060008060a087890312156123c6578384fd5b86356123d18161284e565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff80821115612402578384fd5b818901915089601f830112612415578384fd5b813581811115612423578485fd5b8a6020828501011115612434578485fd5b6020830194508093505050509295509295509295565b60006020828403121561245b578081fd5b5035919050565b600060208284031215612473578081fd5b5051919050565b6000806040838503121561248c578182fd5b505080516020909101519092909150565b6000828483379101908152919050565b600082516124bf8184602087016127bb565b9190910192915050565b6422aa2422a960d91b81526001600160601b0319606097881b8116600583015260198201969096526039810194909452605984019290925290931b9091166079820152608d81019190915260ad0190565b63119054d560e21b81526001600160601b03196060998a1b81166004830152601882019890985295881b87166038870152604c860194909452606c850192909252608c84015290931b90911660ac82015260c081019190915260e00190565b64045524332360dc1b81526001600160601b0319606098891b81166005830152601982019790975294871b86166039860152604d850193909352606d84019190915290931b909116608d82015260a181019190915260c10190565b60006020825282518060208401526125f38160408501602087016127bb565b601f01601f19169190910160400192915050565b60208082526019908201527f696e76616c6964207369676e617475726573206c656e67746800000000000000604082015260600190565b6020808252600e908201526d34b73b30b634b21039b4b3b732b960911b604082015260600190565b6020808252601290820152713737ba1030b63637bbb2b21039b4b3b732b960711b604082015260600190565b60208082526019908201527f696e76616c696420616c6c5369676e657273206c656e67746800000000000000604082015260600190565b60208082526013908201527232bc3834b932b2103a3930b739b0b1ba34b7b760691b604082015260600190565b60208082526016908201527531b0b7103737ba1031329039b0b6b29039b4b3b732b960511b604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561274f5761274f612838565b604052919050565b600067ffffffffffffffff82111561277157612771612838565b5060209081020190565b6000808585111561278a578182fd5b83861115612796578182fd5b5050820193919092039150565b600082198211156127b6576127b6612822565b500190565b60005b838110156127d65781810151838201526020016127be565b838111156118785750506000910152565b60006000198214156127fb576127fb612822565b5060010190565b600060ff821660ff81141561281957612819612822565b60010192915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611bbd57600080fd5b8015158114611bbd57600080fdfea264697066735822122040ce4ca326ac52bc045b1f38e34e8fbcadb42f2580b36422c29d0e83654788d164736f6c634300080200336d75737420626520646966666572656e74207369676e6572730000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f0000000000000000000000001111111254eeb25477b68fb85ed929f73a9605820000000000000000000000007ad80eedf33e81b770e20a66ae17a264ca5647a7000000000000000000000000b2846943c2eda3830fb784d2a6de93435267b11d033bda5c923bae4e84825b74762d5482889b9512465fbffc50d1ae4b82e345c30000000000000000000000000000000000000000000000000000000000000003000000000000000000000000ab56ceac58268af459780abf98c50a7ad2c66ec8000000000000000000000000190aa94cda84949478c54150667e9db6ab480b8c000000000000000000000000f6d79f80758029d8957ee4028fc0156ebeb3b751

Deployed Bytecode

0x6080604052600436106100ab5760003560e01c80638815eb39116100645780638815eb39146101cc5780639fdd761d146101e2578063c189205814610216578063cabb9e7a1461024a578063cfe96c841461027a578063f13b49751461028d576100b2565b80631025e095146100b757806312a5a096146100d95780632079fb9a1461010c578063391cdc0814610144578063496eff7b146101785780636b1430d6146101ac576100b2565b366100b257005b600080fd5b3480156100c357600080fd5b506100d76100d2366004612276565b6102ad565b005b3480156100e557600080fd5b506100f96100f4366004612319565b610544565b6040519081526020015b60405180910390f35b34801561011857600080fd5b5061012c61012736600461244a565b6105f5565b6040516001600160a01b039091168152602001610103565b34801561015057600080fd5b5061012c7f0000000000000000000000007ad80eedf33e81b770e20a66ae17a264ca5647a781565b34801561018457600080fd5b5061012c7f000000000000000000000000b2846943c2eda3830fb784d2a6de93435267b11d81565b3480156101b857600080fd5b506100d76101c736600461213a565b61061f565b3480156101d857600080fd5b506100f960035481565b3480156101ee57600080fd5b5061012c7f0000000000000000000000001111111254eeb25477b68fb85ed929f73a96058281565b34801561022257600080fd5b5061012c7f000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f81565b34801561025657600080fd5b5061026a61026536600461201b565b61099d565b6040519015158152602001610103565b6100f96102883660046123ae565b610a18565b34801561029957600080fd5b506100d76102a83660046121c9565b61118a565b6102b5611673565b6002825110156102e05760405162461bcd60e51b81526004016102d790612692565b60405180910390fd5b80518251146103015760405162461bcd60e51b81526004016102d790612607565b8160018151811061032257634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03168260008151811061035457634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156103835760405162461bcd60e51b81526004016102d7906126f6565b428410156103a35760405162461bcd60e51b81526004016102d7906126c9565b6000878787878730466040516020016103c29796959493929190612579565b6040516020818303038152906040528051906020012090506103e3816116cd565b905060005b83518160ff1610156104bf57600061042a83858460ff168151811061041d57634e487b7160e01b600052603260045260246000fd5b6020026020010151611700565b9050848260ff168151811061044f57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316816001600160a01b0316146104875760405162461bcd60e51b81526004016102d79061263e565b6104908161099d565b6104ac5760405162461bcd60e51b81526004016102d790612666565b50806104b781612802565b9150506103e8565b506104cc84898989611724565b6104e06001600160a01b03871689896117d8565b604080518581526001600160a01b0388811660208301528a16818301526060810189905290517ff8eff9ed148da048feccebca2617170aec98bea5840b0b0be8a289ec03c375fd9181900360800190a15061053b6001600055565b50505050505050565b60008084156105895789898989878a308960405160200161056c98979695949392919061251a565b6040516020818303038152906040528051906020012090506105e8565b6001600160a01b0388166105b25789898888308760405160200161056c969594939291906124c9565b898989898930886040516020016105cf9796959493929190612579565b6040516020818303038152906040528051906020012090505b9998505050505050505050565b6001818154811061060557600080fd5b6000918252602090912001546001600160a01b0316905081565b610627611673565b6002825110156106495760405162461bcd60e51b81526004016102d790612692565b805182511461066a5760405162461bcd60e51b81526004016102d790612607565b8160018151811061068b57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316826000815181106106bd57634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156106ec5760405162461bcd60e51b81526004016102d7906126f6565b4284101561070c5760405162461bcd60e51b81526004016102d7906126c9565b6000868686863046604051602001610729969594939291906124c9565b60405160208183030381529060405280519060200120905061074a816116cd565b905060005b83518160ff16101561081957600061078483858460ff168151811061041d57634e487b7160e01b600052603260045260246000fd5b9050848260ff16815181106107a957634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316816001600160a01b0316146107e15760405162461bcd60e51b81526004016102d79061263e565b6107ea8161099d565b6108065760405162461bcd60e51b81526004016102d790612666565b508061081181612802565b91505061074f565b506108278488886000611724565b854710156108775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016102d7565b6000876001600160a01b03168760405160006040518083038185875af1925050503d80600081146108c4576040519150601f19603f3d011682016040523d82523d6000602084013e6108c9565b606091505b50509050806109405760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016102d7565b604080518681526001600160a01b038a1660208201529081018890527f4d7574efc376e1ee5e6eacc9b23ed30ae9f40acfddb028be515fb99a14e2290c9060600160405180910390a150506109956001600055565b505050505050565b6000805b600154811015610a0d57826001600160a01b0316600182815481106109d657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156109fb576001915050610a13565b80610a05816127e7565b9150506109a1565b50600090505b919050565b6000610a22611673565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f16906370a082319060240160206040518083038186803b158015610a8657600080fd5b505afa158015610a9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abe9190612462565b90507f000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f6001600160a01b0316896001600160a01b03161415610b1757610b0f6001600160a01b038a1633308b611840565b879150610ec2565b6000610b26856004818961277b565b810190610b339190612037565b505091505080600001516001600160a01b03168a6001600160a01b031614610b9d5760405162461bcd60e51b815260206004820181905260248201527f6d69736d6174636820746f6b656e20616e6420646573632e737263546f6b656e60448201526064016102d7565b80602001516001600160a01b03167f000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f6001600160a01b031614610c1a5760405162461bcd60e51b815260206004820152601560248201527434b73b30b634b2103232b9b1973239ba2a37b5b2b760591b60448201526064016102d7565b80608001518914610c6d5760405162461bcd60e51b815260206004820152601f60248201527f6d69736d6174636820616d6f756e7420616e6420646573632e616d6f756e740060448201526064016102d7565b80606001516001600160a01b0316306001600160a01b031614610cd25760405162461bcd60e51b815260206004820152601860248201527f696e76616c696420646573632e6473745265636569766572000000000000000060448201526064016102d7565b6000610ce1826000015161187e565b905080610d7d5760808201518251610d08916001600160a01b039091169033903090611840565b8151610d3f906001600160a01b03167f0000000000000000000000001111111254eeb25477b68fb85ed929f73a96058260006118b8565b60808201518251610d7d916001600160a01b03909116907f0000000000000000000000001111111254eeb25477b68fb85ed929f73a960582906118b8565b6000807f0000000000000000000000001111111254eeb25477b68fb85ed929f73a9605826001600160a01b0316348a8a604051610dbb92919061249d565b60006040518083038185875af1925050503d8060008114610df8576040519150601f19603f3d011682016040523d82523d6000602084013e610dfd565b606091505b509150915081610e415760405162461bcd60e51b815260206004820152600f60248201526e195e18da185b99d94819985a5b1959608a1b60448201526064016102d7565b80806020019051810190610e55919061247a565b5060a0850151909650861015610ebd5760405162461bcd60e51b815260206004820152602760248201527f72656365697665642055534454206c657373207468616e206d696e52657475726044820152661b905b5bdd5b9d60ca1b60648201526084016102d7565b505050505b6040516370a0823160e01b81523060048201526000907f000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f6001600160a01b0316906370a082319060240160206040518083038186803b158015610f2457600080fd5b505afa158015610f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5c9190612462565b9050610f6882846119dc565b8114610fa75760405162461bcd60e51b815260206004820152600e60248201526d1cddd85c081a5b98dbdc9c9958dd60921b60448201526064016102d7565b604080513381526001600160a01b038c1660208201529081018a9052606081018490526080810189905260a081018890527f5f971bd00bf3ffbca8a6d72cdd4fd92cfd4f62636161921d1e5a64f0b64ccb6d9060c00160405180910390a146600114806110145750466005145b8061102157504662aa36a7145b156111705761107b6001600160a01b037f000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f167f0000000000000000000000007ad80eedf33e81b770e20a66ae17a264ca5647a760006118b8565b6110cf6001600160a01b037f000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f167f0000000000000000000000007ad80eedf33e81b770e20a66ae17a264ca5647a7856118b8565b6003546040516327b45c2160e21b8152600481018a9052602481019190915260448101889052606481018490527f0000000000000000000000007ad80eedf33e81b770e20a66ae17a264ca5647a7906001600160a01b03821690639ed1708490608401600060405180830381600087803b15801561114c57600080fd5b505af1158015611160573d6000803e3d6000fd5b5050505083945050505050611176565b50909150505b6111806001600055565b9695505050505050565b611192611673565b7f000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f6001600160a01b0316876001600160a01b0316146112035760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b2103a37b5b2b760991b60448201526064016102d7565b6002825110156112255760405162461bcd60e51b81526004016102d790612692565b80518251146112465760405162461bcd60e51b81526004016102d790612607565b8160018151811061126757634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b03168260008151811061129957634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b031614156112c85760405162461bcd60e51b81526004016102d7906126f6565b428410156112e85760405162461bcd60e51b81526004016102d7906126c9565b6000888789878988304660405160200161130998979695949392919061251a565b60405160208183030381529060405280519060200120905061132a816116cd565b905060005b83518160ff1610156113f957600061136483858460ff168151811061041d57634e487b7160e01b600052603260045260246000fd5b9050848260ff168151811061138957634e487b7160e01b600052603260045260246000fd5b60200260200101516001600160a01b0316816001600160a01b0316146113c15760405162461bcd60e51b81526004016102d79061263e565b6113ca8161099d565b6113e65760405162461bcd60e51b81526004016102d790612666565b50806113f181612802565b91505061132f565b50611406848a898b611724565b6040516001600160601b031960608b811b82166020840152603483018a90528a901b1660548201526068810187905260009060880160408051808303601f19018152908290528051602090910120636a93856760e01b82526004820181905291507f000000000000000000000000b2846943c2eda3830fb784d2a6de93435267b11d906001600160a01b03821690636a9385679060240160206040518083038186803b1580156114b557600080fd5b505afa1580156114c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ed9190612392565b156115315760405162461bcd60e51b8152602060048201526014602482015273199858dd08185b1c9958591e481a5cd5985b1a5960621b60448201526064016102d7565b6115666001600160a01b038b167f000000000000000000000000b2846943c2eda3830fb784d2a6de93435267b11d60006118b8565b61159a6001600160a01b038b167f000000000000000000000000b2846943c2eda3830fb784d2a6de93435267b11d8b6118b8565b604051630ab4574d60e31b81526001600160a01b038c811660048301528b81166024830152604482018b9052606482018a90528216906355a2ba6890608401600060405180830381600087803b1580156115f357600080fd5b505af1158015611607573d6000803e3d6000fd5b5050604080518981526001600160a01b038e811660208301528f1681830152606081018d905290517ff8eff9ed148da048feccebca2617170aec98bea5840b0b0be8a289ec03c375fd9350908190036080019150a15050506116696001600055565b5050505050505050565b600260005414156116c65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016102d7565b6002600055565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c91909152603c902090565b600080600061170f85856119ef565b9150915061171c81611a35565b509392505050565b60008481526002602081905260409091200154600160a01b900460ff161561177f5760405162461bcd60e51b815260206004820152600e60248201526d3932b832b0ba32b21037b93232b960911b60448201526064016102d7565b6000938452600260208190526040909420938401805485546001600160a01b039586166001600160a01b031991821617875560019690960193909355921660ff60a01b19909116600160a01b1792909216919091179055565b6040516001600160a01b03831660248201526044810182905261183b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611bc0565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526118789085906323b872dd60e01b90608401611804565b50505050565b60006001600160a01b03821615806118b257506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b92915050565b8015806119415750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561190757600080fd5b505afa15801561191b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193f9190612462565b155b6119ac5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016102d7565b6040516001600160a01b03831660248201526044810182905261183b90849063095ea7b360e01b90606401611804565b60006119e882846127a3565b9392505050565b600080825160411415611a265760208301516040840151606085015160001a611a1a87828585611c95565b94509450505050611a2e565b506000905060025b9250929050565b6000816004811115611a5757634e487b7160e01b600052602160045260246000fd5b1415611a6257611bbd565b6001816004811115611a8457634e487b7160e01b600052602160045260246000fd5b1415611ad25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016102d7565b6002816004811115611af457634e487b7160e01b600052602160045260246000fd5b1415611b425760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016102d7565b6003816004811115611b6457634e487b7160e01b600052602160045260246000fd5b1415611bbd5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016102d7565b50565b6000611c15826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d599092919063ffffffff16565b9050805160001480611c36575080806020019051810190611c369190612392565b61183b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102d7565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611ccc5750600090506003611d50565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611d20573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611d4957600060019250925050611d50565b9150600090505b94509492505050565b6060611d688484600085611d70565b949350505050565b606082471015611dd15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016102d7565b600080866001600160a01b03168587604051611ded91906124ad565b60006040518083038185875af1925050503d8060008114611e2a576040519150601f19603f3d011682016040523d82523d6000602084013e611e2f565b606091505b5091509150611e4087838387611e4b565b979650505050505050565b60608315611eb7578251611eb0576001600160a01b0385163b611eb05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102d7565b5081611d68565b611d688383815115611ecc5781518083602001fd5b8060405162461bcd60e51b81526004016102d791906125d4565b600082601f830112611ef6578081fd5b81356020611f0b611f0683612757565b612726565b8281528181019085830183850287018401881015611f27578586fd5b855b85811015611f4e578135611f3c8161284e565b84529284019290840190600101611f29565b5090979650505050505050565b600082601f830112611f6b578081fd5b81356020611f7b611f0683612757565b82815281810190858301855b85811015611f4e57611f9e898684358b0101611fb0565b84529284019290840190600101611f87565b600082601f830112611fc0578081fd5b813567ffffffffffffffff811115611fda57611fda612838565b611fed601f8201601f1916602001612726565b818152846020838601011115612001578283fd5b816020850160208301379081016020019190915292915050565b60006020828403121561202c578081fd5b81356119e88161284e565b60008060008084860361014081121561204e578384fd5b85356120598161284e565b945060e0601f198201121561206c578384fd5b5061207760e0612726565b60208601356120858161284e565b815260408601356120958161284e565b602082015260608601356120a88161284e565b604082015260808601356120bb8161284e565b8060608301525060a0860135608082015260c086013560a082015260e086013560c08201528093505061010085013567ffffffffffffffff808211156120ff578384fd5b61210b88838901611fb0565b9350610120870135915080821115612121578283fd5b5061212e87828801611fb0565b91505092959194509250565b60008060008060008060c08789031215612152578182fd5b863561215d8161284e565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff8082111561218e578384fd5b61219a8a838b01611ee6565b935060a08901359150808211156121af578283fd5b506121bc89828a01611f5b565b9150509295509295509295565b600080600080600080600080610100898b0312156121e5578182fd5b88356121f08161284e565b975060208901356122008161284e565b965060408901359550606089013594506080890135935060a0890135925060c089013567ffffffffffffffff80821115612238578384fd5b6122448c838d01611ee6565b935060e08b0135915080821115612259578283fd5b506122668b828c01611f5b565b9150509295985092959890939650565b600080600080600080600060e0888a031215612290578081fd5b873561229b8161284e565b96506020880135955060408801356122b28161284e565b9450606088013593506080880135925060a088013567ffffffffffffffff808211156122dc578283fd5b6122e88b838c01611ee6565b935060c08a01359150808211156122fd578283fd5b5061230a8a828b01611f5b565b91505092959891949750929550565b600080600080600080600080610100898b031215612335578182fd5b88356123408161284e565b97506020890135965060408901356123578161284e565b9550606089013594506080890135935060a089013561237581612863565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156123a3578081fd5b81516119e881612863565b60008060008060008060a087890312156123c6578384fd5b86356123d18161284e565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff80821115612402578384fd5b818901915089601f830112612415578384fd5b813581811115612423578485fd5b8a6020828501011115612434578485fd5b6020830194508093505050509295509295509295565b60006020828403121561245b578081fd5b5035919050565b600060208284031215612473578081fd5b5051919050565b6000806040838503121561248c578182fd5b505080516020909101519092909150565b6000828483379101908152919050565b600082516124bf8184602087016127bb565b9190910192915050565b6422aa2422a960d91b81526001600160601b0319606097881b8116600583015260198201969096526039810194909452605984019290925290931b9091166079820152608d81019190915260ad0190565b63119054d560e21b81526001600160601b03196060998a1b81166004830152601882019890985295881b87166038870152604c860194909452606c850192909252608c84015290931b90911660ac82015260c081019190915260e00190565b64045524332360dc1b81526001600160601b0319606098891b81166005830152601982019790975294871b86166039860152604d850193909352606d84019190915290931b909116608d82015260a181019190915260c10190565b60006020825282518060208401526125f38160408501602087016127bb565b601f01601f19169190910160400192915050565b60208082526019908201527f696e76616c6964207369676e617475726573206c656e67746800000000000000604082015260600190565b6020808252600e908201526d34b73b30b634b21039b4b3b732b960911b604082015260600190565b6020808252601290820152713737ba1030b63637bbb2b21039b4b3b732b960711b604082015260600190565b60208082526019908201527f696e76616c696420616c6c5369676e657273206c656e67746800000000000000604082015260600190565b60208082526013908201527232bc3834b932b2103a3930b739b0b1ba34b7b760691b604082015260600190565b60208082526016908201527531b0b7103737ba1031329039b0b6b29039b4b3b732b960511b604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561274f5761274f612838565b604052919050565b600067ffffffffffffffff82111561277157612771612838565b5060209081020190565b6000808585111561278a578182fd5b83861115612796578182fd5b5050820193919092039150565b600082198211156127b6576127b6612822565b500190565b60005b838110156127d65781810151838201526020016127be565b838111156118785750506000910152565b60006000198214156127fb576127fb612822565b5060010190565b600060ff821660ff81141561281957612819612822565b60010192915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611bbd57600080fd5b8015158114611bbd57600080fdfea264697066735822122040ce4ca326ac52bc045b1f38e34e8fbcadb42f2580b36422c29d0e83654788d164736f6c63430008020033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f0000000000000000000000001111111254eeb25477b68fb85ed929f73a9605820000000000000000000000007ad80eedf33e81b770e20a66ae17a264ca5647a7000000000000000000000000b2846943c2eda3830fb784d2a6de93435267b11d033bda5c923bae4e84825b74762d5482889b9512465fbffc50d1ae4b82e345c30000000000000000000000000000000000000000000000000000000000000003000000000000000000000000ab56ceac58268af459780abf98c50a7ad2c66ec8000000000000000000000000190aa94cda84949478c54150667e9db6ab480b8c000000000000000000000000f6d79f80758029d8957ee4028fc0156ebeb3b751

-----Decoded View---------------
Arg [0] : allowedSigners (address[]): 0xaB56cEAC58268Af459780abf98C50A7aD2C66Ec8,0x190AA94CDa84949478C54150667e9Db6ab480B8C,0xF6d79F80758029D8957ee4028Fc0156ebEb3b751
Arg [1] : usdt (address): 0xd98B590ebE0a3eD8C144170bA4122D402182976f
Arg [2] : aggregationRouterV5 (address): 0x1111111254EEB25477B68fb85Ed929f73A960582
Arg [3] : starkex (address): 0x7Ad80EEDf33e81B770E20a66ae17A264ca5647a7
Arg [4] : fact (address): 0xb2846943C2EdA3830Fb784d2a6de93435267b11D
Arg [5] : assetType (uint256): 1462689598990563437242498716673917341065799132144045992877344104815146517955

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 000000000000000000000000d98b590ebe0a3ed8c144170ba4122d402182976f
Arg [2] : 0000000000000000000000001111111254eeb25477b68fb85ed929f73a960582
Arg [3] : 0000000000000000000000007ad80eedf33e81b770e20a66ae17a264ca5647a7
Arg [4] : 000000000000000000000000b2846943c2eda3830fb784d2a6de93435267b11d
Arg [5] : 033bda5c923bae4e84825b74762d5482889b9512465fbffc50d1ae4b82e345c3
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [7] : 000000000000000000000000ab56ceac58268af459780abf98c50a7ad2c66ec8
Arg [8] : 000000000000000000000000190aa94cda84949478c54150667e9db6ab480b8c
Arg [9] : 000000000000000000000000f6d79f80758029d8957ee4028fc0156ebeb3b751


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  ]

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.