Skip to content

Commit

Permalink
paused chain + updated SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
Defi-Moses committed Dec 18, 2024
1 parent 3feab21 commit 99c8f51
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/sdk-router/src/constants/chainIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ 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.
*/
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:
Expand All @@ -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
Expand All @@ -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
Expand Down
50 changes: 50 additions & 0 deletions packages/sdk-router/src/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,12 @@
"disableBanner": false,
"disableWarning": true,
"disableCountdown": false
},
{
"id": "boba-chain-pause",
"pausedFromChains": [288],
"pausedToChains": [288],
"pauseBridge": true,
"pauseSwap": false
}
]

0 comments on commit 99c8f51

Please sign in to comment.