ETH Price: $1,601.29 (+0.79%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Batch Claim Fast...222907152025-04-17 19:10:2356 secs ago1744917023IN
0x57E9E78A...006298AF6
0 ETH0.000090580.53357336
Fast Finish Tran...222907132025-04-17 19:09:591 min ago1744916999IN
0x57E9E78A...006298AF6
0 ETH0.000135190.56094721
Fast Finish Tran...222907122025-04-17 19:09:471 min ago1744916987IN
0x57E9E78A...006298AF6
0 ETH0.00011490.5384007
Fast Finish Tran...222907092025-04-17 19:08:592 mins ago1744916939IN
0x57E9E78A...006298AF6
0 ETH0.000138050.57282971
Fast Finish Tran...222907072025-04-17 19:08:352 mins ago1744916915IN
0x57E9E78A...006298AF6
0 ETH0.00012870.6030307
Fast Finish Tran...222907032025-04-17 19:07:473 mins ago1744916867IN
0x57E9E78A...006298AF6
0 ETH0.000118790.55658261
Fast Finish Tran...222906942025-04-17 19:05:595 mins ago1744916759IN
0x57E9E78A...006298AF6
0 ETH0.000176110.73078912
Batch Claim Fast...222906852025-04-17 19:04:117 mins ago1744916651IN
0x57E9E78A...006298AF6
0 ETH0.000132220.77900668
Fast Finish Tran...222906662025-04-17 19:00:2310 mins ago1744916423IN
0x57E9E78A...006298AF6
0 ETH0.000155490.64520568
Fast Finish Tran...222906642025-04-17 18:59:5911 mins ago1744916399IN
0x57E9E78A...006298AF6
0 ETH0.00013710.56888176
Batch Claim Fast...222906552025-04-17 18:58:1113 mins ago1744916291IN
0x57E9E78A...006298AF6
0 ETH0.000091410.53860548
Fast Finish Tran...222906552025-04-17 18:58:1113 mins ago1744916291IN
0x57E9E78A...006298AF6
0 ETH0.00012980.53860548
Fast Finish Tran...222906512025-04-17 18:57:2313 mins ago1744916243IN
0x57E9E78A...006298AF6
0 ETH0.00012080.56605106
Fast Finish Tran...222906492025-04-17 18:56:5914 mins ago1744916219IN
0x57E9E78A...006298AF6
0 ETH0.000121320.56851412
Fast Finish Tran...222906332025-04-17 18:53:3517 mins ago1744916015IN
0x57E9E78A...006298AF6
0 ETH0.00010740.50321305
Batch Claim Fast...222906262025-04-17 18:52:1119 mins ago1744915931IN
0x57E9E78A...006298AF6
0 ETH0.000074570.43922121
Fast Finish Tran...222906232025-04-17 18:51:3519 mins ago1744915895IN
0x57E9E78A...006298AF6
0 ETH0.000089540.41959851
Fast Finish Tran...222905892025-04-17 18:44:4726 mins ago1744915487IN
0x57E9E78A...006298AF6
0 ETH0.000078580.36821664
Batch Claim Fast...222905862025-04-17 18:44:1127 mins ago1744915451IN
0x57E9E78A...006298AF6
0 ETH0.000065940.38845625
Fast Finish Tran...222905782025-04-17 18:42:3528 mins ago1744915355IN
0x57E9E78A...006298AF6
0 ETH0.000085910.40258927
Batch Claim Fast...222905562025-04-17 18:38:1133 mins ago1744915091IN
0x57E9E78A...006298AF6
0 ETH0.000131910.39208192
Fast Finish Tran...222905272025-04-17 18:32:2338 mins ago1744914743IN
0x57E9E78A...006298AF6
0 ETH0.000081630.38248864
Batch Claim Fast...222905272025-04-17 18:32:2338 mins ago1744914743IN
0x57E9E78A...006298AF6
0 ETH0.000064930.38248864
Batch Claim Fast...222904872025-04-17 18:24:2346 mins ago1744914263IN
0x57E9E78A...006298AF6
0 ETH0.000069860.41159262
Fast Finish Tran...222904752025-04-17 18:21:5949 mins ago1744914119IN
0x57E9E78A...006298AF6
0 ETH0.000081910.38384948
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x2Dc6C393...0f2AD0238
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
FastCCTP

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 1000 runs

Other Settings:
cancun EvmVersion
File 1 of 8 : FastCCTP.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./EphemeralTokenBurner.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";

interface IMessageTransmitter {
  function receiveMessage(bytes calldata message, bytes calldata attestation) external returns (bool);
}

interface IZkLighter {
  /// @notice Deposit USDC to zkLighter
  /// @param _amount USDC Token amount
  /// @param _to The receiver L1 address
  function deposit(uint64 _amount, address _to) external;
}

contract FastCCTP {
  struct IntentParams {
    address deployer;
    address zklighterRecipient;
    address claimContract;
  }

  address public messageTransmitter; // Address of Circle's MessageTransmitter
  address public zklighterProxy; // Address of zklighter proxy
  address public owner;
  mapping(bytes32 intentAddr => address) public fastBridgeCaller;
  IERC20 usdcToken;

  event FundsReceived(bytes32 messageHash, address fastBridgeCallerAddress, uint256 amount);
  event FastFinished(bytes32 messageHash, address finisher);

  modifier onlyOwner() {
    require(msg.sender == owner, "Not authorized");
    _;
  }

  constructor(address _usdcToken, address _messageTransmitter, address _zklighterProxy) {
    usdcToken = IERC20(_usdcToken);
    messageTransmitter = _messageTransmitter;
    zklighterProxy = _zklighterProxy;
    owner = msg.sender;
    usdcToken.approve(zklighterProxy, type(uint256).max);
  }

  // Pays Bob immediately on chain B. The caller LP sends (toToken, toAmount).
  // Later, when the slower CCTP transfer arrives, the LP will be able to claim
  // (toToken, fromAmount), keeping the spread (if any) between the amounts.
  function fastFinishTransfer(address[] calldata zklighterRecipient, uint256[] calldata fromAmount, bytes32[] calldata messageHash) public {
    require(zklighterRecipient.length == fromAmount.length, "Invalid input length");
    require(fromAmount.length == messageHash.length, "Invalid input length");

    uint256 totalAmount = 0;
    for (uint32 i = 0; i < zklighterRecipient.length; ++i) {
      totalAmount += fromAmount[i];
    }
    usdcToken.safeTransferFrom(msg.sender, address(this), totalAmount);

    for (uint32 i = 0; i < zklighterRecipient.length; ++i) {
      bytes32 keyHash = keccak256(abi.encodePacked(messageHash[i], fromAmount[i], zklighterRecipient[i]));
      require(fastBridgeCaller[keyHash] == address(0), "FCCTP: already finished");

      // Record LP as new recipient
      fastBridgeCaller[keyHash] = msg.sender;

      IZkLighter(zklighterProxy).deposit(SafeCast.toUint64(fromAmount[i]), zklighterRecipient[i]);

      emit FastFinished(messageHash[i], msg.sender);
    }
  }

  // Function to process the Circle attestation and execute custom logic
  function batchClaimFastTransfers(IntentParams[] memory params, bytes[] calldata allMessages, bytes[] calldata attestations) external {
    require(allMessages.length == attestations.length, "Invalid input length");
    require(allMessages.length == params.length, "Invalid input length");

    for (uint32 i = 0; i < allMessages.length; ++i) {
      bytes calldata message = allMessages[i];
      bytes calldata attestation = attestations[i];
      // message structure is:
      // uint32 _version,
      // bytes32 _burnToken,
      // bytes32 _mintRecipient,
      // uint256 _amount,
      // bytes32 _messageSender
      bytes32 recipient;
      uint256 amount = 123;
      bytes32 sender;

      bytes memory body = message[116:];
      assembly {
        // Read recipient (bytes32, next 32 bytes)
        recipient := mload(add(body, 0x44)) // Offset by 36 bytes (4 + 32)

        // Read amount (uint256, next 32 bytes)
        amount := mload(add(body, 0x64)) // Offset by 68 bytes (4 + 32 + 32)

        // Read sender (bytes32, final 32 bytes)
        sender := mload(add(body, 0x84)) // Offset by 100 bytes (4 + 32 + 32 + 32)
      }
      address tokenBurnerAddressGiven = getTokenBurnerAddr(params[i].deployer, params[i].zklighterRecipient, params[i].claimContract);
      address recipientAddress = bytes32ToAddress(recipient);
      require(recipientAddress == address(this), "Invalid recipient");
      address tokenBurnerAddress = bytes32ToAddress(sender);

      require(tokenBurnerAddressGiven == tokenBurnerAddress, "Invalid intent address");
      bytes32 messageHash = keccak256(message);
      bytes32 keyHash = keccak256(abi.encodePacked(messageHash, amount, params[i].zklighterRecipient));

      // Call Circle's MessageTransmitter to validate and mint USDC
      bool success = IMessageTransmitter(messageTransmitter).receiveMessage(message, attestation);
      require(success, "Message processing failed");

      address fastBridgeCallerAddress = fastBridgeCaller[keyHash];
      if (fastBridgeCallerAddress != address(0)) {
        // If a fast finisher has sent the funds before, transfer them back
        usdcToken.transfer(fastBridgeCallerAddress, amount);
        fastBridgeCaller[keyHash] = address(0);
      } else {
        IZkLighter(zklighterProxy).deposit(SafeCast.toUint64(amount), params[i].zklighterRecipient);
      }

      emit FundsReceived(messageHash, fastBridgeCallerAddress, amount);
    }
  }

  /// Computes an ephemeral burner address
  function getTokenBurnerAddr(
    address deployer,
    address zklighterRecipient, // user's account address to be deposited in Zklighter
    address claimContract // zkligher claimer contract
  ) public pure returns (address) {
    bytes memory creationCode = abi.encodePacked(type(EphemeralTokenBurner).creationCode, abi.encode(zklighterRecipient, claimContract));
    return Create2.computeAddress(0, keccak256(creationCode), deployer);
  }

  /**
   * @notice converts bytes32 to address (alignment preserving cast.)
   * @dev Warning: it is possible to have different input values _buf map to the same address.
   * For use cases where this is not acceptable, validate that the first 12 bytes of _buf are zero-padding.
   * @param _buf the bytes32 to convert to address
   */
  function bytes32ToAddress(bytes32 _buf) public pure returns (address) {
    return address(uint160(uint256(_buf)));
  }

  using SafeERC20 for IERC20;

  // Rescuer
  address private _rescuer;

  event RescuerChanged(address indexed newRescuer);

  /**
   * @notice Returns current rescuer
   * @return Rescuer's address
   */
  function rescuer() external view returns (address) {
    return _rescuer;
  }

  /**
   * @notice Revert if called by any account other than the rescuer.
   */
  modifier onlyRescuer() {
    require(msg.sender == _rescuer, "Rescuable: caller is not the rescuer");
    _;
  }

  /**
   * @notice Rescue ERC20 tokens locked up in this contract.
   * @param tokenContract ERC20 token contract address
   * @param to        Recipient address
   * @param amount    Amount to withdraw
   */
  function rescueERC20(IERC20 tokenContract, address to, uint256 amount) external onlyRescuer {
    tokenContract.safeTransfer(to, amount);
  }

  /**
   * @notice Assign the rescuer role to a given address.
   * @param newRescuer New rescuer's address
   */
  function updateRescuer(address newRescuer) external onlyOwner {
    require(newRescuer != address(0), "Rescuable: new rescuer is the zero address");
    _rescuer = newRescuer;
    emit RescuerChanged(newRescuer);
  }
}

File 2 of 8 : 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 3 of 8 : 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 4 of 8 : 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 5 of 8 : 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 6 of 8 : Create2.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Create2.sol)

pragma solidity ^0.8.0;

/**
 * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer.
 * `CREATE2` can be used to compute in advance the address where a smart
 * contract will be deployed, which allows for interesting new mechanisms known
 * as 'counterfactual interactions'.
 *
 * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more
 * information.
 */
library Create2 {
    /**
     * @dev Deploys a contract using `CREATE2`. The address where the contract
     * will be deployed can be known in advance via {computeAddress}.
     *
     * The bytecode for a contract can be obtained from Solidity with
     * `type(contractName).creationCode`.
     *
     * Requirements:
     *
     * - `bytecode` must not be empty.
     * - `salt` must have not been used for `bytecode` already.
     * - the factory must have a balance of at least `amount`.
     * - if `amount` is non-zero, `bytecode` must have a `payable` constructor.
     */
    function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address addr) {
        require(address(this).balance >= amount, "Create2: insufficient balance");
        require(bytecode.length != 0, "Create2: bytecode length is zero");
        /// @solidity memory-safe-assembly
        assembly {
            addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt)
        }
        require(addr != address(0), "Create2: Failed on deploy");
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the
     * `bytecodeHash` or `salt` will result in a new destination address.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) {
        return computeAddress(salt, bytecodeHash, address(this));
    }

    /**
     * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at
     * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}.
     */
    function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address addr) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40) // Get free memory pointer

            // |                   | ↓ ptr ...  ↓ ptr + 0x0B (start) ...  ↓ ptr + 0x20 ...  ↓ ptr + 0x40 ...   |
            // |-------------------|---------------------------------------------------------------------------|
            // | bytecodeHash      |                                                        CCCCCCCCCCCCC...CC |
            // | salt              |                                      BBBBBBBBBBBBB...BB                   |
            // | deployer          | 000000...0000AAAAAAAAAAAAAAAAAAA...AA                                     |
            // | 0xFF              |            FF                                                             |
            // |-------------------|---------------------------------------------------------------------------|
            // | memory            | 000000...00FFAAAAAAAAAAAAAAAAAAA...AABBBBBBBBBBBBB...BBCCCCCCCCCCCCC...CC |
            // | keccak(start, 85) |            ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ |

            mstore(add(ptr, 0x40), bytecodeHash)
            mstore(add(ptr, 0x20), salt)
            mstore(ptr, deployer) // Right-aligned with 12 preceding garbage bytes
            let start := add(ptr, 0x0b) // The hashed data starts at the final garbage byte which we will set to 0xff
            mstore8(start, 0xff)
            addr := keccak256(start, 85)
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 8 : EphemeralTokenBurner.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Create2.sol";

interface ITokenMessenger {
  /**
   * @notice Deposits and burns tokens from sender to be minted on destination domain. The mint
   * on the destination domain must be called by `destinationCaller`.
   * WARNING: if the `destinationCaller` does not represent a valid address as bytes32, then it will not be possible
   * to broadcast the message on the destination domain. This is an advanced feature, and the standard
   * depositForBurn() should be preferred for use cases where a specific destination caller is not required.
   * Emits a `DepositForBurn` event.
   * @dev reverts if:
   * - given destinationCaller is zero address
   * - given burnToken is not supported
   * - given destinationDomain has no TokenMessenger registered
   * - transferFrom() reverts. For example, if sender's burnToken balance or approved allowance
   * to this contract is less than `amount`.
   * - burn() reverts. For example, if `amount` is 0.
   * - MessageTransmitter returns false or reverts.
   * @param amount amount of tokens to burn
   * @param destinationDomain destination domain
   * @param mintRecipient address of mint recipient on destination domain
   * @param burnToken address of contract to burn deposited tokens, on local domain
   * @param destinationCaller caller on the destination domain, as bytes32
   * @return nonce unique nonce reserved by message
   */
  function depositForBurnWithCaller(
    uint256 amount,
    uint32 destinationDomain,
    bytes32 mintRecipient,
    address burnToken,
    bytes32 destinationCaller
  ) external returns (uint64 nonce);
}

// This contract is deployed, then destroyed again in the same transaction.
contract EphemeralTokenBurner {
  using SafeERC20 for IERC20;

  address payable private immutable _creator;
  address private immutable _zklighterRecipient;
  address immutable _claimContract;
  uint32 internal constant destinationDomain = 0;

  constructor(address zklighterRecipient, address claimContract) {
    _creator = payable(msg.sender);
    _claimContract = claimContract;
    _zklighterRecipient = zklighterRecipient;
  }

  function receiveTransferAndSelfDestruct(ITokenMessenger _tokenMessenger, address _usdcToken) public {
    require(msg.sender == _creator, "FCCTP: only creator");
    uint256 receivedAmount = IERC20(_usdcToken).balanceOf(address(this));
    // At least fromAmount is received
    require(receivedAmount > 0, "FCCTP: insufficient balance received");

    IERC20(_usdcToken).forceApprove(address(_tokenMessenger), receivedAmount);
    bytes32 receiver = bytes32(uint256(uint160(_claimContract)));
    // Send to creator, which will forward to current recipient
    _tokenMessenger.depositForBurnWithCaller(receivedAmount, destinationDomain, receiver, _usdcToken, receiver);

    // This use of SELFDESTRUCT is compatible with EIP-6780. Burner
    // contracts are deployed, then destroyed in the same transaction.
    // solhint-disable-next-line
    selfdestruct(_creator);
  }

  function rescueMoneyAndSelfDestruct(address tokenAddress) public {
    require(msg.sender == _creator, "FCCTP: only creator");
    uint256 receivedAmount = IERC20(tokenAddress).balanceOf(address(this));
    require(receivedAmount > 0, "FCCTP: insufficient balance received");

    // Send to FastCCTP, which will forward to current recipient
    IERC20(tokenAddress).safeTransfer(_zklighterRecipient, receivedAmount);

    // This use of SELFDESTRUCT is compatible with EIP-6780. Handoff
    // contracts are deployed, then destroyed in the same transaction.
    // solhint-disable-next-line
    selfdestruct(_creator);
  }
}

contract TokenBurnerSystem {
  using SafeERC20 for IERC20;
  address private immutable _usdcToken;
  ITokenMessenger private immutable _tokenMessenger;

  constructor(
    address tokenMessenger, // Circle cctp token messenger contract
    address usdcToken // source chain usdc contract
  ) {
    _tokenMessenger = ITokenMessenger(tokenMessenger);
    _usdcToken = usdcToken;
  }

  /// Computes an ephemeral burner address
  function getTokenBurnerAddr(
    address zklighterRecipient, // user's account address to be deposited in Zklighter
    address claimContract // zkligher claimer contract
  ) public view returns (address) {
    bytes memory creationCode = abi.encodePacked(type(EphemeralTokenBurner).creationCode, abi.encode(zklighterRecipient, claimContract));
    return Create2.computeAddress(0, keccak256(creationCode));
  }

  function deployAndExecute(
    address zklighterRecipient, // user's account address to be deposited in Zklighter
    address claimContract // zkligher claimer contract
  ) public returns (address) {
    // Deploy the burner contract with CREATE2
    EphemeralTokenBurner burner = new EphemeralTokenBurner{salt: 0}(zklighterRecipient, claimContract);

    // Execute the handoff
    burner.receiveTransferAndSelfDestruct(_tokenMessenger, _usdcToken);

    return address(burner);
  }

  function rescueTokens(
    address zklighterRecipient, // user's account address to be deposited in Zklighter
    address claimContract, // zkligher claimer contract
    address tokenAddress
  ) public returns (address) {
    // Deploy the burner contract with CREATE2
    EphemeralTokenBurner burner = new EphemeralTokenBurner{salt: 0}(zklighterRecipient, claimContract);

    // Execute the handoff
    burner.rescueMoneyAndSelfDestruct(tokenAddress);

    return address(burner);
  }

  /// Gets the token balance of this contract
  function getTokenBalance(IERC20 token) public view returns (uint256) {
    return token.balanceOf(address(this));
  }
}

Settings
{
  "viaIR": true,
  "evmVersion": "cancun",
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_usdcToken","type":"address"},{"internalType":"address","name":"_messageTransmitter","type":"address"},{"internalType":"address","name":"_zklighterProxy","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"messageHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"finisher","type":"address"}],"name":"FastFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"messageHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"fastBridgeCallerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundsReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRescuer","type":"address"}],"name":"RescuerChanged","type":"event"},{"inputs":[{"components":[{"internalType":"address","name":"deployer","type":"address"},{"internalType":"address","name":"zklighterRecipient","type":"address"},{"internalType":"address","name":"claimContract","type":"address"}],"internalType":"struct FastCCTP.IntentParams[]","name":"params","type":"tuple[]"},{"internalType":"bytes[]","name":"allMessages","type":"bytes[]"},{"internalType":"bytes[]","name":"attestations","type":"bytes[]"}],"name":"batchClaimFastTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_buf","type":"bytes32"}],"name":"bytes32ToAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"intentAddr","type":"bytes32"}],"name":"fastBridgeCaller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"zklighterRecipient","type":"address[]"},{"internalType":"uint256[]","name":"fromAmount","type":"uint256[]"},{"internalType":"bytes32[]","name":"messageHash","type":"bytes32[]"}],"name":"fastFinishTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"deployer","type":"address"},{"internalType":"address","name":"zklighterRecipient","type":"address"},{"internalType":"address","name":"claimContract","type":"address"}],"name":"getTokenBurnerAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"messageTransmitter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"tokenContract","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescuer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newRescuer","type":"address"}],"name":"updateRescuer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zklighterProxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x60806040526004361015610011575f80fd5b5f3560e01c80630fed4ac5146100c45780631d3d40a9146100bf5780632ab60045146100ba57806338a63183146100b55780635ced058e146100b05780637b04c181146100ab5780638da5cb5b146100a657806394a7900a146100a1578063a40513481461009c578063ad6d089c146100975763b2118a8d14610092575f80fd5b610804565b6107d7565b6106cb565b61035f565b610308565b6102e3565b6102c2565b61028a565b61015f565b610139565b6100de565b6001600160a01b038116036100da57565b5f80fd5b346100da5760603660031901126100da57602061011e600435610100816100c9565b60243561010c816100c9565b60443591610119836100c9565b6108f9565b6001600160a01b0360405191168152f35b5f9103126100da57565b346100da575f3660031901126100da5760206001600160a01b0360015416604051908152f35b346100da5760203660031901126100da5760043561017c816100c9565b6001600160a01b039081600254163303610246571680156101dc578073ffffffffffffffffffffffffffffffffffffffff1960055416176005557fe475e580d85111348e40d8ca33cfdd74c30fe1655c2d8537a13abc10065ffa5a5f80a2005b608460405162461bcd60e51b815260206004820152602a60248201527f526573637561626c653a206e6577207265736375657220697320746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152fd5b606460405162461bcd60e51b815260206004820152600e60248201527f4e6f7420617574686f72697a65640000000000000000000000000000000000006044820152fd5b346100da575f3660031901126100da5760206001600160a01b0360055416604051908152f35b60209060031901126100da5760043590565b346100da5760206001600160a01b036102da366102b0565b16604051908152f35b346100da575f3660031901126100da5760206001600160a01b035f5416604051908152f35b346100da575f3660031901126100da5760206001600160a01b0360025416604051908152f35b9181601f840112156100da5782359167ffffffffffffffff83116100da576020808501948460051b0101116100da57565b346100da5760603660031901126100da57600467ffffffffffffffff81358181116100da57610391903690840161032e565b9290916024358181116100da576103ab903690840161032e565b916044359081116100da576103c3903690850161032e565b906103cf84881461097f565b6103da82851461097f565b5f96875b63ffffffff8916828110156104125761040c916103ff610406928989610a0c565b3590610a21565b986109de565b976103de565b5093878761043688969761042d83546001600160a01b031690565b30903390611077565b5f5b63ffffffff8116908582101561064257610453828a89610a0c565b359161053a610463828b89610a0c565b3593610478610473848b8a610a0c565b610a2e565b6104c26040966104b488519384926020840196879160549391835260208301526bffffffffffffffffffffffff199060601b1660408201520190565b03601f1981018352826106a9565b5190206104ff6104f96104ed6104e0845f52600360205260405f2090565b546001600160a01b031690565b6001600160a01b031690565b15610a3b565b61051233915f52600360205260405f2090565b906001600160a01b031673ffffffffffffffffffffffffffffffffffffffff19825416179055565b6105526104ed6104ed6001546001600160a01b031690565b610566610560838c8a610a0c565b356110e8565b610574610473848b8a610a0c565b823b156100da576105bc925f9283885180968195829463576bcd2f60e01b84528d84019092916001600160a01b0360209167ffffffffffffffff604085019616845216910152565b03925af193841561063d576106017f2f646723d0723a703a66858bddc8bb7f5600cd367a221e10a2651ff760ad955f936106179361061f97610624575b508d8c610a0c565b9051903581523360208201529081906040820190565b0390a16109de565b610438565b8061063161063792610658565b8061012f565b8e6105f9565b610a86565b005b634e487b7160e01b5f52604160045260245ffd5b67ffffffffffffffff811161066c57604052565b610644565b6060810190811067ffffffffffffffff82111761066c57604052565b6040810190811067ffffffffffffffff82111761066c57604052565b90601f8019910116810190811067ffffffffffffffff82111761066c57604052565b346100da576060806003193601126100da5760043567ffffffffffffffff918282116100da57366023830112156100da5781600401359183831161066c5760206040936040519461072260208360051b01876106a9565b81865260246060602088019302850101933685116100da57602401915b8483106107865787876024358281116100da5761076090369060040161032e565b6044929192359384116100da5761077e61064294369060040161032e565b939092610c96565b85833603126100da57838691835161079d81610671565b85356107a8816100c9565b8152828601356107b7816100c9565b83820152848601356107c8816100c9565b8582015281520192019161073f565b346100da576107e5366102b0565b5f52600360205260206001600160a01b0360405f205416604051908152f35b346100da5760603660031901126100da57600435610821816100c9565b60243561082d816100c9565b6001600160a01b0360055416330361087e5760405163a9059cbb60e01b60208201526001600160a01b0391909116602482015260448035818301528152610642916108796064836106a9565b611167565b608460405162461bcd60e51b8152602060048201526024808201527f526573637561626c653a2063616c6c6572206973206e6f74207468652072657360448201527f63756572000000000000000000000000000000000000000000000000000000006064820152fd5b805191908290602001825e015f815290565b90600b916055936104b46109656108429260409586519461091d60208201876106a9565b80865261134360208701398651916001600160a01b038092166020840152168682015285815261094c81610671565b855192839161095f6020840180976108e7565b906108e7565b5190208251928301525f602083015281520160ff81532090565b1561098657565b606460405162461bcd60e51b815260206004820152601460248201527f496e76616c696420696e707574206c656e6774680000000000000000000000006044820152fd5b634e487b7160e01b5f52601160045260245ffd5b63ffffffff8091169081146109f35760010190565b6109ca565b634e487b7160e01b5f52603260045260245ffd5b9190811015610a1c5760051b0190565b6109f8565b919082018092116109f357565b35610a38816100c9565b90565b15610a4257565b606460405162461bcd60e51b815260206004820152601760248201527f46434354503a20616c72656164792066696e69736865640000000000000000006044820152fd5b6040513d5f823e3d90fd5b9190811015610a1c5760051b81013590601e19813603018212156100da57019081359167ffffffffffffffff83116100da5760200182360381136100da579190565b90929192836074116100da5783116100da57607401916073190190565b67ffffffffffffffff811161066c57601f01601f191660200190565b929192610b1882610af0565b91610b2660405193846106a9565b8294818452818301116100da578281602093845f960137010152565b8051821015610a1c5760209160051b010190565b15610b5d57565b606460405162461bcd60e51b815260206004820152601160248201527f496e76616c696420726563697069656e740000000000000000000000000000006044820152fd5b15610ba857565b606460405162461bcd60e51b815260206004820152601660248201527f496e76616c696420696e74656e742061646472657373000000000000000000006044820152fd5b908160209103126100da575180151581036100da5790565b908060209392818452848401375f828201840152601f01601f1916010190565b9290610c3d90610a389593604086526040860191610c04565b926020818503910152610c04565b15610c5257565b606460405162461bcd60e51b815260206004820152601960248201527f4d6573736167652070726f63657373696e67206661696c6564000000000000006044820152fd5b9291939093610ca682821461097f565b610cb28451821461097f565b5f5b63ffffffff8116908282101561106e57610d678683610cd481878c610a91565b9390610e36610ce4848b8d610a91565b989096610cfc610cf5828087610ad3565b3691610b0c565b9960448b015191608460648d01519c015198610d88610d2c610d1e8784610b42565b51516001600160a01b031690565b94610d7f60209a8b97610d5289610d438c89610b42565b5101516001600160a01b031690565b610d616040610d438d8a610b42565b916108f9565b916001600160a01b039d8e9283928330911614610b56565b16911614610ba1565b8c610de1610dac86610d43610d9e36888e610b0c565b8281519101209d8e96610b42565b60408051888101958652602086019490945260609190911b6bffffffffffffffffffffffff19169084015281605484016104b4565b519020995f610dfd6104ed6104ed83546001600160a01b031690565b92604051978895869485937f57ecfd2800000000000000000000000000000000000000000000000000000000855260049c8d8601610c24565b03925af191821561063d578d92610e54915f91611051575b50610c4b565b610e696104e0885f52600360205260405f2090565b95861615610f8957505095818188865f610e906104ed610ec29d546001600160a01b031690565b926040519c8d958694859363a9059cbb60e01b85528401602090939291936001600160a01b0360408201951681520152565b03925af196871561063d57610f137f7f2e21e422d4fb5bb74228544949520a4779db43797c18e96ebb18c32ac4975f9661061794610f3093610f569b610f5b575b50505f52600360205260405f2090565b73ffffffffffffffffffffffffffffffffffffffff198154169055565b604051938493846001600160a01b03604092959493606083019683521660208201520152565b610cb4565b81610f7a92903d10610f82575b610f7281836106a9565b810190610bec565b505f80610f03565b503d610f68565b9192610fbc919650610d43610fac6104ed6104ed6001546001600160a01b031690565b93610fb68b6110e8565b98610b42565b90803b156100da576040805163576bcd2f60e01b815267ffffffffffffffff9097169387019384526001600160a01b0390921660208401525f9286928391859183910103925af1801561063d57610f56957f7f2e21e422d4fb5bb74228544949520a4779db43797c18e96ebb18c32ac4975f946106179261103e575b50610f30565b8061063161104b92610658565b5f611038565b6110689150863d8811610f8257610f7281836106a9565b5f610e4e565b50505050505050565b9290604051927f23b872dd0000000000000000000000000000000000000000000000000000000060208501526001600160a01b03809216602485015216604483015260648201526064815260a081019181831067ffffffffffffffff84111761066c576110e692604052611167565b565b67ffffffffffffffff908181116110fd571690565b608460405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203660448201527f34206269747300000000000000000000000000000000000000000000000000006064820152fd5b6040516111e2916001600160a01b03166111808261068d565b5f806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af13d1561127d573d916111c783610af0565b926111d560405194856106a9565b83523d5f8785013e6112d0565b805190828215928315611265575b505050156111fb5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6112759350820181019101610bec565b5f82816111f0565b6060916112d0565b1561128c57565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b919290156112f057508151156112e4575090565b610a38903b1515611285565b8251909150156113035750805190602001fd5b604460209160405192839162461bcd60e51b83528160048401528051918291826024860152018484015e5f828201840152601f01601f19168101030190fdfe60e03461008c57601f61084238819003918201601f19168301916001600160401b0383118484101761009057808492604094855283398101031261008c57610052602061004b836100a4565b92016100a4565b3360805260c05260a05260405161078990816100b982396080518181816069015261032a015260a051816103be015260c0518161015b0152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b038216820361008c5756fe604060808152600480361015610013575f80fd5b5f3560e01c80634c6bc9ad146102fb5763d8f30a6414610031575f80fd5b346102005781600319360112610200578035916001600160a01b039081841680940361020057602492833590838216809203610200577f000000000000000000000000000000000000000000000000000000000000000095610096858816331461044e565b8351926370a0823160e01b8452308385015260209586858981855afa9485156102f157908795949392915f956102c0575b506100d38515156104cf565b86517f095ea7b3000000000000000000000000000000000000000000000000000000008782018181526001600160a01b0386168c8401908152602081018990525f91829161012e90869060400103601f198101875286610499565b84519082885af161013d610661565b81610290575b5080610286575b15610214575b5050915f9160a494937f000000000000000000000000000000000000000000000000000000000000000016908389519b8c9889977ff856ddb6000000000000000000000000000000000000000000000000000000008952880152860152816044860152606485015260848401525af190811561020b57506101ce5782ff5b81813d8311610204575b6101e28183610499565b81010312610200575167ffffffffffffffff811603610200575f8082ff5b5f80fd5b503d6101d8565b513d5f823e3d90fd5b909192939495965087519089820152848a8201525f6044820152604481526080810181811067ffffffffffffffff821117610274579261026960a496936102638c9a9997945f978d5285610557565b83610557565b919394819350610150565b8a604188634e487b7160e01b5f52525ffd5b50833b151561014a565b8051801592508a9083156102a8575b5050505f610143565b6102b8935082018101910161053f565b5f898161029f565b8681979296503d83116102ea575b6102d88183610499565b8101031261020057869451935f6100c7565b503d6102ce565b86513d5f823e3d90fd5b50346102005760209081600319360112610200578035906001600160a01b0393848316809303610200576103537f0000000000000000000000000000000000000000000000000000000000000000958616331461044e565b8051916370a0823160e01b835230908301528382602481865afa918215610444575f92610411575b5061040f936103fc8361040a936103b57fa9059cbb00000000000000000000000000000000000000000000000000000000979615156104cf565b519586938401527f000000000000000000000000000000000000000000000000000000000000000060248401602090939291936001600160a01b0360408201951681520152565b03601f198101845283610499565b610557565bff5b9291508383813d831161043d575b6104298183610499565b81010312610200579151909161040f61037b565b503d61041f565b50513d5f823e3d90fd5b1561045557565b606460405162461bcd60e51b815260206004820152601360248201527f46434354503a206f6e6c792063726561746f72000000000000000000000000006044820152fd5b90601f8019910116810190811067ffffffffffffffff8211176104bb57604052565b634e487b7160e01b5f52604160045260245ffd5b156104d657565b608460405162461bcd60e51b8152602060048201526024808201527f46434354503a20696e73756666696369656e742062616c616e6365207265636560448201527f69766564000000000000000000000000000000000000000000000000000000006064820152fd5b90816020910312610200575180151581036102005790565b6001600160a01b0316604051604081019181831067ffffffffffffffff8411176104bb576105c6926040525f806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af16105c0610661565b916106a0565b805190828215928315610649575b505050156105df5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b610659935082018101910161053f565b5f82816105d4565b3d1561069b573d9067ffffffffffffffff82116104bb5760405191610690601f8201601f191660200184610499565b82523d5f602084013e565b606090565b9192901561070157508151156106b4575090565b3b156106bd5790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156107145750805190602001fd5b604460209160405192839162461bcd60e51b83528160048401528051918291826024860152018484015e5f828201840152601f01601f19168101030190fdfea264697066735822122005a9164ca8496d6c697ab7173b2d33e329892063114360a2b63cf1b21d85aa2364736f6c63430008190033a26469706673582212203c4799eabe703f26ea766e034f6e955541e5cafbcc45945deea756da0d9896e764736f6c63430008190033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.