From 99c8f51fb9f2eb4665b611509fa1b7c8fdad03aa Mon Sep 17 00:00:00 2001 From: defi-moses Date: Wed, 18 Dec 2024 21:35:29 +0000 Subject: [PATCH] paused chain + updated SDK --- packages/sdk-router/src/constants/chainIds.ts | 10 +++- packages/sdk-router/src/sdk.test.ts | 50 +++++++++++++++++++ .../public/pauses/v1/paused-chains.json | 7 +++ 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/packages/sdk-router/src/constants/chainIds.ts b/packages/sdk-router/src/constants/chainIds.ts index b3fe066cfe..041705a69e 100644 --- a/packages/sdk-router/src/constants/chainIds.ts +++ b/packages/sdk-router/src/constants/chainIds.ts @@ -33,6 +33,11 @@ const UNSUPPORTED_BRIDGE_CHAIN_IDS: number[] = [ SupportedChainId.WORLDCHAIN, ] +/** + * List of paused chain IDs + */ +export const PAUSED_CHAIN_IDS: SupportedChainId[] = [SupportedChainId.BOBA] + /** * List of supported chain ids, where SynapseBridge is deployed. */ @@ -40,6 +45,7 @@ export const SUPPORTED_CHAIN_IDS: number[] = Object.values(SupportedChainId) .map((chainId) => Number(chainId)) .filter((chainId) => !isNaN(chainId)) .filter((chainId) => !UNSUPPORTED_BRIDGE_CHAIN_IDS.includes(chainId)) + .filter((chainId) => !PAUSED_CHAIN_IDS.includes(chainId)) /** * List of chain ids where SynapseCCTP is deployed, ordered by CCTP's domain: @@ -54,7 +60,7 @@ export const CCTP_SUPPORTED_CHAIN_IDS: number[] = [ SupportedChainId.ARBITRUM, SupportedChainId.BASE, SupportedChainId.POLYGON, // Circle domain 7 -] +].filter((chainId) => !PAUSED_CHAIN_IDS.includes(chainId)) /** * List of chain ids where FastBridge (RFQ) is deployed, ordered by chain id @@ -70,7 +76,7 @@ export const RFQ_SUPPORTED_CHAIN_IDS: number[] = [ SupportedChainId.LINEA, SupportedChainId.BLAST, SupportedChainId.SCROLL, -] +].filter((chainId) => !PAUSED_CHAIN_IDS.includes(chainId)) /** * List of chain ids where hydrating on constructor is supported , ordered by monke diff --git a/packages/sdk-router/src/sdk.test.ts b/packages/sdk-router/src/sdk.test.ts index 68d6d259a2..5bdac2e31b 100644 --- a/packages/sdk-router/src/sdk.test.ts +++ b/packages/sdk-router/src/sdk.test.ts @@ -1818,3 +1818,53 @@ describe('SynapseSDK', () => { }) }) }) + +describe('Paused Chain Tests', () => { + let synapseSDK: SynapseSDK + + beforeEach(() => { + // Setup SDK with test providers + const chainIds = [SupportedChainId.ETH, SupportedChainId.BOBA] // Include a paused chain + const providers = chainIds.map((chainId) => getTestProvider(chainId)) + synapseSDK = new SynapseSDK(chainIds, providers) + }) + + describe('Bridge Quote Generation', () => { + it('should not find quotes when origin chain is paused', async () => { + // Try to get quote from paused chain (BOBA) + await expect( + synapseSDK.bridgeQuote( + SupportedChainId.BOBA, // Paused chain as origin + SupportedChainId.ETH, + ARB_USDC, // Example token addresses + ETH_USDC, + parseFixed('100', 6) + ) + ).rejects.toThrow('No route found') + }) + + it('should not find quotes when destination chain is paused', async () => { + await expect( + synapseSDK.bridgeQuote( + SupportedChainId.ETH, + SupportedChainId.BOBA, // Paused chain as destination + ETH_USDC, + ARB_USDC, + parseFixed('100', 6) + ) + ).rejects.toThrow('No route found') + }) + + it('should not find quotes when allBridgeQuotes is called with paused chains', async () => { + const quotes = await synapseSDK.allBridgeQuotes( + SupportedChainId.BOBA, // Paused chain + SupportedChainId.ETH, + ARB_USDC, + ETH_USDC, + parseFixed('100', 6) + ) + + expect(quotes).toHaveLength(0) + }) + }) +}) diff --git a/packages/synapse-interface/public/pauses/v1/paused-chains.json b/packages/synapse-interface/public/pauses/v1/paused-chains.json index fd6f6ab202..8b8cca0433 100644 --- a/packages/synapse-interface/public/pauses/v1/paused-chains.json +++ b/packages/synapse-interface/public/pauses/v1/paused-chains.json @@ -49,5 +49,12 @@ "disableBanner": false, "disableWarning": true, "disableCountdown": false + }, + { + "id": "boba-chain-pause", + "pausedFromChains": [288], + "pausedToChains": [288], + "pauseBridge": true, + "pauseSwap": false } ]