{
  "address": "0x411180C512206C5217a742bF998A601b367C81Ba",
  "abi": [
    {
      "inputs": [],
      "name": "InvalidAmount",
      "type": "error"
    },
    {
      "inputs": [],
      "name": "InvalidConfig",
      "type": "error"
    },
    {
      "inputs": [],
      "name": "InvalidSourcePoolId",
      "type": "error"
    },
    {
      "inputs": [],
      "name": "ReentrancyError",
      "type": "error"
    },
    {
      "inputs": [],
      "name": "SenderNotStargateRouter",
      "type": "error"
    },
    {
      "inputs": [],
      "name": "StargateRouterAddressZero",
      "type": "error"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "uint16",
          "name": "chainId",
          "type": "uint16"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "token",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint16",
          "name": "poolId",
          "type": "uint16"
        }
      ],
      "name": "SGAddedPool",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "address",
          "name": "stargate",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint16",
          "name": "chainId",
          "type": "uint16"
        }
      ],
      "name": "SGInitialized",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "address",
          "name": "token",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        }
      ],
      "name": "SGReceivedOnDestination",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "string",
          "name": "bridgeUsed",
          "type": "string"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "fromToken",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "toToken",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "from",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "to",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint16",
          "name": "chainIdTo",
          "type": "uint16"
        }
      ],
      "name": "SGTransferStarted",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "address",
          "name": "newAddress",
          "type": "address"
        }
      ],
      "name": "SGUpdatedRouter",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "newSlippage",
          "type": "uint256"
        }
      ],
      "name": "SGUpdatedSlippageTolerance",
      "type": "event"
    },
    {
      "inputs": [
        {
          "internalType": "uint16",
          "name": "_chainId",
          "type": "uint16"
        },
        {
          "internalType": "address",
          "name": "_token",
          "type": "address"
        },
        {
          "internalType": "uint16",
          "name": "_poolId",
          "type": "uint16"
        }
      ],
      "name": "sgAddPool",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "components": [
            {
              "internalType": "uint256",
              "name": "qty",
              "type": "uint256"
            },
            {
              "internalType": "address",
              "name": "fromToken",
              "type": "address"
            },
            {
              "internalType": "address",
              "name": "toToken",
              "type": "address"
            },
            {
              "internalType": "uint16",
              "name": "dstChainId",
              "type": "uint16"
            },
            {
              "internalType": "address",
              "name": "to",
              "type": "address"
            },
            {
              "internalType": "address",
              "name": "destStargateComposed",
              "type": "address"
            }
          ],
          "internalType": "struct StargateFacet.StargateData",
          "name": "_sgData",
          "type": "tuple"
        }
      ],
      "name": "sgBridgeTokens",
      "outputs": [],
      "stateMutability": "payable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint16",
          "name": "_destChain",
          "type": "uint16"
        },
        {
          "internalType": "address",
          "name": "_receiver",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "_router",
          "type": "address"
        }
      ],
      "name": "sgCalculateFees",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint16",
          "name": "_chainId",
          "type": "uint16"
        },
        {
          "internalType": "address",
          "name": "_token",
          "type": "address"
        },
        {
          "internalType": "uint16",
          "name": "_poolId",
          "type": "uint16"
        }
      ],
      "name": "sgCheckPoolId",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_stargateRouter",
          "type": "address"
        },
        {
          "internalType": "uint16",
          "name": "_chainId",
          "type": "uint16"
        }
      ],
      "name": "sgInitialize",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_amount",
          "type": "uint256"
        }
      ],
      "name": "sgMinAmountOut",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint16",
          "name": "_chainId",
          "type": "uint16"
        },
        {
          "internalType": "bytes",
          "name": "_srcAddress",
          "type": "bytes"
        },
        {
          "internalType": "uint256",
          "name": "_nonce",
          "type": "uint256"
        },
        {
          "internalType": "address",
          "name": "_token",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "amountLD",
          "type": "uint256"
        },
        {
          "internalType": "bytes",
          "name": "_payload",
          "type": "bytes"
        }
      ],
      "name": "sgReceive",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint16",
          "name": "_chainId",
          "type": "uint16"
        },
        {
          "internalType": "address",
          "name": "_token",
          "type": "address"
        }
      ],
      "name": "sgRetrievePoolId",
      "outputs": [
        {
          "internalType": "uint16",
          "name": "",
          "type": "uint16"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_newAddress",
          "type": "address"
        }
      ],
      "name": "sgUpdateRouter",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_newSlippage",
          "type": "uint256"
        }
      ],
      "name": "sgUpdateSlippageTolerance",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    }
  ],
  "transactionHash": "0xc837e1ffefa3ac626e72f67bbcc43719db3a2a7d40b695d1580b8fe0e0eaf526",
  "receipt": {
    "to": "0x4e59b44847b379578588920cA78FbF26c0B4956C",
    "from": "0x53fE9288897e254698175740aa359E19E26c10af",
    "contractAddress": null,
    "transactionIndex": 0,
    "gasUsed": "2142581",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "blockHash": "0x5cc663c83191585c82a9685185852131aedfe2b5369e31413b0074574eb9b8d8",
    "transactionHash": "0xc837e1ffefa3ac626e72f67bbcc43719db3a2a7d40b695d1580b8fe0e0eaf526",
    "logs": [],
    "blockNumber": 22233027,
    "cumulativeGasUsed": "2142581",
    "status": 1,
    "byzantium": true
  },
  "args": [],
  "solcInputHash": "893c7c8579088197a1acbd2718e7b759",
  "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"InvalidAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSourcePoolId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyError\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"SenderNotStargateRouter\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"StargateRouterAddressZero\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"chainId\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"poolId\",\"type\":\"uint16\"}],\"name\":\"SGAddedPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"stargate\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"chainId\",\"type\":\"uint16\"}],\"name\":\"SGInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SGReceivedOnDestination\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"bridgeUsed\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"fromToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"chainIdTo\",\"type\":\"uint16\"}],\"name\":\"SGTransferStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SGUpdatedRouter\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newSlippage\",\"type\":\"uint256\"}],\"name\":\"SGUpdatedSlippageTolerance\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_chainId\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_poolId\",\"type\":\"uint16\"}],\"name\":\"sgAddPool\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"qty\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"dstChainId\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"destStargateComposed\",\"type\":\"address\"}],\"internalType\":\"struct StargateFacet.StargateData\",\"name\":\"_sgData\",\"type\":\"tuple\"}],\"name\":\"sgBridgeTokens\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_destChain\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_router\",\"type\":\"address\"}],\"name\":\"sgCalculateFees\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_chainId\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_poolId\",\"type\":\"uint16\"}],\"name\":\"sgCheckPoolId\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_stargateRouter\",\"type\":\"address\"},{\"internalType\":\"uint16\",\"name\":\"_chainId\",\"type\":\"uint16\"}],\"name\":\"sgInitialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"sgMinAmountOut\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_chainId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"_srcAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountLD\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_payload\",\"type\":\"bytes\"}],\"name\":\"sgReceive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"_chainId\",\"type\":\"uint16\"},{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"sgRetrievePoolId\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newAddress\",\"type\":\"address\"}],\"name\":\"sgUpdateRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newSlippage\",\"type\":\"uint256\"}],\"name\":\"sgUpdateSlippageTolerance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Luke Wickens <luke@pillarproject.io>\",\"kind\":\"dev\",\"methods\":{\"sgAddPool(uint16,address,uint16)\":{\"params\":{\"_chainId\":\"Chain id of new pool (NOT actual chain id - check stargate pool ids docs)\",\"_poolId\":\"Pool id (check stargate pool ids docs)\",\"_token\":\"Address of token\"}},\"sgBridgeTokens((uint256,address,address,uint16,address,address))\":{\"params\":{\"_sgData\":\"- struct containing information required to execute bridge\"}},\"sgCalculateFees(uint16,address,address)\":{\"params\":{\"_destChain\":\"Destination chain id\",\"_receiver\":\"Receiver on destination chain\",\"_router\":\"Address of stargate router\"}},\"sgCheckPoolId(uint16,address,uint16)\":{\"params\":{\"_chainId\":\"Chain id of new pool (NOT actual chain id - check stargate pool ids docs)\",\"_poolId\":\"Pool id (check stargate pool ids docs)\",\"_token\":\"Address of token\"}},\"sgInitialize(address,uint16)\":{\"params\":{\"_chainId\":\"- current chain id\",\"_stargateRouter\":\"- address of the Stargate router contract\"}},\"sgMinAmountOut(uint256)\":{\"params\":{\"_amount\":\"Transfer amount\"}},\"sgReceive(uint16,bytes,uint256,address,uint256,bytes)\":{\"params\":{\"_chainId\":\"The remote chainId sending the tokens\",\"_nonce\":\"The message ordering nonce\",\"_payload\":\"The bytes containing the toAddress\",\"_srcAddress\":\"The remote Bridge address\",\"_token\":\"The token contract on the local chain\",\"amountLD\":\"The qty of local _token contract tokens\"}},\"sgRetrievePoolId(uint16,address)\":{\"params\":{\"_chainId\":\"Chain id of new pool (NOT actual chain id - check stargate pool ids docs)\",\"_token\":\"Address of token\"}},\"sgUpdateRouter(address)\":{\"params\":{\"_newAddress\":\"Address of the new router\"}},\"sgUpdateSlippageTolerance(uint256)\":{\"params\":{\"_newSlippage\":\"New slippage amount\"}}},\"title\":\"StargateFacet\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"sgAddPool(uint16,address,uint16)\":{\"notice\":\"Adds a new pool for a specific token and chain\"},\"sgBridgeTokens((uint256,address,address,uint16,address,address))\":{\"notice\":\"initializes state variables for the stargate facet\"},\"sgCalculateFees(uint16,address,address)\":{\"notice\":\"Calculates cross chain fee\"},\"sgCheckPoolId(uint16,address,uint16)\":{\"notice\":\"Checks for a valid token pool on specific chain\"},\"sgInitialize(address,uint16)\":{\"notice\":\"initializes state variables for the Stargate facet\"},\"sgMinAmountOut(uint256)\":{\"notice\":\"Calculates the minimum amount out using slippage tolerance\"},\"sgReceive(uint16,bytes,uint256,address,uint256,bytes)\":{\"notice\":\"required to receive tokens on destination chain\"},\"sgRetrievePoolId(uint16,address)\":{\"notice\":\"Retrieves pool id for a token on a specified chain\"},\"sgUpdateRouter(address)\":{\"notice\":\"Updates stargate router address for deployed chain\"},\"sgUpdateSlippageTolerance(uint256)\":{\"notice\":\"Updates slippage tolerance amount\"}},\"notice\":\"Stargate/LayerZero intergration for bridging tokens\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/bridges/facets/StargateFacet.sol\":\"StargateFacet\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.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(\\n        address from,\\n        address to,\\n        uint256 amount\\n    ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n    using Address for address;\\n\\n    function safeTransfer(\\n        IERC20 token,\\n        address to,\\n        uint256 value\\n    ) internal {\\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n    }\\n\\n    function safeTransferFrom(\\n        IERC20 token,\\n        address from,\\n        address to,\\n        uint256 value\\n    ) internal {\\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n    }\\n\\n    /**\\n     * @dev Deprecated. This function has issues similar to the ones found in\\n     * {IERC20-approve}, and its usage is discouraged.\\n     *\\n     * Whenever possible, use {safeIncreaseAllowance} and\\n     * {safeDecreaseAllowance} instead.\\n     */\\n    function safeApprove(\\n        IERC20 token,\\n        address spender,\\n        uint256 value\\n    ) internal {\\n        // safeApprove should only be called when setting an initial allowance,\\n        // or when resetting it to zero. To increase and decrease it, use\\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n        require(\\n            (value == 0) || (token.allowance(address(this), spender) == 0),\\n            \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n        );\\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n    }\\n\\n    function safeIncreaseAllowance(\\n        IERC20 token,\\n        address spender,\\n        uint256 value\\n    ) internal {\\n        uint256 newAllowance = token.allowance(address(this), spender) + value;\\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n    }\\n\\n    function safeDecreaseAllowance(\\n        IERC20 token,\\n        address spender,\\n        uint256 value\\n    ) internal {\\n        unchecked {\\n            uint256 oldAllowance = token.allowance(address(this), spender);\\n            require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n            uint256 newAllowance = oldAllowance - value;\\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n        }\\n    }\\n\\n    /**\\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\\n     * @param token The token targeted by the call.\\n     * @param data The call data (encoded using abi.encode or one of its variants).\\n     */\\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n        // the target address contains contract code and also asserts for success in the low-level call.\\n\\n        bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n        if (returndata.length > 0) {\\n            // Return data is optional\\n            require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n        }\\n    }\\n}\\n\",\"keccak256\":\"0xc3d946432c0ddbb1f846a0d3985be71299df331b91d06732152117f62f0be2b5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n    /**\\n     * @dev Returns true if `account` is a contract.\\n     *\\n     * [IMPORTANT]\\n     * ====\\n     * It is unsafe to assume that an address for which this function returns\\n     * false is an externally-owned account (EOA) and not a contract.\\n     *\\n     * Among others, `isContract` will return false for the following\\n     * types of addresses:\\n     *\\n     *  - an externally-owned account\\n     *  - a contract in construction\\n     *  - an address where a contract will be created\\n     *  - an address where a contract lived, but was destroyed\\n     * ====\\n     *\\n     * [IMPORTANT]\\n     * ====\\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n     *\\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n     * constructor.\\n     * ====\\n     */\\n    function isContract(address account) internal view returns (bool) {\\n        // This method relies on extcodesize/address.code.length, which returns 0\\n        // for contracts in construction, since the code is only stored at the end\\n        // of the constructor execution.\\n\\n        return account.code.length > 0;\\n    }\\n\\n    /**\\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n     * `recipient`, forwarding all available gas and reverting on errors.\\n     *\\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n     * imposed by `transfer`, making them unable to receive funds via\\n     * `transfer`. {sendValue} removes this limitation.\\n     *\\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n     *\\n     * IMPORTANT: because control is transferred to `recipient`, care must be\\n     * taken to not create reentrancy vulnerabilities. Consider using\\n     * {ReentrancyGuard} or the\\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n     */\\n    function sendValue(address payable recipient, uint256 amount) internal {\\n        require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n        (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n        require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n    }\\n\\n    /**\\n     * @dev Performs a Solidity function call using a low level `call`. A\\n     * plain `call` is an unsafe replacement for a function call: use this\\n     * function instead.\\n     *\\n     * If `target` reverts with a revert reason, it is bubbled up by this\\n     * function (like regular Solidity function calls).\\n     *\\n     * Returns the raw returned data. To convert to the expected return value,\\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n     *\\n     * Requirements:\\n     *\\n     * - `target` must be a contract.\\n     * - calling `target` with `data` must not revert.\\n     *\\n     * _Available since v3.1._\\n     */\\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n        return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n     * `errorMessage` as a fallback revert reason when `target` reverts.\\n     *\\n     * _Available since v3.1._\\n     */\\n    function functionCall(\\n        address target,\\n        bytes memory data,\\n        string memory errorMessage\\n    ) internal returns (bytes memory) {\\n        return functionCallWithValue(target, data, 0, errorMessage);\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n     * but also transferring `value` wei to `target`.\\n     *\\n     * Requirements:\\n     *\\n     * - the calling contract must have an ETH balance of at least `value`.\\n     * - the called Solidity function must be `payable`.\\n     *\\n     * _Available since v3.1._\\n     */\\n    function functionCallWithValue(\\n        address target,\\n        bytes memory data,\\n        uint256 value\\n    ) internal returns (bytes memory) {\\n        return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\\n     *\\n     * _Available since v3.1._\\n     */\\n    function functionCallWithValue(\\n        address target,\\n        bytes memory data,\\n        uint256 value,\\n        string memory errorMessage\\n    ) internal returns (bytes memory) {\\n        require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n        require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\\n        return verifyCallResult(success, returndata, errorMessage);\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n     * but performing a static call.\\n     *\\n     * _Available since v3.3._\\n     */\\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n        return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n     * but performing a static call.\\n     *\\n     * _Available since v3.3._\\n     */\\n    function functionStaticCall(\\n        address target,\\n        bytes memory data,\\n        string memory errorMessage\\n    ) internal view returns (bytes memory) {\\n        require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n        (bool success, bytes memory returndata) = target.staticcall(data);\\n        return verifyCallResult(success, returndata, errorMessage);\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n     * but performing a delegate call.\\n     *\\n     * _Available since v3.4._\\n     */\\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n        return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n     * but performing a delegate call.\\n     *\\n     * _Available since v3.4._\\n     */\\n    function functionDelegateCall(\\n        address target,\\n        bytes memory data,\\n        string memory errorMessage\\n    ) internal returns (bytes memory) {\\n        require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n        (bool success, bytes memory returndata) = target.delegatecall(data);\\n        return verifyCallResult(success, returndata, errorMessage);\\n    }\\n\\n    /**\\n     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n     * revert reason using the provided one.\\n     *\\n     * _Available since v4.3._\\n     */\\n    function verifyCallResult(\\n        bool success,\\n        bytes memory returndata,\\n        string memory errorMessage\\n    ) internal pure returns (bytes memory) {\\n        if (success) {\\n            return returndata;\\n        } else {\\n            // Look for revert reason and bubble it up if present\\n            if (returndata.length > 0) {\\n                // The easiest way to bubble the revert reason is using memory via assembly\\n\\n                assembly {\\n                    let returndata_size := mload(returndata)\\n                    revert(add(32, returndata), returndata_size)\\n                }\\n            } else {\\n                revert(errorMessage);\\n            }\\n        }\\n    }\\n}\\n\",\"keccak256\":\"0x2ccf9d2313a313d41a791505f2b5abfdc62191b5d4334f7f7a82691c088a1c87\",\"license\":\"MIT\"},\"src/bridges/errors/GenericErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// solhint-disable-next-line\\r\\npragma solidity 0.8.4;\\r\\n\\r\\nerror InvalidAmount();\\r\\nerror TokenAddressIsZero();\\r\\nerror CannotBridgeToSameNetwork();\\r\\nerror ZeroPostSwapBalance();\\r\\nerror InvalidBridgeConfigLength();\\r\\nerror NoSwapDataProvided();\\r\\nerror NativeValueWithERC();\\r\\nerror ContractCallNotAllowed();\\r\\nerror NullAddrIsNotAValidSpender();\\r\\nerror NullAddrIsNotAnERC20Token();\\r\\nerror NoTransferToNullAddress();\\r\\nerror NativeAssetTransferFailed();\\r\\nerror InvalidContract();\\r\\nerror InvalidConfig();\\r\\nerror ZeroAddressProvided();\\r\\n\",\"keccak256\":\"0x992fad5a017c0bc7719bf063c34143295086df9493dbae698333b0f5db910d49\",\"license\":\"MIT\"},\"src/bridges/errors/StargateErrors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n// solhint-disable-next-line\\r\\npragma solidity 0.8.4;\\r\\n\\r\\nerror SenderNotStargateRouter();\\r\\nerror NoMsgValueForCrossChainMessage();\\r\\nerror StargateRouterAddressZero();\\r\\nerror InvalidSourcePoolId();\\r\\nerror InvalidDestinationPoolId();\\r\\n\",\"keccak256\":\"0x59a0c01e681e2b4468b6fd82f66a8b5a7f878b58e248e19416f4efa1067ab3d1\",\"license\":\"MIT\"},\"src/bridges/facets/StargateFacet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\npragma solidity 0.8.4;\\r\\n\\r\\nimport {IStargateRouter} from \\\"../interfaces/IStargateRouter.sol\\\";\\r\\nimport {IStargateReceiver} from \\\"../interfaces/IStargateReceiver.sol\\\";\\r\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\r\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\r\\nimport {ReentrancyGuard} from \\\"../../common/helpers/DiamondReentrancyGuard.sol\\\";\\r\\nimport {CannotBridgeToSameNetwork, InvalidAmount, InvalidConfig} from \\\"../errors/GenericErrors.sol\\\";\\r\\nimport {SenderNotStargateRouter, NoMsgValueForCrossChainMessage, StargateRouterAddressZero, InvalidSourcePoolId, InvalidDestinationPoolId} from \\\"../errors/StargateErrors.sol\\\";\\r\\nimport {LibDiamond} from \\\"../libs/LibDiamond.sol\\\";\\r\\n\\r\\n/// @title StargateFacet\\r\\n/// @author Luke Wickens <luke@pillarproject.io>\\r\\n/// @notice Stargate/LayerZero intergration for bridging tokens\\r\\n\\r\\ncontract StargateFacet is IStargateReceiver, ReentrancyGuard {\\r\\n    using SafeERC20 for IERC20;\\r\\n\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    /////////////////////////// Events ///////////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    event SGInitialized(address stargate, uint16 chainId);\\r\\n    event SGTransferStarted(\\r\\n        string bridgeUsed,\\r\\n        address fromToken,\\r\\n        address toToken,\\r\\n        address from,\\r\\n        address to,\\r\\n        uint256 amount,\\r\\n        uint16 chainIdTo\\r\\n    );\\r\\n    event SGReceivedOnDestination(address token, uint256 amount);\\r\\n    event SGUpdatedRouter(address newAddress);\\r\\n    event SGUpdatedSlippageTolerance(uint256 newSlippage);\\r\\n    event SGAddedPool(uint16 chainId, address token, uint16 poolId);\\r\\n\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    ////////////////////////// Storage ///////////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n\\r\\n    bytes32 internal constant NAMESPACE =\\r\\n        keccak256(\\\"io.etherspot.facets.stargate\\\");\\r\\n    struct Storage {\\r\\n        address stargateRouter;\\r\\n        uint16 chainId;\\r\\n        uint256 dstGas;\\r\\n        uint256 slippage;\\r\\n        mapping(uint16 => mapping(address => uint16)) poolIds;\\r\\n    }\\r\\n\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    ////////////////////////// Structs ///////////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n\\r\\n    struct StargateData {\\r\\n        uint256 qty;\\r\\n        address fromToken;\\r\\n        address toToken;\\r\\n        uint16 dstChainId;\\r\\n        address to;\\r\\n        address destStargateComposed;\\r\\n    }\\r\\n\\r\\n    /// @notice initializes state variables for the Stargate facet\\r\\n    /// @param _stargateRouter - address of the Stargate router contract\\r\\n    /// @param _chainId - current chain id\\r\\n    function sgInitialize(address _stargateRouter, uint16 _chainId) external {\\r\\n        if (_stargateRouter == address(0)) revert InvalidConfig();\\r\\n        LibDiamond.enforceIsContractOwner();\\r\\n        Storage storage s = getStorage();\\r\\n        s.stargateRouter = address(_stargateRouter);\\r\\n        s.chainId = _chainId;\\r\\n        s.slippage = 50; // equates to 0.5%\\r\\n        // Adding pre-existing pools => USDC: 1, USDT: 2, BUSD: 5\\r\\n        sgAddPool(1, 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, 1);\\r\\n        sgAddPool(1, 0xdAC17F958D2ee523a2206206994597C13D831ec7, 2);\\r\\n        sgAddPool(2, 0x55d398326f99059fF775485246999027B3197955, 2);\\r\\n        sgAddPool(2, 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56, 5);\\r\\n        sgAddPool(6, 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E, 1);\\r\\n        sgAddPool(6, 0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7, 2);\\r\\n        sgAddPool(9, 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174, 1);\\r\\n        sgAddPool(9, 0xc2132D05D31c914a87C6611C10748AEb04B58e8F, 2);\\r\\n        sgAddPool(10, 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8, 1);\\r\\n        sgAddPool(10, 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9, 2);\\r\\n        sgAddPool(11, 0x7F5c764cBc14f9669B88837ca1490cCa17c31607, 1);\\r\\n        sgAddPool(12, 0x04068DA6C83AFCFA0e13ba15A6696662335D5B75, 1);\\r\\n        emit SGInitialized(_stargateRouter, _chainId);\\r\\n    }\\r\\n\\r\\n    /// @notice initializes state variables for the stargate facet\\r\\n    /// @param _sgData - struct containing information required to execute bridge\\r\\n    function sgBridgeTokens(StargateData memory _sgData)\\r\\n        external\\r\\n        payable\\r\\n        nonReentrant\\r\\n    {\\r\\n        // if (msg.value <= 0) revert NoMsgValueForCrossChainMessage();\\r\\n        if (_sgData.qty <= 0) revert InvalidAmount();\\r\\n        if (\\r\\n            _sgData.fromToken == address(0) ||\\r\\n            _sgData.toToken == address(0) ||\\r\\n            _sgData.to == address(0) ||\\r\\n            _sgData.destStargateComposed == address(0)\\r\\n        ) revert InvalidConfig();\\r\\n\\r\\n        // access storage\\r\\n        Storage storage s = getStorage();\\r\\n\\r\\n        // check pool ids are valid\\r\\n        uint16 srcPoolId = sgRetrievePoolId(s.chainId, _sgData.fromToken);\\r\\n        if (srcPoolId == 0) revert InvalidSourcePoolId();\\r\\n        uint16 dstPoolId = sgRetrievePoolId(\\r\\n            _sgData.dstChainId,\\r\\n            _sgData.toToken\\r\\n        );\\r\\n\\r\\n        // calculate cross chain fees\\r\\n        uint256 fees = sgCalculateFees(\\r\\n            _sgData.dstChainId,\\r\\n            _sgData.to,\\r\\n            s.stargateRouter\\r\\n        );\\r\\n\\r\\n        // calculate slippage\\r\\n        uint256 minAmountOut = sgMinAmountOut(_sgData.qty);\\r\\n\\r\\n        // encode sgReceive implemented\\r\\n        bytes memory destination = abi.encodePacked(\\r\\n            _sgData.destStargateComposed\\r\\n        );\\r\\n\\r\\n        // encode payload data to send to destination contract, which it will handle with sgReceive()\\r\\n        bytes memory payload = abi.encode(_sgData.to);\\r\\n\\r\\n        // this contract calls stargate swap()\\r\\n        IERC20(_sgData.fromToken).safeTransferFrom(\\r\\n            msg.sender,\\r\\n            address(this),\\r\\n            _sgData.qty\\r\\n        );\\r\\n\\r\\n        IERC20(_sgData.fromToken).safeApprove(\\r\\n            address(s.stargateRouter),\\r\\n            _sgData.qty\\r\\n        );\\r\\n\\r\\n        // Stargate's Router.swap() function sends the tokens to the destination chain.\\r\\n        IStargateRouter(s.stargateRouter).swap{value: fees}(\\r\\n            _sgData.dstChainId, // the destination chain id\\r\\n            srcPoolId, // the source Stargate poolId\\r\\n            dstPoolId, // the destination Stargate poolId\\r\\n            payable(msg.sender), // refund adddress. if msg.sender pays too much gas, return extra eth\\r\\n            _sgData.qty, // total tokens to send to destination chain\\r\\n            minAmountOut, // min amount allowed out\\r\\n            IStargateRouter.lzTxObj(200000, 0, \\\"0x\\\"), // default lzTxObj\\r\\n            destination, // destination address, the sgReceive() implementer\\r\\n            payload // bytes payload\\r\\n        );\\r\\n\\r\\n        emit SGTransferStarted(\\r\\n            \\\"stargate\\\",\\r\\n            _sgData.fromToken,\\r\\n            _sgData.toToken,\\r\\n            msg.sender,\\r\\n            _sgData.to,\\r\\n            _sgData.qty,\\r\\n            _sgData.dstChainId\\r\\n        );\\r\\n    }\\r\\n\\r\\n    /// @notice required to receive tokens on destination chain\\r\\n    /// @param _chainId The remote chainId sending the tokens\\r\\n    /// @param _srcAddress The remote Bridge address\\r\\n    /// @param _nonce The message ordering nonce\\r\\n    /// @param _token The token contract on the local chain\\r\\n    /// @param amountLD The qty of local _token contract tokens\\r\\n    /// @param _payload The bytes containing the toAddress\\r\\n    function sgReceive(\\r\\n        uint16 _chainId,\\r\\n        bytes memory _srcAddress,\\r\\n        uint256 _nonce,\\r\\n        address _token,\\r\\n        uint256 amountLD,\\r\\n        bytes memory _payload\\r\\n    ) external override {\\r\\n        Storage storage s = getStorage();\\r\\n        if (msg.sender != address(s.stargateRouter))\\r\\n            revert SenderNotStargateRouter();\\r\\n\\r\\n        address _toAddr = abi.decode(_payload, (address));\\r\\n        IERC20(_token).transfer(_toAddr, amountLD);\\r\\n        emit SGReceivedOnDestination(_token, amountLD);\\r\\n    }\\r\\n\\r\\n    /// @notice Calculates cross chain fee\\r\\n    /// @param _destChain Destination chain id\\r\\n    /// @param _receiver Receiver on destination chain\\r\\n    /// @param _router Address of stargate router\\r\\n    function sgCalculateFees(\\r\\n        uint16 _destChain,\\r\\n        address _receiver,\\r\\n        address _router\\r\\n    ) public view returns (uint256) {\\r\\n        (uint256 nativeFee, ) = IStargateRouter(_router).quoteLayerZeroFee(\\r\\n            _destChain, // destination chain id\\r\\n            1, // 1 = swap\\r\\n            abi.encodePacked(_receiver), // receiver on destination chain\\r\\n            \\\"0x\\\", // payload, using abi.encode()\\r\\n            IStargateRouter.lzTxObj(200000, 0, \\\"0x\\\")\\r\\n        );\\r\\n        return nativeFee;\\r\\n    }\\r\\n\\r\\n    /// @notice Calculates the minimum amount out using slippage tolerance\\r\\n    /// @param _amount Transfer amount\\r\\n    function sgMinAmountOut(uint256 _amount) public view returns (uint256) {\\r\\n        Storage storage s = getStorage();\\r\\n        // equates to 0.5% slippage\\r\\n        return (_amount * (10000 - s.slippage)) / (10000);\\r\\n    }\\r\\n\\r\\n    /// @notice Updates stargate router address for deployed chain\\r\\n    /// @param _newAddress Address of the new router\\r\\n    function sgUpdateRouter(address _newAddress) external {\\r\\n        LibDiamond.enforceIsContractOwner();\\r\\n        if (_newAddress == address(0)) revert StargateRouterAddressZero();\\r\\n        Storage storage s = getStorage();\\r\\n        s.stargateRouter = address(_newAddress);\\r\\n        emit SGUpdatedRouter(_newAddress);\\r\\n    }\\r\\n\\r\\n    /// @notice Updates slippage tolerance amount\\r\\n    /// @param _newSlippage New slippage amount\\r\\n    function sgUpdateSlippageTolerance(uint256 _newSlippage) external {\\r\\n        LibDiamond.enforceIsContractOwner();\\r\\n        Storage storage s = getStorage();\\r\\n        s.slippage = _newSlippage;\\r\\n        emit SGUpdatedSlippageTolerance(_newSlippage);\\r\\n    }\\r\\n\\r\\n    /// @notice Adds a new pool for a specific token and chain\\r\\n    /// @param _chainId Chain id of new pool (NOT actual chain id - check stargate pool ids docs)\\r\\n    /// @param _token Address of token\\r\\n    /// @param _poolId Pool id (check stargate pool ids docs)\\r\\n    function sgAddPool(\\r\\n        uint16 _chainId,\\r\\n        address _token,\\r\\n        uint16 _poolId\\r\\n    ) public {\\r\\n        LibDiamond.enforceIsContractOwner();\\r\\n        Storage storage s = getStorage();\\r\\n        s.poolIds[_chainId][_token] = _poolId;\\r\\n        emit SGAddedPool(_chainId, _token, _poolId);\\r\\n    }\\r\\n\\r\\n    /// @notice Checks for a valid token pool on specific chain\\r\\n    /// @param _chainId Chain id of new pool (NOT actual chain id - check stargate pool ids docs)\\r\\n    /// @param _token Address of token\\r\\n    /// @param _poolId Pool id (check stargate pool ids docs)\\r\\n    function sgCheckPoolId(\\r\\n        uint16 _chainId,\\r\\n        address _token,\\r\\n        uint16 _poolId\\r\\n    ) external view returns (bool) {\\r\\n        Storage storage s = getStorage();\\r\\n        return s.poolIds[_chainId][_token] == _poolId ? true : false;\\r\\n    }\\r\\n\\r\\n    /// @notice Retrieves pool id for a token on a specified chain\\r\\n    /// @param _chainId Chain id of new pool (NOT actual chain id - check stargate pool ids docs)\\r\\n    /// @param _token Address of token\\r\\n    function sgRetrievePoolId(uint16 _chainId, address _token)\\r\\n        public\\r\\n        view\\r\\n        returns (uint16)\\r\\n    {\\r\\n        Storage storage s = getStorage();\\r\\n        return s.poolIds[_chainId][_token];\\r\\n    }\\r\\n\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    ////////////////////// Private Functions /////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n\\r\\n    /// @dev fetch local storage\\r\\n    function getStorage() private pure returns (Storage storage s) {\\r\\n        bytes32 namespace = NAMESPACE;\\r\\n        // solhint-disable-next-line no-inline-assembly\\r\\n        assembly {\\r\\n            s.slot := namespace\\r\\n        }\\r\\n    }\\r\\n}\\r\\n\",\"keccak256\":\"0x12337459d41eca637ccce7e1057caea2fdf1434567ae6a039747774a777a49f3\",\"license\":\"MIT\"},\"src/bridges/interfaces/IDiamondCut.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\npragma solidity >=0.8.4 <0.9.0;\\r\\n\\r\\ninterface IDiamondCut {\\r\\n    enum FacetCutAction {\\r\\n        Add,\\r\\n        Replace,\\r\\n        Remove\\r\\n    }\\r\\n    // Add=0, Replace=1, Remove=2\\r\\n\\r\\n    struct FacetCut {\\r\\n        address facetAddress;\\r\\n        FacetCutAction action;\\r\\n        bytes4[] functionSelectors;\\r\\n    }\\r\\n\\r\\n    /// @notice Add/replace/remove any number of functions and optionally execute\\r\\n    ///         a function with delegatecall\\r\\n    /// @param _diamondCut Contains the facet addresses and function selectors\\r\\n    /// @param _init The address of the contract or facet to execute _calldata\\r\\n    /// @param _calldata A function call, including function selector and arguments\\r\\n    ///                  _calldata is executed with delegatecall on _init\\r\\n    function diamondCut(\\r\\n        FacetCut[] calldata _diamondCut,\\r\\n        address _init,\\r\\n        bytes calldata _calldata\\r\\n    ) external;\\r\\n\\r\\n    event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata);\\r\\n}\\r\\n\",\"keccak256\":\"0x328c89b6fa5bae672416dbfc8b15837f6764895e563675d550edc33c706ad948\",\"license\":\"MIT\"},\"src/bridges/interfaces/IStargateReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\n\\r\\npragma solidity 0.8.4;\\r\\n\\r\\ninterface IStargateReceiver {\\r\\n    function sgReceive(\\r\\n        uint16 _srcChainId, // the remote chainId sending the tokens\\r\\n        bytes memory _srcAddress, // the remote Bridge address\\r\\n        uint256 _nonce,\\r\\n        address _token, // the token contract on the local chain\\r\\n        uint256 amountLD, // the qty of local _token contract tokens\\r\\n        bytes memory payload\\r\\n    ) external;\\r\\n}\\r\\n\",\"keccak256\":\"0xd0fd4663b2343bf3eaa3171208cc14ee84244cd33d1b0232c342c55059cc0716\",\"license\":\"MIT\"},\"src/bridges/interfaces/IStargateRouter.sol\":{\"content\":\"// SPDX-License-Identifier:MIT\\r\\n\\r\\npragma solidity 0.8.4;\\r\\npragma abicoder v2;\\r\\n\\r\\ninterface IStargateRouter {\\r\\n    struct lzTxObj {\\r\\n        uint256 dstGasForCall;\\r\\n        uint256 dstNativeAmount;\\r\\n        bytes dstNativeAddr;\\r\\n    }\\r\\n\\r\\n    function addLiquidity(\\r\\n        uint256 _poolId,\\r\\n        uint256 _amountLD,\\r\\n        address _to\\r\\n    ) external;\\r\\n\\r\\n    function swap(\\r\\n        uint16 _dstChainId,\\r\\n        uint256 _srcPoolId,\\r\\n        uint256 _dstPoolId,\\r\\n        address payable _refundAddress,\\r\\n        uint256 _amountLD,\\r\\n        uint256 _minAmountLD,\\r\\n        lzTxObj memory _lzTxParams,\\r\\n        bytes calldata _to,\\r\\n        bytes calldata _payload\\r\\n    ) external payable;\\r\\n\\r\\n    function redeemRemote(\\r\\n        uint16 _dstChainId,\\r\\n        uint256 _srcPoolId,\\r\\n        uint256 _dstPoolId,\\r\\n        address payable _refundAddress,\\r\\n        uint256 _amountLP,\\r\\n        uint256 _minAmountLD,\\r\\n        bytes calldata _to,\\r\\n        lzTxObj memory _lzTxParams\\r\\n    ) external payable;\\r\\n\\r\\n    function instantRedeemLocal(\\r\\n        uint16 _srcPoolId,\\r\\n        uint256 _amountLP,\\r\\n        address _to\\r\\n    ) external returns (uint256);\\r\\n\\r\\n    function redeemLocal(\\r\\n        uint16 _dstChainId,\\r\\n        uint256 _srcPoolId,\\r\\n        uint256 _dstPoolId,\\r\\n        address payable _refundAddress,\\r\\n        uint256 _amountLP,\\r\\n        bytes calldata _to,\\r\\n        lzTxObj memory _lzTxParams\\r\\n    ) external payable;\\r\\n\\r\\n    function sendCredits(\\r\\n        uint16 _dstChainId,\\r\\n        uint256 _srcPoolId,\\r\\n        uint256 _dstPoolId,\\r\\n        address payable _refundAddress\\r\\n    ) external payable;\\r\\n\\r\\n    function quoteLayerZeroFee(\\r\\n        uint16 _dstChainId,\\r\\n        uint8 _functionType,\\r\\n        bytes calldata _toAddress,\\r\\n        bytes calldata _transferAndCallPayload,\\r\\n        lzTxObj memory _lzTxParams\\r\\n    ) external view returns (uint256, uint256);\\r\\n}\\r\\n\",\"keccak256\":\"0xc094396a243328c31673133b9396efe7b6fc3bf2fb4597c218abbc235b015454\",\"license\":\"MIT\"},\"src/bridges/libs/LibDiamond.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\r\\npragma solidity >=0.8.4 <0.9.0;\\r\\n\\r\\nimport {IDiamondCut} from \\\"../interfaces/IDiamondCut.sol\\\";\\r\\n\\r\\nlibrary LibDiamond {\\r\\n    bytes32 internal constant DIAMOND_STORAGE_POSITION =\\r\\n        keccak256(\\\"diamond.standard.diamond.storage\\\");\\r\\n\\r\\n    struct FacetAddressAndPosition {\\r\\n        address facetAddress;\\r\\n        uint96 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array\\r\\n    }\\r\\n\\r\\n    struct FacetFunctionSelectors {\\r\\n        bytes4[] functionSelectors;\\r\\n        uint256 facetAddressPosition; // position of facetAddress in facetAddresses array\\r\\n    }\\r\\n\\r\\n    struct DiamondStorage {\\r\\n        // maps function selector to the facet address and\\r\\n        // the position of the selector in the facetFunctionSelectors.selectors array\\r\\n        mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition;\\r\\n        // maps facet addresses to function selectors\\r\\n        mapping(address => FacetFunctionSelectors) facetFunctionSelectors;\\r\\n        // facet addresses\\r\\n        address[] facetAddresses;\\r\\n        // Used to query if a contract implements an interface.\\r\\n        // Used to implement ERC-165.\\r\\n        mapping(bytes4 => bool) supportedInterfaces;\\r\\n        // owner of the contract\\r\\n        address contractOwner;\\r\\n    }\\r\\n\\r\\n    function diamondStorage()\\r\\n        internal\\r\\n        pure\\r\\n        returns (DiamondStorage storage ds)\\r\\n    {\\r\\n        bytes32 position = DIAMOND_STORAGE_POSITION;\\r\\n        // solhint-disable-next-line no-inline-assembly\\r\\n        assembly {\\r\\n            ds.slot := position\\r\\n        }\\r\\n    }\\r\\n\\r\\n    event OwnershipTransferred(\\r\\n        address indexed previousOwner,\\r\\n        address indexed newOwner\\r\\n    );\\r\\n\\r\\n    function setContractOwner(address _newOwner) internal {\\r\\n        DiamondStorage storage ds = diamondStorage();\\r\\n        address previousOwner = ds.contractOwner;\\r\\n        ds.contractOwner = _newOwner;\\r\\n        emit OwnershipTransferred(previousOwner, _newOwner);\\r\\n    }\\r\\n\\r\\n    function contractOwner() internal view returns (address contractOwner_) {\\r\\n        contractOwner_ = diamondStorage().contractOwner;\\r\\n    }\\r\\n\\r\\n    function enforceIsContractOwner() internal view {\\r\\n        require(\\r\\n            msg.sender == diamondStorage().contractOwner,\\r\\n            \\\"LibDiamond: Must be contract owner\\\"\\r\\n        );\\r\\n    }\\r\\n\\r\\n    event DiamondCut(\\r\\n        IDiamondCut.FacetCut[] _diamondCut,\\r\\n        address _init,\\r\\n        bytes _calldata\\r\\n    );\\r\\n\\r\\n    // Internal function version of diamondCut\\r\\n    function diamondCut(\\r\\n        IDiamondCut.FacetCut[] memory _diamondCut,\\r\\n        address _init,\\r\\n        bytes memory _calldata\\r\\n    ) internal {\\r\\n        for (\\r\\n            uint256 facetIndex;\\r\\n            facetIndex < _diamondCut.length;\\r\\n            facetIndex++\\r\\n        ) {\\r\\n            IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action;\\r\\n            if (action == IDiamondCut.FacetCutAction.Add) {\\r\\n                addFunctions(\\r\\n                    _diamondCut[facetIndex].facetAddress,\\r\\n                    _diamondCut[facetIndex].functionSelectors\\r\\n                );\\r\\n            } else if (action == IDiamondCut.FacetCutAction.Replace) {\\r\\n                replaceFunctions(\\r\\n                    _diamondCut[facetIndex].facetAddress,\\r\\n                    _diamondCut[facetIndex].functionSelectors\\r\\n                );\\r\\n            } else if (action == IDiamondCut.FacetCutAction.Remove) {\\r\\n                removeFunctions(\\r\\n                    _diamondCut[facetIndex].facetAddress,\\r\\n                    _diamondCut[facetIndex].functionSelectors\\r\\n                );\\r\\n            } else {\\r\\n                revert(\\\"LibDiamondCut: Incorrect FacetCutAction\\\");\\r\\n            }\\r\\n        }\\r\\n        emit DiamondCut(_diamondCut, _init, _calldata);\\r\\n        initializeDiamondCut(_init, _calldata);\\r\\n    }\\r\\n\\r\\n    function addFunctions(\\r\\n        address _facetAddress,\\r\\n        bytes4[] memory _functionSelectors\\r\\n    ) internal {\\r\\n        require(\\r\\n            _functionSelectors.length > 0,\\r\\n            \\\"LibDiamondCut: No selectors in facet to cut\\\"\\r\\n        );\\r\\n        DiamondStorage storage ds = diamondStorage();\\r\\n        require(\\r\\n            _facetAddress != address(0),\\r\\n            \\\"LibDiamondCut: Add facet can't be address(0)\\\"\\r\\n        );\\r\\n        uint96 selectorPosition = uint96(\\r\\n            ds.facetFunctionSelectors[_facetAddress].functionSelectors.length\\r\\n        );\\r\\n        // add new facet address if it does not exist\\r\\n        if (selectorPosition == 0) {\\r\\n            addFacet(ds, _facetAddress);\\r\\n        }\\r\\n        for (\\r\\n            uint256 selectorIndex;\\r\\n            selectorIndex < _functionSelectors.length;\\r\\n            selectorIndex++\\r\\n        ) {\\r\\n            bytes4 selector = _functionSelectors[selectorIndex];\\r\\n            address oldFacetAddress = ds\\r\\n                .selectorToFacetAndPosition[selector]\\r\\n                .facetAddress;\\r\\n            require(\\r\\n                oldFacetAddress == address(0),\\r\\n                \\\"LibDiamondCut: Can't add function that already exists\\\"\\r\\n            );\\r\\n            addFunction(ds, selector, selectorPosition, _facetAddress);\\r\\n            selectorPosition++;\\r\\n        }\\r\\n    }\\r\\n\\r\\n    function replaceFunctions(\\r\\n        address _facetAddress,\\r\\n        bytes4[] memory _functionSelectors\\r\\n    ) internal {\\r\\n        require(\\r\\n            _functionSelectors.length > 0,\\r\\n            \\\"LibDiamondCut: No selectors in facet to cut\\\"\\r\\n        );\\r\\n        DiamondStorage storage ds = diamondStorage();\\r\\n        require(\\r\\n            _facetAddress != address(0),\\r\\n            \\\"LibDiamondCut: Add facet can't be address(0)\\\"\\r\\n        );\\r\\n        uint96 selectorPosition = uint96(\\r\\n            ds.facetFunctionSelectors[_facetAddress].functionSelectors.length\\r\\n        );\\r\\n        // add new facet address if it does not exist\\r\\n        if (selectorPosition == 0) {\\r\\n            addFacet(ds, _facetAddress);\\r\\n        }\\r\\n        for (\\r\\n            uint256 selectorIndex;\\r\\n            selectorIndex < _functionSelectors.length;\\r\\n            selectorIndex++\\r\\n        ) {\\r\\n            bytes4 selector = _functionSelectors[selectorIndex];\\r\\n            address oldFacetAddress = ds\\r\\n                .selectorToFacetAndPosition[selector]\\r\\n                .facetAddress;\\r\\n            require(\\r\\n                oldFacetAddress != _facetAddress,\\r\\n                \\\"LibDiamondCut: Can't replace function with same function\\\"\\r\\n            );\\r\\n            removeFunction(ds, oldFacetAddress, selector);\\r\\n            addFunction(ds, selector, selectorPosition, _facetAddress);\\r\\n            selectorPosition++;\\r\\n        }\\r\\n    }\\r\\n\\r\\n    function removeFunctions(\\r\\n        address _facetAddress,\\r\\n        bytes4[] memory _functionSelectors\\r\\n    ) internal {\\r\\n        require(\\r\\n            _functionSelectors.length > 0,\\r\\n            \\\"LibDiamondCut: No selectors in facet to cut\\\"\\r\\n        );\\r\\n        DiamondStorage storage ds = diamondStorage();\\r\\n        // if function does not exist then do nothing and return\\r\\n        require(\\r\\n            _facetAddress == address(0),\\r\\n            \\\"LibDiamondCut: Remove facet address must be address(0)\\\"\\r\\n        );\\r\\n        for (\\r\\n            uint256 selectorIndex;\\r\\n            selectorIndex < _functionSelectors.length;\\r\\n            selectorIndex++\\r\\n        ) {\\r\\n            bytes4 selector = _functionSelectors[selectorIndex];\\r\\n            address oldFacetAddress = ds\\r\\n                .selectorToFacetAndPosition[selector]\\r\\n                .facetAddress;\\r\\n            removeFunction(ds, oldFacetAddress, selector);\\r\\n        }\\r\\n    }\\r\\n\\r\\n    function addFacet(DiamondStorage storage ds, address _facetAddress)\\r\\n        internal\\r\\n    {\\r\\n        enforceHasContractCode(\\r\\n            _facetAddress,\\r\\n            \\\"LibDiamondCut: New facet has no code\\\"\\r\\n        );\\r\\n        ds.facetFunctionSelectors[_facetAddress].facetAddressPosition = ds\\r\\n            .facetAddresses\\r\\n            .length;\\r\\n        ds.facetAddresses.push(_facetAddress);\\r\\n    }\\r\\n\\r\\n    function addFunction(\\r\\n        DiamondStorage storage ds,\\r\\n        bytes4 _selector,\\r\\n        uint96 _selectorPosition,\\r\\n        address _facetAddress\\r\\n    ) internal {\\r\\n        ds\\r\\n            .selectorToFacetAndPosition[_selector]\\r\\n            .functionSelectorPosition = _selectorPosition;\\r\\n        ds.facetFunctionSelectors[_facetAddress].functionSelectors.push(\\r\\n            _selector\\r\\n        );\\r\\n        ds.selectorToFacetAndPosition[_selector].facetAddress = _facetAddress;\\r\\n    }\\r\\n\\r\\n    function removeFunction(\\r\\n        DiamondStorage storage ds,\\r\\n        address _facetAddress,\\r\\n        bytes4 _selector\\r\\n    ) internal {\\r\\n        require(\\r\\n            _facetAddress != address(0),\\r\\n            \\\"LibDiamondCut: Can't remove function that doesn't exist\\\"\\r\\n        );\\r\\n        // an immutable function is a function defined directly in a diamond\\r\\n        require(\\r\\n            _facetAddress != address(this),\\r\\n            \\\"LibDiamondCut: Can't remove immutable function\\\"\\r\\n        );\\r\\n        // replace selector with last selector, then delete last selector\\r\\n        uint256 selectorPosition = ds\\r\\n            .selectorToFacetAndPosition[_selector]\\r\\n            .functionSelectorPosition;\\r\\n        uint256 lastSelectorPosition = ds\\r\\n            .facetFunctionSelectors[_facetAddress]\\r\\n            .functionSelectors\\r\\n            .length - 1;\\r\\n        // if not the same then replace _selector with lastSelector\\r\\n        if (selectorPosition != lastSelectorPosition) {\\r\\n            bytes4 lastSelector = ds\\r\\n                .facetFunctionSelectors[_facetAddress]\\r\\n                .functionSelectors[lastSelectorPosition];\\r\\n            ds.facetFunctionSelectors[_facetAddress].functionSelectors[\\r\\n                    selectorPosition\\r\\n                ] = lastSelector;\\r\\n            ds\\r\\n                .selectorToFacetAndPosition[lastSelector]\\r\\n                .functionSelectorPosition = uint96(selectorPosition);\\r\\n        }\\r\\n        // delete the last selector\\r\\n        ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop();\\r\\n        delete ds.selectorToFacetAndPosition[_selector];\\r\\n\\r\\n        // if no more selectors for facet address then delete the facet address\\r\\n        if (lastSelectorPosition == 0) {\\r\\n            // replace facet address with last facet address and delete last facet address\\r\\n            uint256 lastFacetAddressPosition = ds.facetAddresses.length - 1;\\r\\n            uint256 facetAddressPosition = ds\\r\\n                .facetFunctionSelectors[_facetAddress]\\r\\n                .facetAddressPosition;\\r\\n            if (facetAddressPosition != lastFacetAddressPosition) {\\r\\n                address lastFacetAddress = ds.facetAddresses[\\r\\n                    lastFacetAddressPosition\\r\\n                ];\\r\\n                ds.facetAddresses[facetAddressPosition] = lastFacetAddress;\\r\\n                ds\\r\\n                    .facetFunctionSelectors[lastFacetAddress]\\r\\n                    .facetAddressPosition = facetAddressPosition;\\r\\n            }\\r\\n            ds.facetAddresses.pop();\\r\\n            delete ds\\r\\n                .facetFunctionSelectors[_facetAddress]\\r\\n                .facetAddressPosition;\\r\\n        }\\r\\n    }\\r\\n\\r\\n    function initializeDiamondCut(address _init, bytes memory _calldata)\\r\\n        internal\\r\\n    {\\r\\n        if (_init == address(0)) {\\r\\n            require(\\r\\n                _calldata.length == 0,\\r\\n                \\\"LibDiamondCut: _init is address(0) but_calldata is not empty\\\"\\r\\n            );\\r\\n        } else {\\r\\n            require(\\r\\n                _calldata.length > 0,\\r\\n                \\\"LibDiamondCut: _calldata is empty but _init is not address(0)\\\"\\r\\n            );\\r\\n            if (_init != address(this)) {\\r\\n                enforceHasContractCode(\\r\\n                    _init,\\r\\n                    \\\"LibDiamondCut: _init address has no code\\\"\\r\\n                );\\r\\n            }\\r\\n            // solhint-disable-next-line avoid-low-level-calls\\r\\n            (bool success, bytes memory error) = _init.delegatecall(_calldata);\\r\\n            if (!success) {\\r\\n                if (error.length > 0) {\\r\\n                    // bubble up the error\\r\\n                    revert(string(error));\\r\\n                } else {\\r\\n                    revert(\\\"LibDiamondCut: _init function reverted\\\");\\r\\n                }\\r\\n            }\\r\\n        }\\r\\n    }\\r\\n\\r\\n    function enforceHasContractCode(\\r\\n        address _contract,\\r\\n        string memory _errorMessage\\r\\n    ) internal view {\\r\\n        uint256 contractSize;\\r\\n        // solhint-disable-next-line no-inline-assembly\\r\\n        assembly {\\r\\n            contractSize := extcodesize(_contract)\\r\\n        }\\r\\n        require(contractSize > 0, _errorMessage);\\r\\n    }\\r\\n}\\r\\n\",\"keccak256\":\"0x3edf6c990e9b8e885c9c7fb000d182fc1a4fe6466ada506197a77b8e536ff657\",\"license\":\"MIT\"},\"src/common/helpers/DiamondReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\r\\npragma solidity 0.8.4;\\r\\n\\r\\n/// @title Reentrancy Guard\\r\\n/// @notice Abstract contract to provide protection against reentrancy\\r\\nabstract contract ReentrancyGuard {\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    ////////////////////////// Storage ///////////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n\\r\\n    bytes32 private constant NAMESPACE =\\r\\n        keccak256(\\\"io.etherspot.helpers.reentrancyguard\\\");\\r\\n\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    ////////////////////////// Structs ///////////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n\\r\\n    struct ReentrancyStorage {\\r\\n        uint256 status;\\r\\n    }\\r\\n\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    ////////////////////////// Errors ////////////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n\\r\\n    error ReentrancyError();\\r\\n\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    ///////////////////////// Constants //////////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n\\r\\n    uint256 private constant _NOT_ENTERED = 0;\\r\\n    uint256 private constant _ENTERED = 1;\\r\\n\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    ///////////////////////// Modifiers ///////////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n\\r\\n    modifier nonReentrant() {\\r\\n        ReentrancyStorage storage s = reentrancyStorage();\\r\\n        if (s.status == _ENTERED) revert ReentrancyError();\\r\\n        s.status = _ENTERED;\\r\\n        _;\\r\\n        s.status = _NOT_ENTERED;\\r\\n    }\\r\\n\\r\\n    //////////////////////////////////////////////////////////////\\r\\n    ////////////////////// Private Functions /////////////////////\\r\\n    //////////////////////////////////////////////////////////////\\r\\n\\r\\n    /// @dev fetch local storage\\r\\n    function reentrancyStorage()\\r\\n        private\\r\\n        pure\\r\\n        returns (ReentrancyStorage storage data)\\r\\n    {\\r\\n        bytes32 position = NAMESPACE;\\r\\n        // solhint-disable-next-line no-inline-assembly\\r\\n        assembly {\\r\\n            data.slot := position\\r\\n        }\\r\\n    }\\r\\n}\\r\\n\",\"keccak256\":\"0x90eaedd37c9a92797c6a914c6c0644ec8bea0dbba96bd1f6378b61ecdf4c9942\",\"license\":\"UNLICENSED\"}},\"version\":1}",
  "bytecode": "0x608060405234801561001057600080fd5b506125df806100206000396000f3fe6080604052600436106100915760003560e01c8063498ee46911610059578063498ee469146101925780634be85c35146101bb578063618c3f29146101e4578063ab8236f314610221578063b8c06ccc1461024a57610091565b80631f8097fb14610096578063217aabb7146100b25780632a8dcdb7146100db57806342d910c614610118578063430dbc3a14610155575b600080fd5b6100b060048036038101906100ab91906117a5565b610273565b005b3480156100be57600080fd5b506100d960048036038101906100d49190611961565b610734565b005b3480156100e757600080fd5b5061010260048036038101906100fd9190611859565b61078c565b60405161010f9190611d9e565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a919061180a565b610824565b60405161014c9190612049565b60405180910390f35b34801561016157600080fd5b5061017c600480360381019061017791906117ce565b610936565b6040516101899190611eef565b60405180910390f35b34801561019e57600080fd5b506101b960048036038101906101b49190611740565b6109b5565b005b3480156101c757600080fd5b506101e260048036038101906101dd91906116ee565b610c66565b005b3480156101f057600080fd5b5061020b60048036038101906102069190611961565b610d5f565b6040516102189190612049565b60405180910390f35b34801561022d57600080fd5b50610248600480360381019061024391906118a8565b610d9e565b005b34801561025657600080fd5b50610271600480360381019061026c9190611859565b610f1c565b005b600061027d610fe6565b90506001816000015414156102be576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600181600001819055506000826000015111610306576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16826020015173ffffffffffffffffffffffffffffffffffffffff1614806103755750600073ffffffffffffffffffffffffffffffffffffffff16826040015173ffffffffffffffffffffffffffffffffffffffff16145b806103b05750600073ffffffffffffffffffffffffffffffffffffffff16826080015173ffffffffffffffffffffffffffffffffffffffff16145b806103eb5750600073ffffffffffffffffffffffffffffffffffffffff168260a0015173ffffffffffffffffffffffffffffffffffffffff16145b15610422576040517f35be3ac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061042c611013565b905060006104508260000160149054906101000a900461ffff168560200151610936565b905060008161ffff161415610491576040517f7790ca9900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006104a585606001518660400151610936565b905060006104e0866060015187608001518660000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610824565b905060006104f18760000151610d5f565b905060008760a0015160405160200161050a9190611c9f565b6040516020818303038152906040529050600088608001516040516020016105329190611cd1565b604051602081830303815290604052905061057833308b600001518c6020015173ffffffffffffffffffffffffffffffffffffffff16611040909392919063ffffffff16565b6105cf8760000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a600001518b6020015173ffffffffffffffffffffffffffffffffffffffff166110c99092919063ffffffff16565b8660000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639fbf10fc858b606001518989338f600001518a604051806060016040528062030d408152602001600081526020016040518060400160405280600281526020017f30780000000000000000000000000000000000000000000000000000000000008152508152508b8b6040518b63ffffffff1660e01b815260040161069899989796959493929190611fa7565b6000604051808303818588803b1580156106b157600080fd5b505af11580156106c5573d6000803e3d6000fd5b50505050507f7a72e6f4a3d77f8a5a6c536a973421c5bf00107f9aec7995661537673b8be08789602001518a60400151338c608001518d600001518e6060015160405161071796959493929190611e1b565b60405180910390a150505050505050600081600001819055505050565b61073c611227565b6000610746611013565b90508181600201819055507f45934903f6b10aff9d3435b8362d284d95d14ca68e8554f05f04c7856a6003c0826040516107809190612049565b60405180910390a15050565b600080610797611013565b90508261ffff168160030160008761ffff1661ffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff161461081757600061081a565b60015b9150509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff16630a512369866001876040516020016108579190611c9f565b604051602081830303815290604052604051806060016040528062030d408152602001600081526020016040518060400160405280600281526020017f30780000000000000000000000000000000000000000000000000000000000008152508152506040518563ffffffff1660e01b81526004016108d99493929190611f41565b604080518083038186803b1580156108f057600080fd5b505afa158015610904573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092891906119b3565b509050809150509392505050565b600080610941611013565b90508060030160008561ffff1661ffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1691505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a1c576040517f35be3ac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a24611227565b6000610a2e611013565b9050828160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818160000160146101000a81548161ffff021916908361ffff16021790555060328160020181905550610abd600173a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001610f1c565b610ade600173dac17f958d2ee523a2206206994597c13d831ec76002610f1c565b610aff60027355d398326f99059ff775485246999027b31979556002610f1c565b610b20600273e9e7cea3dedca5984780bafc599bd69add087d566005610f1c565b610b41600673b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001610f1c565b610b626006739702230a8ea53601f5cd2dc00fdbc13d4df4a8c76002610f1c565b610b836009732791bca1f2de4661ed88a30c99a7a9449aa841746001610f1c565b610ba4600973c2132d05d31c914a87c6611c10748aeb04b58e8f6002610f1c565b610bc5600a73ff970a61a04b1ca14834a43f5de4533ebddb5cc86001610f1c565b610be6600a73fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb96002610f1c565b610c07600b737f5c764cbc14f9669b88837ca1490cca17c316076001610f1c565b610c28600c7304068da6c83afcfa0e13ba15a6696662335d5b756001610f1c565b7fc8ec31998a27444f477c01de93c393769fd4fc017fb63163f71f8a8ab72ccd508383604051610c59929190611d4c565b60405180910390a1505050565b610c6e611227565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610cd5576040517f3911c65500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610cdf611013565b9050818160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f9ac04272c4559bf7459414abb5568dc1df58ab649f0af4afd1510074f5cc2fec82604051610d539190611cd1565b60405180910390a15050565b600080610d6a611013565b90506127108160020154612710610d819190612199565b84610d8c919061213f565b610d96919061210e565b915050919050565b6000610da8611013565b90508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e33576040517fdade3c7100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082806020019051810190610e499190611717565b90508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82866040518363ffffffff1660e01b8152600401610e86929190611d75565b602060405180830381600087803b158015610ea057600080fd5b505af1158015610eb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed8919061177c565b507f827e3293895509ef037b7438d4e009f37ad7b2562a14695d9dfd9cb0659842188585604051610f0a929190611d75565b60405180910390a15050505050505050565b610f24611227565b6000610f2e611013565b9050818160030160008661ffff1661ffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff1602179055507f85adba3a23dc45072c12199244adfbf4c1d736a46ac453eb732f4e5158af5867848484604051610fd893929190611f0a565b60405180910390a150505050565b6000807fc59b5acc5a6673a6c49ca2de898f87adbd9fdfdff36f689476b1c9e0c50964b490508091505090565b6000807fbaeadb48cbcf0176d6c6ac156b0140abe0fb28a100a9a6a8b5df37e55693b1c890508091505090565b6110c3846323b872dd60e01b85858560405160240161106193929190611d15565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506112c2565b50505050565b6000811480611162575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401611110929190611cec565b60206040518083038186803b15801561112857600080fd5b505afa15801561113c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611160919061198a565b145b6111a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119890611ecf565b60405180910390fd5b6112228363095ea7b360e01b84846040516024016111c0929190611d75565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506112c2565b505050565b61122f611389565b60040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b790611ddb565b60405180910390fd5b565b6000611324826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113b69092919063ffffffff16565b90506000815111156113845780806020019051810190611344919061177c565b611383576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137a90611eaf565b60405180910390fd5b5b505050565b6000807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90508091505090565b60606113c584846000856113ce565b90509392505050565b606082471015611413576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140a90611dfb565b60405180910390fd5b61141c856114e2565b61145b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145290611e8f565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114849190611cba565b60006040518083038185875af1925050503d80600081146114c1576040519150601f19603f3d011682016040523d82523d6000602084013e6114c6565b606091505b50915091506114d6828286611505565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6060831561151557829050611565565b6000835111156115285782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c9190611db9565b60405180910390fd5b9392505050565b600061157f61157a84612089565b612064565b90508281526020810184848401111561159757600080fd5b6115a2848285612266565b509392505050565b6000813590506115b98161255f565b92915050565b6000815190506115ce81612576565b92915050565b6000815190506115e38161258d565b92915050565b600082601f8301126115fa57600080fd5b813561160a84826020860161156c565b91505092915050565b600060c0828403121561162557600080fd5b61162f60c0612064565b9050600061163f848285016116c4565b6000830152506020611653848285016115aa565b6020830152506040611667848285016115aa565b604083015250606061167b848285016116af565b606083015250608061168f848285016115aa565b60808301525060a06116a3848285016115aa565b60a08301525092915050565b6000813590506116be816125a4565b92915050565b6000813590506116d3816125bb565b92915050565b6000815190506116e8816125bb565b92915050565b60006020828403121561170057600080fd5b600061170e848285016115aa565b91505092915050565b60006020828403121561172957600080fd5b6000611737848285016115bf565b91505092915050565b6000806040838503121561175357600080fd5b6000611761858286016115aa565b9250506020611772858286016116af565b9150509250929050565b60006020828403121561178e57600080fd5b600061179c848285016115d4565b91505092915050565b600060c082840312156117b757600080fd5b60006117c584828501611613565b91505092915050565b600080604083850312156117e157600080fd5b60006117ef858286016116af565b9250506020611800858286016115aa565b9150509250929050565b60008060006060848603121561181f57600080fd5b600061182d868287016116af565b935050602061183e868287016115aa565b925050604061184f868287016115aa565b9150509250925092565b60008060006060848603121561186e57600080fd5b600061187c868287016116af565b935050602061188d868287016115aa565b925050604061189e868287016116af565b9150509250925092565b60008060008060008060c087890312156118c157600080fd5b60006118cf89828a016116af565b965050602087013567ffffffffffffffff8111156118ec57600080fd5b6118f889828a016115e9565b955050604061190989828a016116c4565b945050606061191a89828a016115aa565b935050608061192b89828a016116c4565b92505060a087013567ffffffffffffffff81111561194857600080fd5b61195489828a016115e9565b9150509295509295509295565b60006020828403121561197357600080fd5b6000611981848285016116c4565b91505092915050565b60006020828403121561199c57600080fd5b60006119aa848285016116d9565b91505092915050565b600080604083850312156119c657600080fd5b60006119d4858286016116d9565b92505060206119e5858286016116d9565b9150509250929050565b6119f8816121df565b82525050565b611a07816121cd565b82525050565b611a1e611a19826121cd565b6122d9565b82525050565b611a2d816121f1565b82525050565b6000611a3e826120ba565b611a4881856120d0565b9350611a58818560208601612275565b611a618161238a565b840191505092915050565b6000611a77826120ba565b611a8181856120e1565b9350611a91818560208601612275565b611a9a8161238a565b840191505092915050565b6000611ab0826120ba565b611aba81856120f2565b9350611aca818560208601612275565b80840191505092915050565b611adf81612242565b82525050565b6000611af0826120c5565b611afa81856120fd565b9350611b0a818560208601612275565b611b138161238a565b840191505092915050565b6000611b2b6022836120fd565b9150611b36826123a8565b604082019050919050565b6000611b4e6002836120e1565b9150611b59826123f7565b602082019050919050565b6000611b716026836120fd565b9150611b7c82612420565b604082019050919050565b6000611b946008836120fd565b9150611b9f8261246f565b602082019050919050565b6000611bb7601d836120fd565b9150611bc282612498565b602082019050919050565b6000611bda602a836120fd565b9150611be5826124c1565b604082019050919050565b6000611bfd6036836120fd565b9150611c0882612510565b604082019050919050565b6000606083016000830151611c2b6000860182611c81565b506020830151611c3e6020860182611c81565b5060408301518482036040860152611c568282611a33565b9150508091505092915050565b611c6c816121fd565b82525050565b611c7b81612254565b82525050565b611c8a8161222b565b82525050565b611c998161222b565b82525050565b6000611cab8284611a0d565b60148201915081905092915050565b6000611cc68284611aa5565b915081905092915050565b6000602082019050611ce660008301846119fe565b92915050565b6000604082019050611d0160008301856119fe565b611d0e60208301846119fe565b9392505050565b6000606082019050611d2a60008301866119fe565b611d3760208301856119fe565b611d446040830184611c90565b949350505050565b6000604082019050611d6160008301856119fe565b611d6e6020830184611c63565b9392505050565b6000604082019050611d8a60008301856119fe565b611d976020830184611c90565b9392505050565b6000602082019050611db36000830184611a24565b92915050565b60006020820190508181036000830152611dd38184611ae5565b905092915050565b60006020820190508181036000830152611df481611b1e565b9050919050565b60006020820190508181036000830152611e1481611b64565b9050919050565b600060e0820190508181036000830152611e3481611b87565b9050611e4360208301896119fe565b611e5060408301886119fe565b611e5d60608301876119fe565b611e6a60808301866119fe565b611e7760a0830185611c90565b611e8460c0830184611c63565b979650505050505050565b60006020820190508181036000830152611ea881611baa565b9050919050565b60006020820190508181036000830152611ec881611bcd565b9050919050565b60006020820190508181036000830152611ee881611bf0565b9050919050565b6000602082019050611f046000830184611c63565b92915050565b6000606082019050611f1f6000830186611c63565b611f2c60208301856119fe565b611f396040830184611c63565b949350505050565b600060a082019050611f566000830187611c63565b611f636020830186611ad6565b8181036040830152611f758185611a6c565b90508181036060830152611f8881611b41565b90508181036080830152611f9c8184611c13565b905095945050505050565b600061012082019050611fbd600083018c611c63565b611fca602083018b611c72565b611fd7604083018a611c72565b611fe460608301896119ef565b611ff16080830188611c90565b611ffe60a0830187611c90565b81810360c08301526120108186611c13565b905081810360e08301526120248185611a6c565b90508181036101008301526120398184611a6c565b90509a9950505050505050505050565b600060208201905061205e6000830184611c90565b92915050565b600061206e61207f565b905061207a82826122a8565b919050565b6000604051905090565b600067ffffffffffffffff8211156120a4576120a361235b565b5b6120ad8261238a565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60006121198261222b565b91506121248361222b565b9250826121345761213361232c565b5b828204905092915050565b600061214a8261222b565b91506121558361222b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561218e5761218d6122fd565b5b828202905092915050565b60006121a48261222b565b91506121af8361222b565b9250828210156121c2576121c16122fd565b5b828203905092915050565b60006121d88261220b565b9050919050565b60006121ea8261220b565b9050919050565b60008115159050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061224d82612235565b9050919050565b600061225f826121fd565b9050919050565b82818337600083830152505050565b60005b83811015612293578082015181840152602081019050612278565b838111156122a2576000848401525b50505050565b6122b18261238a565b810181811067ffffffffffffffff821117156122d0576122cf61235b565b5b80604052505050565b60006122e4826122eb565b9050919050565b60006122f68261239b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f4c69624469616d6f6e643a204d75737420626520636f6e7472616374206f776e60008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b7f3078000000000000000000000000000000000000000000000000000000000000600082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f7374617267617465000000000000000000000000000000000000000000000000600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60008201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000602082015250565b612568816121cd565b811461257357600080fd5b50565b61257f816121df565b811461258a57600080fd5b50565b612596816121f1565b81146125a157600080fd5b50565b6125ad816121fd565b81146125b857600080fd5b50565b6125c48161222b565b81146125cf57600080fd5b5056fea164736f6c6343000804000a",
  "deployedBytecode": "0x6080604052600436106100915760003560e01c8063498ee46911610059578063498ee469146101925780634be85c35146101bb578063618c3f29146101e4578063ab8236f314610221578063b8c06ccc1461024a57610091565b80631f8097fb14610096578063217aabb7146100b25780632a8dcdb7146100db57806342d910c614610118578063430dbc3a14610155575b600080fd5b6100b060048036038101906100ab91906117a5565b610273565b005b3480156100be57600080fd5b506100d960048036038101906100d49190611961565b610734565b005b3480156100e757600080fd5b5061010260048036038101906100fd9190611859565b61078c565b60405161010f9190611d9e565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a919061180a565b610824565b60405161014c9190612049565b60405180910390f35b34801561016157600080fd5b5061017c600480360381019061017791906117ce565b610936565b6040516101899190611eef565b60405180910390f35b34801561019e57600080fd5b506101b960048036038101906101b49190611740565b6109b5565b005b3480156101c757600080fd5b506101e260048036038101906101dd91906116ee565b610c66565b005b3480156101f057600080fd5b5061020b60048036038101906102069190611961565b610d5f565b6040516102189190612049565b60405180910390f35b34801561022d57600080fd5b50610248600480360381019061024391906118a8565b610d9e565b005b34801561025657600080fd5b50610271600480360381019061026c9190611859565b610f1c565b005b600061027d610fe6565b90506001816000015414156102be576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600181600001819055506000826000015111610306576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16826020015173ffffffffffffffffffffffffffffffffffffffff1614806103755750600073ffffffffffffffffffffffffffffffffffffffff16826040015173ffffffffffffffffffffffffffffffffffffffff16145b806103b05750600073ffffffffffffffffffffffffffffffffffffffff16826080015173ffffffffffffffffffffffffffffffffffffffff16145b806103eb5750600073ffffffffffffffffffffffffffffffffffffffff168260a0015173ffffffffffffffffffffffffffffffffffffffff16145b15610422576040517f35be3ac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061042c611013565b905060006104508260000160149054906101000a900461ffff168560200151610936565b905060008161ffff161415610491576040517f7790ca9900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006104a585606001518660400151610936565b905060006104e0866060015187608001518660000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610824565b905060006104f18760000151610d5f565b905060008760a0015160405160200161050a9190611c9f565b6040516020818303038152906040529050600088608001516040516020016105329190611cd1565b604051602081830303815290604052905061057833308b600001518c6020015173ffffffffffffffffffffffffffffffffffffffff16611040909392919063ffffffff16565b6105cf8760000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168a600001518b6020015173ffffffffffffffffffffffffffffffffffffffff166110c99092919063ffffffff16565b8660000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639fbf10fc858b606001518989338f600001518a604051806060016040528062030d408152602001600081526020016040518060400160405280600281526020017f30780000000000000000000000000000000000000000000000000000000000008152508152508b8b6040518b63ffffffff1660e01b815260040161069899989796959493929190611fa7565b6000604051808303818588803b1580156106b157600080fd5b505af11580156106c5573d6000803e3d6000fd5b50505050507f7a72e6f4a3d77f8a5a6c536a973421c5bf00107f9aec7995661537673b8be08789602001518a60400151338c608001518d600001518e6060015160405161071796959493929190611e1b565b60405180910390a150505050505050600081600001819055505050565b61073c611227565b6000610746611013565b90508181600201819055507f45934903f6b10aff9d3435b8362d284d95d14ca68e8554f05f04c7856a6003c0826040516107809190612049565b60405180910390a15050565b600080610797611013565b90508261ffff168160030160008761ffff1661ffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1661ffff161461081757600061081a565b60015b9150509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff16630a512369866001876040516020016108579190611c9f565b604051602081830303815290604052604051806060016040528062030d408152602001600081526020016040518060400160405280600281526020017f30780000000000000000000000000000000000000000000000000000000000008152508152506040518563ffffffff1660e01b81526004016108d99493929190611f41565b604080518083038186803b1580156108f057600080fd5b505afa158015610904573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092891906119b3565b509050809150509392505050565b600080610941611013565b90508060030160008561ffff1661ffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900461ffff1691505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a1c576040517f35be3ac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a24611227565b6000610a2e611013565b9050828160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818160000160146101000a81548161ffff021916908361ffff16021790555060328160020181905550610abd600173a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001610f1c565b610ade600173dac17f958d2ee523a2206206994597c13d831ec76002610f1c565b610aff60027355d398326f99059ff775485246999027b31979556002610f1c565b610b20600273e9e7cea3dedca5984780bafc599bd69add087d566005610f1c565b610b41600673b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e6001610f1c565b610b626006739702230a8ea53601f5cd2dc00fdbc13d4df4a8c76002610f1c565b610b836009732791bca1f2de4661ed88a30c99a7a9449aa841746001610f1c565b610ba4600973c2132d05d31c914a87c6611c10748aeb04b58e8f6002610f1c565b610bc5600a73ff970a61a04b1ca14834a43f5de4533ebddb5cc86001610f1c565b610be6600a73fd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb96002610f1c565b610c07600b737f5c764cbc14f9669b88837ca1490cca17c316076001610f1c565b610c28600c7304068da6c83afcfa0e13ba15a6696662335d5b756001610f1c565b7fc8ec31998a27444f477c01de93c393769fd4fc017fb63163f71f8a8ab72ccd508383604051610c59929190611d4c565b60405180910390a1505050565b610c6e611227565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610cd5576040517f3911c65500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610cdf611013565b9050818160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f9ac04272c4559bf7459414abb5568dc1df58ab649f0af4afd1510074f5cc2fec82604051610d539190611cd1565b60405180910390a15050565b600080610d6a611013565b90506127108160020154612710610d819190612199565b84610d8c919061213f565b610d96919061210e565b915050919050565b6000610da8611013565b90508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e33576040517fdade3c7100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082806020019051810190610e499190611717565b90508473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82866040518363ffffffff1660e01b8152600401610e86929190611d75565b602060405180830381600087803b158015610ea057600080fd5b505af1158015610eb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed8919061177c565b507f827e3293895509ef037b7438d4e009f37ad7b2562a14695d9dfd9cb0659842188585604051610f0a929190611d75565b60405180910390a15050505050505050565b610f24611227565b6000610f2e611013565b9050818160030160008661ffff1661ffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548161ffff021916908361ffff1602179055507f85adba3a23dc45072c12199244adfbf4c1d736a46ac453eb732f4e5158af5867848484604051610fd893929190611f0a565b60405180910390a150505050565b6000807fc59b5acc5a6673a6c49ca2de898f87adbd9fdfdff36f689476b1c9e0c50964b490508091505090565b6000807fbaeadb48cbcf0176d6c6ac156b0140abe0fb28a100a9a6a8b5df37e55693b1c890508091505090565b6110c3846323b872dd60e01b85858560405160240161106193929190611d15565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506112c2565b50505050565b6000811480611162575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401611110929190611cec565b60206040518083038186803b15801561112857600080fd5b505afa15801561113c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611160919061198a565b145b6111a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119890611ecf565b60405180910390fd5b6112228363095ea7b360e01b84846040516024016111c0929190611d75565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506112c2565b505050565b61122f611389565b60040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b790611ddb565b60405180910390fd5b565b6000611324826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166113b69092919063ffffffff16565b90506000815111156113845780806020019051810190611344919061177c565b611383576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137a90611eaf565b60405180910390fd5b5b505050565b6000807fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c90508091505090565b60606113c584846000856113ce565b90509392505050565b606082471015611413576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140a90611dfb565b60405180910390fd5b61141c856114e2565b61145b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145290611e8f565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114849190611cba565b60006040518083038185875af1925050503d80600081146114c1576040519150601f19603f3d011682016040523d82523d6000602084013e6114c6565b606091505b50915091506114d6828286611505565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6060831561151557829050611565565b6000835111156115285782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c9190611db9565b60405180910390fd5b9392505050565b600061157f61157a84612089565b612064565b90508281526020810184848401111561159757600080fd5b6115a2848285612266565b509392505050565b6000813590506115b98161255f565b92915050565b6000815190506115ce81612576565b92915050565b6000815190506115e38161258d565b92915050565b600082601f8301126115fa57600080fd5b813561160a84826020860161156c565b91505092915050565b600060c0828403121561162557600080fd5b61162f60c0612064565b9050600061163f848285016116c4565b6000830152506020611653848285016115aa565b6020830152506040611667848285016115aa565b604083015250606061167b848285016116af565b606083015250608061168f848285016115aa565b60808301525060a06116a3848285016115aa565b60a08301525092915050565b6000813590506116be816125a4565b92915050565b6000813590506116d3816125bb565b92915050565b6000815190506116e8816125bb565b92915050565b60006020828403121561170057600080fd5b600061170e848285016115aa565b91505092915050565b60006020828403121561172957600080fd5b6000611737848285016115bf565b91505092915050565b6000806040838503121561175357600080fd5b6000611761858286016115aa565b9250506020611772858286016116af565b9150509250929050565b60006020828403121561178e57600080fd5b600061179c848285016115d4565b91505092915050565b600060c082840312156117b757600080fd5b60006117c584828501611613565b91505092915050565b600080604083850312156117e157600080fd5b60006117ef858286016116af565b9250506020611800858286016115aa565b9150509250929050565b60008060006060848603121561181f57600080fd5b600061182d868287016116af565b935050602061183e868287016115aa565b925050604061184f868287016115aa565b9150509250925092565b60008060006060848603121561186e57600080fd5b600061187c868287016116af565b935050602061188d868287016115aa565b925050604061189e868287016116af565b9150509250925092565b60008060008060008060c087890312156118c157600080fd5b60006118cf89828a016116af565b965050602087013567ffffffffffffffff8111156118ec57600080fd5b6118f889828a016115e9565b955050604061190989828a016116c4565b945050606061191a89828a016115aa565b935050608061192b89828a016116c4565b92505060a087013567ffffffffffffffff81111561194857600080fd5b61195489828a016115e9565b9150509295509295509295565b60006020828403121561197357600080fd5b6000611981848285016116c4565b91505092915050565b60006020828403121561199c57600080fd5b60006119aa848285016116d9565b91505092915050565b600080604083850312156119c657600080fd5b60006119d4858286016116d9565b92505060206119e5858286016116d9565b9150509250929050565b6119f8816121df565b82525050565b611a07816121cd565b82525050565b611a1e611a19826121cd565b6122d9565b82525050565b611a2d816121f1565b82525050565b6000611a3e826120ba565b611a4881856120d0565b9350611a58818560208601612275565b611a618161238a565b840191505092915050565b6000611a77826120ba565b611a8181856120e1565b9350611a91818560208601612275565b611a9a8161238a565b840191505092915050565b6000611ab0826120ba565b611aba81856120f2565b9350611aca818560208601612275565b80840191505092915050565b611adf81612242565b82525050565b6000611af0826120c5565b611afa81856120fd565b9350611b0a818560208601612275565b611b138161238a565b840191505092915050565b6000611b2b6022836120fd565b9150611b36826123a8565b604082019050919050565b6000611b4e6002836120e1565b9150611b59826123f7565b602082019050919050565b6000611b716026836120fd565b9150611b7c82612420565b604082019050919050565b6000611b946008836120fd565b9150611b9f8261246f565b602082019050919050565b6000611bb7601d836120fd565b9150611bc282612498565b602082019050919050565b6000611bda602a836120fd565b9150611be5826124c1565b604082019050919050565b6000611bfd6036836120fd565b9150611c0882612510565b604082019050919050565b6000606083016000830151611c2b6000860182611c81565b506020830151611c3e6020860182611c81565b5060408301518482036040860152611c568282611a33565b9150508091505092915050565b611c6c816121fd565b82525050565b611c7b81612254565b82525050565b611c8a8161222b565b82525050565b611c998161222b565b82525050565b6000611cab8284611a0d565b60148201915081905092915050565b6000611cc68284611aa5565b915081905092915050565b6000602082019050611ce660008301846119fe565b92915050565b6000604082019050611d0160008301856119fe565b611d0e60208301846119fe565b9392505050565b6000606082019050611d2a60008301866119fe565b611d3760208301856119fe565b611d446040830184611c90565b949350505050565b6000604082019050611d6160008301856119fe565b611d6e6020830184611c63565b9392505050565b6000604082019050611d8a60008301856119fe565b611d976020830184611c90565b9392505050565b6000602082019050611db36000830184611a24565b92915050565b60006020820190508181036000830152611dd38184611ae5565b905092915050565b60006020820190508181036000830152611df481611b1e565b9050919050565b60006020820190508181036000830152611e1481611b64565b9050919050565b600060e0820190508181036000830152611e3481611b87565b9050611e4360208301896119fe565b611e5060408301886119fe565b611e5d60608301876119fe565b611e6a60808301866119fe565b611e7760a0830185611c90565b611e8460c0830184611c63565b979650505050505050565b60006020820190508181036000830152611ea881611baa565b9050919050565b60006020820190508181036000830152611ec881611bcd565b9050919050565b60006020820190508181036000830152611ee881611bf0565b9050919050565b6000602082019050611f046000830184611c63565b92915050565b6000606082019050611f1f6000830186611c63565b611f2c60208301856119fe565b611f396040830184611c63565b949350505050565b600060a082019050611f566000830187611c63565b611f636020830186611ad6565b8181036040830152611f758185611a6c565b90508181036060830152611f8881611b41565b90508181036080830152611f9c8184611c13565b905095945050505050565b600061012082019050611fbd600083018c611c63565b611fca602083018b611c72565b611fd7604083018a611c72565b611fe460608301896119ef565b611ff16080830188611c90565b611ffe60a0830187611c90565b81810360c08301526120108186611c13565b905081810360e08301526120248185611a6c565b90508181036101008301526120398184611a6c565b90509a9950505050505050505050565b600060208201905061205e6000830184611c90565b92915050565b600061206e61207f565b905061207a82826122a8565b919050565b6000604051905090565b600067ffffffffffffffff8211156120a4576120a361235b565b5b6120ad8261238a565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60006121198261222b565b91506121248361222b565b9250826121345761213361232c565b5b828204905092915050565b600061214a8261222b565b91506121558361222b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561218e5761218d6122fd565b5b828202905092915050565b60006121a48261222b565b91506121af8361222b565b9250828210156121c2576121c16122fd565b5b828203905092915050565b60006121d88261220b565b9050919050565b60006121ea8261220b565b9050919050565b60008115159050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061224d82612235565b9050919050565b600061225f826121fd565b9050919050565b82818337600083830152505050565b60005b83811015612293578082015181840152602081019050612278565b838111156122a2576000848401525b50505050565b6122b18261238a565b810181811067ffffffffffffffff821117156122d0576122cf61235b565b5b80604052505050565b60006122e4826122eb565b9050919050565b60006122f68261239b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f4c69624469616d6f6e643a204d75737420626520636f6e7472616374206f776e60008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b7f3078000000000000000000000000000000000000000000000000000000000000600082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f7374617267617465000000000000000000000000000000000000000000000000600082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60008201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000602082015250565b612568816121cd565b811461257357600080fd5b50565b61257f816121df565b811461258a57600080fd5b50565b612596816121f1565b81146125a157600080fd5b50565b6125ad816121fd565b81146125b857600080fd5b50565b6125c48161222b565b81146125cf57600080fd5b5056fea164736f6c6343000804000a",
  "devdoc": {
    "author": "Luke Wickens <luke@pillarproject.io>",
    "kind": "dev",
    "methods": {
      "sgAddPool(uint16,address,uint16)": {
        "params": {
          "_chainId": "Chain id of new pool (NOT actual chain id - check stargate pool ids docs)",
          "_poolId": "Pool id (check stargate pool ids docs)",
          "_token": "Address of token"
        }
      },
      "sgBridgeTokens((uint256,address,address,uint16,address,address))": {
        "params": {
          "_sgData": "- struct containing information required to execute bridge"
        }
      },
      "sgCalculateFees(uint16,address,address)": {
        "params": {
          "_destChain": "Destination chain id",
          "_receiver": "Receiver on destination chain",
          "_router": "Address of stargate router"
        }
      },
      "sgCheckPoolId(uint16,address,uint16)": {
        "params": {
          "_chainId": "Chain id of new pool (NOT actual chain id - check stargate pool ids docs)",
          "_poolId": "Pool id (check stargate pool ids docs)",
          "_token": "Address of token"
        }
      },
      "sgInitialize(address,uint16)": {
        "params": {
          "_chainId": "- current chain id",
          "_stargateRouter": "- address of the Stargate router contract"
        }
      },
      "sgMinAmountOut(uint256)": {
        "params": {
          "_amount": "Transfer amount"
        }
      },
      "sgReceive(uint16,bytes,uint256,address,uint256,bytes)": {
        "params": {
          "_chainId": "The remote chainId sending the tokens",
          "_nonce": "The message ordering nonce",
          "_payload": "The bytes containing the toAddress",
          "_srcAddress": "The remote Bridge address",
          "_token": "The token contract on the local chain",
          "amountLD": "The qty of local _token contract tokens"
        }
      },
      "sgRetrievePoolId(uint16,address)": {
        "params": {
          "_chainId": "Chain id of new pool (NOT actual chain id - check stargate pool ids docs)",
          "_token": "Address of token"
        }
      },
      "sgUpdateRouter(address)": {
        "params": {
          "_newAddress": "Address of the new router"
        }
      },
      "sgUpdateSlippageTolerance(uint256)": {
        "params": {
          "_newSlippage": "New slippage amount"
        }
      }
    },
    "title": "StargateFacet",
    "version": 1
  },
  "userdoc": {
    "kind": "user",
    "methods": {
      "sgAddPool(uint16,address,uint16)": {
        "notice": "Adds a new pool for a specific token and chain"
      },
      "sgBridgeTokens((uint256,address,address,uint16,address,address))": {
        "notice": "initializes state variables for the stargate facet"
      },
      "sgCalculateFees(uint16,address,address)": {
        "notice": "Calculates cross chain fee"
      },
      "sgCheckPoolId(uint16,address,uint16)": {
        "notice": "Checks for a valid token pool on specific chain"
      },
      "sgInitialize(address,uint16)": {
        "notice": "initializes state variables for the Stargate facet"
      },
      "sgMinAmountOut(uint256)": {
        "notice": "Calculates the minimum amount out using slippage tolerance"
      },
      "sgReceive(uint16,bytes,uint256,address,uint256,bytes)": {
        "notice": "required to receive tokens on destination chain"
      },
      "sgRetrievePoolId(uint16,address)": {
        "notice": "Retrieves pool id for a token on a specified chain"
      },
      "sgUpdateRouter(address)": {
        "notice": "Updates stargate router address for deployed chain"
      },
      "sgUpdateSlippageTolerance(uint256)": {
        "notice": "Updates slippage tolerance amount"
      }
    },
    "notice": "Stargate/LayerZero intergration for bridging tokens",
    "version": 1
  },
  "storageLayout": {
    "storage": [],
    "types": null
  }
}