creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "@openzeppelin/contracts/access/Ownable2Step.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n    address private _pendingOwner;\n\n    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Returns the address of the pending owner.\n     */\n    function pendingOwner() public view virtual returns (address) {\n        return _pendingOwner;\n    }\n\n    /**\n     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual override onlyOwner {\n        _pendingOwner = newOwner;\n        emit OwnershipTransferStarted(owner(), newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual override {\n        delete _pendingOwner;\n        super._transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev The new owner accepts the ownership transfer.\n     */\n    function acceptOwnership() public virtual {\n        address sender = _msgSender();\n        require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n        _transferOwnership(sender);\n    }\n}\n"
      },
      "@openzeppelin/contracts/security/Pausable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n    /**\n     * @dev Emitted when the pause is triggered by `account`.\n     */\n    event Paused(address account);\n\n    /**\n     * @dev Emitted when the pause is lifted by `account`.\n     */\n    event Unpaused(address account);\n\n    bool private _paused;\n\n    /**\n     * @dev Initializes the contract in unpaused state.\n     */\n    constructor() {\n        _paused = false;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    modifier whenNotPaused() {\n        _requireNotPaused();\n        _;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is paused.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    modifier whenPaused() {\n        _requirePaused();\n        _;\n    }\n\n    /**\n     * @dev Returns true if the contract is paused, and false otherwise.\n     */\n    function paused() public view virtual returns (bool) {\n        return _paused;\n    }\n\n    /**\n     * @dev Throws if the contract is paused.\n     */\n    function _requireNotPaused() internal view virtual {\n        require(!paused(), \"Pausable: paused\");\n    }\n\n    /**\n     * @dev Throws if the contract is not paused.\n     */\n    function _requirePaused() internal view virtual {\n        require(paused(), \"Pausable: not paused\");\n    }\n\n    /**\n     * @dev Triggers stopped state.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    function _pause() internal virtual whenNotPaused {\n        _paused = true;\n        emit Paused(_msgSender());\n    }\n\n    /**\n     * @dev Returns to normal state.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    function _unpause() internal virtual whenPaused {\n        _paused = false;\n        emit Unpaused(_msgSender());\n    }\n}\n"
      },
      "@openzeppelin/contracts/security/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == _ENTERED;\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
      },
      "contracts/bases/ArcBase.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.19;\n\nimport {Ownable2Step} from \"@openzeppelin/contracts/access/Ownable2Step.sol\";\nimport {Pausable} from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * Provides set of properties, functions, and modifiers to help with \n * security and access control of extending contracts\n */\ncontract ArcBase is Ownable2Step, Pausable, ReentrancyGuard\n{\n    function pause() public onlyOwner\n    {\n        _pause();\n    }\n    \n    function unpause() public onlyOwner\n    {\n        _unpause();\n    }\n\n    function withdrawNative(address beneficiary) public onlyOwner {\n        uint256 amount = address(this).balance;\n        (bool sent, ) = beneficiary.call{value: amount}(\"\");\n        require(sent, 'Unable to withdraw');\n    }\n\n    function withdrawToken(address beneficiary, address token) public onlyOwner {\n        uint256 amount = IERC20(token).balanceOf(address(this));\n        IERC20(token).transfer(beneficiary, amount);\n    }\n}\n"
      },
      "contracts/bases/ArcBaseWithRainbowRoad.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.19;\n\nimport {ArcBase} from \"./ArcBase.sol\";\nimport {IRainbowRoad} from \"../interfaces/IRainbowRoad.sol\";\n\n/**\n * Extends the ArcBase contract to provide\n * for interactions with the Rainbow Road\n */\ncontract ArcBaseWithRainbowRoad is ArcBase\n{\n    IRainbowRoad public rainbowRoad;\n    \n    constructor(address _rainbowRoad)\n    {\n        require(_rainbowRoad != address(0), 'Rainbow Road cannot be zero address');\n        rainbowRoad = IRainbowRoad(_rainbowRoad);\n    }\n    \n    function setRainbowRoad(address _rainbowRoad) external onlyOwner\n    {\n        require(_rainbowRoad != address(0), 'Rainbow Road cannot be zero address');\n        rainbowRoad = IRainbowRoad(_rainbowRoad);\n    }\n    \n    /// @dev Only calls from the Rainbow Road are accepted.\n    modifier onlyRainbowRoad() \n    {\n        require(msg.sender == address(rainbowRoad), 'Must be called by Rainbow Road');\n        _;\n    }\n}\n"
      },
      "contracts/interfaces/IArc.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.19;\n\ninterface IArc {\n    function approve(address _spender, uint _value) external returns (bool);\n    function burn(uint amount) external;\n    function mint(address account, uint amount) external;\n    function transfer(address, uint) external returns (bool);\n    function transferFrom(address _from, address _to, uint _value) external;\n}"
      },
      "contracts/interfaces/ILayerZeroEndpoint.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\nimport \"./ILayerZeroUserApplicationConfig.sol\";\n\ninterface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {\n    // @notice send a LayerZero message to the specified address at a LayerZero endpoint.\n    // @param _dstChainId - the destination chain identifier\n    // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains\n    // @param _payload - a custom bytes payload to send to the destination contract\n    // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address\n    // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction\n    // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination\n    function send(\n        uint16 _dstChainId,\n        bytes calldata _destination,\n        bytes calldata _payload,\n        address payable _refundAddress,\n        address _zroPaymentAddress,\n        bytes calldata _adapterParams\n    ) external payable;\n\n    // @notice used by the messaging library to publish verified payload\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source contract (as bytes) at the source chain\n    // @param _dstAddress - the address on destination chain\n    // @param _nonce - the unbound message ordering nonce\n    // @param _gasLimit - the gas limit for external contract execution\n    // @param _payload - verified payload to send to the destination contract\n    function receivePayload(\n        uint16 _srcChainId,\n        bytes calldata _srcAddress,\n        address _dstAddress,\n        uint64 _nonce,\n        uint _gasLimit,\n        bytes calldata _payload\n    ) external;\n\n    // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);\n\n    // @notice get the outboundNonce from this source chain which, consequently, is always an EVM\n    // @param _srcAddress - the source chain contract address\n    function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);\n\n    // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery\n    // @param _dstChainId - the destination chain identifier\n    // @param _userApplication - the user app address on this EVM chain\n    // @param _payload - the custom message to send over LayerZero\n    // @param _payInZRO - if false, user app pays the protocol fee in native token\n    // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain\n    function estimateFees(\n        uint16 _dstChainId,\n        address _userApplication,\n        bytes calldata _payload,\n        bool _payInZRO,\n        bytes calldata _adapterParam\n    ) external view returns (uint nativeFee, uint zroFee);\n\n    // @notice get this Endpoint's immutable source identifier\n    function getChainId() external view returns (uint16);\n\n    // @notice the interface to retry failed message on this Endpoint destination\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    // @param _payload - the payload to be retried\n    function retryPayload(\n        uint16 _srcChainId,\n        bytes calldata _srcAddress,\n        bytes calldata _payload\n    ) external;\n\n    // @notice query if any STORED payload (message blocking) at the endpoint.\n    // @param _srcChainId - the source chain identifier\n    // @param _srcAddress - the source chain contract address\n    function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);\n\n    // @notice query if the _libraryAddress is valid for sending msgs.\n    // @param _userApplication - the user app address on this EVM chain\n    function getSendLibraryAddress(address _userApplication) external view returns (address);\n\n    // @notice query if the _libraryAddress is valid for receiving msgs.\n    // @param _userApplication - the user app address on this EVM chain\n    function getReceiveLibraryAddress(address _userApplication) external view returns (address);\n\n    // @notice query if the non-reentrancy guard for send() is on\n    // @return true if the guard is on. false otherwise\n    function isSendingPayload() external view returns (bool);\n\n    // @notice query if the non-reentrancy guard for receive() is on\n    // @return true if the guard is on. false otherwise\n    function isReceivingPayload() external view returns (bool);\n\n    // @notice get the configuration of the LayerZero messaging library of the specified version\n    // @param _version - messaging library version\n    // @param _chainId - the chainId for the pending config change\n    // @param _userApplication - the contract address of the user application\n    // @param _configType - type of configuration. every messaging library has its own convention.\n    function getConfig(\n        uint16 _version,\n        uint16 _chainId,\n        address _userApplication,\n        uint _configType\n    ) external view returns (bytes memory);\n\n    // @notice get the send() LayerZero messaging library version\n    // @param _userApplication - the contract address of the user application\n    function getSendVersion(address _userApplication) external view returns (uint16);\n\n    // @notice get the lzReceive() LayerZero messaging library version\n    // @param _userApplication - the contract address of the user application\n    function getReceiveVersion(address _userApplication) external view returns (uint16);\n}\n"
      },
      "contracts/interfaces/ILayerZeroReceiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroReceiver {\n    // @notice LayerZero endpoint will invoke this function to deliver the message on the destination\n    // @param _srcChainId - the source endpoint identifier\n    // @param _srcAddress - the source sending contract address from the source chain\n    // @param _nonce - the ordered message nonce\n    // @param _payload - the signed payload is the UA bytes has encoded to be sent\n    function lzReceive(\n        uint16 _srcChainId,\n        bytes calldata _srcAddress,\n        uint64 _nonce,\n        bytes calldata _payload\n    ) external;\n}\n"
      },
      "contracts/interfaces/ILayerZeroUserApplicationConfig.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.5.0;\n\ninterface ILayerZeroUserApplicationConfig {\n    // @notice set the configuration of the LayerZero messaging library of the specified version\n    // @param _version - messaging library version\n    // @param _chainId - the chainId for the pending config change\n    // @param _configType - type of configuration. every messaging library has its own convention.\n    // @param _config - configuration in the bytes. can encode arbitrary content.\n    function setConfig(\n        uint16 _version,\n        uint16 _chainId,\n        uint _configType,\n        bytes calldata _config\n    ) external;\n\n    // @notice set the send() LayerZero messaging library version to _version\n    // @param _version - new messaging library version\n    function setSendVersion(uint16 _version) external;\n\n    // @notice set the lzReceive() LayerZero messaging library version to _version\n    // @param _version - new messaging library version\n    function setReceiveVersion(uint16 _version) external;\n\n    // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload\n    // @param _srcChainId - the chainId of the source chain\n    // @param _srcAddress - the contract address of the source contract at the source chain\n    function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;\n}\n"
      },
      "contracts/interfaces/IRainbowRoad.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.19;\n\nimport {IArc} from \"./IArc.sol\";\n\ninterface IRainbowRoad {\n    \n    function acceptTeam() external;\n    function actionHandlers(string calldata action) external view returns (address);\n    function arc() external view returns (IArc);\n    function blockToken(address tokenAddress) external;\n    function disableFeeManager(address feeManager) external;\n    function disableOpenTokenWhitelisting() external;\n    function disableReceiver(address receiver) external;\n    function disableSender(address sender) external;\n    function disableSendFeeBurn() external;\n    function disableSendFeeCharge() external;\n    function disableWhitelistingFeeBurn() external;\n    function disableWhitelistingFeeCharge() external;\n    function enableFeeManager(address feeManager) external;\n    function enableOpenTokenWhitelisting() external;\n    function enableReceiver(address receiver) external;\n    function enableSendFeeBurn() external;\n    function enableSender(address sender) external;\n    function enableSendFeeCharge() external;\n    function enableWhitelistingFeeBurn() external;\n    function enableWhitelistingFeeCharge() external;\n    function sendFee() external view returns (uint256);\n    function whitelistingFee() external view returns (uint256);\n    function chargeSendFee() external view returns (bool);\n    function chargeWhitelistingFee() external view returns (bool);\n    function burnSendFee() external view returns (bool);\n    function burnWhitelistingFee() external view returns (bool);\n    function openTokenWhitelisting() external view returns (bool);\n    function config(string calldata configName) external view returns (bytes memory);\n    function blockedTokens(address tokenAddress) external view returns (bool);\n    function feeManagers(address feeManager) external view returns (bool);\n    function receiveAction(string calldata action, address to, bytes calldata payload) external;\n    function sendAction(string calldata action, address from, bytes calldata payload) external;\n    function setActionHandler(string memory action, address handler) external;\n    function setArc(address _arc) external;\n    function setSendFee(uint256 _fee) external;\n    function setTeam(address _team) external;\n    function setTeamRate(uint256 _teamRate) external;\n    function setToken(string calldata tokenSymbol, address tokenAddress) external;\n    function setWhitelistingFee(uint256 _fee) external;\n    function team() external view returns (address);\n    function teamRate() external view returns (uint256);\n    function tokens(string calldata tokenSymbol) external view returns (address);\n    function MAX_TEAM_RATE() external view returns (uint256);\n    function receivers(address receiver) external view returns (bool);\n    function senders(address sender) external view returns (bool);\n    function unblockToken(address tokenAddress) external;\n    function whitelist(address tokenAddress) external;\n}"
      },
      "contracts/receivers/LayerZeroReceiver.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity 0.8.19;\n\nimport {ArcBaseWithRainbowRoad} from \"../bases/ArcBaseWithRainbowRoad.sol\";\nimport {ILayerZeroReceiver} from \"../interfaces/ILayerZeroReceiver.sol\";\nimport {ILayerZeroEndpoint} from \"../interfaces/ILayerZeroEndpoint.sol\";\nimport {IRainbowRoad} from \"../interfaces/IRainbowRoad.sol\";\n\n/**\n * Receives messages from LayerZero endpoint\n */\ncontract LayerZeroReceiver is ArcBaseWithRainbowRoad, ILayerZeroReceiver \n{\n    ILayerZeroEndpoint public endpoint;\n    mapping(uint16 => mapping(bytes => bool)) public messageSenders;\n    mapping(uint16 => bytes) public trustedRemoteLookup;\n    mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages;\n    \n    event MessageReceived(uint64 sourceChainSelector, bytes sourceAddress, uint64 nonce, string action, address actionRecipient);\n    event MessageFailed(uint16 sourceChainSelector, bytes sourceAddress, uint64 nonce, bytes payload);\n    event RetryMessageSuccess(uint16 sourceChainSelector, bytes sourceAddress, uint64 nonce, bytes32 payloadHash);\n    event RetryMessageAdded(uint16 sourceChainSelector, bytes sourceAddress, uint64 nonce, bytes payload);\n    event RetryMessageRemoved(uint16 sourceChainSelector, bytes sourceAddress, uint64 nonce, bytes payload);\n    \n    constructor(address _rainbowRoad, address _endpoint) ArcBaseWithRainbowRoad(_rainbowRoad)\n    {\n        require(_endpoint != address(0), 'LayerZero endpoint cannot be zero address');\n        endpoint = ILayerZeroEndpoint(_endpoint);\n    }\n    \n    function setEndpoint(address _endpoint) external onlyOwner\n    {\n        require(_endpoint != address(0), 'LayerZero endpoint cannot be zero address');\n        endpoint = ILayerZeroEndpoint(_endpoint);\n    }\n    \n    function enableMessageSender(uint16 sourceChainSelector, address remoteAddress, address localAddress) external onlyOwner\n    {\n        require(remoteAddress != address(0), 'Remote address cannot be zero address');\n        require(localAddress != address(0), 'Local address cannot be zero address');\n        bytes memory trustedRemote = abi.encodePacked(remoteAddress, localAddress);\n        \n        require(!messageSenders[sourceChainSelector][trustedRemote], 'Message sender for source chain is enabled');\n        messageSenders[sourceChainSelector][trustedRemote] = true;\n        trustedRemoteLookup[sourceChainSelector] = trustedRemote;\n    }\n    \n    function disableMessageSender(uint16 sourceChainSelector, address remoteAddress, address localAddress) external onlyOwner\n    {\n        require(remoteAddress != address(0), 'Remote address cannot be zero address');\n        require(localAddress != address(0), 'Local address cannot be zero address');\n        bytes memory trustedRemote = abi.encodePacked(remoteAddress, localAddress);\n        \n        require(messageSenders[sourceChainSelector][trustedRemote], 'Message sender for source chain is disabled');\n        messageSenders[sourceChainSelector][trustedRemote] = false;\n        delete trustedRemoteLookup[sourceChainSelector];\n    }\n  \n    function lzReceive(uint16 sourceChainSelector, bytes calldata sourceAddress, uint64 nonce, bytes calldata message) public virtual override whenNotPaused\n    {   \n        require(msg.sender == address(endpoint), \"Invalid endpoint caller\");\n\n        bytes memory trustedRemote = trustedRemoteLookup[sourceChainSelector];\n        \n        require(\n            sourceAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(sourceAddress) == keccak256(trustedRemote) && messageSenders[sourceChainSelector][sourceAddress],\n            \"Unsupported source chain/message sender\"\n        );\n\n        try this.handleReceive(sourceChainSelector, sourceAddress, nonce, message) {\n            \n        } catch {\n            failedMessages[sourceChainSelector][sourceAddress][nonce] = keccak256(message);\n            emit MessageFailed(sourceChainSelector, sourceAddress, nonce, message);\n        }\n    }\n    \n    function handleReceive(uint16 sourceChainSelector, bytes calldata sourceAddress, uint64 nonce, bytes calldata message) public \n    {\n        require(msg.sender == address(this), \"Invalid caller\");\n        \n        (string memory action, address actionRecipient, bytes memory payload) = abi.decode(message, (string, address, bytes));\n\n        rainbowRoad.receiveAction(action, actionRecipient, payload);\n        \n        emit MessageReceived(sourceChainSelector, sourceAddress, nonce, action, actionRecipient);\n    }\n    \n    function retryMessage(uint16 sourceChainSelector, bytes calldata sourceAddress, uint64 nonce, bytes calldata message) public virtual \n    {\n        // assert there is message to retry\n        bytes32 payloadHash = failedMessages[sourceChainSelector][sourceAddress][nonce];\n        require(payloadHash != bytes32(0), \"Message not found\");\n        require(keccak256(message) == payloadHash, \"Invalid payload\");\n        \n        // clear the stored message\n        delete failedMessages[sourceChainSelector][sourceAddress][nonce];\n        \n        // execute the message. revert if it fails again\n        this.handleReceive(sourceChainSelector, sourceAddress, nonce, message);\n        emit RetryMessageSuccess(sourceChainSelector, sourceAddress, nonce, payloadHash);\n    }\n    \n    function addRetryMessage(uint16 sourceChainSelector, bytes calldata sourceAddress, uint64 nonce, bytes calldata message) public virtual onlyOwner\n    {\n        failedMessages[sourceChainSelector][sourceAddress][nonce] = keccak256(message);\n        emit RetryMessageAdded(sourceChainSelector, sourceAddress, nonce, message);\n    }\n    \n    function removeRetryMessage(uint16 sourceChainSelector, bytes calldata sourceAddress, uint64 nonce, bytes calldata message) public virtual onlyOwner\n    {\n        delete failedMessages[sourceChainSelector][sourceAddress][nonce];\n        emit RetryMessageRemoved(sourceChainSelector, sourceAddress, nonce, message);\n    }\n\n    receive() external payable {}\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 10000
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}