ETH Price: $3,303.41 (-1.79%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Migrate To PRL242273872026-01-13 17:51:592 days ago1768326719IN
0x0EC5ab25...e74487Eb3
0 ETH0.000008280.11
Migrate To PRL242258562026-01-13 12:40:352 days ago1768308035IN
0x0EC5ab25...e74487Eb3
0 ETH0.000119922.05981082
Migrate To PRL242258412026-01-13 12:37:352 days ago1768307855IN
0x0EC5ab25...e74487Eb3
0 ETH0.00016592.07099928
Migrate To PRL242257552026-01-13 12:20:232 days ago1768306823IN
0x0EC5ab25...e74487Eb3
0 ETH0.000121292.08324304
Migrate To PRL242257462026-01-13 12:18:352 days ago1768306715IN
0x0EC5ab25...e74487Eb3
0 ETH0.000131012.0791941
Migrate To PRL242257302026-01-13 12:15:232 days ago1768306523IN
0x0EC5ab25...e74487Eb3
0 ETH0.000131912.09270798
Migrate To PRL241967662026-01-09 11:16:116 days ago1767957371IN
0x0EC5ab25...e74487Eb3
0 ETH0.000154382.04899827
Migrate To PRL241604012026-01-04 9:28:1112 days ago1767518891IN
0x0EC5ab25...e74487Eb3
0 ETH0.000153212.03416707
Transfer Ownersh...239973732025-12-12 15:16:3534 days ago1765552595IN
0x0EC5ab25...e74487Eb3
0 ETH0.000059332.07287273
Migrate To PRL239829282025-12-10 14:32:4736 days ago1765377167IN
0x0EC5ab25...e74487Eb3
0 ETH0.000162522.15707777
Migrate To PRL239816552025-12-10 10:16:4736 days ago1765361807IN
0x0EC5ab25...e74487Eb3
0 ETH0.000174452.177401
Set Enforced Opt...239677972025-12-08 11:30:2338 days ago1765193423IN
0x0EC5ab25...e74487Eb3
0 ETH0.000019810.37730536
Migrate To PRL239213852025-12-01 21:42:2345 days ago1764625343IN
0x0EC5ab25...e74487Eb3
0 ETH0.000164022.0465427
Migrate To PRL236765072025-10-28 14:26:4779 days ago1761661607IN
0x0EC5ab25...e74487Eb3
0 ETH0.000190972.53458289
Migrate To PRL235675492025-10-13 8:17:3595 days ago1760343455IN
0x0EC5ab25...e74487Eb3
0 ETH0.0001291.71212106
Migrate To PRL235274362025-10-07 17:41:35100 days ago1759858895IN
0x0EC5ab25...e74487Eb3
0 ETH0.00007921.0513762
Migrate To PRL A...235036062025-10-04 9:45:59104 days ago1759571159IN
0x0EC5ab25...e74487Eb3
0.00003568 ETH0.000045360.11705951
Migrate To PRL A...235027622025-10-04 6:56:35104 days ago1759560995IN
0x0EC5ab25...e74487Eb3
0.00003568 ETH0.000046290.11946241
Migrate To PRL A...235008002025-10-04 0:20:59104 days ago1759537259IN
0x0EC5ab25...e74487Eb3
0.00003942 ETH0.000050780.13103053
Migrate To PRL235007892025-10-04 0:18:47104 days ago1759537127IN
0x0EC5ab25...e74487Eb3
0 ETH0.000085761.13825238
Migrate To PRL235007562025-10-04 0:12:11104 days ago1759536731IN
0x0EC5ab25...e74487Eb3
0 ETH0.000011670.14573056
Migrate To PRL235007362025-10-04 0:08:11104 days ago1759536491IN
0x0EC5ab25...e74487Eb3
0 ETH0.000011080.13835749
Migrate To PRL234985882025-10-03 16:56:47104 days ago1759510607IN
0x0EC5ab25...e74487Eb3
0 ETH0.000222092.94763755
Migrate To PRL A...234968172025-10-03 11:00:23104 days ago1759489223IN
0x0EC5ab25...e74487Eb3
0.00003523 ETH0.000061970.15796815
Migrate To PRL234966712025-10-03 10:31:11104 days ago1759487471IN
0x0EC5ab25...e74487Eb3
0 ETH0.000015150.17843944
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Send241117992025-12-28 14:42:2318 days ago1766932943
0x0EC5ab25...e74487Eb3
0.00001948 ETH
Lz Receive241117992025-12-28 14:42:2318 days ago1766932943
0x0EC5ab25...e74487Eb3
0.00001948 ETH
Send235677502025-10-13 8:57:4795 days ago1760345867
0x0EC5ab25...e74487Eb3
0.00001455 ETH
Lz Receive235677502025-10-13 8:57:4795 days ago1760345867
0x0EC5ab25...e74487Eb3
0.00001455 ETH
Send235159842025-10-06 3:15:59102 days ago1759720559
0x0EC5ab25...e74487Eb3
0.00001295 ETH
Lz Receive235159842025-10-06 3:15:59102 days ago1759720559
0x0EC5ab25...e74487Eb3
0.00001295 ETH
Send235036062025-10-04 9:45:59104 days ago1759571159
0x0EC5ab25...e74487Eb3
0.00003568 ETH
Send235027622025-10-04 6:56:35104 days ago1759560995
0x0EC5ab25...e74487Eb3
0.00003568 ETH
Send235008002025-10-04 0:20:59104 days ago1759537259
0x0EC5ab25...e74487Eb3
0.00003942 ETH
Send234968172025-10-03 11:00:23104 days ago1759489223
0x0EC5ab25...e74487Eb3
0.00003523 ETH
Send234965832025-10-03 10:13:35104 days ago1759486415
0x0EC5ab25...e74487Eb3
0.00003523 ETH
Send234962622025-10-03 9:08:59105 days ago1759482539
0x0EC5ab25...e74487Eb3
0.00003523 ETH
Send234961052025-10-03 8:37:11105 days ago1759480631
0x0EC5ab25...e74487Eb3
0.00003523 ETH
Send234950772025-10-03 5:11:11105 days ago1759468271
0x0EC5ab25...e74487Eb3
0.00003523 ETH
Send234924862025-10-02 20:28:11105 days ago1759436891
0x0EC5ab25...e74487Eb3
0.00003746 ETH
Send234874772025-10-02 3:39:35106 days ago1759376375
0x0EC5ab25...e74487Eb3
0.00003656 ETH
Send234871832025-10-02 2:40:23106 days ago1759372823
0x0EC5ab25...e74487Eb3
0.00003656 ETH
Send234866412025-10-02 0:51:35106 days ago1759366295
0x0EC5ab25...e74487Eb3
0.00004407 ETH
Send234864552025-10-02 0:14:23106 days ago1759364063
0x0EC5ab25...e74487Eb3
0.00004407 ETH
Send234863022025-10-01 23:43:47106 days ago1759362227
0x0EC5ab25...e74487Eb3
0.00003814 ETH
Send234862692025-10-01 23:37:11106 days ago1759361831
0x0EC5ab25...e74487Eb3
0.00003814 ETH
Send234862412025-10-01 23:31:35106 days ago1759361495
0x0EC5ab25...e74487Eb3
0.00003814 ETH
Send234818192025-10-01 8:38:59107 days ago1759307939
0x0EC5ab25...e74487Eb3
0.00003834 ETH
Send234648692025-09-28 23:47:47109 days ago1759103267
0x0EC5ab25...e74487Eb3
0.00003884 ETH
Send234603402025-09-28 8:34:47110 days ago1759048487
0x0EC5ab25...e74487Eb3
0.00004121 ETH
View All Internal Transactions
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PrincipalMigrationContract

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 1000 runs

Other Settings:
paris EvmVersion, MIT license
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { Pausable } from "@openzeppelin/contracts/utils/Pausable.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { OAppReceiver, Origin } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppReceiver.sol";
import { OAppCore } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppCore.sol";
import { OAppOptionsType3 } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/libs/OAppOptionsType3.sol";

import { SendParam, MessagingFee, IOFT } from "contracts/layerZero/interfaces/IOFT.sol";
import { OFTMsgCodec } from "contracts/layerZero/libs/OFTMsgCodec.sol";

import { ErrorsLib } from "contracts/libraries/ErrorsLib.sol";

/// @title PrincipalMigrationContract
/// @author Cooper Labs
/// @custom:contact [email protected]
/// @notice LayerZero OappReceiver contract.
/// Messages received will contain the amount of Mimo the user want to migrate and the chain he want to receive it.
/// @dev This contract will use the LockBox contract to bridge PRL to the destination chain that user specified.
contract PrincipalMigrationContract is OAppReceiver, OAppOptionsType3, Pausable, ReentrancyGuard {
    using SafeERC20 for IERC20;
    using OFTMsgCodec for bytes;
    using OFTMsgCodec for bytes32;
    using Address for *;

    uint256 private constant EXTRA_OPTION_START = 192;
    /// MIMO contract token
    IERC20 public immutable MIMO;
    /// PRL contract token
    IERC20 public immutable PRL;
    /// LayerZero's OFTAdapter used to send PRL token to other chains
    IOFT public immutable lockBox;

    //-------------------------------------------
    // Events
    //-------------------------------------------

    /// @notice Emitted when MIMO tokens are migrated to PRL tokens directly on this chain.
    /// @param caller The address that initiate the migration.
    /// @param receiver The address receiving the PRL tokens.
    /// @param amount The amount of MIMO tokens migrated to PRL tokens.
    event MIMOToPRLMigrated(address caller, address receiver, uint256 amount);

    /// @notice Emitted when MIMO tokens are migrated to PRL tokens and bridged to another chain.
    /// @param caller The address that initiate the migration.
    /// @param receiver The address receiving the PRL tokens.
    /// @param sendParam The SendParam struct send to the LockBox contract.
    /// @param fee The MessagingFee struct paid for the bridging.
    event MIMOToPRLMigratedAndBridged(address caller, address receiver, SendParam sendParam, MessagingFee fee);

    /// @notice Emitted when a migration message is received
    /// @param guid The unique identifier of the received message
    /// @param srcEid The source endpoint ID
    /// @param sender The address of the sender
    /// @param destEid The destination endpoint ID
    /// @param receiver The address of the receiver
    /// @param mimoAmount The amount of tokens being migrated
    /// @param prlAmount The amount of PRL tokens to be received
    event MigrationMessageReceived(
        bytes32 guid,
        uint32 srcEid,
        address sender,
        uint32 destEid,
        address receiver,
        uint256 mimoAmount,
        uint256 prlAmount
    );

    /// @notice Emitted when tokens are rescued in an emergency
    /// @param token The address of the rescued token
    /// @param amount The amount of tokens rescued
    /// @param recipient The address that received the rescued tokens
    event EmergencyRescued(address indexed token, uint256 amount, address indexed recipient);

    //-------------------------------------------
    // Constructor
    //-------------------------------------------

    /// @notice Constructor for PrincipalMigrationContract
    /// @param _mimo Address of the MIMO token contract
    /// @param _prl Address of the PRL token contract
    /// @param _lockBox Address of the PRL bridge contract (OFTAdapter)
    /// @param _endpoint Address of the LayerZero endpoint
    /// @param _owner Address of the contract owner
    constructor(
        address _mimo,
        address _prl,
        address _lockBox,
        address _endpoint,
        address _owner
    )
        OAppCore(_endpoint, _owner)
        Ownable(_owner)
    {
        if (_mimo == address(0)) revert ErrorsLib.AddressZero();
        if (_prl == address(0)) revert ErrorsLib.AddressZero();
        if (_lockBox == address(0)) revert ErrorsLib.AddressZero();
        MIMO = IERC20(_mimo);
        PRL = IERC20(_prl);
        lockBox = IOFT(_lockBox);
    }

    //-------------------------------------------
    // External functions
    //-------------------------------------------

    /// @notice Migrates MIMO tokens to PRL tokens
    /// @param _amount The amount of MIMO tokens to migrate
    function migrateToPRL(uint256 _amount, address _recipient) external whenNotPaused nonReentrant {
        emit MIMOToPRLMigrated(msg.sender, _recipient, _amount);
        MIMO.safeTransferFrom(msg.sender, address(this), _amount);
        PRL.safeTransfer(_recipient, _amount);
    }

    /// @notice Migrates MIMO tokens to PRL tokens and bridges them to another chain
    /// @dev This function is payable to pay for the messaging fee.
    /// @param _sendParam The parameters for the send operation.
    /// @param _refundAddress The address to refund the native gas in case of failed source message.
    function migrateToPRLAndBridge(
        SendParam calldata _sendParam,
        address _refundAddress
    )
        external
        payable
        whenNotPaused
        nonReentrant
    {
        if (_refundAddress == address(0)) revert ErrorsLib.AddressZero();
        emit MIMOToPRLMigratedAndBridged(
            msg.sender, _sendParam.to.bytes32ToAddress(), _sendParam, MessagingFee(msg.value, 0)
        );
        MIMO.safeTransferFrom(msg.sender, address(this), _sendParam.amount);
        PRL.approve(address(lockBox), _sendParam.amount);
        lockBox.send{ value: msg.value }(_sendParam, MessagingFee(msg.value, 0), _refundAddress);
    }

    /// @notice Fallback function to receive Ether
    /// @dev This function allows the contract to receive Ether. It's required for
    ///      handling native token refunds from LayerZero or any other operations
    ///      that might send Ether to this contract.
    receive() external payable { }

    //-------------------------------------------
    // OnlyOwner functions
    //-------------------------------------------

    /// @notice Allows the owner to rescue any ERC20 token from the contract in case of emergency
    /// @dev This function can only be called by the owner and only when the contract is paused
    /// @param _token The address of the ERC20 token to rescue
    /// @param _amount The amount of tokens to rescue
    function emergencyRescue(address _token, uint256 _amount) external onlyOwner whenPaused {
        emit EmergencyRescued(_token, _amount, msg.sender);
        IERC20(_token).safeTransfer(msg.sender, _amount);
    }

    /// @notice Allow owner to pause the contract
    /// @dev This function can only be called by the owner
    function pause() external onlyOwner {
        _pause();
    }

    /// @notice Allow owner to unpause the contract
    /// @dev This function can only be called by the owner
    function unpause() external onlyOwner {
        _unpause();
    }

    //-------------------------------------------
    // Internal functions
    //-------------------------------------------

    /// @dev Internal function to handle the received message on the LayerZero endpoint.
    /// @param _origin The origin information.
    ///  - srcEid: The source chain endpoint ID.
    ///  - sender: The sender address from the src chain.
    ///  - nonce: The nonce of the LayerZero message.
    /// @param _guid The unique identifier for the received LayerZero message.
    /// @param _message The encoded message.
    /// @dev _executor The address of the executor.
    /// @dev _extraData Additional data.
    function _lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address, /*_executor*/ // @dev unused in the default implementation.
        bytes calldata /*_extraData*/ // @dev unused in the default implementation.
    )
        internal
        override
    {
        (address receiver, uint256 amount, uint32 destEid, uint256 extraOptionsLength) = _decodeMessage(_message);
        emit MigrationMessageReceived(
            _guid, _origin.srcEid, _origin.sender.bytes32ToAddress(), destEid, receiver, amount, amount
        );
        if (extraOptionsLength == 0 || destEid == endpoint.eid()) {
            emit MIMOToPRLMigrated(_origin.sender.bytes32ToAddress(), receiver, amount);
            PRL.safeTransfer(receiver, amount);
        } else {
            SendParam memory sendParam = _buildSendParam(_message, receiver, amount, destEid, extraOptionsLength);
            PRL.approve(address(lockBox), amount);
            try lockBox.send{ value: msg.value }(sendParam, MessagingFee(msg.value, 0), receiver) {
                emit MIMOToPRLMigratedAndBridged(
                    _origin.sender.bytes32ToAddress(), receiver, sendParam, MessagingFee(msg.value, 0)
                );
            } catch {
                emit MIMOToPRLMigrated(_origin.sender.bytes32ToAddress(), receiver, amount);
                PRL.approve(address(lockBox), 0);
                PRL.safeTransfer(receiver, amount);
                payable(receiver).sendValue(msg.value);
            }
        }
    }

    /// @notice Decodes the received LayerZero message
    /// @param _encodedMessage The encoded message received from LayerZero
    /// @return receiver The address of the receiver
    /// @return amount The amount of tokens being migrated
    /// @return destEid The destination endpoint ID
    /// @return extraOptionsLength The length of extra options in the message
    function _decodeMessage(bytes calldata _encodedMessage)
        public
        pure
        returns (address receiver, uint256 amount, uint32 destEid, uint256 extraOptionsLength)
    {
        // Decode the first part of the message
        (bytes32 _to, uint256 _amount, uint32 _destEid, uint256 _extraOptionsLength) =
            abi.decode(_encodedMessage, (bytes32, uint256, uint32, uint256));
        return (_to.bytes32ToAddress(), _amount, _destEid, _extraOptionsLength);
    }

    /// @notice Builds the SendParam struct for the OFT bridge
    /// @param _encodedMessage The encoded message received from LayerZero
    /// @param _receiver The address of the receiver
    /// @param _finalAmount The final amount of PRL tokens to be sent
    /// @param _destEid The destination endpoint ID
    /// @param _extraOptionsLength The length of extra options in the message
    /// @return params The SendParam struct for the OFT bridge
    function _buildSendParam(
        bytes calldata _encodedMessage,
        address _receiver,
        uint256 _finalAmount,
        uint32 _destEid,
        uint256 _extraOptionsLength
    )
        internal
        pure
        returns (SendParam memory params)
    {
        bytes memory _options = _encodedMessage[EXTRA_OPTION_START:EXTRA_OPTION_START + _extraOptionsLength];
        return
            SendParam(_destEid, OFTMsgCodec.addressToBytes32(_receiver), _finalAmount, _finalAmount, _options, "", "");
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IOAppCore, ILayerZeroEndpointV2 } from "./interfaces/IOAppCore.sol";

/**
 * @title OAppCore
 * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.
 */
abstract contract OAppCore is IOAppCore, Ownable {
    // The LayerZero endpoint associated with the given OApp
    ILayerZeroEndpointV2 public immutable endpoint;

    // Mapping to store peers associated with corresponding endpoints
    mapping(uint32 eid => bytes32 peer) public peers;

    /**
     * @dev Constructor to initialize the OAppCore with the provided endpoint and delegate.
     * @param _endpoint The address of the LOCAL Layer Zero endpoint.
     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
     *
     * @dev The delegate typically should be set as the owner of the contract.
     */
    constructor(address _endpoint, address _delegate) {
        endpoint = ILayerZeroEndpointV2(_endpoint);

        if (_delegate == address(0)) revert InvalidDelegate();
        endpoint.setDelegate(_delegate);
    }

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.
     * @dev Set this to bytes32(0) to remove the peer address.
     * @dev Peer is a bytes32 to accommodate non-evm chains.
     */
    function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {
        _setPeer(_eid, _peer);
    }

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     *
     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.
     * @dev Set this to bytes32(0) to remove the peer address.
     * @dev Peer is a bytes32 to accommodate non-evm chains.
     */
    function _setPeer(uint32 _eid, bytes32 _peer) internal virtual {
        peers[_eid] = _peer;
        emit PeerSet(_eid, _peer);
    }

    /**
     * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.
     * ie. the peer is set to bytes32(0).
     * @param _eid The endpoint ID.
     * @return peer The address of the peer associated with the specified endpoint.
     */
    function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32) {
        bytes32 peer = peers[_eid];
        if (peer == bytes32(0)) revert NoPeer(_eid);
        return peer;
    }

    /**
     * @notice Sets the delegate address for the OApp.
     * @param _delegate The address of the delegate to be set.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.
     */
    function setDelegate(address _delegate) public onlyOwner {
        endpoint.setDelegate(_delegate);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { IOAppReceiver, Origin } from "./interfaces/IOAppReceiver.sol";
import { OAppCore } from "./OAppCore.sol";

/**
 * @title OAppReceiver
 * @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.
 */
abstract contract OAppReceiver is IOAppReceiver, OAppCore {
    // Custom error message for when the caller is not the registered endpoint/
    error OnlyEndpoint(address addr);

    // @dev The version of the OAppReceiver implementation.
    // @dev Version is bumped when changes are made to this contract.
    uint64 internal constant RECEIVER_VERSION = 2;

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     *
     * @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented.
     * ie. this is a RECEIVE only OApp.
     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.
     */
    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {
        return (0, RECEIVER_VERSION);
    }

    /**
     * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.
     * @dev _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @dev _message The lzReceive payload.
     * @param _sender The sender address.
     * @return isSender Is a valid sender.
     *
     * @dev Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer.
     * @dev The default sender IS the OAppReceiver implementer.
     */
    function isComposeMsgSender(
        Origin calldata /*_origin*/,
        bytes calldata /*_message*/,
        address _sender
    ) public view virtual returns (bool) {
        return _sender == address(this);
    }

    /**
     * @notice Checks if the path initialization is allowed based on the provided origin.
     * @param origin The origin information containing the source endpoint and sender address.
     * @return Whether the path has been initialized.
     *
     * @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.
     * @dev This defaults to assuming if a peer has been set, its initialized.
     * Can be overridden by the OApp if there is other logic to determine this.
     */
    function allowInitializePath(Origin calldata origin) public view virtual returns (bool) {
        return peers[origin.srcEid] == origin.sender;
    }

    /**
     * @notice Retrieves the next nonce for a given source endpoint and sender address.
     * @dev _srcEid The source endpoint ID.
     * @dev _sender The sender address.
     * @return nonce The next nonce.
     *
     * @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.
     * @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered.
     * @dev This is also enforced by the OApp.
     * @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.
     */
    function nextNonce(uint32 /*_srcEid*/, bytes32 /*_sender*/) public view virtual returns (uint64 nonce) {
        return 0;
    }

    /**
     * @dev Entry point for receiving messages or packets from the endpoint.
     * @param _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @param _guid The unique identifier for the received LayerZero message.
     * @param _message The payload of the received message.
     * @param _executor The address of the executor for the received message.
     * @param _extraData Additional arbitrary data provided by the corresponding executor.
     *
     * @dev Entry point for receiving msg/packet from the LayerZero endpoint.
     */
    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) public payable virtual {
        // Ensures that only the endpoint can attempt to lzReceive() messages to this OApp.
        if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);

        // Ensure that the sender matches the expected peer for the source endpoint.
        if (_getPeerOrRevert(_origin.srcEid) != _origin.sender) revert OnlyPeer(_origin.srcEid, _origin.sender);

        // Call the internal OApp implementation of lzReceive.
        _lzReceive(_origin, _guid, _message, _executor, _extraData);
    }

    /**
     * @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation.
     */
    function _lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) internal virtual;
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { MessagingParams, MessagingFee, MessagingReceipt } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";
import { OAppCore } from "./OAppCore.sol";

/**
 * @title OAppSender
 * @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.
 */
abstract contract OAppSender is OAppCore {
    using SafeERC20 for IERC20;

    // Custom error messages
    error NotEnoughNative(uint256 msgValue);
    error LzTokenUnavailable();

    // @dev The version of the OAppSender implementation.
    // @dev Version is bumped when changes are made to this contract.
    uint64 internal constant SENDER_VERSION = 1;

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     *
     * @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented.
     * ie. this is a SEND only OApp.
     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions
     */
    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {
        return (SENDER_VERSION, 0);
    }

    /**
     * @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.
     * @param _dstEid The destination endpoint ID.
     * @param _message The message payload.
     * @param _options Additional options for the message.
     * @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens.
     * @return fee The calculated MessagingFee for the message.
     *      - nativeFee: The native fee for the message.
     *      - lzTokenFee: The LZ token fee for the message.
     */
    function _quote(
        uint32 _dstEid,
        bytes memory _message,
        bytes memory _options,
        bool _payInLzToken
    ) internal view virtual returns (MessagingFee memory fee) {
        return
            endpoint.quote(
                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _payInLzToken),
                address(this)
            );
    }

    /**
     * @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message.
     * @param _dstEid The destination endpoint ID.
     * @param _message The message payload.
     * @param _options Additional options for the message.
     * @param _fee The calculated LayerZero fee for the message.
     *      - nativeFee: The native fee.
     *      - lzTokenFee: The lzToken fee.
     * @param _refundAddress The address to receive any excess fee values sent to the endpoint.
     * @return receipt The receipt for the sent message.
     *      - guid: The unique identifier for the sent message.
     *      - nonce: The nonce of the sent message.
     *      - fee: The LayerZero fee incurred for the message.
     */
    function _lzSend(
        uint32 _dstEid,
        bytes memory _message,
        bytes memory _options,
        MessagingFee memory _fee,
        address _refundAddress
    ) internal virtual returns (MessagingReceipt memory receipt) {
        // @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint.
        uint256 messageValue = _payNative(_fee.nativeFee);
        if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);

        return
            // solhint-disable-next-line check-send-result
            endpoint.send{ value: messageValue }(
                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _fee.lzTokenFee > 0),
                _refundAddress
            );
    }

    /**
     * @dev Internal function to pay the native fee associated with the message.
     * @param _nativeFee The native fee to be paid.
     * @return nativeFee The amount of native currency paid.
     *
     * @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction,
     * this will need to be overridden because msg.value would contain multiple lzFees.
     * @dev Should be overridden in the event the LayerZero endpoint requires a different native currency.
     * @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees.
     * @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.
     */
    function _payNative(uint256 _nativeFee) internal virtual returns (uint256 nativeFee) {
        if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);
        return _nativeFee;
    }

    /**
     * @dev Internal function to pay the LZ token fee associated with the message.
     * @param _lzTokenFee The LZ token fee to be paid.
     *
     * @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.
     * @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend().
     */
    function _payLzToken(uint256 _lzTokenFee) internal virtual {
        // @dev Cannot cache the token because it is not immutable in the endpoint.
        address lzToken = endpoint.lzToken();
        if (lzToken == address(0)) revert LzTokenUnavailable();

        // Pay LZ token fee by sending tokens to the endpoint.
        IERC20(lzToken).safeTransferFrom(msg.sender, address(endpoint), _lzTokenFee);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { ILayerZeroEndpointV2 } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";

/**
 * @title IOAppCore
 */
interface IOAppCore {
    // Custom error messages
    error OnlyPeer(uint32 eid, bytes32 sender);
    error NoPeer(uint32 eid);
    error InvalidEndpointCall();
    error InvalidDelegate();

    // Event emitted when a peer (OApp) is set for a corresponding endpoint
    event PeerSet(uint32 eid, bytes32 peer);

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     */
    function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion);

    /**
     * @notice Retrieves the LayerZero endpoint associated with the OApp.
     * @return iEndpoint The LayerZero endpoint as an interface.
     */
    function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);

    /**
     * @notice Retrieves the peer (OApp) associated with a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @return peer The peer address (OApp instance) associated with the corresponding endpoint.
     */
    function peers(uint32 _eid) external view returns (bytes32 peer);

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     */
    function setPeer(uint32 _eid, bytes32 _peer) external;

    /**
     * @notice Sets the delegate address for the OApp Core.
     * @param _delegate The address of the delegate to be set.
     */
    function setDelegate(address _delegate) external;
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

/**
 * @dev Struct representing enforced option parameters.
 */
struct EnforcedOptionParam {
    uint32 eid; // Endpoint ID
    uint16 msgType; // Message Type
    bytes options; // Additional options
}

/**
 * @title IOAppOptionsType3
 * @dev Interface for the OApp with Type 3 Options, allowing the setting and combining of enforced options.
 */
interface IOAppOptionsType3 {
    // Custom error message for invalid options
    error InvalidOptions(bytes options);

    // Event emitted when enforced options are set
    event EnforcedOptionSet(EnforcedOptionParam[] _enforcedOptions);

    /**
     * @notice Sets enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     */
    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) external;

    /**
     * @notice Combines options for a given endpoint and message type.
     * @param _eid The endpoint ID.
     * @param _msgType The OApp message type.
     * @param _extraOptions Additional options passed by the caller.
     * @return options The combination of caller specified options AND enforced options.
     */
    function combineOptions(
        uint32 _eid,
        uint16 _msgType,
        bytes calldata _extraOptions
    ) external view returns (bytes memory options);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import { ILayerZeroReceiver, Origin } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol";

interface IOAppReceiver is ILayerZeroReceiver {
    /**
     * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.
     * @param _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @param _message The lzReceive payload.
     * @param _sender The sender address.
     * @return isSender Is a valid sender.
     *
     * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.
     * @dev The default sender IS the OAppReceiver implementer.
     */
    function isComposeMsgSender(
        Origin calldata _origin,
        bytes calldata _message,
        address _sender
    ) external view returns (bool isSender);
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IOAppOptionsType3, EnforcedOptionParam } from "../interfaces/IOAppOptionsType3.sol";

/**
 * @title OAppOptionsType3
 * @dev Abstract contract implementing the IOAppOptionsType3 interface with type 3 options.
 */
abstract contract OAppOptionsType3 is IOAppOptionsType3, Ownable {
    uint16 internal constant OPTION_TYPE_3 = 3;

    // @dev The "msgType" should be defined in the child contract.
    mapping(uint32 eid => mapping(uint16 msgType => bytes enforcedOption)) public enforcedOptions;

    /**
     * @dev Sets the enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.
     * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType.
     * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay
     * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().
     */
    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) public virtual onlyOwner {
        _setEnforcedOptions(_enforcedOptions);
    }

    /**
     * @dev Sets the enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     *
     * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.
     * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType.
     * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay
     * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().
     */
    function _setEnforcedOptions(EnforcedOptionParam[] memory _enforcedOptions) internal virtual {
        for (uint256 i = 0; i < _enforcedOptions.length; i++) {
            // @dev Enforced options are only available for optionType 3, as type 1 and 2 dont support combining.
            _assertOptionsType3(_enforcedOptions[i].options);
            enforcedOptions[_enforcedOptions[i].eid][_enforcedOptions[i].msgType] = _enforcedOptions[i].options;
        }

        emit EnforcedOptionSet(_enforcedOptions);
    }

    /**
     * @notice Combines options for a given endpoint and message type.
     * @param _eid The endpoint ID.
     * @param _msgType The OAPP message type.
     * @param _extraOptions Additional options passed by the caller.
     * @return options The combination of caller specified options AND enforced options.
     *
     * @dev If there is an enforced lzReceive option:
     * - {gasLimit: 200k, msg.value: 1 ether} AND a caller supplies a lzReceive option: {gasLimit: 100k, msg.value: 0.5 ether}
     * - The resulting options will be {gasLimit: 300k, msg.value: 1.5 ether} when the message is executed on the remote lzReceive() function.
     * @dev This presence of duplicated options is handled off-chain in the verifier/executor.
     */
    function combineOptions(
        uint32 _eid,
        uint16 _msgType,
        bytes calldata _extraOptions
    ) public view virtual returns (bytes memory) {
        bytes memory enforced = enforcedOptions[_eid][_msgType];

        // No enforced options, pass whatever the caller supplied, even if it's empty or legacy type 1/2 options.
        if (enforced.length == 0) return _extraOptions;

        // No caller options, return enforced
        if (_extraOptions.length == 0) return enforced;

        // @dev If caller provided _extraOptions, must be type 3 as its the ONLY type that can be combined.
        if (_extraOptions.length >= 2) {
            _assertOptionsType3(_extraOptions);
            // @dev Remove the first 2 bytes containing the type from the _extraOptions and combine with enforced.
            return bytes.concat(enforced, _extraOptions[2:]);
        }

        // No valid set of options was found.
        revert InvalidOptions(_extraOptions);
    }

    /**
     * @dev Internal function to assert that options are of type 3.
     * @param _options The options to be checked.
     */
    function _assertOptionsType3(bytes memory _options) internal pure virtual {
        uint16 optionsType;
        assembly {
            optionsType := mload(add(_options, 2))
        }
        if (optionsType != OPTION_TYPE_3) revert InvalidOptions(_options);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { IMessageLibManager } from "./IMessageLibManager.sol";
import { IMessagingComposer } from "./IMessagingComposer.sol";
import { IMessagingChannel } from "./IMessagingChannel.sol";
import { IMessagingContext } from "./IMessagingContext.sol";

struct MessagingParams {
    uint32 dstEid;
    bytes32 receiver;
    bytes message;
    bytes options;
    bool payInLzToken;
}

struct MessagingReceipt {
    bytes32 guid;
    uint64 nonce;
    MessagingFee fee;
}

struct MessagingFee {
    uint256 nativeFee;
    uint256 lzTokenFee;
}

struct Origin {
    uint32 srcEid;
    bytes32 sender;
    uint64 nonce;
}

interface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext {
    event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);

    event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);

    event PacketDelivered(Origin origin, address receiver);

    event LzReceiveAlert(
        address indexed receiver,
        address indexed executor,
        Origin origin,
        bytes32 guid,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    event LzTokenSet(address token);

    event DelegateSet(address sender, address delegate);

    function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);

    function send(
        MessagingParams calldata _params,
        address _refundAddress
    ) external payable returns (MessagingReceipt memory);

    function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;

    function verifiable(Origin calldata _origin, address _receiver) external view returns (bool);

    function initializable(Origin calldata _origin, address _receiver) external view returns (bool);

    function lzReceive(
        Origin calldata _origin,
        address _receiver,
        bytes32 _guid,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;

    // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order
    function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;

    function setLzToken(address _lzToken) external;

    function lzToken() external view returns (address);

    function nativeToken() external view returns (address);

    function setDelegate(address _delegate) external;
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { Origin } from "./ILayerZeroEndpointV2.sol";

interface ILayerZeroReceiver {
    function allowInitializePath(Origin calldata _origin) external view returns (bool);

    function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64);

    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) external payable;
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

struct SetConfigParam {
    uint32 eid;
    uint32 configType;
    bytes config;
}

interface IMessageLibManager {
    struct Timeout {
        address lib;
        uint256 expiry;
    }

    event LibraryRegistered(address newLib);
    event DefaultSendLibrarySet(uint32 eid, address newLib);
    event DefaultReceiveLibrarySet(uint32 eid, address newLib);
    event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);
    event SendLibrarySet(address sender, uint32 eid, address newLib);
    event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);
    event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);

    function registerLibrary(address _lib) external;

    function isRegisteredLibrary(address _lib) external view returns (bool);

    function getRegisteredLibraries() external view returns (address[] memory);

    function setDefaultSendLibrary(uint32 _eid, address _newLib) external;

    function defaultSendLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _gracePeriod) external;

    function defaultReceiveLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;

    function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);

    function isSupportedEid(uint32 _eid) external view returns (bool);

    function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);

    /// ------------------- OApp interfaces -------------------
    function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;

    function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);

    function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);

    function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;

    function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);

    function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _expiry) external;

    function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);

    function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;

    function getConfig(
        address _oapp,
        address _lib,
        uint32 _eid,
        uint32 _configType
    ) external view returns (bytes memory config);
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingChannel {
    event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce);
    event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);
    event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);

    function eid() external view returns (uint32);

    // this is an emergency function if a message cannot be verified for some reasons
    // required to provide _nextNonce to avoid race condition
    function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external;

    function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32);

    function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);

    function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64);

    function inboundPayloadHash(
        address _receiver,
        uint32 _srcEid,
        bytes32 _sender,
        uint64 _nonce
    ) external view returns (bytes32);

    function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingComposer {
    event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message);
    event ComposeDelivered(address from, address to, bytes32 guid, uint16 index);
    event LzComposeAlert(
        address indexed from,
        address indexed to,
        address indexed executor,
        bytes32 guid,
        uint16 index,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    function composeQueue(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index
    ) external view returns (bytes32 messageHash);

    function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external;

    function lzCompose(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingContext {
    function isSendingMessage() external view returns (bool);

    function getSendContext() external view returns (uint32 dstEid, address sender);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 17 of 29 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 18 of 29 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            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 silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @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 Errors.InsufficientBalance(address(this).balance, amount);
        }

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

    /**
     * @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
     * {Errors.FailedCall} 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 Errors.InsufficientBalance(address(this).balance, value);
        }
        (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 {Errors.FailedCall}) 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 {Errors.FailedCall} 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 {Errors.FailedCall}.
     */
    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
            assembly ("memory-safe") {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert Errors.FailedCall();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 23 of 29 : Errors.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

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

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

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

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import { MessagingReceipt, MessagingFee } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppSender.sol";

/// @dev Struct representing token parameters for the OFT send() operation.
struct SendParam {
    uint32 dstEid; // Destination endpoint ID.
    bytes32 to; // Recipient address.
    uint256 amount; // Amount to send.
    uint256 minAmount; // Minimum amount to send.
    bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message.
    bytes composeMsg; // The composed message for the send() operation.
    bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations.
}

/// @dev Struct representing OFT limit information.
/// @dev These amounts can change dynamically and are up the the specific oft implementation.
struct OFTLimit {
    uint256 minAmount; // Minimum amount that can be sent to the recipient.
    uint256 maxAmount; // Maximum amount that can be sent to the recipient.
}

/// @dev Struct representing OFT receipt information.
struct OFTReceipt {
    uint256 amountSent; // Amount of tokens ACTUALLY debited from the sender.
    // @dev In non-default implementations, the amountReceived COU differ from this value.
    uint256 amountReceived; // Amount of tokens to be received on the remote side.
}

/// @dev Struct representing OFT fee details.
/// @dev Future proof mechanism to provide a standardized way to communicate fees to things like a UI.
struct OFTFeeDetail {
    int256 feeAmount; // Amount of the fee.
    string description; // Description of the fee.
}

/// @title IOFTCore
/// @author Forked from
/// https://github.com/LayerZero-Labs/LayerZero-v2/blob/main/packages/layerzero-v2/evm/oapp/contracts/oft/IOFT.sol
/// @dev Modifications made by Cooper Labs. Removing sharedDecimals/decimalConversionRate feature.
/// @dev Interface for the OftChain (OFT) token.
/// @dev Does not inherit ERC20 to accommodate usage by OFTAdapter as well.
/// @dev This specific interface ID is '0x18fb6cf8'.
interface IOFT {
    error SlippageExceeded(uint256 amount, uint256 minAmount);

    // Events
    // GUID of the OFT message.
    // Destination Endpoint ID.
    // Address of the sender on the src chain.
    // Amount of tokens sent.
    // Amount of tokens received.
    event OFTSent(
        bytes32 indexed guid, uint32 dstEid, address indexed fromAddress, uint256 amountSent, uint256 amountReceived
    );

    // GUID of the OFT message.
    // Source Endpoint ID.
    // Address of the recipient on the dst chain.
    // Amount of tokens received.
    event OFTReceived(bytes32 indexed guid, uint32 srcEid, address indexed toAddress, uint256 amountReceived);

    /// @notice Retrieves interfaceID and the version of the OFT.
    /// @return interfaceId The interface ID.
    /// @return version The version.
    /// @dev interfaceId: This specific interface ID is '0x18fb6cf8'.
    /// @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.
    /// @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.
    /// ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)
    function oftVersion() external view returns (bytes4 interfaceId, uint64 version);

    /// @notice Retrieves the address of the token associated with the OFT.
    /// @return token The address of the ERC20 token implementation.
    function token() external view returns (address);

    /**
     * @notice Indicates whether the OFT contract requires approval of the 'token()' to send.
     * @return requiresApproval Needs approval of the underlying token implementation.
     *
     * @dev Allows things like wallet implementers to determine integration requirements,
     * without understanding the underlying token implementation.
     */
    function approvalRequired() external view returns (bool);

    /// @notice Provides a quote for OFT-related operations.
    /// @param _sendParam The parameters for the send operation.
    /// @return limit The OFT limit information.
    /// @return oftFeeDetails The details of OFT fees.
    /// @return receipt The OFT receipt information.
    function quoteOFT(SendParam calldata _sendParam)
        external
        view
        returns (OFTLimit memory, OFTFeeDetail[] memory oftFeeDetails, OFTReceipt memory);

    /// @notice Provides a quote for the send() operation.
    /// @param _sendParam The parameters for the send() operation.
    /// @param _payInLzToken Flag indicating whether the caller is paying in the LZ token.
    /// @return fee The calculated LayerZero messaging fee from the send() operation.
    /// @dev MessagingFee: LayerZero msg fee
    ///  - nativeFee: The native fee.
    ///  - lzTokenFee: The lzToken fee.
    function quoteSend(SendParam calldata _sendParam, bool _payInLzToken) external view returns (MessagingFee memory);

    /// @notice Executes the send() operation.
    /// @param _sendParam The parameters for the send operation.
    /// @param _fee The fee information supplied by the caller.
    ///      - nativeFee: The native fee.
    ///      - lzTokenFee: The lzToken fee.
    /// @param _refundAddress The address to receive any excess funds from fees etc. on the src.
    /// @return receipt The LayerZero messaging receipt from the send() operation.
    /// @return oftReceipt The OFT receipt information.
    /// @dev MessagingReceipt: LayerZero msg receipt
    ///  - guid: The unique identifier for the sent message.
    ///  - nonce: The nonce of the sent message.
    ///  - fee: The LayerZero fee incurred for the message.
    function send(
        SendParam calldata _sendParam,
        MessagingFee calldata _fee,
        address _refundAddress
    )
        external
        payable
        returns (MessagingReceipt memory, OFTReceipt memory);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/// @title OFTMsgCodec
/// @author Forked from
/// https://github.com/LayerZero-Labs/LayerZero-v2/blob/main/packages/layerzero-v2/evm/oapp/contracts/oft/libs/OFTMsgCodec.sol
/// @dev Modifications made by Cooper Labs. Removed 'SD' (Shared Decimals) related code.
library OFTMsgCodec {
    // Offset constants for encoding and decoding OFT messages
    uint8 private constant SEND_TO_OFFSET = 32;
    uint8 private constant SEND_AMOUNT_OFFSET = 64;

    /// @dev Encodes an OFT LayerZero message.
    /// @param _sendTo The recipient address.
    /// @param _amount The amount.
    /// @param _composeMsg The composed message.
    /// @return _msg The encoded message.
    /// @return hasCompose A boolean indicating whether the message has a composed payload.
    function encode(
        bytes32 _sendTo,
        uint256 _amount,
        bytes memory _composeMsg
    )
        internal
        view
        returns (bytes memory _msg, bool hasCompose)
    {
        hasCompose = _composeMsg.length > 0;
        // @dev Remote chains will want to know the composed function caller ie. msg.sender on the src.
        _msg = hasCompose
            ? abi.encodePacked(_sendTo, _amount, addressToBytes32(msg.sender), _composeMsg)
            : abi.encodePacked(_sendTo, _amount);
    }

    /// @dev Checks if the OFT message is composed.
    /// @param _msg The OFT message.
    /// @return A boolean indicating whether the message is composed.
    function isComposed(bytes calldata _msg) internal pure returns (bool) {
        return _msg.length > SEND_AMOUNT_OFFSET;
    }

    /// @dev Retrieves the recipient address from the OFT message.
    /// @param _msg The OFT message.
    /// @return The recipient address.
    function sendTo(bytes calldata _msg) internal pure returns (bytes32) {
        return bytes32(_msg[:SEND_TO_OFFSET]);
    }

    /// @dev Retrieves the amount from the OFT message.
    /// @param _msg The OFT message.
    /// @return The amount.
    function amount(bytes calldata _msg) internal pure returns (uint256) {
        return uint256(bytes32(_msg[SEND_TO_OFFSET:SEND_AMOUNT_OFFSET]));
    }

    /// @dev Retrieves the composed message from the OFT message.
    /// @param _msg The OFT message.
    /// @return The composed message.
    function composeMsg(bytes calldata _msg) internal pure returns (bytes memory) {
        return _msg[SEND_AMOUNT_OFFSET:];
    }

    /// @dev Converts an address to bytes32.
    /// @param _addr The address to convert.
    /// @return The bytes32 representation of the address.
    function addressToBytes32(address _addr) internal pure returns (bytes32) {
        return bytes32(uint256(uint160(_addr)));
    }

    /// @dev Converts bytes32 to an address.
    /// @param _b The bytes32 value to convert.
    /// @return The address representation of bytes32.
    function bytes32ToAddress(bytes32 _b) internal pure returns (address) {
        return address(uint160(uint256(_b)));
    }
}

File 29 of 29 : ErrorsLib.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/// @title ErrorsLib
/// @author Cooper Labs
/// @custom:contact [email protected]
/// @notice Library exposing all commun errors.
library ErrorsLib {
    /// @notice Thrown when the address is zero.
    error AddressZero();

    /// @notice Thrown when the msg length is invalid.
    error InvalidMsgLength();
}

Settings
{
  "evmVersion": "paris",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_mimo","type":"address"},{"internalType":"address","name":"_prl","type":"address"},{"internalType":"address","name":"_lockBox","type":"address"},{"internalType":"address","name":"_endpoint","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidDelegate","type":"error"},{"inputs":[],"name":"InvalidEndpointCall","type":"error"},{"inputs":[{"internalType":"bytes","name":"options","type":"bytes"}],"name":"InvalidOptions","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"NoPeer","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"OnlyEndpoint","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"}],"name":"OnlyPeer","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"EmergencyRescued","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"indexed":false,"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"EnforcedOptionSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MIMOToPRLMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"indexed":false,"internalType":"struct SendParam","name":"sendParam","type":"tuple"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"indexed":false,"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"name":"MIMOToPRLMigratedAndBridged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"guid","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"srcEid","type":"uint32"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint32","name":"destEid","type":"uint32"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"mimoAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"prlAmount","type":"uint256"}],"name":"MigrationMessageReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"eid","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"peer","type":"bytes32"}],"name":"PeerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MIMO","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRL","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_encodedMessage","type":"bytes"}],"name":"_decodeMessage","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"destEid","type":"uint32"},{"internalType":"uint256","name":"extraOptionsLength","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"origin","type":"tuple"}],"name":"allowInitializePath","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"uint16","name":"_msgType","type":"uint16"},{"internalType":"bytes","name":"_extraOptions","type":"bytes"}],"name":"combineOptions","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"emergencyRescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"}],"name":"enforcedOptions","outputs":[{"internalType":"bytes","name":"enforcedOption","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"","type":"tuple"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"address","name":"_sender","type":"address"}],"name":"isComposeMsgSender","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockBox","outputs":[{"internalType":"contract IOFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"_origin","type":"tuple"},{"internalType":"bytes32","name":"_guid","type":"bytes32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"migrateToPRL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"internalType":"address","name":"_refundAddress","type":"address"}],"name":"migrateToPRLAndBridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"nextNonce","outputs":[{"internalType":"uint64","name":"nonce","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oAppVersion","outputs":[{"internalType":"uint64","name":"senderVersion","type":"uint64"},{"internalType":"uint64","name":"receiverVersion","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"peers","outputs":[{"internalType":"bytes32","name":"peer","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"setEnforcedOptions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"setPeer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

61010060405234801561001157600080fd5b5060405161292e38038061292e83398101604081905261003091610208565b8181806001600160a01b03811661006157604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61006a8161019c565b506001600160a01b03808316608052811661009857604051632d618d8160e21b815260040160405180910390fd5b60805160405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b1580156100df57600080fd5b505af11580156100f3573d6000803e3d6000fd5b50506003805460ff191690555050600160045550506001600160a01b03851661012f57604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b03841661015657604051639fabe1c160e01b815260040160405180910390fd5b6001600160a01b03831661017d57604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b0392831660a05290821660c0521660e05261026d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b038116811461020357600080fd5b919050565b600080600080600060a0868803121561022057600080fd5b610229866101ec565b9450610237602087016101ec565b9350610245604087016101ec565b9250610253606087016101ec565b9150610261608087016101ec565b90509295509295909350565b60805160a05160c05160e0516126186103166000396000818161032e015281816107a20152818161086d015281816110450152818161111101526111ef015260008181610291015281816107d301528181610d4c01528181610ff2015281816110770152818161121e01526112990152600081816104370152818161075e0152610d170152600081816103620152818161057601528181610c520152610f0201526126186000f3fe60806040526004361061019a5760003560e01c80637d25a05e116100e1578063b98bd0701161008a578063ca5eb5e111610064578063ca5eb5e1146104f4578063df1c272914610514578063f2fde38b14610534578063ff7bd03d1461055457600080fd5b8063b98bd07014610479578063bb0b6a5314610499578063bc70b354146104d457600080fd5b80638da5cb5b116100bb5780638da5cb5b14610407578063a00e07c414610425578063b72952ee1461045957600080fd5b80637d25a05e1461039957806382413eac146103d25780638456cb59146103f257600080fd5b80635502c73b116101435780635d19b0d11161011d5780635d19b0d11461031c5780635e280f1114610350578063715018a61461038457600080fd5b80635502c73b1461027f5780635535d461146102cb5780635c975abb146102f857600080fd5b80633400288b116101745780633400288b146102375780633b1a50b5146102575780633f4ba83a1461026a57600080fd5b806313137d65146101a657806317442b70146101bb57806324fd4c05146101e257600080fd5b366101a157005b600080fd5b6101b96101b4366004611a5e565b610574565b005b3480156101c757600080fd5b50604080516000815260026020820152015b60405180910390f35b3480156101ee57600080fd5b506102026101fd366004611afd565b610666565b604080516001600160a01b039095168552602085019390935263ffffffff9091169183019190915260608201526080016101d9565b34801561024357600080fd5b506101b9610252366004611b51565b61069a565b6101b9610265366004611b7d565b6106b0565b34801561027657600080fd5b506101b96108f5565b34801561028b57600080fd5b506102b37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101d9565b3480156102d757600080fd5b506102eb6102e6366004611be2565b610907565b6040516101d99190611c5e565b34801561030457600080fd5b5060035460ff165b60405190151581526020016101d9565b34801561032857600080fd5b506102b37f000000000000000000000000000000000000000000000000000000000000000081565b34801561035c57600080fd5b506102b37f000000000000000000000000000000000000000000000000000000000000000081565b34801561039057600080fd5b506101b96109ac565b3480156103a557600080fd5b506103b96103b4366004611b51565b6109be565b60405167ffffffffffffffff90911681526020016101d9565b3480156103de57600080fd5b5061030c6103ed366004611c78565b6109c7565b3480156103fe57600080fd5b506101b96109dc565b34801561041357600080fd5b506000546001600160a01b03166102b3565b34801561043157600080fd5b506102b37f000000000000000000000000000000000000000000000000000000000000000081565b34801561046557600080fd5b506101b9610474366004611cde565b6109ec565b34801561048557600080fd5b506101b9610494366004611cfa565b610a50565b3480156104a557600080fd5b506104c66104b4366004611d6f565b60016020526000908152604090205481565b6040519081526020016101d9565b3480156104e057600080fd5b506102eb6104ef366004611d8c565b610a6a565b34801561050057600080fd5b506101b961050f366004611def565b610c12565b34801561052057600080fd5b506101b961052f366004611e0a565b610cb1565b34801561054057600080fd5b506101b961054f366004611def565b610d7d565b34801561056057600080fd5b5061030c61056f366004611e2d565b610dd4565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633146105dd576040517f91ac5e4f0000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b602087018035906105f7906105f2908a611d6f565b610e0a565b1461064e576106096020880188611d6f565b6040517fc26bebcc00000000000000000000000000000000000000000000000000000000815263ffffffff9091166004820152602088013560248201526044016105d4565b61065d87878787878787610e5f565b50505050505050565b60008080808080808061067b898b018b611e49565b935093509350935061068a8490565b9a92995090975095509350505050565b6106a2611342565b6106ac8282611388565b5050565b6106b86113dd565b6106c061141a565b6001600160a01b038116610700576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fa99346fe26352079fd1ef7b9d9fe67cfa784267a782cf56b6437d7fbc1aac5333360208401356040805180820182523481526000602082015290516107499392918791611f9f565b60405180910390a161078a6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330604086013561145d565b6040805163095ea7b360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301529184013560248201527f00000000000000000000000000000000000000000000000000000000000000009091169063095ea7b3906044016020604051808303816000875af115801561081e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108429190611fe8565b506040805180820182523480825260006020830152915163c7c7f5b360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263c7c7f5b39290916108a6918791879060040161200a565b60c06040518083038185885af11580156108c4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108e9919061210c565b50506106ac6001600455565b6108fd611342565b6109056114df565b565b60026020908152600092835260408084209091529082529020805461092b9061217c565b80601f01602080910402602001604051908101604052809291908181526020018280546109579061217c565b80156109a45780601f10610979576101008083540402835291602001916109a4565b820191906000526020600020905b81548152906001019060200180831161098757829003601f168201915b505050505081565b6109b4611342565b6109056000611531565b60005b92915050565b6001600160a01b03811630145b949350505050565b6109e4611342565b610905611599565b6109f4611342565b6109fc6115d6565b60405181815233906001600160a01b038416907f050bfcf56def683ba46089b74b240740900eb3e22309f1a9a50cdad12e7a43b29060200160405180910390a36106ac6001600160a01b0383163383611612565b610a58611342565b6106ac610a6582846121b0565b611648565b63ffffffff8416600090815260026020908152604080832061ffff87168452909152812080546060929190610a9e9061217c565b80601f0160208091040260200160405190810160405280929190818152602001828054610aca9061217c565b8015610b175780601f10610aec57610100808354040283529160200191610b17565b820191906000526020600020905b815481529060010190602001808311610afa57829003601f168201915b505050505090508051600003610b675783838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294506109d49350505050565b6000839003610b775790506109d4565b60028310610bf557610bbe84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061175a92505050565b80610bcc84600281886122d8565b604051602001610bde93929190612302565b6040516020818303038152906040529150506109d4565b8383604051639a6d49cd60e01b81526004016105d492919061232a565b610c1a611342565b6040517fca5eb5e10000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ca5eb5e190602401600060405180830381600087803b158015610c9657600080fd5b505af1158015610caa573d6000803e3d6000fd5b5050505050565b610cb96113dd565b610cc161141a565b604080513381526001600160a01b03831660208201529081018390527fbb5252b2894a0074f70a195e56c61da7ea6cfb3c340ee8e20021d646ee59096f9060600160405180910390a1610d3f6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308561145d565b610d736001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168284611612565b6106ac6001600455565b610d85611342565b6001600160a01b038116610dc8576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016105d4565b610dd181611531565b50565b6000602082018035906001908390610dec9086611d6f565b63ffffffff1681526020810191909152604001600020541492915050565b63ffffffff8116600090815260016020526040812054806109c1576040517ff6ff4fb700000000000000000000000000000000000000000000000000000000815263ffffffff841660048201526024016105d4565b600080600080610e6f8989610666565b929650909450925090507f1f1b0dd6b79d5ded2d2940f8d747107122f25860b53f46cf78dca361897f76268a610ea860208e018e611d6f565b60208e01356040805193845263ffffffff92831660208501526001600160a01b039182169084015290851660608301528616608082015260a0810185905260c0810185905260e00160405180910390a1801580610f9157507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663416ecebf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f82919061233e565b63ffffffff168263ffffffff16145b1561101e577fbb5252b2894a0074f70a195e56c61da7ea6cfb3c340ee8e20021d646ee59096f60208c0135604080516001600160a01b0392831681529187166020830152810185905260600160405180910390a16110196001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168585611612565b611335565b600061102e8a8a87878787611786565b60405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018790529192507f00000000000000000000000000000000000000000000000000000000000000009091169063095ea7b3906044016020604051808303816000875af11580156110c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e69190611fe8565b506040805180820182523480825260006020830152915163c7c7f5b360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263c7c7f5b392909161114a9186918b906004016123d1565b60c06040518083038185885af193505050508015611185575060408051601f3d908101601f191682019092526111829181019061210c565b60015b6112d8577fbb5252b2894a0074f70a195e56c61da7ea6cfb3c340ee8e20021d646ee59096f60208d0135604080516001600160a01b0392831681529188166020830152810186905260600160405180910390a160405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152600060248301527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af1158015611267573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128b9190611fe8565b506112c06001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168686611612565b6112d36001600160a01b03861634611887565b611333565b50507fa99346fe26352079fd1ef7b9d9fe67cfa784267a782cf56b6437d7fbc1aac5336113068d6020013590565b60408051808201825234815260006020820152905161132a929189918691906123e4565b60405180910390a15b505b5050505050505050505050565b6000546001600160a01b03163314610905576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016105d4565b63ffffffff8216600081815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b60035460ff1615610905576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260045403611456576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600455565b6040516001600160a01b0384811660248301528381166044830152606482018390526114d99186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611957565b50505050565b6114e76115d6565b6003805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6115a16113dd565b6003805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586115143390565b60035460ff16610905576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b0383811660248301526044820183905261164391859182169063a9059cbb90606401611492565b505050565b60005b815181101561171f5761167a82828151811061166957611669612410565b60200260200101516040015161175a565b81818151811061168c5761168c612410565b602002602001015160400151600260008484815181106116ae576116ae612410565b60200260200101516000015163ffffffff1663ffffffff16815260200190815260200160002060008484815181106116e8576116e8612410565b60200260200101516020015161ffff1661ffff16815260200190815260200160002090816117169190612476565b5060010161164b565b507fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b6748160405161174f9190612536565b60405180910390a150565b600281015161ffff81166003146106ac5781604051639a6d49cd60e01b81526004016105d49190611c5e565b6117cf6040518060e00160405280600063ffffffff1681526020016000801916815260200160008152602001600081526020016060815260200160608152602001606081525090565b60008760c0886117df86836125c1565b926117ec939291906122d8565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506040805160e08101825263ffffffff9a909a168a526001600160a01b039b909b166020808b0191909152898c018b905260608a019a909a52608089019490945250508751808801895282815260a087015250865195860190965250505091815260c082015292915050565b804710156118ca576040517fcf479181000000000000000000000000000000000000000000000000000000008152476004820152602481018290526044016105d4565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611917576040519150601f19603f3d011682016040523d82523d6000602084013e61191c565b606091505b5050905080611643576040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080602060008451602086016000885af18061197a576040513d6000823e3d81fd5b50506000513d9150811561199257806001141561199f565b6001600160a01b0384163b155b156114d9576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016105d4565b6000606082840312156119f357600080fd5b50919050565b60008083601f840112611a0b57600080fd5b50813567ffffffffffffffff811115611a2357600080fd5b602083019150836020828501011115611a3b57600080fd5b9250929050565b80356001600160a01b0381168114611a5957600080fd5b919050565b600080600080600080600060e0888a031215611a7957600080fd5b611a8389896119e1565b965060608801359550608088013567ffffffffffffffff80821115611aa757600080fd5b611ab38b838c016119f9565b9097509550859150611ac760a08b01611a42565b945060c08a0135915080821115611add57600080fd5b50611aea8a828b016119f9565b989b979a50959850939692959293505050565b60008060208385031215611b1057600080fd5b823567ffffffffffffffff811115611b2757600080fd5b611b33858286016119f9565b90969095509350505050565b63ffffffff81168114610dd157600080fd5b60008060408385031215611b6457600080fd5b8235611b6f81611b3f565b946020939093013593505050565b60008060408385031215611b9057600080fd5b823567ffffffffffffffff811115611ba757600080fd5b830160e08186031215611bb957600080fd5b9150611bc760208401611a42565b90509250929050565b803561ffff81168114611a5957600080fd5b60008060408385031215611bf557600080fd5b8235611c0081611b3f565b9150611bc760208401611bd0565b60005b83811015611c29578181015183820152602001611c11565b50506000910152565b60008151808452611c4a816020860160208601611c0e565b601f01601f19169290920160200192915050565b602081526000611c716020830184611c32565b9392505050565b60008060008060a08587031215611c8e57600080fd5b611c9886866119e1565b9350606085013567ffffffffffffffff811115611cb457600080fd5b611cc0878288016119f9565b9094509250611cd3905060808601611a42565b905092959194509250565b60008060408385031215611cf157600080fd5b611b6f83611a42565b60008060208385031215611d0d57600080fd5b823567ffffffffffffffff80821115611d2557600080fd5b818501915085601f830112611d3957600080fd5b813581811115611d4857600080fd5b8660208260051b8501011115611d5d57600080fd5b60209290920196919550909350505050565b600060208284031215611d8157600080fd5b8135611c7181611b3f565b60008060008060608587031215611da257600080fd5b8435611dad81611b3f565b9350611dbb60208601611bd0565b9250604085013567ffffffffffffffff811115611dd757600080fd5b611de3878288016119f9565b95989497509550505050565b600060208284031215611e0157600080fd5b611c7182611a42565b60008060408385031215611e1d57600080fd5b82359150611bc760208401611a42565b600060608284031215611e3f57600080fd5b611c7183836119e1565b60008060008060808587031215611e5f57600080fd5b84359350602085013592506040850135611e7881611b3f565b9396929550929360600135925050565b6000808335601e19843603018112611e9f57600080fd5b830160208101925035905067ffffffffffffffff811115611ebf57600080fd5b803603821315611a3b57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008135611f0481611b3f565b63ffffffff8116845250602082013560208401526040820135604084015260608201356060840152611f396080830183611e88565b60e06080860152611f4e60e086018284611ece565b915050611f5e60a0840184611e88565b85830360a0870152611f71838284611ece565b92505050611f8260c0840184611e88565b85830360c0870152611f95838284611ece565b9695505050505050565b60006001600160a01b03808716835280861660208401525060a06040830152611fcb60a0830185611ef7565b835160608401526020840151608084015290505b95945050505050565b600060208284031215611ffa57600080fd5b81518015158114611c7157600080fd5b60808152600061201d6080830186611ef7565b9050612036602083018580518252602090810151910152565b6001600160a01b0383166060830152949350505050565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff811182821017156120865761208661204d565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156120b5576120b561204d565b604052919050565b6000604082840312156120cf57600080fd5b6040516040810181811067ffffffffffffffff821117156120f2576120f261204d565b604052825181526020928301519281019290925250919050565b60008082840360c081121561212057600080fd5b608081121561212e57600080fd5b50612137612063565b83518152602084015167ffffffffffffffff8116811461215657600080fd5b602082015261216885604086016120bd565b60408201529150611bc784608085016120bd565b600181811c9082168061219057607f821691505b6020821081036119f357634e487b7160e01b600052602260045260246000fd5b600067ffffffffffffffff808411156121cb576121cb61204d565b8360051b60206121dc81830161208c565b8681529185019181810190368411156121f457600080fd5b865b848110156122cc5780358681111561220e5760008081fd5b880160603682900312156122225760008081fd5b61222a612063565b813561223581611b3f565b8152612242828701611bd0565b868201526040808301358981111561225a5760008081fd5b9290920191601f36818501126122705760008081fd5b83358a8111156122825761228261204d565b612293818301601f19168a0161208c565b915080825236898287010111156122aa5760008081fd5b808986018a8401376000908201890152908201528452509183019183016121f6565b50979650505050505050565b600080858511156122e857600080fd5b838611156122f557600080fd5b5050820193919092039150565b60008451612314818460208901611c0e565b8201838582376000930192835250909392505050565b6020815260006109d4602083018486611ece565b60006020828403121561235057600080fd5b8151611c7181611b3f565b63ffffffff81511682526020810151602083015260408101516040830152606081015160608301526000608082015160e0608085015261239e60e0850182611c32565b905060a083015184820360a08601526123b78282611c32565b91505060c083015184820360c0860152611fdf8282611c32565b60808152600061201d608083018661235b565b60006001600160a01b03808716835280861660208401525060a06040830152611fcb60a083018561235b565b634e487b7160e01b600052603260045260246000fd5b601f821115611643576000816000526020600020601f850160051c8101602086101561244f5750805b601f850160051c820191505b8181101561246e5782815560010161245b565b505050505050565b815167ffffffffffffffff8111156124905761249061204d565b6124a48161249e845461217c565b84612426565b602080601f8311600181146124d957600084156124c15750858301515b600019600386901b1c1916600185901b17855561246e565b600085815260208120601f198616915b82811015612508578886015182559484019460019091019084016124e9565b50858210156125265787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b838110156125b357888303603f190185528151805163ffffffff1684528781015161ffff1688850152860151606087850181905261259f81860183611c32565b96890196945050509086019060010161255f565b509098975050505050505050565b808201808211156109c157634e487b7160e01b600052601160045260246000fdfea2646970667358221220d2228ae4412fa9e193d616c7a6a4ca580659edfb89bf70394fe60b2a4d5a3beb64736f6c6343000819003300000000000000000000000090b831fa3bebf58e9744a14d638e25b4ee06f9bc0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c3000000000000000000000000de91eb8206c228f4208c34510cf0c61c9302a4340000000000000000000000001a44076050125825900e736c501f859c50fe728c00000000000000000000000066ccec236bbce5f1bbd1b2fc0a4014e57a55ad02

Deployed Bytecode

0x60806040526004361061019a5760003560e01c80637d25a05e116100e1578063b98bd0701161008a578063ca5eb5e111610064578063ca5eb5e1146104f4578063df1c272914610514578063f2fde38b14610534578063ff7bd03d1461055457600080fd5b8063b98bd07014610479578063bb0b6a5314610499578063bc70b354146104d457600080fd5b80638da5cb5b116100bb5780638da5cb5b14610407578063a00e07c414610425578063b72952ee1461045957600080fd5b80637d25a05e1461039957806382413eac146103d25780638456cb59146103f257600080fd5b80635502c73b116101435780635d19b0d11161011d5780635d19b0d11461031c5780635e280f1114610350578063715018a61461038457600080fd5b80635502c73b1461027f5780635535d461146102cb5780635c975abb146102f857600080fd5b80633400288b116101745780633400288b146102375780633b1a50b5146102575780633f4ba83a1461026a57600080fd5b806313137d65146101a657806317442b70146101bb57806324fd4c05146101e257600080fd5b366101a157005b600080fd5b6101b96101b4366004611a5e565b610574565b005b3480156101c757600080fd5b50604080516000815260026020820152015b60405180910390f35b3480156101ee57600080fd5b506102026101fd366004611afd565b610666565b604080516001600160a01b039095168552602085019390935263ffffffff9091169183019190915260608201526080016101d9565b34801561024357600080fd5b506101b9610252366004611b51565b61069a565b6101b9610265366004611b7d565b6106b0565b34801561027657600080fd5b506101b96108f5565b34801561028b57600080fd5b506102b37f0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c381565b6040516001600160a01b0390911681526020016101d9565b3480156102d757600080fd5b506102eb6102e6366004611be2565b610907565b6040516101d99190611c5e565b34801561030457600080fd5b5060035460ff165b60405190151581526020016101d9565b34801561032857600080fd5b506102b37f000000000000000000000000de91eb8206c228f4208c34510cf0c61c9302a43481565b34801561035c57600080fd5b506102b37f0000000000000000000000001a44076050125825900e736c501f859c50fe728c81565b34801561039057600080fd5b506101b96109ac565b3480156103a557600080fd5b506103b96103b4366004611b51565b6109be565b60405167ffffffffffffffff90911681526020016101d9565b3480156103de57600080fd5b5061030c6103ed366004611c78565b6109c7565b3480156103fe57600080fd5b506101b96109dc565b34801561041357600080fd5b506000546001600160a01b03166102b3565b34801561043157600080fd5b506102b37f00000000000000000000000090b831fa3bebf58e9744a14d638e25b4ee06f9bc81565b34801561046557600080fd5b506101b9610474366004611cde565b6109ec565b34801561048557600080fd5b506101b9610494366004611cfa565b610a50565b3480156104a557600080fd5b506104c66104b4366004611d6f565b60016020526000908152604090205481565b6040519081526020016101d9565b3480156104e057600080fd5b506102eb6104ef366004611d8c565b610a6a565b34801561050057600080fd5b506101b961050f366004611def565b610c12565b34801561052057600080fd5b506101b961052f366004611e0a565b610cb1565b34801561054057600080fd5b506101b961054f366004611def565b610d7d565b34801561056057600080fd5b5061030c61056f366004611e2d565b610dd4565b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031633146105dd576040517f91ac5e4f0000000000000000000000000000000000000000000000000000000081523360048201526024015b60405180910390fd5b602087018035906105f7906105f2908a611d6f565b610e0a565b1461064e576106096020880188611d6f565b6040517fc26bebcc00000000000000000000000000000000000000000000000000000000815263ffffffff9091166004820152602088013560248201526044016105d4565b61065d87878787878787610e5f565b50505050505050565b60008080808080808061067b898b018b611e49565b935093509350935061068a8490565b9a92995090975095509350505050565b6106a2611342565b6106ac8282611388565b5050565b6106b86113dd565b6106c061141a565b6001600160a01b038116610700576040517f9fabe1c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fa99346fe26352079fd1ef7b9d9fe67cfa784267a782cf56b6437d7fbc1aac5333360208401356040805180820182523481526000602082015290516107499392918791611f9f565b60405180910390a161078a6001600160a01b037f00000000000000000000000090b831fa3bebf58e9744a14d638e25b4ee06f9bc163330604086013561145d565b6040805163095ea7b360e01b81526001600160a01b037f000000000000000000000000de91eb8206c228f4208c34510cf0c61c9302a434811660048301529184013560248201527f0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c39091169063095ea7b3906044016020604051808303816000875af115801561081e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108429190611fe8565b506040805180820182523480825260006020830152915163c7c7f5b360e01b81526001600160a01b037f000000000000000000000000de91eb8206c228f4208c34510cf0c61c9302a434169263c7c7f5b39290916108a6918791879060040161200a565b60c06040518083038185885af11580156108c4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108e9919061210c565b50506106ac6001600455565b6108fd611342565b6109056114df565b565b60026020908152600092835260408084209091529082529020805461092b9061217c565b80601f01602080910402602001604051908101604052809291908181526020018280546109579061217c565b80156109a45780601f10610979576101008083540402835291602001916109a4565b820191906000526020600020905b81548152906001019060200180831161098757829003601f168201915b505050505081565b6109b4611342565b6109056000611531565b60005b92915050565b6001600160a01b03811630145b949350505050565b6109e4611342565b610905611599565b6109f4611342565b6109fc6115d6565b60405181815233906001600160a01b038416907f050bfcf56def683ba46089b74b240740900eb3e22309f1a9a50cdad12e7a43b29060200160405180910390a36106ac6001600160a01b0383163383611612565b610a58611342565b6106ac610a6582846121b0565b611648565b63ffffffff8416600090815260026020908152604080832061ffff87168452909152812080546060929190610a9e9061217c565b80601f0160208091040260200160405190810160405280929190818152602001828054610aca9061217c565b8015610b175780601f10610aec57610100808354040283529160200191610b17565b820191906000526020600020905b815481529060010190602001808311610afa57829003601f168201915b505050505090508051600003610b675783838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294506109d49350505050565b6000839003610b775790506109d4565b60028310610bf557610bbe84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061175a92505050565b80610bcc84600281886122d8565b604051602001610bde93929190612302565b6040516020818303038152906040529150506109d4565b8383604051639a6d49cd60e01b81526004016105d492919061232a565b610c1a611342565b6040517fca5eb5e10000000000000000000000000000000000000000000000000000000081526001600160a01b0382811660048301527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c169063ca5eb5e190602401600060405180830381600087803b158015610c9657600080fd5b505af1158015610caa573d6000803e3d6000fd5b5050505050565b610cb96113dd565b610cc161141a565b604080513381526001600160a01b03831660208201529081018390527fbb5252b2894a0074f70a195e56c61da7ea6cfb3c340ee8e20021d646ee59096f9060600160405180910390a1610d3f6001600160a01b037f00000000000000000000000090b831fa3bebf58e9744a14d638e25b4ee06f9bc1633308561145d565b610d736001600160a01b037f0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c3168284611612565b6106ac6001600455565b610d85611342565b6001600160a01b038116610dc8576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024016105d4565b610dd181611531565b50565b6000602082018035906001908390610dec9086611d6f565b63ffffffff1681526020810191909152604001600020541492915050565b63ffffffff8116600090815260016020526040812054806109c1576040517ff6ff4fb700000000000000000000000000000000000000000000000000000000815263ffffffff841660048201526024016105d4565b600080600080610e6f8989610666565b929650909450925090507f1f1b0dd6b79d5ded2d2940f8d747107122f25860b53f46cf78dca361897f76268a610ea860208e018e611d6f565b60208e01356040805193845263ffffffff92831660208501526001600160a01b039182169084015290851660608301528616608082015260a0810185905260c0810185905260e00160405180910390a1801580610f9157507f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031663416ecebf6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f82919061233e565b63ffffffff168263ffffffff16145b1561101e577fbb5252b2894a0074f70a195e56c61da7ea6cfb3c340ee8e20021d646ee59096f60208c0135604080516001600160a01b0392831681529187166020830152810185905260600160405180910390a16110196001600160a01b037f0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c3168585611612565b611335565b600061102e8a8a87878787611786565b60405163095ea7b360e01b81526001600160a01b037f000000000000000000000000de91eb8206c228f4208c34510cf0c61c9302a43481166004830152602482018790529192507f0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c39091169063095ea7b3906044016020604051808303816000875af11580156110c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e69190611fe8565b506040805180820182523480825260006020830152915163c7c7f5b360e01b81526001600160a01b037f000000000000000000000000de91eb8206c228f4208c34510cf0c61c9302a434169263c7c7f5b392909161114a9186918b906004016123d1565b60c06040518083038185885af193505050508015611185575060408051601f3d908101601f191682019092526111829181019061210c565b60015b6112d8577fbb5252b2894a0074f70a195e56c61da7ea6cfb3c340ee8e20021d646ee59096f60208d0135604080516001600160a01b0392831681529188166020830152810186905260600160405180910390a160405163095ea7b360e01b81526001600160a01b037f000000000000000000000000de91eb8206c228f4208c34510cf0c61c9302a43481166004830152600060248301527f0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c3169063095ea7b3906044016020604051808303816000875af1158015611267573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128b9190611fe8565b506112c06001600160a01b037f0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c3168686611612565b6112d36001600160a01b03861634611887565b611333565b50507fa99346fe26352079fd1ef7b9d9fe67cfa784267a782cf56b6437d7fbc1aac5336113068d6020013590565b60408051808201825234815260006020820152905161132a929189918691906123e4565b60405180910390a15b505b5050505050505050505050565b6000546001600160a01b03163314610905576040517f118cdaa70000000000000000000000000000000000000000000000000000000081523360048201526024016105d4565b63ffffffff8216600081815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b60035460ff1615610905576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260045403611456576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600455565b6040516001600160a01b0384811660248301528381166044830152606482018390526114d99186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611957565b50505050565b6114e76115d6565b6003805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6115a16113dd565b6003805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586115143390565b60035460ff16610905576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516001600160a01b0383811660248301526044820183905261164391859182169063a9059cbb90606401611492565b505050565b60005b815181101561171f5761167a82828151811061166957611669612410565b60200260200101516040015161175a565b81818151811061168c5761168c612410565b602002602001015160400151600260008484815181106116ae576116ae612410565b60200260200101516000015163ffffffff1663ffffffff16815260200190815260200160002060008484815181106116e8576116e8612410565b60200260200101516020015161ffff1661ffff16815260200190815260200160002090816117169190612476565b5060010161164b565b507fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b6748160405161174f9190612536565b60405180910390a150565b600281015161ffff81166003146106ac5781604051639a6d49cd60e01b81526004016105d49190611c5e565b6117cf6040518060e00160405280600063ffffffff1681526020016000801916815260200160008152602001600081526020016060815260200160608152602001606081525090565b60008760c0886117df86836125c1565b926117ec939291906122d8565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506040805160e08101825263ffffffff9a909a168a526001600160a01b039b909b166020808b0191909152898c018b905260608a019a909a52608089019490945250508751808801895282815260a087015250865195860190965250505091815260c082015292915050565b804710156118ca576040517fcf479181000000000000000000000000000000000000000000000000000000008152476004820152602481018290526044016105d4565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611917576040519150601f19603f3d011682016040523d82523d6000602084013e61191c565b606091505b5050905080611643576040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080602060008451602086016000885af18061197a576040513d6000823e3d81fd5b50506000513d9150811561199257806001141561199f565b6001600160a01b0384163b155b156114d9576040517f5274afe70000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201526024016105d4565b6000606082840312156119f357600080fd5b50919050565b60008083601f840112611a0b57600080fd5b50813567ffffffffffffffff811115611a2357600080fd5b602083019150836020828501011115611a3b57600080fd5b9250929050565b80356001600160a01b0381168114611a5957600080fd5b919050565b600080600080600080600060e0888a031215611a7957600080fd5b611a8389896119e1565b965060608801359550608088013567ffffffffffffffff80821115611aa757600080fd5b611ab38b838c016119f9565b9097509550859150611ac760a08b01611a42565b945060c08a0135915080821115611add57600080fd5b50611aea8a828b016119f9565b989b979a50959850939692959293505050565b60008060208385031215611b1057600080fd5b823567ffffffffffffffff811115611b2757600080fd5b611b33858286016119f9565b90969095509350505050565b63ffffffff81168114610dd157600080fd5b60008060408385031215611b6457600080fd5b8235611b6f81611b3f565b946020939093013593505050565b60008060408385031215611b9057600080fd5b823567ffffffffffffffff811115611ba757600080fd5b830160e08186031215611bb957600080fd5b9150611bc760208401611a42565b90509250929050565b803561ffff81168114611a5957600080fd5b60008060408385031215611bf557600080fd5b8235611c0081611b3f565b9150611bc760208401611bd0565b60005b83811015611c29578181015183820152602001611c11565b50506000910152565b60008151808452611c4a816020860160208601611c0e565b601f01601f19169290920160200192915050565b602081526000611c716020830184611c32565b9392505050565b60008060008060a08587031215611c8e57600080fd5b611c9886866119e1565b9350606085013567ffffffffffffffff811115611cb457600080fd5b611cc0878288016119f9565b9094509250611cd3905060808601611a42565b905092959194509250565b60008060408385031215611cf157600080fd5b611b6f83611a42565b60008060208385031215611d0d57600080fd5b823567ffffffffffffffff80821115611d2557600080fd5b818501915085601f830112611d3957600080fd5b813581811115611d4857600080fd5b8660208260051b8501011115611d5d57600080fd5b60209290920196919550909350505050565b600060208284031215611d8157600080fd5b8135611c7181611b3f565b60008060008060608587031215611da257600080fd5b8435611dad81611b3f565b9350611dbb60208601611bd0565b9250604085013567ffffffffffffffff811115611dd757600080fd5b611de3878288016119f9565b95989497509550505050565b600060208284031215611e0157600080fd5b611c7182611a42565b60008060408385031215611e1d57600080fd5b82359150611bc760208401611a42565b600060608284031215611e3f57600080fd5b611c7183836119e1565b60008060008060808587031215611e5f57600080fd5b84359350602085013592506040850135611e7881611b3f565b9396929550929360600135925050565b6000808335601e19843603018112611e9f57600080fd5b830160208101925035905067ffffffffffffffff811115611ebf57600080fd5b803603821315611a3b57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008135611f0481611b3f565b63ffffffff8116845250602082013560208401526040820135604084015260608201356060840152611f396080830183611e88565b60e06080860152611f4e60e086018284611ece565b915050611f5e60a0840184611e88565b85830360a0870152611f71838284611ece565b92505050611f8260c0840184611e88565b85830360c0870152611f95838284611ece565b9695505050505050565b60006001600160a01b03808716835280861660208401525060a06040830152611fcb60a0830185611ef7565b835160608401526020840151608084015290505b95945050505050565b600060208284031215611ffa57600080fd5b81518015158114611c7157600080fd5b60808152600061201d6080830186611ef7565b9050612036602083018580518252602090810151910152565b6001600160a01b0383166060830152949350505050565b634e487b7160e01b600052604160045260246000fd5b6040516060810167ffffffffffffffff811182821017156120865761208661204d565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156120b5576120b561204d565b604052919050565b6000604082840312156120cf57600080fd5b6040516040810181811067ffffffffffffffff821117156120f2576120f261204d565b604052825181526020928301519281019290925250919050565b60008082840360c081121561212057600080fd5b608081121561212e57600080fd5b50612137612063565b83518152602084015167ffffffffffffffff8116811461215657600080fd5b602082015261216885604086016120bd565b60408201529150611bc784608085016120bd565b600181811c9082168061219057607f821691505b6020821081036119f357634e487b7160e01b600052602260045260246000fd5b600067ffffffffffffffff808411156121cb576121cb61204d565b8360051b60206121dc81830161208c565b8681529185019181810190368411156121f457600080fd5b865b848110156122cc5780358681111561220e5760008081fd5b880160603682900312156122225760008081fd5b61222a612063565b813561223581611b3f565b8152612242828701611bd0565b868201526040808301358981111561225a5760008081fd5b9290920191601f36818501126122705760008081fd5b83358a8111156122825761228261204d565b612293818301601f19168a0161208c565b915080825236898287010111156122aa5760008081fd5b808986018a8401376000908201890152908201528452509183019183016121f6565b50979650505050505050565b600080858511156122e857600080fd5b838611156122f557600080fd5b5050820193919092039150565b60008451612314818460208901611c0e565b8201838582376000930192835250909392505050565b6020815260006109d4602083018486611ece565b60006020828403121561235057600080fd5b8151611c7181611b3f565b63ffffffff81511682526020810151602083015260408101516040830152606081015160608301526000608082015160e0608085015261239e60e0850182611c32565b905060a083015184820360a08601526123b78282611c32565b91505060c083015184820360c0860152611fdf8282611c32565b60808152600061201d608083018661235b565b60006001600160a01b03808716835280861660208401525060a06040830152611fcb60a083018561235b565b634e487b7160e01b600052603260045260246000fd5b601f821115611643576000816000526020600020601f850160051c8101602086101561244f5750805b601f850160051c820191505b8181101561246e5782815560010161245b565b505050505050565b815167ffffffffffffffff8111156124905761249061204d565b6124a48161249e845461217c565b84612426565b602080601f8311600181146124d957600084156124c15750858301515b600019600386901b1c1916600185901b17855561246e565b600085815260208120601f198616915b82811015612508578886015182559484019460019091019084016124e9565b50858210156125265787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b838110156125b357888303603f190185528151805163ffffffff1684528781015161ffff1688850152860151606087850181905261259f81860183611c32565b96890196945050509086019060010161255f565b509098975050505050505050565b808201808211156109c157634e487b7160e01b600052601160045260246000fdfea2646970667358221220d2228ae4412fa9e193d616c7a6a4ca580659edfb89bf70394fe60b2a4d5a3beb64736f6c63430008190033

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

00000000000000000000000090b831fa3bebf58e9744a14d638e25b4ee06f9bc0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c3000000000000000000000000de91eb8206c228f4208c34510cf0c61c9302a4340000000000000000000000001a44076050125825900e736c501f859c50fe728c00000000000000000000000066ccec236bbce5f1bbd1b2fc0a4014e57a55ad02

-----Decoded View---------------
Arg [0] : _mimo (address): 0x90B831fa3Bebf58E9744A14D638E25B4eE06f9Bc
Arg [1] : _prl (address): 0x6c0aeceeDc55c9d55d8B99216a670D85330941c3
Arg [2] : _lockBox (address): 0xdE91eb8206c228f4208c34510cf0C61C9302a434
Arg [3] : _endpoint (address): 0x1a44076050125825900e736c501f859c50fE728c
Arg [4] : _owner (address): 0x66CcEC236bbcE5f1bBd1b2fC0a4014e57A55ad02

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 00000000000000000000000090b831fa3bebf58e9744a14d638e25b4ee06f9bc
Arg [1] : 0000000000000000000000006c0aeceedc55c9d55d8b99216a670d85330941c3
Arg [2] : 000000000000000000000000de91eb8206c228f4208c34510cf0c61c9302a434
Arg [3] : 0000000000000000000000001a44076050125825900e736c501f859c50fe728c
Arg [4] : 00000000000000000000000066ccec236bbce5f1bbd1b2fc0a4014e57a55ad02


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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