From 8620f3c587c6661dc3708a6e4b62c7865b51860f Mon Sep 17 00:00:00 2001 From: defi-moses Date: Thu, 25 Jul 2024 11:43:28 +0100 Subject: [PATCH] fixing bridgeMap --- .../synapse-constants/constants/bridgeMap.ts | 164 ++++++++++----- .../constants/tokens/bridgeMap.ts | 196 +++++++++++++----- .../constants/tokens/bridgeable.ts | 1 + .../{ => scripts}/abi/IDefaultPool.json | 0 .../{ => scripts}/abi/IERC20Metadata.json | 0 .../{ => scripts}/abi/SwapQuoter.json | 0 .../{ => scripts}/abi/SynapseCCTP.json | 0 .../{ => scripts}/abi/SynapseCCTPRouter.json | 0 .../{ => scripts}/abi/SynapseRouter.json | 0 .../data/ignoredBridgeSymbols.json | 0 .../{ => scripts}/data/legacyTokens.json | 0 .../{ => scripts}/data/providers.json | 0 .../{ => scripts}/data/symbolOverrides.json | 0 .../synapse-constants/scripts/generateMaps.js | 131 ++++++++++-- .../scripts/utils/fetchRfqData.js | 17 ++ .../scripts/utils/prettyPrintTs.js | 13 ++ 16 files changed, 400 insertions(+), 122 deletions(-) rename packages/synapse-constants/{ => scripts}/abi/IDefaultPool.json (100%) rename packages/synapse-constants/{ => scripts}/abi/IERC20Metadata.json (100%) rename packages/synapse-constants/{ => scripts}/abi/SwapQuoter.json (100%) rename packages/synapse-constants/{ => scripts}/abi/SynapseCCTP.json (100%) rename packages/synapse-constants/{ => scripts}/abi/SynapseCCTPRouter.json (100%) rename packages/synapse-constants/{ => scripts}/abi/SynapseRouter.json (100%) rename packages/synapse-constants/{ => scripts}/data/ignoredBridgeSymbols.json (100%) rename packages/synapse-constants/{ => scripts}/data/legacyTokens.json (100%) rename packages/synapse-constants/{ => scripts}/data/providers.json (100%) rename packages/synapse-constants/{ => scripts}/data/symbolOverrides.json (100%) create mode 100644 packages/synapse-constants/scripts/utils/fetchRfqData.js create mode 100644 packages/synapse-constants/scripts/utils/prettyPrintTs.js diff --git a/packages/synapse-constants/constants/bridgeMap.ts b/packages/synapse-constants/constants/bridgeMap.ts index 2f002e5c53..9becd86da2 100644 --- a/packages/synapse-constants/constants/bridgeMap.ts +++ b/packages/synapse-constants/constants/bridgeMap.ts @@ -31,7 +31,15 @@ export const BRIDGE_MAP = { '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F': { decimals: 18, symbol: 'nUSD', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', @@ -60,7 +68,15 @@ export const BRIDGE_MAP = { '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0': { decimals: 18, symbol: 'LUSD', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -82,7 +98,15 @@ export const BRIDGE_MAP = { '0x6B175474E89094C44Da98b954EedeAC495271d0F': { decimals: 18, symbol: 'DAI', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC', 'DAI', 'nUSD'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -97,7 +121,15 @@ export const BRIDGE_MAP = { '0x6c3ea9036406852006290770BEdFcAbA0e23A0e8': { decimals: 6, symbol: 'PYUSD', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -126,7 +158,15 @@ export const BRIDGE_MAP = { '0x853d955aCEf822Db058eb8505911ED77F175b99e': { decimals: 18, symbol: 'FRAX', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC', 'synFRAX'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -148,8 +188,16 @@ export const BRIDGE_MAP = { '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48': { decimals: 6, symbol: 'USDC', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], - destination: ['CCTP.USDC', 'USDC', 'nUSD'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], + destination: ['CCTP.USDC', 'USDC', 'nUSD', 'RFQ.USDC'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', @@ -184,15 +232,15 @@ export const BRIDGE_MAP = { '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [], }, '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [], }, '0xb753428af26E81097e7fD17f40c88aaA3E04902c': { @@ -205,7 +253,15 @@ export const BRIDGE_MAP = { '0xdAC17F958D2ee523a2206206994597C13D831ec7': { decimals: 6, symbol: 'USDT', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC', 'USDT', 'nUSD'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -227,7 +283,15 @@ export const BRIDGE_MAP = { '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E': { decimals: 18, symbol: 'crvUSD', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -244,8 +308,8 @@ export const BRIDGE_MAP = { '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85': { decimals: 6, symbol: 'USDC', - origin: ['CCTP.USDC', 'nUSD'], - destination: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], + destination: ['CCTP.USDC', 'RFQ.USDC'], swappable: [ '0x67C10C397dD0Ba417329543c1a40eb48AAa7cd00', '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', @@ -264,7 +328,7 @@ export const BRIDGE_MAP = { '0x121ab82b49B2BC4c7901CA46B8277962b4350204': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x809DC529f07651bD43A172e8dB6f4a7a0d771036', @@ -288,7 +352,7 @@ export const BRIDGE_MAP = { '0x67C10C397dD0Ba417329543c1a40eb48AAa7cd00': { decimals: 18, symbol: 'nUSD', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -301,7 +365,7 @@ export const BRIDGE_MAP = { '0x7F5c764cBc14f9669B88837ca1490cCa17c31607': { decimals: 6, symbol: 'USDC.e', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -314,7 +378,7 @@ export const BRIDGE_MAP = { '0x809DC529f07651bD43A172e8dB6f4a7a0d771036': { decimals: 18, symbol: 'nETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x121ab82b49B2BC4c7901CA46B8277962b4350204', @@ -324,7 +388,7 @@ export const BRIDGE_MAP = { '0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9': { decimals: 18, symbol: 'sUSD', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -337,7 +401,7 @@ export const BRIDGE_MAP = { '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58': { decimals: 6, symbol: 'USDT', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -357,7 +421,7 @@ export const BRIDGE_MAP = { '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1': { decimals: 18, symbol: 'DAI', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -377,8 +441,8 @@ export const BRIDGE_MAP = { '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [ '0x121ab82b49B2BC4c7901CA46B8277962b4350204', '0x809DC529f07651bD43A172e8dB6f4a7a0d771036', @@ -1183,7 +1247,7 @@ export const BRIDGE_MAP = { '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93': { decimals: 18, symbol: 'crvUSD', - origin: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], destination: ['CCTP.USDC'], swappable: [ '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb', @@ -1195,7 +1259,7 @@ export const BRIDGE_MAP = { '0x4200000000000000000000000000000000000006': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', @@ -1212,7 +1276,7 @@ export const BRIDGE_MAP = { '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb': { decimals: 18, symbol: 'DAI', - origin: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], destination: ['CCTP.USDC'], swappable: [ '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93', @@ -1231,8 +1295,8 @@ export const BRIDGE_MAP = { '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913': { decimals: 6, symbol: 'USDC', - origin: ['CCTP.USDC'], - destination: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], + destination: ['CCTP.USDC', 'RFQ.USDC'], swappable: [ '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93', '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb', @@ -1250,7 +1314,7 @@ export const BRIDGE_MAP = { '0xEB466342C4d449BC9f53A865D5Cb90586f405215': { decimals: 6, symbol: 'axlUSDC', - origin: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], destination: ['CCTP.USDC'], swappable: [ '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93', @@ -1262,8 +1326,8 @@ export const BRIDGE_MAP = { '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [ '0x4200000000000000000000000000000000000006', '0xb554A55358fF0382Fb21F0a478C3546d1106Be8c', @@ -1272,7 +1336,7 @@ export const BRIDGE_MAP = { '0xb554A55358fF0382Fb21F0a478C3546d1106Be8c': { decimals: 18, symbol: 'nETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x4200000000000000000000000000000000000006', @@ -1282,7 +1346,7 @@ export const BRIDGE_MAP = { '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA': { decimals: 6, symbol: 'USDbC', - origin: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], destination: ['CCTP.USDC'], swappable: [ '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93', @@ -1317,7 +1381,7 @@ export const BRIDGE_MAP = { '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F': { decimals: 18, symbol: 'FRAX', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688', @@ -1330,7 +1394,7 @@ export const BRIDGE_MAP = { '0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688': { decimals: 18, symbol: 'nUSD', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', @@ -1350,7 +1414,7 @@ export const BRIDGE_MAP = { '0x3ea9B0ab55F34Fb188824Ee288CeaEfC63cf908e': { decimals: 18, symbol: 'nETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', @@ -1374,7 +1438,7 @@ export const BRIDGE_MAP = { '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x3ea9B0ab55F34Fb188824Ee288CeaEfC63cf908e', @@ -1405,7 +1469,7 @@ export const BRIDGE_MAP = { '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1': { decimals: 18, symbol: 'DAI', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', @@ -1418,8 +1482,8 @@ export const BRIDGE_MAP = { '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [ '0x3ea9B0ab55F34Fb188824Ee288CeaEfC63cf908e', '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', @@ -1428,7 +1492,7 @@ export const BRIDGE_MAP = { '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8': { decimals: 6, symbol: 'USDC.e', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', @@ -1441,7 +1505,7 @@ export const BRIDGE_MAP = { '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9': { decimals: 6, symbol: 'USDT', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', @@ -1461,8 +1525,8 @@ export const BRIDGE_MAP = { '0xaf88d065e77c8cC2239327C5EDb3A432268e5831': { decimals: 6, symbol: 'USDC', - origin: ['CCTP.USDC', 'nUSD'], - destination: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], + destination: ['CCTP.USDC', 'RFQ.USDC'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', '0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688', @@ -1740,14 +1804,14 @@ export const BRIDGE_MAP = { '0x4300000000000000000000000000000000000003': { decimals: 18, symbol: 'USDB', - origin: ['nUSD'], - destination: ['nUSD'], + origin: ['nUSD', 'RFQ.USDB'], + destination: ['nUSD', 'RFQ.USDB'], swappable: ['0x3194B0A295D87fDAA54DF852c248F7a6BAF6c6e0'], }, '0x4300000000000000000000000000000000000004': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', @@ -1764,8 +1828,8 @@ export const BRIDGE_MAP = { '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [ '0x4300000000000000000000000000000000000004', '0xce971282fAAc9faBcF121944956da7142cccC855', @@ -1774,7 +1838,7 @@ export const BRIDGE_MAP = { '0xce971282fAAc9faBcF121944956da7142cccC855': { decimals: 18, symbol: 'nETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x4300000000000000000000000000000000000004', diff --git a/packages/synapse-constants/constants/tokens/bridgeMap.ts b/packages/synapse-constants/constants/tokens/bridgeMap.ts index 2f002e5c53..70f9755d4a 100644 --- a/packages/synapse-constants/constants/tokens/bridgeMap.ts +++ b/packages/synapse-constants/constants/tokens/bridgeMap.ts @@ -31,7 +31,15 @@ export const BRIDGE_MAP = { '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F': { decimals: 18, symbol: 'nUSD', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', @@ -60,7 +68,15 @@ export const BRIDGE_MAP = { '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0': { decimals: 18, symbol: 'LUSD', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -82,7 +98,15 @@ export const BRIDGE_MAP = { '0x6B175474E89094C44Da98b954EedeAC495271d0F': { decimals: 18, symbol: 'DAI', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC', 'DAI', 'nUSD'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -97,7 +121,15 @@ export const BRIDGE_MAP = { '0x6c3ea9036406852006290770BEdFcAbA0e23A0e8': { decimals: 6, symbol: 'PYUSD', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -126,7 +158,15 @@ export const BRIDGE_MAP = { '0x853d955aCEf822Db058eb8505911ED77F175b99e': { decimals: 18, symbol: 'FRAX', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC', 'synFRAX'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -148,8 +188,16 @@ export const BRIDGE_MAP = { '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48': { decimals: 6, symbol: 'USDC', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], - destination: ['CCTP.USDC', 'USDC', 'nUSD'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], + destination: ['CCTP.USDC', 'USDC', 'nUSD', 'RFQ.USDC'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', @@ -184,15 +232,15 @@ export const BRIDGE_MAP = { '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [], }, '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [], }, '0xb753428af26E81097e7fD17f40c88aaA3E04902c': { @@ -205,7 +253,15 @@ export const BRIDGE_MAP = { '0xdAC17F958D2ee523a2206206994597C13D831ec7': { decimals: 6, symbol: 'USDT', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC', 'USDT', 'nUSD'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -227,7 +283,15 @@ export const BRIDGE_MAP = { '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E': { decimals: 18, symbol: 'crvUSD', - origin: ['CCTP.USDC', 'DAI', 'USDC', 'USDT', 'nUSD', 'synFRAX'], + origin: [ + 'CCTP.USDC', + 'DAI', + 'RFQ.USDC', + 'USDC', + 'USDT', + 'nUSD', + 'synFRAX', + ], destination: ['CCTP.USDC'], swappable: [ '0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F', @@ -244,8 +308,8 @@ export const BRIDGE_MAP = { '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85': { decimals: 6, symbol: 'USDC', - origin: ['CCTP.USDC', 'nUSD'], - destination: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], + destination: ['CCTP.USDC', 'RFQ.USDC'], swappable: [ '0x67C10C397dD0Ba417329543c1a40eb48AAa7cd00', '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', @@ -264,7 +328,7 @@ export const BRIDGE_MAP = { '0x121ab82b49B2BC4c7901CA46B8277962b4350204': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x809DC529f07651bD43A172e8dB6f4a7a0d771036', @@ -288,7 +352,7 @@ export const BRIDGE_MAP = { '0x67C10C397dD0Ba417329543c1a40eb48AAa7cd00': { decimals: 18, symbol: 'nUSD', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -301,7 +365,7 @@ export const BRIDGE_MAP = { '0x7F5c764cBc14f9669B88837ca1490cCa17c31607': { decimals: 6, symbol: 'USDC.e', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -314,7 +378,7 @@ export const BRIDGE_MAP = { '0x809DC529f07651bD43A172e8dB6f4a7a0d771036': { decimals: 18, symbol: 'nETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x121ab82b49B2BC4c7901CA46B8277962b4350204', @@ -324,7 +388,7 @@ export const BRIDGE_MAP = { '0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9': { decimals: 18, symbol: 'sUSD', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -337,7 +401,7 @@ export const BRIDGE_MAP = { '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58': { decimals: 6, symbol: 'USDT', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -357,7 +421,7 @@ export const BRIDGE_MAP = { '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1': { decimals: 18, symbol: 'DAI', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', @@ -377,8 +441,8 @@ export const BRIDGE_MAP = { '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [ '0x121ab82b49B2BC4c7901CA46B8277962b4350204', '0x809DC529f07651bD43A172e8dB6f4a7a0d771036', @@ -1183,7 +1247,7 @@ export const BRIDGE_MAP = { '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93': { decimals: 18, symbol: 'crvUSD', - origin: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], destination: ['CCTP.USDC'], swappable: [ '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb', @@ -1195,7 +1259,7 @@ export const BRIDGE_MAP = { '0x4200000000000000000000000000000000000006': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', @@ -1212,7 +1276,7 @@ export const BRIDGE_MAP = { '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb': { decimals: 18, symbol: 'DAI', - origin: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], destination: ['CCTP.USDC'], swappable: [ '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93', @@ -1231,8 +1295,8 @@ export const BRIDGE_MAP = { '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913': { decimals: 6, symbol: 'USDC', - origin: ['CCTP.USDC'], - destination: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], + destination: ['CCTP.USDC', 'RFQ.USDC'], swappable: [ '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93', '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb', @@ -1250,7 +1314,7 @@ export const BRIDGE_MAP = { '0xEB466342C4d449BC9f53A865D5Cb90586f405215': { decimals: 6, symbol: 'axlUSDC', - origin: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], destination: ['CCTP.USDC'], swappable: [ '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93', @@ -1262,8 +1326,8 @@ export const BRIDGE_MAP = { '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [ '0x4200000000000000000000000000000000000006', '0xb554A55358fF0382Fb21F0a478C3546d1106Be8c', @@ -1272,7 +1336,7 @@ export const BRIDGE_MAP = { '0xb554A55358fF0382Fb21F0a478C3546d1106Be8c': { decimals: 18, symbol: 'nETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x4200000000000000000000000000000000000006', @@ -1282,7 +1346,7 @@ export const BRIDGE_MAP = { '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA': { decimals: 6, symbol: 'USDbC', - origin: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC'], destination: ['CCTP.USDC'], swappable: [ '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93', @@ -1317,7 +1381,7 @@ export const BRIDGE_MAP = { '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F': { decimals: 18, symbol: 'FRAX', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688', @@ -1330,7 +1394,7 @@ export const BRIDGE_MAP = { '0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688': { decimals: 18, symbol: 'nUSD', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', @@ -1350,7 +1414,7 @@ export const BRIDGE_MAP = { '0x3ea9B0ab55F34Fb188824Ee288CeaEfC63cf908e': { decimals: 18, symbol: 'nETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', @@ -1374,7 +1438,7 @@ export const BRIDGE_MAP = { '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x3ea9B0ab55F34Fb188824Ee288CeaEfC63cf908e', @@ -1405,7 +1469,7 @@ export const BRIDGE_MAP = { '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1': { decimals: 18, symbol: 'DAI', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', @@ -1418,8 +1482,8 @@ export const BRIDGE_MAP = { '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [ '0x3ea9B0ab55F34Fb188824Ee288CeaEfC63cf908e', '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', @@ -1428,7 +1492,7 @@ export const BRIDGE_MAP = { '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8': { decimals: 6, symbol: 'USDC.e', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', @@ -1441,7 +1505,7 @@ export const BRIDGE_MAP = { '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9': { decimals: 6, symbol: 'USDT', - origin: ['CCTP.USDC', 'nUSD'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], destination: ['CCTP.USDC', 'nUSD'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', @@ -1461,8 +1525,8 @@ export const BRIDGE_MAP = { '0xaf88d065e77c8cC2239327C5EDb3A432268e5831': { decimals: 6, symbol: 'USDC', - origin: ['CCTP.USDC', 'nUSD'], - destination: ['CCTP.USDC'], + origin: ['CCTP.USDC', 'RFQ.USDC', 'nUSD'], + destination: ['CCTP.USDC', 'RFQ.USDC'], swappable: [ '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', '0x2913E812Cf0dcCA30FB28E6Cac3d2DCFF4497688', @@ -1729,6 +1793,22 @@ export const BRIDGE_MAP = { swappable: [], }, }, + '59144': { + '0x176211869cA2b568f2A7D4EE941E073a821EE1ff': { + origin: ['RFQ.USDC'], + destination: ['RFQ.USDC'], + swappable: [], + symbol: 'USDC', + decimals: 6, + }, + '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { + origin: ['RFQ.ETH'], + destination: ['RFQ.ETH'], + swappable: [], + symbol: 'ETH', + decimals: 18, + }, + }, '81457': { '0x3194B0A295D87fDAA54DF852c248F7a6BAF6c6e0': { decimals: 18, @@ -1740,14 +1820,14 @@ export const BRIDGE_MAP = { '0x4300000000000000000000000000000000000003': { decimals: 18, symbol: 'USDB', - origin: ['nUSD'], - destination: ['nUSD'], + origin: ['nUSD', 'RFQ.USDB'], + destination: ['nUSD', 'RFQ.USDB'], swappable: ['0x3194B0A295D87fDAA54DF852c248F7a6BAF6c6e0'], }, '0x4300000000000000000000000000000000000004': { decimals: 18, symbol: 'WETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', @@ -1764,8 +1844,8 @@ export const BRIDGE_MAP = { '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { decimals: 18, symbol: 'ETH', - origin: ['nETH'], - destination: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], + destination: ['nETH', 'RFQ.ETH'], swappable: [ '0x4300000000000000000000000000000000000004', '0xce971282fAAc9faBcF121944956da7142cccC855', @@ -1774,7 +1854,7 @@ export const BRIDGE_MAP = { '0xce971282fAAc9faBcF121944956da7142cccC855': { decimals: 18, symbol: 'nETH', - origin: ['nETH'], + origin: ['RFQ.ETH', 'nETH'], destination: ['nETH'], swappable: [ '0x4300000000000000000000000000000000000004', @@ -1782,6 +1862,22 @@ export const BRIDGE_MAP = { ], }, }, + '534352': { + '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4': { + origin: ['RFQ.USDC'], + destination: ['RFQ.USDC'], + swappable: [], + symbol: 'USDC', + decimals: 6, + }, + '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': { + origin: ['RFQ.ETH'], + destination: ['RFQ.ETH'], + swappable: [], + symbol: 'ETH', + decimals: 18, + }, + }, '1313161554': { '0x07379565cD8B0CaE7c60Dc78e7f601b34AF2A21c': { decimals: 18, diff --git a/packages/synapse-constants/constants/tokens/bridgeable.ts b/packages/synapse-constants/constants/tokens/bridgeable.ts index 4fb2a9c585..98a4469b48 100644 --- a/packages/synapse-constants/constants/tokens/bridgeable.ts +++ b/packages/synapse-constants/constants/tokens/bridgeable.ts @@ -506,6 +506,7 @@ export const USDT = new Token({ [CHAINS.KLAYTN.id]: 6, [CHAINS.ARBITRUM.id]: 6, [CHAINS.AVALANCHE.id]: 6, + [CHAINS.SCROLL.id]: 6, }, symbol: 'USDT', name: 'USD Tether', diff --git a/packages/synapse-constants/abi/IDefaultPool.json b/packages/synapse-constants/scripts/abi/IDefaultPool.json similarity index 100% rename from packages/synapse-constants/abi/IDefaultPool.json rename to packages/synapse-constants/scripts/abi/IDefaultPool.json diff --git a/packages/synapse-constants/abi/IERC20Metadata.json b/packages/synapse-constants/scripts/abi/IERC20Metadata.json similarity index 100% rename from packages/synapse-constants/abi/IERC20Metadata.json rename to packages/synapse-constants/scripts/abi/IERC20Metadata.json diff --git a/packages/synapse-constants/abi/SwapQuoter.json b/packages/synapse-constants/scripts/abi/SwapQuoter.json similarity index 100% rename from packages/synapse-constants/abi/SwapQuoter.json rename to packages/synapse-constants/scripts/abi/SwapQuoter.json diff --git a/packages/synapse-constants/abi/SynapseCCTP.json b/packages/synapse-constants/scripts/abi/SynapseCCTP.json similarity index 100% rename from packages/synapse-constants/abi/SynapseCCTP.json rename to packages/synapse-constants/scripts/abi/SynapseCCTP.json diff --git a/packages/synapse-constants/abi/SynapseCCTPRouter.json b/packages/synapse-constants/scripts/abi/SynapseCCTPRouter.json similarity index 100% rename from packages/synapse-constants/abi/SynapseCCTPRouter.json rename to packages/synapse-constants/scripts/abi/SynapseCCTPRouter.json diff --git a/packages/synapse-constants/abi/SynapseRouter.json b/packages/synapse-constants/scripts/abi/SynapseRouter.json similarity index 100% rename from packages/synapse-constants/abi/SynapseRouter.json rename to packages/synapse-constants/scripts/abi/SynapseRouter.json diff --git a/packages/synapse-constants/data/ignoredBridgeSymbols.json b/packages/synapse-constants/scripts/data/ignoredBridgeSymbols.json similarity index 100% rename from packages/synapse-constants/data/ignoredBridgeSymbols.json rename to packages/synapse-constants/scripts/data/ignoredBridgeSymbols.json diff --git a/packages/synapse-constants/data/legacyTokens.json b/packages/synapse-constants/scripts/data/legacyTokens.json similarity index 100% rename from packages/synapse-constants/data/legacyTokens.json rename to packages/synapse-constants/scripts/data/legacyTokens.json diff --git a/packages/synapse-constants/data/providers.json b/packages/synapse-constants/scripts/data/providers.json similarity index 100% rename from packages/synapse-constants/data/providers.json rename to packages/synapse-constants/scripts/data/providers.json diff --git a/packages/synapse-constants/data/symbolOverrides.json b/packages/synapse-constants/scripts/data/symbolOverrides.json similarity index 100% rename from packages/synapse-constants/data/symbolOverrides.json rename to packages/synapse-constants/scripts/data/symbolOverrides.json diff --git a/packages/synapse-constants/scripts/generateMaps.js b/packages/synapse-constants/scripts/generateMaps.js index 867aa39ad3..f37ada1328 100644 --- a/packages/synapse-constants/scripts/generateMaps.js +++ b/packages/synapse-constants/scripts/generateMaps.js @@ -1,21 +1,21 @@ -const fs = require('fs') -const { execSync } = require('child_process') - const { ethers } = require('ethers') +const { prettyPrintTS } = require('./utils/prettyPrintTs') +const { fetchRfqData } = require('./utils/fetchRfqData') // Provider URLs -const providers = require('../data/providers.json') +const providers = require('./data/providers.json') // List of ignored bridge symbols -const ignoredBridgeSymbols = require('../data/ignoredBridgeSymbols.json') +const ignoredBridgeSymbols = require('./data/ignoredBridgeSymbols.json') // Symbol overrides (for tokens with incorrect on-chain symbols) -const symbolOverrides = require('../data/symbolOverrides.json') +const symbolOverrides = require('./data/symbolOverrides.json') // Contract ABIs -const SynapseRouterABI = require('../abi/SynapseRouter.json') -const SynapseCCTPABI = require('../abi/SynapseCCTP.json') -const SynapseCCTPRouterABI = require('../abi/SynapseCCTPRouter.json') -const SwapQuoterABI = require('../abi/SwapQuoter.json') -const ERC20ABI = require('../abi/IERC20Metadata.json') -const DefaultPoolABI = require('../abi/IDefaultPool.json') +const SynapseRouterABI = require('./abi/SynapseRouter.json') +const SynapseCCTPABI = require('./abi/SynapseCCTP.json') +const SynapseCCTPRouterABI = require('./abi/SynapseCCTPRouter.json') +const SwapQuoterABI = require('./abi/SwapQuoter.json') +const ERC20ABI = require('./abi/IERC20Metadata.json') +const DefaultPoolABI = require('./abi/IDefaultPool.json') +// const rfqResponse = require('./data/rfqResponse.json') // ETH address const ETH = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' @@ -30,13 +30,22 @@ const SynapseRouterAddress = '0x7e7a0e201fd38d3adaa9523da6c109a07118c96a' const SynapseCCTPRouterAddress = '0xd5a597d6e7ddf373a92C8f477DAAA673b0902F48' const SynapseCCTPAddress = '0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E' +// Chain IDs where SynapseBridge is allowed +const allowedChainIdsForSynapseBridge = [ + 1, 10, 25, 56, 137, 250, 288, 1088, 1284, 1285, 2000, 7700, 8217, 8453, 81457, + 42161, 43114, 53935, 1313161554, 1666600000, +] + // Chain IDs where SynapseCCTPRouter is allowed const allowedChainIdsForSynapseCCTPRouter = [1, 10, 137, 8453, 42161, 43114] +// Chain IDs where RFQ is allowed +const allowedChainIdsForRfq = [1, 10, 56, 8453, 42161, 59144, 81457, 534352] + // Get SynapseRouter contract instances for each chain const SynapseRouters = {} const SwapQuoters = {} -Object.keys(providers).forEach((chainId) => { +allowedChainIdsForSynapseBridge.forEach((chainId) => { SynapseRouters[chainId] = new ethers.Contract( SynapseRouterAddress, SynapseRouterABI, @@ -69,6 +78,13 @@ allowedChainIdsForSynapseCCTPRouter.forEach((chainId) => { // Function to get list of tokens that could be swapped // into SynapseBridge tokens for a given chain. const getBridgeOriginMap = async (chainId) => { + if (!SwapQuoters[chainId]) { + return { + originMap: {}, + poolSets: [], + } + } + // Get WETH address const weth = await SwapQuoters[chainId].weth() // Get list of supported tokens @@ -254,11 +270,12 @@ const sortMapByKeys = (map) => { }) return sortedMap } - const printMaps = async () => { const bridgeMap = {} const bridgeSymbolsMap = {} console.log('Starting on chains: ', Object.keys(providers)) + + const rfqResponse = await fetchRfqData() await Promise.all( Object.keys(providers).map(async (chainId) => { // Get map from token to set of bridge token symbols @@ -268,6 +285,17 @@ const printMaps = async () => { Object.keys(cctpOriginMap).forEach((token) => { addSetToMap(originMap, token, cctpOriginMap[token]) }) + // Add RFQ.ETH and RFQ.USDC to origin map of tokens bridgeable into nETH or CCTP.USDC respectively + if (allowedChainIdsForRfq.includes(Number(chainId))) { + Object.keys(originMap).forEach((token) => { + if (originMap[token].has('nETH')) { + originMap[token].add('RFQ.ETH') + } + if (originMap[token].has('CCTP.USDC')) { + originMap[token].add('RFQ.USDC') + } + }) + } const tokens = {} await Promise.all( Object.keys(originMap).map(async (token) => { @@ -280,12 +308,72 @@ const printMaps = async () => { } }) ) + + if (allowedChainIdsForRfq.includes(Number(chainId))) { + await Promise.all( + rfqResponse.map(async (quote) => { + const { + origin_chain_id, + origin_token_addr, + dest_chain_id, + dest_token_addr, + } = quote + + const normalizedOriginAddress = + ethers.utils.getAddress(origin_token_addr) + + const normalizedDestAddress = + ethers.utils.getAddress(dest_token_addr) + + if (origin_chain_id === Number(chainId)) { + const originTokenSymbol = await getTokenSymbol( + origin_chain_id, + normalizedOriginAddress + ) + + const rfqOriginSymbol = getRFQSymbol(originTokenSymbol) + + if (!tokens[normalizedOriginAddress]) { + tokens[normalizedOriginAddress] = { + origin: [], + destination: [], + swappable: [], // poolSets are handled during SynapseBridge portion + symbol: originTokenSymbol, + decimals: await getTokenDecimals( + origin_chain_id, + normalizedOriginAddress + ), + } + } + // Add RFQ symbol to origin list if not already present + if ( + !tokens[normalizedOriginAddress].origin.includes( + rfqOriginSymbol + ) + ) { + tokens[normalizedOriginAddress].origin.push(rfqOriginSymbol) + } + // Add RFQ symbol to destination list if not already present + if ( + !tokens[normalizedOriginAddress].destination.includes( + rfqOriginSymbol + ) + ) { + tokens[normalizedOriginAddress].destination.push( + rfqOriginSymbol + ) + } + } + }) + ) + } + bridgeMap[chainId] = sortMapByKeys(tokens) bridgeSymbolsMap[chainId] = sortMapByKeys(extractBridgeSymbolsMap(tokens)) console.log('Finished chain: ', chainId) }) ) - prettyPrintTS(bridgeMap, 'BRIDGE_MAP', './constants/tokens/bridgeMap.ts') + prettyPrintTS(bridgeMap, 'BRIDGE_MAP', './constants/bridgeMap.ts') } @@ -323,6 +411,7 @@ const extractBridgeSymbolsMap = (tokens) => { ...Object.keys(bridgeSymbolsDestinationSets), ]) const bridgeSymbolsMap = {} + bridgeSymbols.forEach((symbol) => { bridgeSymbolsMap[symbol] = { origin: Array.from(bridgeSymbolsOriginSets[symbol]).sort(), @@ -335,6 +424,9 @@ const extractBridgeSymbolsMap = (tokens) => { const getTokenSymbol = async (chainId, token) => { // Check if token is ETH if (token === ETH) { + if (!SwapQuoters[chainId]) { + return 'ETH' + } // Get WETH address from SwapQuoter const weth = await SwapQuoters[chainId].weth() // Return "WETH" symbol without first character @@ -367,13 +459,8 @@ const getTokenDecimals = async (chainId, token) => { return decimals } -// Writes map export to a TypeScript file, then runs prettier on the file -const prettyPrintTS = (map, mapName, fn) => { - console.log(`Writing ${mapName} to ${fn}`) - const json = JSON.stringify(map) - fs.writeFileSync(fn, `export const ${mapName} = ${json}`) - // Run prettier on the file using terminal command: - execSync(`npx prettier --write ${fn}`) +const getRFQSymbol = (symbol) => { + return `RFQ.${symbol}` } printMaps() diff --git a/packages/synapse-constants/scripts/utils/fetchRfqData.js b/packages/synapse-constants/scripts/utils/fetchRfqData.js new file mode 100644 index 0000000000..8289c36d58 --- /dev/null +++ b/packages/synapse-constants/scripts/utils/fetchRfqData.js @@ -0,0 +1,17 @@ +// URL for RFQ quotes +const RFQ_URL = 'https://rfq-api.omnirpc.io/quotes' + +const fetchRfqData = async () => { + try { + const response = await fetch(RFQ_URL) + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`) + } + return await response.json() + } catch (error) { + console.error('Failed to fetch RFQ data:', error) + return [] + } +} + +module.exports = { fetchRfqData } diff --git a/packages/synapse-constants/scripts/utils/prettyPrintTs.js b/packages/synapse-constants/scripts/utils/prettyPrintTs.js new file mode 100644 index 0000000000..61629dafdc --- /dev/null +++ b/packages/synapse-constants/scripts/utils/prettyPrintTs.js @@ -0,0 +1,13 @@ +const fs = require('fs') +const { execSync } = require('child_process') + +// Writes map export to a TypeScript file, then runs prettier on the file +const prettyPrintTS = (map, mapName, fn) => { + console.log(`Writing ${mapName} to ${fn}`) + const json = JSON.stringify(map) + fs.writeFileSync(fn, `export const ${mapName} = ${json}`) + // Run prettier on the file using terminal command: + execSync(`npx prettier --write ${fn}`) +} + +module.exports = { prettyPrintTS }