@etherspot/contracts
Version:
Etherspot Solidity contracts
458 lines • 116 kB
JSON
{
"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": "0x20ec26406abc089ecf6e114b1ac1f3c8c179f61724ff269387956d9f14662df5",
"receipt": {
"to": "0x4e59b44847b379578588920cA78FbF26c0B4956C",
"from": "0x53fE9288897e254698175740aa359E19E26c10af",
"contractAddress": null,
"transactionIndex": 1,
"gasUsed": "2142581",
"logsBloom": "0x00000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000004000000000000000000000000000000000000000000000000080000000400000000000000000000000000000000000000000000000000080000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000000000000000000000100040000000000000000000000000000000000000000000800000000000000000000000100000",
"blockHash": "0x6b11b89121acb874330aa90bad47452003841600aed97d81c0adc36437ff830f",
"transactionHash": "0x20ec26406abc089ecf6e114b1ac1f3c8c179f61724ff269387956d9f14662df5",
"logs": [
{
"transactionIndex": 1,
"blockNumber": 27757282,
"transactionHash": "0x20ec26406abc089ecf6e114b1ac1f3c8c179f61724ff269387956d9f14662df5",
"address": "0x0000000000000000000000000000000000001010",
"topics": [
"0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63",
"0x0000000000000000000000000000000000000000000000000000000000001010",
"0x00000000000000000000000053fe9288897e254698175740aa359e19e26c10af",
"0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f"
],
"data": "0x00000000000000000000000000000000000000000000000000260db7a248d919000000000000000000000000000000000000000000000000278126e3f5e9400000000000000000000000000000000000000000000000245c2a1093cae075361a000000000000000000000000000000000000000000000000275b192c53a066e700000000000000000000000000000000000000000000245c2a36a18282be0f33",
"logIndex": 11,
"blockHash": "0x6b11b89121acb874330aa90bad47452003841600aed97d81c0adc36437ff830f"
}
],
"blockNumber": 27757282,
"cumulativeGasUsed": "2899308",
"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