Contract 0x2FEE8a563d1c3901EBfe2F86B5723CCc1d55F7A4

Contract Overview

Balance:
0 MNT

Token:
Txn Hash Method
Block
From
To
Value
0x6a440a764c04ba86a043cc73e89eafc9d8f0a974501c0e19ee2123a763dd8f1fRefund174376132025-01-09 10:51:3928 days 4 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.003286616740.02
0x62490c67cb65ac49c06af5003b2259e1158744afd9dccab94d08d501e3c29f40Lock174043722025-01-08 16:23:3728 days 22 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.01392379520.02
0x2202fc2e0a62a9561e05f18ea249fb7d60d7f1256df7f97919cf7d97d4bf6804Lock174041072025-01-08 16:14:4728 days 22 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40.00088674 MNT0.005560487220.02
0x54498bfef4ce3156c11d3802d1844874ed18c3fd36b296d59c9055a30ff76ef9Lock174039702025-01-08 16:10:1328 days 23 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40.00088765 MNT0.006254477240.02
0x01725e1bd87367be0cc0deeeddc6b0d85742360b850c4da900200cbd990fe432Lock170190202024-12-30 18:18:3337 days 20 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.002092807660.02
0x84b618dcff832686c9d89f6d5afe39619986097f79958407e1f4bc52ffff32cbRefund169820352024-12-29 21:45:4338 days 17 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.002872361960.02
0xe14d3384d8684efdbde01a1f5a3f563a9627bb9a2140efb5809e33c09723502aLock169802062024-12-29 20:44:4538 days 18 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.0114327890.02
0xf408670b0cba3e67cf68697da179c28c6e394de59170c1f72b4eeb312a20d26bRefund168973302024-12-27 22:42:1340 days 16 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.002820548860.02
0xc7636986a41c64385c3e0665cc4ba60e8596fed9158e4f22a32b4903e122e20fLock168955302024-12-27 21:42:1340 days 17 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.011003921560.02
0x629fc41a0887a61dc92bcd0546685d1795037365ebe681664b3501e366b9b89fRedeem168838662024-12-27 15:13:2540 days 23 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.00465600070.02
0x4c0c21d89d7533dfef9aa62d76c17fd979d092182ce6c553e216dc589c0f06a1Lock168838462024-12-27 15:12:4541 days ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.011621636240.02
0xaa48ae4ee6668c1f721c04fcf3f9e1f0299f2534b53928a2d655f07a518df228Redeem168654062024-12-27 4:58:0541 days 10 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.003663823480.02
0x439eb73629099e825871bc3e33692e1a9b49aa723b54a064d353e802e52921deLock168653402024-12-27 4:55:5341 days 10 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.011574402980.02
0x6cd2e785e45355e1101fcb6c634255298344a7f8c8893c7b923bd203e980620cRedeem168647222024-12-27 4:35:1741 days 10 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.003622166180.02
0xece3a457c8217334271e7bdb29e2cd2297799b5a55b387558f30615c3f16836bLock168647042024-12-27 4:34:4141 days 10 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.01157129960.02
0xce8fd62bde54e6948902490acadbd195e9a45e4846f98f13b9f1352426b5b210Redeem168644312024-12-27 4:25:3541 days 10 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.003638120060.02
0x08e157d43851bc91b3cde6fafd55694d57fc40940915fbbc2b696581ab7efcc2Lock168643842024-12-27 4:24:0141 days 10 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.011534453460.02
0x631190166f6b8799212557bc3c9c97834c0547edd5d135fc1f8f76bfd067d6d4Redeem168642392024-12-27 4:19:1141 days 10 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.004586766280.02
0x58d601cae784fda575204a12c07a627b3c7a916c7ae06855c25dab0242aaa3fbLock168642192024-12-27 4:18:3141 days 10 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.011569630640.02
0xbf5de38f0dd3f5db11ef948b525ae3d36433975490292ffc443a188b8bcc911fRefund168034722024-12-25 18:33:3742 days 20 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.002790427660.02
0x945c8172d5d41e2b5cbff0366e13ef56a7d8acf474078874082ce9cbf45cffe0Lock168016722024-12-25 17:33:3742 days 21 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.011247227340.02
0x88b1dda8d83f248449ce8ba1449b50353fc57853fb32f280cbed542d8ff92bc1Refund167585012024-12-24 17:34:3543 days 21 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.003624479120.02
0xb544b4a974fbcd78913f01cae5c67abf9c33876631c785f4aa1ab88c61eb2c18Redeem167567692024-12-24 16:36:5143 days 22 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.009084110840.02
0x904ccdbbbc0869fbcace6ef6b73247a28ed41173b568fbf6aa95477c5e85df99Lock167567472024-12-24 16:36:0743 days 22 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.020503713280.02
0x78ddb718d9329cfb926d6f0fd85d046a2f58f1cc980e6b15bb25b0bc7cadc914Lock167567012024-12-24 16:34:3543 days 22 hrs ago0x2330bc7d79f670f51546dcf5fd0eca6889a7ceb9 IN  0x2fee8a563d1c3901ebfe2f86b5723ccc1d55f7a40 MNT0.019003677260.02
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LayerswapV8ERC20

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 6 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @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 2 of 6 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

File 3 of 6 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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 An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @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.encodeCall(token.approve, (spender, value));

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

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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(token).code.length > 0;
    }
}

File 4 of 6 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

File 5 of 6 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

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

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

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

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

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

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

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

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

        return (signer, RecoverError.NoError, bytes32(0));
    }

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

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

File 6 of 6 : HashedTimeLockERC20.sol
/*
 _                                                 __     _____ 
| |    __ _ _   _  ___ _ __ _____      ____ _ _ __ \ \   / ( _ )
| |   / _` | | | |/ _ \ '__/ __\ \ /\ / / _` | '_ \ \ \ / // _ \
| |__| (_| | |_| |  __/ |  \__ \\ V  V / (_| | |_) | \ V /| (_) |
|_____\__,_|\__, |\___|_|  |___/ \_/\_/ \__,_| .__/   \_/  \___/
            |___/                            |_|

*/

// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// @title LayerswapV8ERC20 Contract
/// @notice Implements the Layerswap V8 PreHTLC protocol for ERC20 tokens, enabling secure and atomic cross-chain swaps.
/// @dev Manages HTLCs for ERC20 tokens with event-driven updates.

/// @dev Represents the EIP-712 domain for signature verification.
struct EIP712Domain {
    string name;
    string version;
    uint256 chainId;
    address verifyingContract;
    bytes32 salt;
}

contract LayerswapV8ERC20 {
    using ECDSA for bytes32;

    bytes32 private immutable DOMAIN_SEPARATOR;

    /// @dev Sets up the EIP-712 domain details used for verifying signed messages.
    constructor() {
        DOMAIN_SEPARATOR = hashDomain(
            EIP712Domain({
                name: "LayerswapV8ERC20",
                version: "1",
                chainId: block.chainid,
                verifyingContract: address(this),
                salt: 0x2e4ff7169d640efc0d28f2e302a56f1cf54aff7e127eededda94b3df0946f5c0
            })
        );
    }

    /// @dev Custom errors to simplify failure handling in the contract.
    error FundsNotSent();
    error NotFutureTimelock();
    error NotPassedTimelock();
    error HTLCAlreadyExists();
    error HTLCNotExists();
    error HashlockNotMatch();
    error AlreadyClaimed();
    error NoAllowance();
    error InvalidSigniture();
    error HashlockAlreadySet();
    error TransferFailed();
    error InsufficientBalance();

    /// @dev Represents a hashed time-locked contract (HTLC) for ERC20 tokens.
    struct HTLC {
        /// @notice The amount of ERC20 tokens locked in the HTLC.
        uint256 amount;
        /// @notice The hash of the secret required for redemption.
        bytes32 hashlock;
        /// @notice The secret required to redeem.
        uint256 secret;
        /// @notice The ERC20 token contract address.
        address tokenContract;
        /// @notice The timestamp after which the funds can be refunded.
        uint48 timelock;
        /// @notice Indicates whether the funds were claimed (redeemed(3) or refunded(2)).
        uint8 claimed;
        /// @notice The creator of the HTLC.
        address payable sender;
        /// @notice The recipient of the funds if conditions are met.
        address payable srcReceiver;
    }

    /// @dev Represents the details required to add a lock, used as part of the `addLockSig` parameters.
    struct addLockMsg {
        /// @notice The identifier of the HTLC to which the hashlock should be added and the timelock updated.
        bytes32 Id;
        /// @notice The hashlock to be added to the HTLC.
        bytes32 hashlock;
        /// @notice The new timelock to be set for the HTLC.
        uint48 timelock;
    }

    using SafeERC20 for IERC20;

    /// @dev Unique identifier generation using block hash and a nonce.
    uint256 private immutable blockHashAsUint =
        uint256(blockhash(block.number - 20));
    uint256 private contractNonce = 0;

    /// @dev Storage for HTLCs
    mapping(bytes32 => HTLC) private contracts;

    /// @dev Emitted when an HTLC is created and ERC20 tokens are committed.
    /// @param Id The unique identifier of the HTLC.
    /// @param hopChains The sequence of chains forming the path from the source to the destination chain.
    /// @param hopAssets The sequence of assets being swapped along the path.
    /// @param hopAddresses The sequence of addresses involved along the path.
    /// @param dstChain The destination blockchain.
    /// @param dstAddress The recipient address on the destination chain.
    /// @param dstAsset The asset on the destination chain.
    /// @param sender The creator of the HTLC.
    /// @param srcReceiver The recipient of the funds if conditions are met.
    /// @param srcAsset The asset being locked.
    /// @param amount The amount of ERC20 tokens locked in the HTLC.
    /// @param timelock The timestamp after which the funds can be refunded.
    /// @param tokenContract The address of the ERC20 token contract.
    event TokenCommitted(
        bytes32 indexed Id,
        string[] hopChains,
        string[] hopAssets,
        string[] hopAddresses,
        string dstChain,
        string dstAddress,
        string dstAsset,
        address indexed sender,
        address indexed srcReceiver,
        string srcAsset,
        uint256 amount,
        uint48 timelock,
        address tokenContract
    );

    /// @dev Emitted when an HTLC is locked with a hashlock and timelock.
    event TokenLocked(
        bytes32 indexed Id,
        bytes32 hashlock,
        string dstChain,
        string dstAddress,
        string dstAsset,
        address indexed sender,
        address indexed srcReceiver,
        string srcAsset,
        uint256 amount,
        uint48 timelock,
        address tokenContract
    );

    /// @dev Emitted when a hashlock and timelock are added to an existing HTLC.
    event TokenLockAdded(bytes32 indexed Id, bytes32 hashlock, uint48 timelock);

    /// @dev Emitted when funds are redeemed from an HTLC using the correct secret.
    event TokenRedeemed(
        bytes32 indexed Id,
        address redeemAddress,
        uint256 secret,
        bytes32 hashlock
    );

    /// @dev Emitted when funds are redeemed from an HTLC using the correct secret.
    event TokenRefunded(bytes32 indexed Id);

    /// @dev Modifier to ensure HTLC exists before proceeding.
    modifier _exists(bytes32 Id) {
        require(hasHTLC(Id), "HTLC Not Exists");
        _;
    }

    /// @notice Creates and commits a new hashed time-locked contract (HTLC) for ERC20 tokens.
    /// @dev Transfers the specified amount of ERC20 tokens to the contract and emits a `TokenCommitted` event.
    /// @param hopChains The sequence of chains forming the path from the source to the destination chain.
    /// @param hopAssets The sequence of assets being swapped along the path.
    /// @param hopAddresses The sequence of addresses involved along the path.
    /// @param dstChain The destination blockchain.
    /// @param dstAsset The asset on the destination chain.
    /// @param dstAddress The recipient address on the destination chain.
    /// @param srcAsset The asset being locked.
    /// @param srcReceiver The recipient of the funds if conditions are met.
    /// @param timelock The timestamp after which the funds can be refunded.
    /// @param amount The amount of ERC20 tokens to lock in the HTLC.
    /// @param tokenContract The address of the ERC20 token contract.
    /// @return Id The unique identifier of the created HTLC.
    function commit(
        string[] calldata hopChains,
        string[] calldata hopAssets,
        string[] calldata hopAddresses,
        string calldata dstChain,
        string calldata dstAsset,
        string calldata dstAddress,
        string calldata srcAsset,
        address srcReceiver,
        uint48 timelock,
        uint256 amount,
        address tokenContract
    ) external returns (bytes32 Id) {
        if (amount == 0) revert FundsNotSent(); // Ensure funds are sent.
        if (timelock < block.timestamp) revert NotFutureTimelock(); // Ensure timelock is in the future.
        IERC20 token = IERC20(tokenContract);

        if (token.balanceOf(msg.sender) < amount) revert InsufficientBalance();
        if (token.allowance(msg.sender, address(this)) < amount)
            revert NoAllowance();
        token.safeTransferFrom(msg.sender, address(this), amount);

        unchecked {
            ++contractNonce; // Increment nonce for uniqueness.
        }
        Id = bytes32(blockHashAsUint ^ contractNonce);

        // Store HTLC details.
        contracts[Id] = HTLC(
            amount,
            bytes32(bytes1(0x01)),
            uint256(1),
            tokenContract,
            timelock,
            uint8(1),
            payable(msg.sender),
            payable(srcReceiver)
        );

        // Emit the commit event.
        emit TokenCommitted(
            Id,
            hopChains,
            hopAssets,
            hopAddresses,
            dstChain,
            dstAddress,
            dstAsset,
            msg.sender,
            srcReceiver,
            srcAsset,
            amount,
            timelock,
            tokenContract
        );
    }

    /// @notice Adds a hashlock and updates the timelock for an existing HTLC.
    /// @dev Can only be called by the HTLC's creator if the HTLC exists and has not been claimed. Emits a `TokenLockAdded` event.
    /// @param Id The unique identifier of the HTLC to update.
    /// @param hashlock The hashlock to be added.
    /// @param timelock The new timelock to be set.
    /// @return bytes32 The updated HTLC identifier.
    function addLock(
        bytes32 Id,
        bytes32 hashlock,
        uint48 timelock
    ) external _exists(Id) returns (bytes32) {
        HTLC storage htlc = contracts[Id];
        if (htlc.claimed == 2 || htlc.claimed == 3) revert AlreadyClaimed();
        if (timelock < block.timestamp) revert NotFutureTimelock();
        if (msg.sender == htlc.sender) {
            if (htlc.hashlock == bytes32(bytes1(0x01))) {
                htlc.hashlock = hashlock;
                htlc.timelock = timelock;
            } else {
                revert HashlockAlreadySet(); // Prevent overwriting hashlock.
            }
            emit TokenLockAdded(Id, hashlock, timelock);
            return Id;
        } else {
            revert NoAllowance(); // Ensure only allowed accounts can add a lock.
        }
    }

    /// @notice Adds a hashlock and updates the timelock for an existing HTLC using a signed message.
    /// @dev Verifies the provided signature and updates the HTLC if valid. Emits a `TokenLockAdded` event.
    /// @param message The details of the lock to be added, including the HTLC ID, hashlock, and timelock.
    /// @param r The `r` value of the ECDSA signature.
    /// @param s The `s` value of the ECDSA signature.
    /// @param v The `v` value of the ECDSA signature.
    /// @return bytes32 The updated HTLC identifier.
    function addLockSig(
        addLockMsg calldata message,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external _exists(message.Id) returns (bytes32) {
        if (verifyMessage(message, r, s, v)) {
            HTLC storage htlc = contracts[message.Id];
            if (htlc.claimed == 2 || htlc.claimed == 3) revert AlreadyClaimed();
            if (message.timelock < block.timestamp) revert NotFutureTimelock();
            if (htlc.hashlock == bytes32(bytes1(0x01))) {
                htlc.hashlock = message.hashlock;
                htlc.timelock = message.timelock;
            } else {
                revert HashlockAlreadySet();
            }
            emit TokenLockAdded(message.Id, message.hashlock, message.timelock);
            return message.Id;
        } else {
            revert InvalidSigniture(); // Ensure valid signature.
        }
    }

    /// @notice Locks ERC20 tokens in a new hashed time-locked contract (HTLC).
    /// @dev Transfers the specified amount of ERC20 tokens to the contract and emits a `TokenLocked` event.
    /// @param Id The unique identifier of the HTLC.
    /// @param hashlock The hash of the secret required for redemption.
    /// @param timelock The timestamp after which the funds can be refunded if not claimed.
    /// @param srcReceiver The recipient of the funds if the HTLC is successfully redeemed.
    /// @param srcAsset The asset being locked.
    /// @param dstChain The destination blockchain for the swap.
    /// @param dstAddress The recipient address on the destination chain.
    /// @param dstAsset The asset on the destination chain.
    /// @param amount The amount of ERC20 tokens to lock in the HTLC.
    /// @param tokenContract The address of the ERC20 token contract.
    /// @return bytes32 The unique identifier of the created HTLC.
    function lock(
        bytes32 Id,
        bytes32 hashlock,
        uint48 timelock,
        address srcReceiver,
        string calldata srcAsset,
        string calldata dstChain,
        string calldata dstAddress,
        string calldata dstAsset,
        uint256 amount,
        address tokenContract
    ) external returns (bytes32) {
        if (amount == 0) revert FundsNotSent();
        if (timelock < block.timestamp) revert NotFutureTimelock();
        if (hasHTLC(Id)) revert HTLCAlreadyExists();
        IERC20 token = IERC20(tokenContract);

        if (token.balanceOf(msg.sender) < amount) revert InsufficientBalance();
        if (token.allowance(msg.sender, address(this)) < amount)
            revert NoAllowance();

        token.safeTransferFrom(msg.sender, address(this), amount);
        contracts[Id] = HTLC(
            amount,
            hashlock,
            uint256(1),
            tokenContract,
            timelock,
            uint8(1),
            payable(msg.sender),
            payable(srcReceiver)
        );

        emit TokenLocked(
            Id,
            hashlock,
            dstChain,
            dstAddress,
            dstAsset,
            msg.sender,
            srcReceiver,
            srcAsset,
            amount,
            timelock,
            tokenContract
        );
        return Id;
    }

    /// @notice Redeems funds from an HTLC using the correct secret.
    /// @dev Verifies the provided secret against the hashlock and transfers the funds to the recipient. Emits a `TokenRedeemed` event.
    /// @param Id The unique identifier of the HTLC to be redeemed.
    /// @param secret The secret value used to unlock the HTLC.
    /// @return bool Returns `true` if the redemption is successful.
    function redeem(
        bytes32 Id,
        uint256 secret
    ) external _exists(Id) returns (bool) {
        HTLC storage htlc = contracts[Id];

        if (htlc.hashlock != sha256(abi.encodePacked(secret)))
            revert HashlockNotMatch(); // Ensure secret matches hashlock.
        if (htlc.claimed == 3 || htlc.claimed == 2) revert AlreadyClaimed();

        htlc.claimed = 3;
        htlc.secret = secret;
        IERC20(htlc.tokenContract).safeTransfer(htlc.srcReceiver, htlc.amount);
        emit TokenRedeemed(Id, msg.sender, secret, htlc.hashlock);
        return true;
    }

    /// @notice Refunds the locked funds from an HTLC after the timelock expires.
    /// @dev Can only be called if the HTLC exists and the timelock has passed. Emits a `TokenRefunded` event.
    /// @param Id The unique identifier of the HTLC to be refunded.
    /// @return bool Returns `true` if the refund is successful.
    function refund(bytes32 Id) external _exists(Id) returns (bool) {
        HTLC storage htlc = contracts[Id];
        if (htlc.claimed == 2 || htlc.claimed == 3) revert AlreadyClaimed(); // Prevent refund if already redeemed or refunded.
        if (htlc.timelock > block.timestamp) revert NotPassedTimelock(); // Ensure timelock has passed.

        htlc.claimed = 2;
        IERC20(htlc.tokenContract).safeTransfer(htlc.sender, htlc.amount);
        emit TokenRefunded(Id);
        return true;
    }

    /// @notice Retrieves the details of a specific HTLC.
    /// @dev Returns the HTLC structure associated with the given identifier.
    /// @param Id The unique identifier of the HTLC.
    /// @return HTLC The details of the specified HTLC.
    function getDetails(bytes32 Id) public view returns (HTLC memory) {
        return contracts[Id];
    }

    /// @notice Generates a hash of the EIP-712 domain.
    /// @dev Encodes and hashes the EIP-712 domain fields according to the specification.
    /// @param domain The EIP-712 domain structure containing the domain details.
    /// @return bytes32 The hashed representation of the EIP-712 domain.
    function hashDomain(
        EIP712Domain memory domain
    ) private pure returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256(
                        "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)"
                    ),
                    keccak256(bytes(domain.name)),
                    keccak256(bytes(domain.version)),
                    domain.chainId,
                    domain.verifyingContract,
                    domain.salt
                )
            );
    }

    /// @notice Generates a hash of the `addLockMsg` structure.
    /// @dev Encodes and hashes the `addLockMsg` fields for use in EIP-712 signature verification.
    /// @param message The `addLockMsg` structure containing the HTLC details to be hashed.
    /// @return bytes32 The hashed representation of the `addLockMsg` structure.
    function hashMessage(
        addLockMsg calldata message
    ) private pure returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256(
                        "addLockMsg(bytes32 Id,bytes32 hashlock,uint48 timelock)"
                    ),
                    message.Id,
                    message.hashlock,
                    message.timelock
                )
            );
    }

    /// @notice Verifies that an EIP-712 message signature matches the sender of the specified HTLC.
    /// @dev Combines the domain separator and the hashed message to create the digest, then verifies the signature.
    /// @param message The `addLockMsg` structure containing the HTLC details.
    /// @param r The `r` value of the ECDSA signature.
    /// @param s The `s` value of the ECDSA signature.
    /// @param v The `v` value of the ECDSA signature.
    /// @return bool Returns `true` if the signature is valid and matches the sender of the HTLC.
    function verifyMessage(
        addLockMsg calldata message,
        bytes32 r,
        bytes32 s,
        uint8 v
    ) private view returns (bool) {
        bytes32 digest = keccak256(
            abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, hashMessage(message))
        );
        return (ECDSA.recover(digest, v, r, s) == contracts[message.Id].sender);
    }

    /// @notice Checks whether an HTLC with the given Id exists.
    /// @dev An HTLC exists if the sender address in its details is non-zero.
    /// @param Id The unique identifier of the HTLC to check.
    /// @return Returns `true` if the HTLC exists, otherwise `false`.
    function hasHTLC(bytes32 Id) private view returns (bool) {
        return (contracts[Id].sender != address(0));
    }
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AlreadyClaimed","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"FundsNotSent","type":"error"},{"inputs":[],"name":"HTLCAlreadyExists","type":"error"},{"inputs":[],"name":"HTLCNotExists","type":"error"},{"inputs":[],"name":"HashlockAlreadySet","type":"error"},{"inputs":[],"name":"HashlockNotMatch","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidSigniture","type":"error"},{"inputs":[],"name":"NoAllowance","type":"error"},{"inputs":[],"name":"NotFutureTimelock","type":"error"},{"inputs":[],"name":"NotPassedTimelock","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"Id","type":"bytes32"},{"indexed":false,"internalType":"string[]","name":"hopChains","type":"string[]"},{"indexed":false,"internalType":"string[]","name":"hopAssets","type":"string[]"},{"indexed":false,"internalType":"string[]","name":"hopAddresses","type":"string[]"},{"indexed":false,"internalType":"string","name":"dstChain","type":"string"},{"indexed":false,"internalType":"string","name":"dstAddress","type":"string"},{"indexed":false,"internalType":"string","name":"dstAsset","type":"string"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"srcReceiver","type":"address"},{"indexed":false,"internalType":"string","name":"srcAsset","type":"string"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint48","name":"timelock","type":"uint48"},{"indexed":false,"internalType":"address","name":"tokenContract","type":"address"}],"name":"TokenCommitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"Id","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"hashlock","type":"bytes32"},{"indexed":false,"internalType":"uint48","name":"timelock","type":"uint48"}],"name":"TokenLockAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"Id","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"hashlock","type":"bytes32"},{"indexed":false,"internalType":"string","name":"dstChain","type":"string"},{"indexed":false,"internalType":"string","name":"dstAddress","type":"string"},{"indexed":false,"internalType":"string","name":"dstAsset","type":"string"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"srcReceiver","type":"address"},{"indexed":false,"internalType":"string","name":"srcAsset","type":"string"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint48","name":"timelock","type":"uint48"},{"indexed":false,"internalType":"address","name":"tokenContract","type":"address"}],"name":"TokenLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"Id","type":"bytes32"},{"indexed":false,"internalType":"address","name":"redeemAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"secret","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"hashlock","type":"bytes32"}],"name":"TokenRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"Id","type":"bytes32"}],"name":"TokenRefunded","type":"event"},{"inputs":[{"internalType":"bytes32","name":"Id","type":"bytes32"},{"internalType":"bytes32","name":"hashlock","type":"bytes32"},{"internalType":"uint48","name":"timelock","type":"uint48"}],"name":"addLock","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"Id","type":"bytes32"},{"internalType":"bytes32","name":"hashlock","type":"bytes32"},{"internalType":"uint48","name":"timelock","type":"uint48"}],"internalType":"struct LayerswapV8ERC20.addLockMsg","name":"message","type":"tuple"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"addLockSig","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"hopChains","type":"string[]"},{"internalType":"string[]","name":"hopAssets","type":"string[]"},{"internalType":"string[]","name":"hopAddresses","type":"string[]"},{"internalType":"string","name":"dstChain","type":"string"},{"internalType":"string","name":"dstAsset","type":"string"},{"internalType":"string","name":"dstAddress","type":"string"},{"internalType":"string","name":"srcAsset","type":"string"},{"internalType":"address","name":"srcReceiver","type":"address"},{"internalType":"uint48","name":"timelock","type":"uint48"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"tokenContract","type":"address"}],"name":"commit","outputs":[{"internalType":"bytes32","name":"Id","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"Id","type":"bytes32"}],"name":"getDetails","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"hashlock","type":"bytes32"},{"internalType":"uint256","name":"secret","type":"uint256"},{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint48","name":"timelock","type":"uint48"},{"internalType":"uint8","name":"claimed","type":"uint8"},{"internalType":"address payable","name":"sender","type":"address"},{"internalType":"address payable","name":"srcReceiver","type":"address"}],"internalType":"struct LayerswapV8ERC20.HTLC","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"Id","type":"bytes32"},{"internalType":"bytes32","name":"hashlock","type":"bytes32"},{"internalType":"uint48","name":"timelock","type":"uint48"},{"internalType":"address","name":"srcReceiver","type":"address"},{"internalType":"string","name":"srcAsset","type":"string"},{"internalType":"string","name":"dstChain","type":"string"},{"internalType":"string","name":"dstAddress","type":"string"},{"internalType":"string","name":"dstAsset","type":"string"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"tokenContract","type":"address"}],"name":"lock","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"Id","type":"bytes32"},{"internalType":"uint256","name":"secret","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"Id","type":"bytes32"}],"name":"refund","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

60c03461019157601319430143811161017b574060a090815260008080556001600160401b039290918101838111828210176101675760409080825261004481610196565b601081526f04c6179657273776170563845524332360841b60c0840152825280519261006f84610196565b6001845260208401603160f81b815284602085015246838501523060608501527f2e4ff7169d640efc0d28f2e302a56f1cf54aff7e127eededda94b3df0946f5c0938460808201525160208151910120945190209282519360208501957fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac5647287528486015260608501524660808501523060a085015260c084015260c0835260e08301948386109086111761015357508390525190206080526115ab90816101c8823960805181611142015260a05181818161076c015281816108f401526109460152f35b634e487b7160e01b81526041600452602490fd5b634e487b7160e01b83526041600452602483fd5b634e487b7160e01b600052601160045260246000fd5b600080fd5b604081019081106001600160401b038211176101b157604052565b634e487b7160e01b600052604160045260246000fdfe60a0604052600436101561001257600080fd5b60003560e01c8063673da15414610c475780637249fbb614610b3e578063984bc70014610a24578063a9e0c1a5146109d1578063bf4a79f614610521578063f0a31096146100db5763f774547a1461006957600080fd5b346100d657366003190160c081126100d6576060136100d65760643560ff811681036100d6576100ce6020916100c16100bc600435600052600160205260018060a01b0360046040600020015416151590565b610e42565b60a43590608435906110bc565b604051908152f35b600080fd5b346100d6576101403660031901126100d6576100f5610dce565b6064356001600160a01b03811681036100d65767ffffffffffffffff906084358281116100d65761012a903690600401610e14565b909260a4358181116100d657610144903690600401610e14565b94909260c4358381116100d65761015f903690600401610e14565b909360e4359081116100d657610179903690600401610e14565b610124356001600160a01b03811690036100d657610104351561050f574265ffffffffffff8b16106104fd5760048035600090815260016020526040902001546001600160a01b03166104eb576040516370a0823160e01b8152336004820152602081602481610124356001600160a01b03165afa90811561049b576000916104b9575b5061010435116104a757604051636eb1769f60e11b81523360048201523060248201526020816044816001600160a01b0361012435165afa90811561049b57600091610469575b5061010435116104575765ffffffffffff966103f8966103ea946103dc926103ce908e610282610104353033610124356001600160a01b03166112e3565b8c6040519161029083610e80565b61010435835260243560208401526001604084015260018060a01b0361012435166060840152166080820152600160a08201523360c08201528d60018060a01b031660e0820152600435600052600160205260406000208151815560208201516001820155604082015160028201556005600382019161038560018060a01b03606086015116936bffffffffffffffffffffffff60a01b948582541617815565ffffffffffff61036690608088015116829081549065ffffffffffff60a01b9060a01b169065ffffffffffff60a01b1916179055565b60a0860151815460ff60d01b191660d09190911b60ff60d01b16179055565b6004810160018060a01b0360c08601511684825416179055019160e060018060a01b0391015116908254161790556040519d8e6101009060243581528160208201520191611010565b8c810360408e015291611010565b9189830360608b0152611010565b918683036080880152611010565b6101043560a0850152931660c08301526001600160a01b0361012435811660e084015216913391600435917fe702557ad0409d89ea96fc805366337612bbf2893ac79e0c689dcb2bff7e472b919081900390a460206040516004358152f35b604051631d7eb35960e31b8152600490fd5b90506020813d602011610493575b8161048460209383610ed5565b810103126100d657518b610244565b3d9150610477565b6040513d6000823e3d90fd5b604051631e9acf1760e31b8152600490fd5b90506020813d6020116104e3575b816104d460209383610ed5565b810103126100d657518b6101fd565b3d91506104c7565b604051630ed8e66b60e21b8152600490fd5b604051633dd8280960e21b8152600490fd5b604051636f8ab38d60e11b8152600490fd5b346100d6576101603660031901126100d65767ffffffffffffffff6004358181116100d657610554903690600401610de3565b90916024358181116100d65761056e903690600401610de3565b916044358181116100d657610587903690600401610de3565b90916064358181116100d6576105a1903690600401610e14565b92906084358381116100d6576105bb903690600401610e14565b94909560a4358581116100d6576105d6903690600401610e14565b94909560c4359081116100d6576105f1903690600401610e14565b909a90999060e4356001600160a01b03811690036100d657610104359d8e65ffffffffffff8116036100d657610144356001600160a01b03811690036100d657610124351561050f578e65ffffffffffff429116106104fd576040516370a0823160e01b8152336004820152602081602481610144356001600160a01b03165afa90811561049b5760009161099f575b5061012435116104a757604051636eb1769f60e11b81523360048201523060248201526020816044816001600160a01b0361014435165afa90811561049b5760009161096d575b506101243511610457578e6106ee610124353033610144356001600160a01b03166112e3565b6000546001016080526080516000556040519061070a82610e80565b610124358252600160f81b602080840191825260016040808601828152610144356001600160a01b039081166060890190815265ffffffffffff979097166080808a0191825260a0808b018790523360c08c015260e435841660e08c015290517f0000000000000000000000000000000000000000000000000000000000000000186000908152968690529390952088518155955193860193909355516002850155935160038401805493516001600160d01b031990941691909216179190931b65ffffffffffff60a01b161782556001600160a01b03199160a0840151815460ff60d01b191660d09190911b60ff60d01b1617905560048101600160a01b6001900360c0850151168382541617905560050191600160a01b600190039060e0015116908254161790556040519d8e61014090818152019061084b92611031565b908d808303906020015261085e92611031565b908b820360408d015261087092611031565b9089820360608b015261088292611010565b90878203608089015261089492611010565b9085820360a08701526108a692611010565b9083820360c08501526108b892611010565b6101243560e083015265ffffffffffff909216610100820152610144356001600160a01b0390811661012083015260805160e4359091169233927f0000000000000000000000000000000000000000000000000000000000000000909218917f2f44482bd1ec016eb488e5a8eaed3a93c498a2f9705f77e409958e9b3c245a6c9181900390a46040516080517f0000000000000000000000000000000000000000000000000000000000000000188152602090f35b90506020813d602011610997575b8161098860209383610ed5565b810103126100d65751386106c8565b3d915061097b565b90506020813d6020116109c9575b816109ba60209383610ed5565b810103126100d6575138610681565b3d91506109ad565b346100d65760603660031901126100d65760206100ce6004356109f2610dce565b600082815260016020526040902060040154909190610a1b906001600160a01b03161515610e42565b60243590610ef7565b346100d65760203660031901126100d657600060e0604051610a4581610e80565b8281528260208201528260408201528260608201528260808201528260a08201528260c082015201526004356000526001602052610100604060002060405190610a8e82610e80565b8054918281526001820154602082019081528160ff60028501549260408301938452826003870154809260018060a01b03988997889260e0846005606089019582891687528b60a065ffffffffffff9b8c608082019c831c168c52019b60d01c168b5260c0836004830154169d019c8d520154169b019a8b526040519c8d525160208d01525160408c0152511660608a015251166080880152511660a0860152511660c0840152511660e0820152f35b346100d65760203660031901126100d65760048035600081815260016020526040902090910154610b79906001600160a01b03161515610e42565b80600052600160205260406000209060038201805460ff8160d01c1660028114908115610c3c575b50610c2a574265ffffffffffff8260a01c1611610c185760ff60d01b198116600160d11b1790915560048301549254602093610be9926001600160a01b0391821691166112a3565b604051907f92b8d387b3b4732fb701784c5e553091c36997ec127e0865a7c990bc62cc7382600080a260018152f35b60405163b3f711f760e01b8152600490fd5b604051630c8d9eab60e31b8152600490fd5b600391501485610ba1565b346100d65760403660031901126100d65760043560243590610c846100bc82600052600160205260018060a01b0360046040600020015416151590565b806000526020916001835260406000206001810191825460405182878201528681526040810181811067ffffffffffffffff821117610db85787918160405280518360005b828110610da457505090600092918101836040820152039060025afa1561049b5760005103610d9257600382019283549360ff8560d01c1660038114908115610d87575b50610c2a5760ff60d01b198516600360d01b17905560028301829055600583015492547f7cbd5a76f728157ea921886950b9fb8dbf8f7c21b4d81b7ad97dd405e07a77a394606094610d6c92916001600160a01b0391821691166112a3565b5460405191338352868301526040820152a260405160018152f35b600291501488610d0d565b60405163e73bcb3560e01b8152600490fd5b808401604083820151910152018490610cc9565b634e487b7160e01b600052604160045260246000fd5b6044359065ffffffffffff821682036100d657565b9181601f840112156100d65782359167ffffffffffffffff83116100d6576020808501948460051b0101116100d657565b9181601f840112156100d65782359167ffffffffffffffff83116100d657602083818601950101116100d657565b15610e4957565b60405162461bcd60e51b815260206004820152600f60248201526e48544c43204e6f742045786973747360881b6044820152606490fd5b610100810190811067ffffffffffffffff821117610db857604052565b60a0810190811067ffffffffffffffff821117610db857604052565b6080810190811067ffffffffffffffff821117610db857604052565b90601f8019910116810190811067ffffffffffffffff821117610db857604052565b9190826000526001602052604080600020600381019060ff825460d01c1660028114908115611005575b50610ff4574265ffffffffffff861610610fe3576004810154336001600160a01b0390911603610fd2576001018054600160f81b03610fc157839055805465ffffffffffff60a01b191660a085901b65ffffffffffff60a01b161790555190815265ffffffffffff909116602082015281907f4ceab1c2914b95780a2f8f611de30f855494a303ba92b618f434814a617637c79080604081015b0390a290565b8251636e6870d560e01b8152600490fd5b8251631d7eb35960e31b8152600490fd5b8251633dd8280960e21b8152600490fd5b8251630c8d9eab60e31b8152600490fd5b600391501438610f21565b908060209392818452848401376000828201840152601f01601f1916010190565b908281815260208091019360208360051b82010194846000925b85841061105c575050505050505090565b90919293949596601f198282030184528735601e19843603018112156100d657830186810191903567ffffffffffffffff81116100d65780360383136100d6576110ab88928392600195611010565b99019401940192959493919061104b565b600480359360443593602435939265ffffffffffff8616918287036100d6576111899361118091604096875160208101907fde6780c140fbc4ab251ad9d48d26e1652301c0f664623a09aeb6c54131b0fe5382528c8a8201528a60608201528760808201526080815261112e81610e9d565b5190208851602081019161190160f01b83527f0000000000000000000000000000000000000000000000000000000000000000602283015260428201526042815261117881610eb9565b5190206113fd565b9094919461148d565b6000878152600160205284812082015490936001600160a01b03908116911603611295578683526001602052838320600381019260ff845460d01c166002811490811561128a575b5061127a57421161126b576001018054909190600160f81b0361125d5750849055805465ffffffffffff60a01b191660a086901b65ffffffffffff60a01b161790558061125a57505190815265ffffffffffff909116602082015281907f4ceab1c2914b95780a2f8f611de30f855494a303ba92b618f434814a617637c7908060408101610fbb565b80fd5b8451636e6870d560e01b8152fd5b508351633dd8280960e21b8152fd5b8551630c8d9eab60e31b81528390fd5b6003915014386111d1565b835163553470cf60e01b8152fd5b60405163a9059cbb60e01b60208201526001600160a01b0390921660248301526044808301939093529181526112e1916112dc82610eb9565b611325565b565b6040516323b872dd60e01b60208201526001600160a01b0392831660248201529290911660448301526064808301939093529181526112e1916112dc82610e9d565b60018060a01b031690600080826020829451910182865af13d156113f1573d9067ffffffffffffffff82116113dd579061138191604051916113716020601f19601f8401160184610ed5565b82523d84602084013e5b84611512565b9081519182151592836113b1575b5050506113995750565b60249060405190635274afe760e01b82526004820152fd5b8192935090602091810103126113d957602001519081159182150361125a575038808061138f565b5080fd5b634e487b7160e01b83526041600452602483fd5b6113819060609061137b565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161148157926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156114755780516001600160a01b0381161561146c57918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b60048110156114fc578061149f575050565b600181036114b95760405163f645eedf60e01b8152600490fd5b600281036114da5760405163fce698f760e01b815260048101839052602490fd5b6003146114e45750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b600052602160045260246000fd5b90611539575080511561152757805190602001fd5b604051630a12f52160e11b8152600490fd5b8151158061156c575b61154a575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561154256fea2646970667358221220320304e618b744040142036e1da5bc7cee9d5b3b5aca2b71c88f4d96440203ff64736f6c63430008170033

Deployed Bytecode

0x60a0604052600436101561001257600080fd5b60003560e01c8063673da15414610c475780637249fbb614610b3e578063984bc70014610a24578063a9e0c1a5146109d1578063bf4a79f614610521578063f0a31096146100db5763f774547a1461006957600080fd5b346100d657366003190160c081126100d6576060136100d65760643560ff811681036100d6576100ce6020916100c16100bc600435600052600160205260018060a01b0360046040600020015416151590565b610e42565b60a43590608435906110bc565b604051908152f35b600080fd5b346100d6576101403660031901126100d6576100f5610dce565b6064356001600160a01b03811681036100d65767ffffffffffffffff906084358281116100d65761012a903690600401610e14565b909260a4358181116100d657610144903690600401610e14565b94909260c4358381116100d65761015f903690600401610e14565b909360e4359081116100d657610179903690600401610e14565b610124356001600160a01b03811690036100d657610104351561050f574265ffffffffffff8b16106104fd5760048035600090815260016020526040902001546001600160a01b03166104eb576040516370a0823160e01b8152336004820152602081602481610124356001600160a01b03165afa90811561049b576000916104b9575b5061010435116104a757604051636eb1769f60e11b81523360048201523060248201526020816044816001600160a01b0361012435165afa90811561049b57600091610469575b5061010435116104575765ffffffffffff966103f8966103ea946103dc926103ce908e610282610104353033610124356001600160a01b03166112e3565b8c6040519161029083610e80565b61010435835260243560208401526001604084015260018060a01b0361012435166060840152166080820152600160a08201523360c08201528d60018060a01b031660e0820152600435600052600160205260406000208151815560208201516001820155604082015160028201556005600382019161038560018060a01b03606086015116936bffffffffffffffffffffffff60a01b948582541617815565ffffffffffff61036690608088015116829081549065ffffffffffff60a01b9060a01b169065ffffffffffff60a01b1916179055565b60a0860151815460ff60d01b191660d09190911b60ff60d01b16179055565b6004810160018060a01b0360c08601511684825416179055019160e060018060a01b0391015116908254161790556040519d8e6101009060243581528160208201520191611010565b8c810360408e015291611010565b9189830360608b0152611010565b918683036080880152611010565b6101043560a0850152931660c08301526001600160a01b0361012435811660e084015216913391600435917fe702557ad0409d89ea96fc805366337612bbf2893ac79e0c689dcb2bff7e472b919081900390a460206040516004358152f35b604051631d7eb35960e31b8152600490fd5b90506020813d602011610493575b8161048460209383610ed5565b810103126100d657518b610244565b3d9150610477565b6040513d6000823e3d90fd5b604051631e9acf1760e31b8152600490fd5b90506020813d6020116104e3575b816104d460209383610ed5565b810103126100d657518b6101fd565b3d91506104c7565b604051630ed8e66b60e21b8152600490fd5b604051633dd8280960e21b8152600490fd5b604051636f8ab38d60e11b8152600490fd5b346100d6576101603660031901126100d65767ffffffffffffffff6004358181116100d657610554903690600401610de3565b90916024358181116100d65761056e903690600401610de3565b916044358181116100d657610587903690600401610de3565b90916064358181116100d6576105a1903690600401610e14565b92906084358381116100d6576105bb903690600401610e14565b94909560a4358581116100d6576105d6903690600401610e14565b94909560c4359081116100d6576105f1903690600401610e14565b909a90999060e4356001600160a01b03811690036100d657610104359d8e65ffffffffffff8116036100d657610144356001600160a01b03811690036100d657610124351561050f578e65ffffffffffff429116106104fd576040516370a0823160e01b8152336004820152602081602481610144356001600160a01b03165afa90811561049b5760009161099f575b5061012435116104a757604051636eb1769f60e11b81523360048201523060248201526020816044816001600160a01b0361014435165afa90811561049b5760009161096d575b506101243511610457578e6106ee610124353033610144356001600160a01b03166112e3565b6000546001016080526080516000556040519061070a82610e80565b610124358252600160f81b602080840191825260016040808601828152610144356001600160a01b039081166060890190815265ffffffffffff979097166080808a0191825260a0808b018790523360c08c015260e435841660e08c015290517f643261a0aca15cbb1e93b4bee350a9377fa70b7c13631364dbebf02550b99265186000908152968690529390952088518155955193860193909355516002850155935160038401805493516001600160d01b031990941691909216179190931b65ffffffffffff60a01b161782556001600160a01b03199160a0840151815460ff60d01b191660d09190911b60ff60d01b1617905560048101600160a01b6001900360c0850151168382541617905560050191600160a01b600190039060e0015116908254161790556040519d8e61014090818152019061084b92611031565b908d808303906020015261085e92611031565b908b820360408d015261087092611031565b9089820360608b015261088292611010565b90878203608089015261089492611010565b9085820360a08701526108a692611010565b9083820360c08501526108b892611010565b6101243560e083015265ffffffffffff909216610100820152610144356001600160a01b0390811661012083015260805160e4359091169233927f643261a0aca15cbb1e93b4bee350a9377fa70b7c13631364dbebf02550b99265909218917f2f44482bd1ec016eb488e5a8eaed3a93c498a2f9705f77e409958e9b3c245a6c9181900390a46040516080517f643261a0aca15cbb1e93b4bee350a9377fa70b7c13631364dbebf02550b99265188152602090f35b90506020813d602011610997575b8161098860209383610ed5565b810103126100d65751386106c8565b3d915061097b565b90506020813d6020116109c9575b816109ba60209383610ed5565b810103126100d6575138610681565b3d91506109ad565b346100d65760603660031901126100d65760206100ce6004356109f2610dce565b600082815260016020526040902060040154909190610a1b906001600160a01b03161515610e42565b60243590610ef7565b346100d65760203660031901126100d657600060e0604051610a4581610e80565b8281528260208201528260408201528260608201528260808201528260a08201528260c082015201526004356000526001602052610100604060002060405190610a8e82610e80565b8054918281526001820154602082019081528160ff60028501549260408301938452826003870154809260018060a01b03988997889260e0846005606089019582891687528b60a065ffffffffffff9b8c608082019c831c168c52019b60d01c168b5260c0836004830154169d019c8d520154169b019a8b526040519c8d525160208d01525160408c0152511660608a015251166080880152511660a0860152511660c0840152511660e0820152f35b346100d65760203660031901126100d65760048035600081815260016020526040902090910154610b79906001600160a01b03161515610e42565b80600052600160205260406000209060038201805460ff8160d01c1660028114908115610c3c575b50610c2a574265ffffffffffff8260a01c1611610c185760ff60d01b198116600160d11b1790915560048301549254602093610be9926001600160a01b0391821691166112a3565b604051907f92b8d387b3b4732fb701784c5e553091c36997ec127e0865a7c990bc62cc7382600080a260018152f35b60405163b3f711f760e01b8152600490fd5b604051630c8d9eab60e31b8152600490fd5b600391501485610ba1565b346100d65760403660031901126100d65760043560243590610c846100bc82600052600160205260018060a01b0360046040600020015416151590565b806000526020916001835260406000206001810191825460405182878201528681526040810181811067ffffffffffffffff821117610db85787918160405280518360005b828110610da457505090600092918101836040820152039060025afa1561049b5760005103610d9257600382019283549360ff8560d01c1660038114908115610d87575b50610c2a5760ff60d01b198516600360d01b17905560028301829055600583015492547f7cbd5a76f728157ea921886950b9fb8dbf8f7c21b4d81b7ad97dd405e07a77a394606094610d6c92916001600160a01b0391821691166112a3565b5460405191338352868301526040820152a260405160018152f35b600291501488610d0d565b60405163e73bcb3560e01b8152600490fd5b808401604083820151910152018490610cc9565b634e487b7160e01b600052604160045260246000fd5b6044359065ffffffffffff821682036100d657565b9181601f840112156100d65782359167ffffffffffffffff83116100d6576020808501948460051b0101116100d657565b9181601f840112156100d65782359167ffffffffffffffff83116100d657602083818601950101116100d657565b15610e4957565b60405162461bcd60e51b815260206004820152600f60248201526e48544c43204e6f742045786973747360881b6044820152606490fd5b610100810190811067ffffffffffffffff821117610db857604052565b60a0810190811067ffffffffffffffff821117610db857604052565b6080810190811067ffffffffffffffff821117610db857604052565b90601f8019910116810190811067ffffffffffffffff821117610db857604052565b9190826000526001602052604080600020600381019060ff825460d01c1660028114908115611005575b50610ff4574265ffffffffffff861610610fe3576004810154336001600160a01b0390911603610fd2576001018054600160f81b03610fc157839055805465ffffffffffff60a01b191660a085901b65ffffffffffff60a01b161790555190815265ffffffffffff909116602082015281907f4ceab1c2914b95780a2f8f611de30f855494a303ba92b618f434814a617637c79080604081015b0390a290565b8251636e6870d560e01b8152600490fd5b8251631d7eb35960e31b8152600490fd5b8251633dd8280960e21b8152600490fd5b8251630c8d9eab60e31b8152600490fd5b600391501438610f21565b908060209392818452848401376000828201840152601f01601f1916010190565b908281815260208091019360208360051b82010194846000925b85841061105c575050505050505090565b90919293949596601f198282030184528735601e19843603018112156100d657830186810191903567ffffffffffffffff81116100d65780360383136100d6576110ab88928392600195611010565b99019401940192959493919061104b565b600480359360443593602435939265ffffffffffff8616918287036100d6576111899361118091604096875160208101907fde6780c140fbc4ab251ad9d48d26e1652301c0f664623a09aeb6c54131b0fe5382528c8a8201528a60608201528760808201526080815261112e81610e9d565b5190208851602081019161190160f01b83527fe43ae5e88479501dd59899a9032f8ef25f126914c6c1039fed04bbaa4c0e8eb6602283015260428201526042815261117881610eb9565b5190206113fd565b9094919461148d565b6000878152600160205284812082015490936001600160a01b03908116911603611295578683526001602052838320600381019260ff845460d01c166002811490811561128a575b5061127a57421161126b576001018054909190600160f81b0361125d5750849055805465ffffffffffff60a01b191660a086901b65ffffffffffff60a01b161790558061125a57505190815265ffffffffffff909116602082015281907f4ceab1c2914b95780a2f8f611de30f855494a303ba92b618f434814a617637c7908060408101610fbb565b80fd5b8451636e6870d560e01b8152fd5b508351633dd8280960e21b8152fd5b8551630c8d9eab60e31b81528390fd5b6003915014386111d1565b835163553470cf60e01b8152fd5b60405163a9059cbb60e01b60208201526001600160a01b0390921660248301526044808301939093529181526112e1916112dc82610eb9565b611325565b565b6040516323b872dd60e01b60208201526001600160a01b0392831660248201529290911660448301526064808301939093529181526112e1916112dc82610e9d565b60018060a01b031690600080826020829451910182865af13d156113f1573d9067ffffffffffffffff82116113dd579061138191604051916113716020601f19601f8401160184610ed5565b82523d84602084013e5b84611512565b9081519182151592836113b1575b5050506113995750565b60249060405190635274afe760e01b82526004820152fd5b8192935090602091810103126113d957602001519081159182150361125a575038808061138f565b5080fd5b634e487b7160e01b83526041600452602483fd5b6113819060609061137b565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161148157926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156114755780516001600160a01b0381161561146c57918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b60048110156114fc578061149f575050565b600181036114b95760405163f645eedf60e01b8152600490fd5b600281036114da5760405163fce698f760e01b815260048101839052602490fd5b6003146114e45750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b600052602160045260246000fd5b90611539575080511561152757805190602001fd5b604051630a12f52160e11b8152600490fd5b8151158061156c575b61154a575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b1561154256fea2646970667358221220320304e618b744040142036e1da5bc7cee9d5b3b5aca2b71c88f4d96440203ff64736f6c63430008170033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading