Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding JEWEL support for Metis and ETH #2310

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions packages/synapse-constants/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Synapse Constants
[![npm](https://img.shields.io/npm/v/%40synapsecns%2Fsdk-router?style=flat-square)](https://www.npmjs.com/package/@synapsecns/sdk-router)

[![npm](https://img.shields.io/npm/v/synapse-constants?style=flat-square)](https://www.npmjs.com/package/synapse-constants)

This package contains the Synapse Protocol Token and Chain Constants

Expand All @@ -12,20 +11,42 @@ This package contains the Synapse Protocol Token and Chain Constants
## Installation

```bash
npm install synapse-constants/dist
npm install synapse-constants
```

With Yarn:

```bash
yarn add synapse-constants/dist
yarn add synapse-constants
```

## Usage


To restrict the assets and chains that are imported, you can create a "custom bridge list". From the set of all tokens imported from "bridgeable.ts" you can import specific tokens and use that as the custom list you use in your application. The same can be done for chains

## Usage
For maintenance, when new tokens are added to the bridge the following steps should be taken.

1. Regenerate bridgeMaps.ts

```bash
yarn maps:generate
```

2. Update Bridgeable.ts with the new token addresses (check all other variables like decimals/ symbols etc. )

3. Repackage and webpack all of the data

```bash
yarn compile
```

4. Republish the npm package (make sure to update the version)

```bash
npm publish
```
Defi-Moses marked this conversation as resolved.
Show resolved Hide resolved


TODO:
Expand Down
14 changes: 14 additions & 0 deletions packages/synapse-constants/constants/bridgeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ export const BRIDGE_MAP = {
destination: ['SYN'],
swappable: [],
},
'0x12f79f8c1A6e47a9b5F0796FDb008Bdc182fa19e': {
decimals: 18,
symbol: 'JEWEL',
origin: ['JEWEL'],
destination: ['JEWEL'],
swappable: [],
},
'0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F': {
decimals: 18,
symbol: 'nUSD',
Expand Down Expand Up @@ -795,6 +802,13 @@ export const BRIDGE_MAP = {
},
},
'1088': {
'0x17C09cfC96C865CF546d73365Cedb6dC66986963': {
decimals: 18,
symbol: 'JEWEL',
origin: ['JEWEL'],
destination: ['JEWEL'],
swappable: [],
},
'0x420000000000000000000000000000000000000A': {
decimals: 18,
symbol: 'WETH',
Expand Down
14 changes: 14 additions & 0 deletions packages/synapse-constants/constants/tokens/bridgeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ export const BRIDGE_MAP = {
destination: ['SYN'],
swappable: [],
},
'0x12f79f8c1A6e47a9b5F0796FDb008Bdc182fa19e': {
decimals: 18,
symbol: 'JEWEL',
origin: ['JEWEL'],
destination: ['JEWEL'],
swappable: [],
},
'0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F': {
decimals: 18,
symbol: 'nUSD',
Expand Down Expand Up @@ -795,6 +802,13 @@ export const BRIDGE_MAP = {
},
},
'1088': {
'0x17C09cfC96C865CF546d73365Cedb6dC66986963': {
decimals: 18,
symbol: 'JEWEL',
origin: ['JEWEL'],
destination: ['JEWEL'],
swappable: [],
},
'0x420000000000000000000000000000000000000A': {
decimals: 18,
symbol: 'WETH',
Expand Down
2 changes: 2 additions & 0 deletions packages/synapse-constants/constants/tokens/bridgeable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,8 @@ export const JEWEL = new Token({
[CHAINS.HARMONY.id]: '0x72cb10c6bfa5624dd07ef608027e366bd690048f',
[CHAINS.KLAYTN.id]: '0x30C103f8f5A3A732DFe2dCE1Cc9446f545527b43',
[CHAINS.AVALANCHE.id]: '0x997Ddaa07d716995DE90577C123Db411584E5E46',
[CHAINS.METIS.id]: '0x17C09cfC96C865CF546d73365Cedb6dC66986963',
[CHAINS.ETH.id]: '0x12f79f8c1A6e47a9b5F0796FDb008Bdc182fa19e',
},
decimals: 18,
symbol: 'JEWEL',
Expand Down
8 changes: 4 additions & 4 deletions packages/synapse-constants/data/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"10": "https://mainnet.optimism.io",
"25": "https://evm.cronos.org",
"56": "https://bsc.publicnode.com",
"137": "https://polygon-rpc.com",
"250": "https://fantom-pokt.nodies.app",
"137": "https://polygon-bor.publicnode.com",
"250": "https://rpc3.fantom.network",
"288": "https://replica.boba.network",
"1088": "https://andromeda.metis.io/?owner=1088",
"1284": "https://moonbeam.public.blastapi.io",
"1285": "https://moonriver.public.blastapi.io",
"2000": "https://rpc.dogechain.dog",
"7700": "https://mainnode.plexnode.org:8545",
"81457": "https://rpc.blast.io",
"8217": "https://klaytn-pokt.nodies.app",
"8453": "https://developer-access-mainnet.base.org",
"42161": "https://arbitrum-one.public.blastapi.io",
"81457": "https://lingering-indulgent-replica.blast-mainnet.quiknode.pro/6667a8f4be701cb6549b415d567bc706fb2f13a8",
"42161": "https://arbitrum-one.publicnode.com",
"43114": "https://api.avax.network/ext/bc/C/rpc",
"53935": "https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc",
"1313161554": "https://mainnet.aurora.dev",
Expand Down
7 changes: 4 additions & 3 deletions packages/synapse-constants/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "synapse-constants",
"version": "1.3.6",
"version": "1.3.61",
Defi-Moses marked this conversation as resolved.
Show resolved Hide resolved
"description": "This is an npm package that maintains all synapse constants",
"main": "dist/index.js",
"module": "dist/index.js",
Expand All @@ -19,7 +19,8 @@
"lint:check": "eslint . --max-warnings=0",
"build": "node scripts/generateMaps.js && node scripts/findMissing.js",
"prepublish": "tsc",
"compile": "tsc && copyfiles -u 1 \"constants/assets/**/*.*\" dist/constants && webpack"
"compile": "tsc && copyfiles -u 1 \"constants/assets/**/*.*\" dist/constants && webpack",
"maps:generate": "yarn build && yarn compile"
},
"author": "",
"license": "ISC",
Expand All @@ -44,4 +45,4 @@
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
}
}
}
1 change: 1 addition & 0 deletions packages/synapse-constants/scripts/generateMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ const printMaps = async () => {
console.log('Finished chain: ', chainId)
})
)
prettyPrintTS(bridgeMap, 'BRIDGE_MAP', './constants/tokens/bridgeMap.ts')
prettyPrintTS(bridgeMap, 'BRIDGE_MAP', './constants/bridgeMap.ts')
Comment on lines +288 to 289
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calls to prettyPrintTS for generating TypeScript files for bridgeMap are a good addition for maintaining the bridge maps. However, it appears that prettyPrintTS is called twice with the same arguments, which seems redundant. If the intention was to generate TypeScript files in two different locations, please ensure the file paths in the arguments are distinct. Otherwise, consider removing the redundant call.

-  prettyPrintTS(bridgeMap, 'BRIDGE_MAP', './constants/bridgeMap.ts')

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
prettyPrintTS(bridgeMap, 'BRIDGE_MAP', './constants/tokens/bridgeMap.ts')
prettyPrintTS(bridgeMap, 'BRIDGE_MAP', './constants/bridgeMap.ts')
prettyPrintTS(bridgeMap, 'BRIDGE_MAP', './constants/tokens/bridgeMap.ts')

}

Expand Down
14 changes: 14 additions & 0 deletions packages/synapse-interface/constants/bridgeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ export const BRIDGE_MAP = {
destination: ['SYN'],
swappable: [],
},
'0x12f79f8c1A6e47a9b5F0796FDb008Bdc182fa19e': {
decimals: 18,
symbol: 'JEWEL',
origin: ['JEWEL'],
destination: ['JEWEL'],
swappable: [],
},
'0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F': {
decimals: 18,
symbol: 'nUSD',
Expand Down Expand Up @@ -795,6 +802,13 @@ export const BRIDGE_MAP = {
},
},
'1088': {
'0x17C09cfC96C865CF546d73365Cedb6dC66986963': {
decimals: 18,
symbol: 'JEWEL',
origin: ['JEWEL'],
destination: ['JEWEL'],
swappable: [],
},
'0x420000000000000000000000000000000000000A': {
decimals: 18,
symbol: 'WETH',
Expand Down
2 changes: 2 additions & 0 deletions packages/synapse-interface/constants/tokens/bridgeable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,8 @@ export const JEWEL = new Token({
[CHAINS.HARMONY.id]: '0x72cb10c6bfa5624dd07ef608027e366bd690048f',
[CHAINS.KLAYTN.id]: '0x30C103f8f5A3A732DFe2dCE1Cc9446f545527b43',
[CHAINS.AVALANCHE.id]: '0x997Ddaa07d716995DE90577C123Db411584E5E46',
[CHAINS.METIS.id]: '0x17C09cfC96C865CF546d73365Cedb6dC66986963',
[CHAINS.ETH.id]: '0x12f79f8c1A6e47a9b5F0796FDb008Bdc182fa19e',
},
decimals: 18,
symbol: 'JEWEL',
Expand Down
4 changes: 2 additions & 2 deletions packages/widget/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@synapsecns/widget",
"description": "Widget library for interacting with the Synapse Protocol",
"version": "0.1.7",
"version": "0.1.8",
Defi-Moses marked this conversation as resolved.
Show resolved Hide resolved
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -71,4 +71,4 @@
"lodash": "^4.17.21",
"react-redux": "^9.0.2"
}
}
}
14 changes: 14 additions & 0 deletions packages/widget/src/constants/bridgeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ export const BRIDGE_MAP = {
destination: ['SYN'],
swappable: [],
},
'0x12f79f8c1A6e47a9b5F0796FDb008Bdc182fa19e': {
decimals: 18,
symbol: 'JEWEL',
origin: ['JEWEL'],
destination: ['JEWEL'],
swappable: [],
},
'0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F': {
decimals: 18,
symbol: 'nUSD',
Expand Down Expand Up @@ -795,6 +802,13 @@ export const BRIDGE_MAP = {
},
},
'1088': {
'0x17C09cfC96C865CF546d73365Cedb6dC66986963': {
decimals: 18,
symbol: 'JEWEL',
origin: ['JEWEL'],
destination: ['JEWEL'],
swappable: [],
},
'0x420000000000000000000000000000000000000A': {
decimals: 18,
symbol: 'WETH',
Expand Down
4 changes: 4 additions & 0 deletions packages/widget/src/constants/bridgeable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,12 +904,16 @@ export const JEWEL: BridgeableToken = {
[CHAINS.HARMONY.id]: '0x72cb10c6bfa5624dd07ef608027e366bd690048f',
[CHAINS.KLAYTN.id]: '0x30C103f8f5A3A732DFe2dCE1Cc9446f545527b43',
[CHAINS.AVALANCHE.id]: '0x997Ddaa07d716995DE90577C123Db411584E5E46',
[CHAINS.METIS.id]: '0x17C09cfC96C865CF546d73365Cedb6dC66986963',
[CHAINS.ETHEREUM.id]: '0x12f79f8c1A6e47a9b5F0796FDb008Bdc182fa19e',
},
decimals: {
[CHAINS.DFK.id]: 18,
[CHAINS.HARMONY.id]: 18,
[CHAINS.KLAYTN.id]: 18,
[CHAINS.AVALANCHE.id]: 18,
[CHAINS.METIS.id]: 18,
[CHAINS.ETHEREUM.id]: 18,
},
symbol: 'JEWEL',
name: 'JEWEL',
Expand Down
Loading