Skip to content

Commit

Permalink
Merge branch 'master' into contracts/deploy-testnets
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed Sep 6, 2023
2 parents 810113a + d499d8c commit 9ef2ef1
Show file tree
Hide file tree
Showing 21 changed files with 249 additions and 95 deletions.
8 changes: 8 additions & 0 deletions packages/rest-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.0.17](https://github.com/synapsecns/sanguine/compare/@synapsecns/rest-api@1.0.16...@synapsecns/rest-api@1.0.17) (2023-09-05)

**Note:** Version bump only for package @synapsecns/rest-api





## [1.0.16](https://github.com/synapsecns/sanguine/compare/@synapsecns/rest-api@1.0.15...@synapsecns/rest-api@1.0.16) (2023-08-28)

**Note:** Version bump only for package @synapsecns/rest-api
Expand Down
4 changes: 2 additions & 2 deletions packages/rest-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@synapsecns/rest-api",
"version": "1.0.16",
"version": "1.0.17",
"private": "true",
"engines": {
"node": ">=16.0.0"
Expand All @@ -23,7 +23,7 @@
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@ethersproject/units": "5.7.0",
"@synapsecns/sdk-router": "^0.2.14",
"@synapsecns/sdk-router": "^0.2.15",
"bignumber": "^1.1.0",
"ethers": "5.7.2",
"express": "^4.18.2",
Expand Down
8 changes: 8 additions & 0 deletions packages/sdk-router/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.2.15](https://github.com/synapsecns/sanguine/compare/@synapsecns/sdk-router@0.2.14...@synapsecns/sdk-router@0.2.15) (2023-09-05)

**Note:** Version bump only for package @synapsecns/sdk-router





## [0.2.14](https://github.com/synapsecns/sanguine/compare/@synapsecns/sdk-router@0.2.13...@synapsecns/sdk-router@0.2.14) (2023-08-28)

**Note:** Version bump only for package @synapsecns/sdk-router
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-router/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@synapsecns/sdk-router",
"description": "An SDK for interacting with the Synapse Protocol",
"version": "0.2.14",
"version": "0.2.15",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-router/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const CCTP_ROUTER_ADDRESS: { [chainId: number]: string } = {
[SupportedChainId.ETH]: '0xd359bc471554504f683fbd4f6e36848612349ddf',
[SupportedChainId.ARBITRUM]: '0xd359bc471554504f683fbd4f6e36848612349ddf',
[SupportedChainId.AVALANCHE]: '0xd359bc471554504f683fbd4f6e36848612349ddf',
[SupportedChainId.OPTIMISM]: '0xd359bc471554504f683fbd4f6e36848612349ddf',
}

export const ROUTER_ADDRESS: { [chainId: number]: string } = {
Expand Down
51 changes: 51 additions & 0 deletions packages/synapse-interface/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,57 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.1.113](https://github.com/synapsecns/sanguine/compare/@synapsecns/synapse-interface@0.1.112...@synapsecns/synapse-interface@0.1.113) (2023-09-05)

**Note:** Version bump only for package @synapsecns/synapse-interface





## [0.1.112](https://github.com/synapsecns/sanguine/compare/@synapsecns/synapse-interface@0.1.111...@synapsecns/synapse-interface@0.1.112) (2023-09-05)

**Note:** Version bump only for package @synapsecns/synapse-interface





## [0.1.111](https://github.com/synapsecns/sanguine/compare/@synapsecns/synapse-interface@0.1.110...@synapsecns/synapse-interface@0.1.111) (2023-09-05)

**Note:** Version bump only for package @synapsecns/synapse-interface





## [0.1.110](https://github.com/synapsecns/sanguine/compare/@synapsecns/synapse-interface@0.1.109...@synapsecns/synapse-interface@0.1.110) (2023-09-05)


### Bug Fixes

* packages/synapse-interface/package.json to reduce vulnerabilities ([#1292](https://github.com/synapsecns/sanguine/issues/1292)) ([24bc6b6](https://github.com/synapsecns/sanguine/commit/24bc6b6bc80d718fb9a40a8ae26bc4594c2915b9))





## [0.1.109](https://github.com/synapsecns/sanguine/compare/@synapsecns/synapse-interface@0.1.108...@synapsecns/synapse-interface@0.1.109) (2023-09-05)

**Note:** Version bump only for package @synapsecns/synapse-interface





## [0.1.108](https://github.com/synapsecns/sanguine/compare/@synapsecns/synapse-interface@0.1.107...@synapsecns/synapse-interface@0.1.108) (2023-09-05)

**Note:** Version bump only for package @synapsecns/synapse-interface





## [0.1.107](https://github.com/synapsecns/sanguine/compare/@synapsecns/synapse-interface@0.1.106...@synapsecns/synapse-interface@0.1.107) (2023-09-04)

**Note:** Version bump only for package @synapsecns/synapse-interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import useCloseOnOutsideClick from '@/utils/hooks/useCloseOnOutsideClick'
import { CloseButton } from './components/CloseButton'
import { SearchResults } from './components/SearchResults'

import { PAUSED_TO_CHAIN_IDS } from '@constants/chains'

export const ToChainListOverlay = () => {
const { toChainIds, toChainId } = useBridgeState()
const [currentIdx, setCurrentIdx] = useState(-1)
Expand All @@ -37,7 +39,7 @@ export const ToChainListOverlay = () => {
Object.keys(CHAINS_BY_ID).map((id) => CHAINS_BY_ID[id]),
toChainIds.map((id) => CHAINS_BY_ID[id])
)
)
).filter((chain) => !PAUSED_TO_CHAIN_IDS.includes(chain.id))

const possibleChainsWithSource = possibleChains.map((chain) => ({
...chain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ import SelectSpecificTokenButton from './components/SelectSpecificTokenButton'
import { getRoutePossibilities } from '@/utils/routeMaker/generateRoutePossibilities'

import { sortByPriorityRank } from './helpers/sortByPriorityRank'
import { usePortfolioBalances } from '@/slices/portfolio/hooks'
import { CHAINS_BY_ID } from '@/constants/chains'
import useCloseOnOutsideClick from '@/utils/hooks/useCloseOnOutsideClick'
import { CloseButton } from './components/CloseButton'
import { SearchResults } from './components/SearchResults'

export const ToTokenListOverlay = () => {
const { fromChainId, toTokens, toChainId, toToken } = useBridgeState()
const portfolioBalances = usePortfolioBalances()

const [currentIdx, setCurrentIdx] = useState(-1)
const [searchStr, setSearchStr] = useState('')
Expand All @@ -38,9 +36,9 @@ export const ToTokenListOverlay = () => {
toToken: null,
})

let remainingChainTokens = sortByPriorityRank(
_.difference(allToChainTokens, toTokens)
)
let remainingChainTokens = toChainId
? sortByPriorityRank(_.difference(allToChainTokens, toTokens))
: []

const { toTokens: allTokens } = getRoutePossibilities({
fromChainId: null,
Expand All @@ -49,9 +47,9 @@ export const ToTokenListOverlay = () => {
toToken: null,
})

let allOtherToTokens = sortByPriorityRank(
_.difference(allTokens, allToChainTokens)
)
let allOtherToTokens = toChainId
? sortByPriorityRank(_.difference(allTokens, allToChainTokens))
: sortByPriorityRank(allTokens)

const possibleTokenswithSource = possibleTokens.map((token) => ({
...token,
Expand Down
9 changes: 8 additions & 1 deletion packages/synapse-interface/constants/bridgeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ export const BRIDGE_MAP = {
},
},
'10': {
'0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85': {
decimals: 6,
symbol: 'USDC',
origin: ['CCTP.USDC'],
destination: ['CCTP.USDC'],
swappable: [],
},
'0x0b5740c6b4a97f90eF2F0220651Cca420B868FfB': {
decimals: 18,
symbol: 'gOHM',
Expand Down Expand Up @@ -203,7 +210,7 @@ export const BRIDGE_MAP = {
},
'0x7F5c764cBc14f9669B88837ca1490cCa17c31607': {
decimals: 6,
symbol: 'USDC',
symbol: 'USDC.e',
origin: ['nUSD'],
destination: ['nUSD'],
swappable: [
Expand Down
19 changes: 14 additions & 5 deletions packages/synapse-interface/constants/existingBridgeRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import { BRIDGE_MAP } from '@/constants/bridgeMap'
import { flattenPausedTokens } from '@/utils/flattenPausedTokens'

export type BridgeRoutes = Record<string, string[]>

const constructJSON = (swappableMap) => {
const constructJSON = (swappableMap, exclusionList) => {
const result = {}

// Iterate through the chains
for (const chainA in swappableMap) {
for (const tokenA in swappableMap[chainA]) {
const symbolA = swappableMap[chainA][tokenA].symbol
const key = `${symbolA}-${chainA}`

if (exclusionList.includes(key)) continue

// Iterate through other chains to compare
for (const chainB in swappableMap) {
if (chainA !== chainB) {
for (const tokenB in swappableMap[chainB]) {
const symbolB = swappableMap[chainB][tokenB].symbol
const value = `${symbolB}-${chainB}`

if (exclusionList.includes(value)) continue

// Check if there's a bridge between the origins and destinations
for (const bridgeSymbol of swappableMap[chainA][tokenA].origin) {
if (
swappableMap[chainA][tokenA].origin.includes(bridgeSymbol) &&
swappableMap[chainB][tokenB].destination.includes(bridgeSymbol)
) {
const key = `${symbolA}-${chainA}`
const value = `${symbolB}-${chainB}`

// Add to the result if the key exists, else create a new array
if (result[key]) {
result[key].push(value)
Expand All @@ -42,4 +46,9 @@ const constructJSON = (swappableMap) => {
return result
}

export const EXISTING_BRIDGE_ROUTES: BridgeRoutes = constructJSON(BRIDGE_MAP)
const PAUSED_TOKENS = flattenPausedTokens()

export const EXISTING_BRIDGE_ROUTES: BridgeRoutes = constructJSON(
BRIDGE_MAP,
PAUSED_TOKENS
)
56 changes: 56 additions & 0 deletions packages/synapse-interface/constants/tokens/auxilliary.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import avaxLogo from '@assets/icons/avax.svg'
import avwethLogo from '@assets/icons/avweth.svg'
import ethLogo from '@assets/icons/eth.svg'
import mimLogo from '@assets/icons/mim.svg'
import usdcLogo from '@assets/icons/usdc.svg'
import usdtLogo from '@assets/icons/usdt.svg'
import wethLogo from '@assets/icons/weth.svg'

Expand Down Expand Up @@ -88,3 +90,57 @@ export const MULTIAVAX = new Token({
priorityRank: 3,
routeSymbol: 'MULTIAVAX',
})

export const FANTOMUSDC = new Token({
visibilityRank: 101,
addresses: {
[CHAINS.FANTOM.id]: '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
},
decimals: {
[CHAINS.FANTOM.id]: 6,
},
symbol: 'USDC',
name: 'USD Coin',
logo: usdcLogo,
swapableType: 'USD',
swapableOn: [],
color: 'blue',
priorityRank: 1,
routeSymbol: 'USDC',
})

export const FANTOMUSDT = new Token({
addresses: {
[CHAINS.FANTOM.id]: '0x049d68029688eabf473097a2fc38ef61633a3c7a',
},
swapExceptions: {},
decimals: {
[CHAINS.FANTOM.id]: 6,
},
symbol: 'USDT',
name: 'USD Tether',
logo: usdtLogo,
color: 'lime',
swapableType: 'USD',
swapableOn: [],
visibilityRank: 100,
priorityRank: 1,
routeSymbol: 'USDT',
})

export const FANTOMETH = new Token({
addresses: {
[CHAINS.FANTOM.id]: '0x74b23882a30290451A17c44f4F05243b6b58C76d',
},
decimals: 18,
symbol: 'ETH',
name: 'Ethereum',
logo: ethLogo,
isNative: true,
swapableType: 'ETH',
color: 'sky',
visibilityRank: 101,
priorityRank: 2,
swapableOn: [],
routeSymbol: 'ETH',
})
15 changes: 6 additions & 9 deletions packages/synapse-interface/constants/tokens/bridgeable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,10 @@ export const USDC = new Token({
visibilityRank: 101,
addresses: {
[CHAINS.ETH.id]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
[CHAINS.OPTIMISM.id]: '0x7f5c764cbc14f9669b88837ca1490cca17c31607',
[CHAINS.OPTIMISM.id]: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
[CHAINS.CRONOS.id]: '0xc21223249ca28397b4b6541dffaecc539bff0c59',
[CHAINS.BNB.id]: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d',
[CHAINS.POLYGON.id]: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
[CHAINS.FANTOM.id]: '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
[CHAINS.BOBA.id]: '0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc',
[CHAINS.DOGE.id]: '0x85C2D3bEBffD83025910985389aB8aD655aBC946',
[CHAINS.CANTO.id]: '0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd',
Expand All @@ -397,7 +396,6 @@ export const USDC = new Token({
[CHAINS.CRONOS.id]: 6,
[CHAINS.BNB.id]: 18,
[CHAINS.POLYGON.id]: 6,
[CHAINS.FANTOM.id]: 6,
[CHAINS.BOBA.id]: 6,
[CHAINS.DOGE.id]: 6,
[CHAINS.CANTO.id]: 6,
Expand All @@ -418,7 +416,6 @@ export const USDC = new Token({
CHAINS.BNB.id,
CHAINS.ETH.id,
CHAINS.POLYGON.id,
CHAINS.FANTOM.id,
CHAINS.ARBITRUM.id,
CHAINS.AVALANCHE.id,
CHAINS.HARMONY.id,
Expand Down Expand Up @@ -742,7 +739,6 @@ export const ETH = new Token({
addresses: {
[CHAINS.ETH.id]: zeroAddress,
[CHAINS.OPTIMISM.id]: zeroAddress,
[CHAINS.FANTOM.id]: '0x74b23882a30290451A17c44f4F05243b6b58C76d',
[CHAINS.BOBA.id]: zeroAddress,
[CHAINS.CANTO.id]: '0x5FD55A1B9FC24967C4dB09C513C3BA0DFa7FF687',
[CHAINS.BASE.id]: zeroAddress,
Expand Down Expand Up @@ -785,11 +781,11 @@ export const MOVR = new Token({

export const AVAX = new Token({
addresses: {
[CHAINS.AVALANCHE.id]: zeroAddress,
[CHAINS.DFK.id]: '0xB57B60DeBDB0b8172bb6316a9164bd3C695F133a',
[CHAINS.MOONBEAM.id]: '0xA1f8890E39b4d8E33efe296D698fe42Fb5e59cC3',
[CHAINS.HARMONY.id]: '0xD9eAA386cCD65F30b77FF175F6b52115FE454fD6',
[CHAINS.KLAYTN.id]: '0xCd8fE44A29Db9159dB36f96570d7A4d91986f528',
[CHAINS.AVALANCHE.id]: zeroAddress,
[CHAINS.DFK.id]: '0xB57B60DeBDB0b8172bb6316a9164bd3C695F133a',
[CHAINS.HARMONY.id]: '0xb12c13e66AdE1F72f71834f2FC5082Db8C091358',
},
decimals: 18,
symbol: 'AVAX',
Expand Down Expand Up @@ -897,6 +893,7 @@ export const XJEWEL = new Token({

export const USDCe = new Token({
addresses: {
[CHAINS.OPTIMISM.id]: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607',
[CHAINS.AVALANCHE.id]: '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
[CHAINS.ARBITRUM.id]: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8',
[CHAINS.AURORA.id]: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802',
Expand All @@ -907,7 +904,7 @@ export const USDCe = new Token({
logo: usdcLogo,
swapableType: 'USD',
color: 'blue',
swapableOn: [CHAINS.AVALANCHE.id, CHAINS.ARBITRUM.id],
swapableOn: [CHAINS.AVALANCHE.id, CHAINS.ARBITRUM.id, CHAINS.OPTIMISM.id],
visibilityRank: 100,
priorityRank: 1,
routeSymbol: 'USDC.e',
Expand Down
Loading

0 comments on commit 9ef2ef1

Please sign in to comment.