Skip to content

Commit

Permalink
release: v1.0.0-beta.22.3 #1919 from SwaprHQ/develop
Browse files Browse the repository at this point in the history
release: v1.0.0-beta.22.3
* feat(SWA-146): add Openocean support (#1913)
* docs(SWA-138): update footer links to docs URLs
  • Loading branch information
ElRodrigote authored Mar 25, 2024
2 parents f914f90 + 05a650a commit 20493e1
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Binary file added src/assets/images/openocean-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions src/constants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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,
Expand All @@ -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]: [],
Expand All @@ -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]: [
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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]: [],
}

Expand Down Expand Up @@ -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: {
Expand All @@ -892,6 +905,7 @@ export const ROUTABLE_PLATFORM_LOGO: {
[RoutablePlatform.VELODROME.name]: <img width={16} height={16} src={VelodromeLogo} alt="Velodrome" />,
[RoutablePlatform.SWAPR_V3.name]: <img width={16} height={16} src={SwaprV3Logo} alt="Swapr v3" />,
[RoutablePlatform.SUSHISWAP.name]: <img width={16} height={16} src={SushiswapNewLogo} alt="sushiswap" />,
[RoutablePlatform.OPENOCEAN.name]: <img width={16} height={16} src={OpenoceanLogo} alt="openocean" />,
}

export const ChainLabel: any = {
Expand Down
5 changes: 5 additions & 0 deletions src/constants/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
5 changes: 3 additions & 2 deletions src/hooks/useSwapCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
CoWTrade,
CurveTrade,
OneInchTrade,
OpenoceanTrade,
Trade,
TradeType,
UniswapTrade,
Expand Down Expand Up @@ -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 [
{
Expand Down
11 changes: 11 additions & 0 deletions src/lib/eco-router/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
ZeroXTrade,
SwaprV3Trade,
SushiswapTrade,
OpenoceanTrade,
} from '@swapr/sdk'

// Low-level API for Uniswap V2
Expand Down Expand Up @@ -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({
Expand Down
1 change: 1 addition & 0 deletions src/lib/eco-router/platforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ export function getSupportedPlatformsByChainId(chainId: ChainId) {
RoutablePlatform.VELODROME,
RoutablePlatform.SWAPR_V3,
RoutablePlatform.SUSHISWAP,
RoutablePlatform.OPENOCEAN,
].filter(platform => platform.supportsChain(chainId))
}
4 changes: 3 additions & 1 deletion src/utils/prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
ZeroXTrade,
SwaprV3Trade,
SushiswapTrade,
OpenoceanTrade,
} from '@swapr/sdk'

import _Decimal from 'decimal.js-light'
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/utils/uiConstants.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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}`,
},
],
},
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -8603,7 +8603,7 @@ __metadata:
tslib: ^2.3.1
peerDependencies:
ethers: ^5.4.0
checksum: 14eae4662ce191d30e6749b6be6514545a9965e22b0c00a138821a265599791fce9055dbdbc8dd75eff8ffef6b04274eb1ad588ec66d89abee0b8db4ead23e10
checksum: 2ae6bb18dec24ad0ef91ab968335e288d76beb756d62b21e013a25210397cc4ee5006e17b20d4279291c4371f06f23e6baf9bbcd1ac7fc8b979b1eb88888b140
languageName: node
linkType: hard

Expand Down

0 comments on commit 20493e1

Please sign in to comment.