diff --git a/package.json b/package.json index 7ab6d3f8d..597ce6f59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swapr/frontend", - "version": "1.0.0-beta.22.2", + "version": "1.0.0-beta.22.3", "private": true, "description": "DXswap Decentralized Application", "license": "GPL-3.0-or-later", @@ -48,7 +48,7 @@ "@reduxjs/toolkit": "^1.9.5", "@swapr/core": "^0.3.19", "@swapr/periphery": "^0.3.22", - "@swapr/sdk": "1.11.3", + "@swapr/sdk": "1.11.4", "@tanstack/react-query": "4.24.6", "@uniswap/token-lists": "^1.0.0-beta.27", "@uniswap/v3-periphery": "1.4.1", diff --git a/src/assets/images/openocean-logo.png b/src/assets/images/openocean-logo.png new file mode 100644 index 000000000..c4eff3983 Binary files /dev/null and b/src/assets/images/openocean-logo.png differ diff --git a/src/constants/index.tsx b/src/constants/index.tsx index 308899fd2..b27bd7201 100644 --- a/src/constants/index.tsx +++ b/src/constants/index.tsx @@ -40,6 +40,7 @@ import LevinswapLogo from '../assets/images/levinswap-logo.svg' import SwaprLogo from '../assets/images/logo.svg' import ZeroXLogo from '../assets/images/logos/ZeroX.svg' import Metamask from '../assets/images/metamask.png' +import OpenoceanLogo from '../assets/images/openocean-logo.png' import QuickswapLogo from '../assets/images/quickswap-logo.png' import SushiswapNewLogo from '../assets/images/sushiswap-new-logo.svg' import SwaprV3Logo from '../assets/images/swapr-v3-logo.svg' @@ -683,6 +684,7 @@ export const RoutablePlatformKeysByNetwork = { RoutablePlatform.UNISWAP.name, UniswapV2RoutablePlatform.SUSHISWAP.name, RoutablePlatform.ONE_INCH.name, + RoutablePlatform.OPENOCEAN.name, ], [ChainId.ARBITRUM_RINKEBY]: [ UniswapV2RoutablePlatform.SWAPR.name, @@ -698,6 +700,7 @@ export const RoutablePlatformKeysByNetwork = { UniswapV2RoutablePlatform.SUSHISWAP.name, UniswapV2RoutablePlatform.PANCAKESWAP.name, RoutablePlatform.ONE_INCH.name, + RoutablePlatform.OPENOCEAN.name, ], [ChainId.BSC_TESTNET]: [], [ChainId.GOERLI]: [], @@ -708,6 +711,7 @@ export const RoutablePlatformKeysByNetwork = { RoutablePlatform.ZEROX.name, RoutablePlatform.GNOSIS_PROTOCOL.name, RoutablePlatform.ONE_INCH.name, + RoutablePlatform.OPENOCEAN.name, ], [ChainId.OPTIMISM_GOERLI]: [], [ChainId.OPTIMISM_MAINNET]: [ @@ -716,6 +720,7 @@ export const RoutablePlatformKeysByNetwork = { RoutablePlatform.CURVE.name, RoutablePlatform.VELODROME.name, RoutablePlatform.ONE_INCH.name, + RoutablePlatform.OPENOCEAN.name, ], [ChainId.POLYGON]: [ RoutablePlatform.UNISWAP.name, @@ -724,6 +729,7 @@ export const RoutablePlatformKeysByNetwork = { UniswapV2RoutablePlatform.DFYN.name, RoutablePlatform.ZEROX.name, RoutablePlatform.ONE_INCH.name, + RoutablePlatform.OPENOCEAN.name, ], [ChainId.RINKEBY]: [ UniswapV2RoutablePlatform.SWAPR.name, @@ -734,7 +740,7 @@ export const RoutablePlatformKeysByNetwork = { UniswapV2RoutablePlatform.BAOSWAP.name, RoutablePlatform.CURVE.name, ], - [ChainId.SCROLL_MAINNET]: [RoutablePlatform.SUSHISWAP.name], + [ChainId.SCROLL_MAINNET]: [RoutablePlatform.OPENOCEAN.name, RoutablePlatform.SUSHISWAP.name], [ChainId.XDAI]: [ UniswapV2RoutablePlatform.SWAPR.name, RoutablePlatform.UNISWAP.name, @@ -745,8 +751,9 @@ export const RoutablePlatformKeysByNetwork = { RoutablePlatform.CURVE.name, RoutablePlatform.GNOSIS_PROTOCOL.name, RoutablePlatform.ONE_INCH.name, + RoutablePlatform.OPENOCEAN.name, ], - [ChainId.ZK_SYNC_ERA_MAINNET]: [RoutablePlatform.ONE_INCH.name], + [ChainId.ZK_SYNC_ERA_MAINNET]: [RoutablePlatform.ONE_INCH.name, RoutablePlatform.OPENOCEAN.name], [ChainId.ZK_SYNC_ERA_TESTNET]: [], } @@ -869,6 +876,12 @@ export const ROUTABLE_PLATFORM_STYLE: { gradientColor: '#FB52A1', name: RoutablePlatform.SUSHISWAP.name, }, + [RoutablePlatform.OPENOCEAN.name]: { + logo: OpenoceanLogo, + alt: RoutablePlatform.OPENOCEAN.name, + gradientColor: '#FB52A1', + name: RoutablePlatform.OPENOCEAN.name, + }, } export const ROUTABLE_PLATFORM_LOGO: { @@ -892,6 +905,7 @@ export const ROUTABLE_PLATFORM_LOGO: { [RoutablePlatform.VELODROME.name]: Velodrome, [RoutablePlatform.SWAPR_V3.name]: Swapr v3, [RoutablePlatform.SUSHISWAP.name]: sushiswap, + [RoutablePlatform.OPENOCEAN.name]: openocean, } export const ChainLabel: any = { diff --git a/src/constants/urls.ts b/src/constants/urls.ts index 79c3da403..5a34cfb28 100644 --- a/src/constants/urls.ts +++ b/src/constants/urls.ts @@ -2,3 +2,8 @@ export const DISCORD_INVITE_LINK = process.env.DISCORD_INVITE_URL ?? 'https://di export const LIQUIDITY_V3_LINK = process.env.LIQUIDITY_V3_URL ?? 'https://v3.swapr.eth.limo/' export const LIQUIDITY_V3_INFO_POOLS_LINK = `${LIQUIDITY_V3_LINK}#/info/pools` export const STACKLY_URL = process.env.REACT_APP_STACKLY_URL ?? 'https://www.stackly.app/' +export const SWAPR_DOCS_BASE_URL = 'https://swapr-eth.gitbook.io/swapr' +export const SWAPR_DOCS_PATH_URLS = { + FAQ: '/faq', + PROJECT_INFO_BRANDING: '/project-information/branding-and-logos', +} diff --git a/src/hooks/useSwapCallback.ts b/src/hooks/useSwapCallback.ts index 40c90d12e..ca980f9a9 100644 --- a/src/hooks/useSwapCallback.ts +++ b/src/hooks/useSwapCallback.ts @@ -5,6 +5,7 @@ import { CoWTrade, CurveTrade, OneInchTrade, + OpenoceanTrade, Trade, TradeType, UniswapTrade, @@ -84,13 +85,13 @@ export function useSwapsCallArguments( } const swapMethods = [] - // Curve, Uniswap v3, ZeroX if ( trade instanceof CurveTrade || trade instanceof UniswapTrade || trade instanceof ZeroXTrade || trade instanceof SwaprV3Trade || - trade instanceof SushiswapTrade + trade instanceof SushiswapTrade || + trade instanceof OpenoceanTrade ) { return [ { diff --git a/src/lib/eco-router/api.ts b/src/lib/eco-router/api.ts index 74ea3b599..ab468173d 100644 --- a/src/lib/eco-router/api.ts +++ b/src/lib/eco-router/api.ts @@ -17,6 +17,7 @@ import { ZeroXTrade, SwaprV3Trade, SushiswapTrade, + OpenoceanTrade, } from '@swapr/sdk' // Low-level API for Uniswap V2 @@ -136,6 +137,16 @@ export async function getExactIn( tradeType: TradeType.EXACT_INPUT, }) } + // Openocean + if (platform.name === RoutablePlatform.OPENOCEAN.name) { + return OpenoceanTrade.getQuote({ + quoteCurrency: currencyOut, + amount: currencyAmountIn, + maximumSlippage, + recipient: receiver, + tradeType: TradeType.EXACT_INPUT, + }) + } // Curve if (platform.name === RoutablePlatform.CURVE.name) { return CurveTrade.bestTradeExactIn({ diff --git a/src/lib/eco-router/platforms.ts b/src/lib/eco-router/platforms.ts index 894e83530..c24834418 100644 --- a/src/lib/eco-router/platforms.ts +++ b/src/lib/eco-router/platforms.ts @@ -39,5 +39,6 @@ export function getSupportedPlatformsByChainId(chainId: ChainId) { RoutablePlatform.VELODROME, RoutablePlatform.SWAPR_V3, RoutablePlatform.SUSHISWAP, + RoutablePlatform.OPENOCEAN, ].filter(platform => platform.supportsChain(chainId)) } diff --git a/src/utils/prices.ts b/src/utils/prices.ts index 062885266..74a3f91a3 100644 --- a/src/utils/prices.ts +++ b/src/utils/prices.ts @@ -21,6 +21,7 @@ import { ZeroXTrade, SwaprV3Trade, SushiswapTrade, + OpenoceanTrade, } from '@swapr/sdk' import _Decimal from 'decimal.js-light' @@ -77,7 +78,8 @@ export function computeTradePriceBreakdown(trade?: Trade): TradePriceBreakdown { trade instanceof UniswapTrade || trade instanceof ZeroXTrade || trade instanceof SwaprV3Trade || - trade instanceof SushiswapTrade + trade instanceof SushiswapTrade || + trade instanceof OpenoceanTrade ) { return trade.fee } else if (trade instanceof CurveTrade || trade instanceof VelodromeTrade || trade instanceof OneInchTrade) { diff --git a/src/utils/uiConstants.tsx b/src/utils/uiConstants.tsx index 996ffc035..6b7db0b9d 100644 --- a/src/utils/uiConstants.tsx +++ b/src/utils/uiConstants.tsx @@ -1,4 +1,4 @@ -import { DISCORD_INVITE_LINK } from '../constants' +import { DISCORD_INVITE_LINK, SWAPR_DOCS_BASE_URL, SWAPR_DOCS_PATH_URLS } from '../constants' import BNBLogo from './../assets/images/BNBLogo.svg' import ArbitrumLogo from './../assets/images/logo-Arbitrum.svg' @@ -25,7 +25,7 @@ import RoutingZerox from './../assets/images/routing-Zerox.svg' export const mainNavigation = [ { label: 'Documentation', - href: 'http://dxdocs.eth.limo.ipns.localhost:8080/docs/Products/swapr/', + href: SWAPR_DOCS_BASE_URL, }, { label: 'Stats', @@ -160,7 +160,7 @@ export const FooterContent = { footerLinks: [ { label: 'FAQ', - href: 'https://dxdocs.eth.limo/docs/Products/swapr/faq/', + href: `${SWAPR_DOCS_BASE_URL}${SWAPR_DOCS_PATH_URLS.FAQ}`, }, { label: 'Blog', @@ -172,7 +172,7 @@ export const FooterContent = { }, { label: 'Brand Assets', - href: 'https://dxdocs.eth.limo/docs/BrandingAssets/#swapr-brand-assets', + href: `${SWAPR_DOCS_BASE_URL}${SWAPR_DOCS_PATH_URLS.PROJECT_INFO_BRANDING}`, }, ], }, diff --git a/yarn.lock b/yarn.lock index acd65225b..9b14e10a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8429,7 +8429,7 @@ __metadata: "@storybook/testing-library": 0.1.0 "@swapr/core": ^0.3.19 "@swapr/periphery": ^0.3.22 - "@swapr/sdk": 1.11.3 + "@swapr/sdk": 1.11.4 "@synthetixio/synpress": ^2.3.3 "@tanstack/react-query": 4.24.6 "@testing-library/cypress": ^9.0.0 @@ -8570,9 +8570,9 @@ __metadata: languageName: node linkType: hard -"@swapr/sdk@npm:1.11.3": - version: 1.11.3 - resolution: "@swapr/sdk@npm:1.11.3" +"@swapr/sdk@npm:1.11.4": + version: 1.11.4 + resolution: "@swapr/sdk@npm:1.11.4" dependencies: "@cowprotocol/cow-sdk": ^1.0.2-RC.0 "@ethersproject/abi": ^5.6.4 @@ -8603,7 +8603,7 @@ __metadata: tslib: ^2.3.1 peerDependencies: ethers: ^5.4.0 - checksum: 14eae4662ce191d30e6749b6be6514545a9965e22b0c00a138821a265599791fce9055dbdbc8dd75eff8ffef6b04274eb1ad588ec66d89abee0b8db4ead23e10 + checksum: 2ae6bb18dec24ad0ef91ab968335e288d76beb756d62b21e013a25210397cc4ee5006e17b20d4279291c4371f06f23e6baf9bbcd1ac7fc8b979b1eb88888b140 languageName: node linkType: hard