From 757053b415503584341217e2a4a1395df649eb70 Mon Sep 17 00:00:00 2001 From: Trajan0x Date: Mon, 5 Dec 2022 18:52:08 -0500 Subject: [PATCH 1/2] wavax token --- src/swappools.ts | 4 +++- src/tokens.ts | 3 ++- test/synapsebridge/getEstimatedBridgeOutput-test.ts | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/swappools.ts b/src/swappools.ts index 51f79f62..1079649d 100644 --- a/src/swappools.ts +++ b/src/swappools.ts @@ -775,7 +775,8 @@ export namespace SwapPools { [SwapType.WBTC]: [Tokens.WBTC], [SwapType.KLAY]: KLAY_Pool.poolTokens, [SwapType.JEWEL]: [Tokens.JEWEL], - [SwapType.BTCB]: [Tokens.BTCB] + [SwapType.BTCB]: [Tokens.BTCB], + [SwapType.AVAX]: [Tokens.WAVAX], }, swappableSwapGroups: { [SwapType.ETH]: {poolTokens: [Tokens.ETH, Tokens.WETH], swapType: SwapType.ETH}, @@ -783,6 +784,7 @@ export namespace SwapPools { [SwapType.KLAY]: KLAY_Pool, [SwapType.JEWEL]: JEWEL_POOL, [SwapType.BTCB]: BTCB_Pool, + [SwapType.AVAX]: WAVAX_Pool, }, }, }; diff --git a/src/tokens.ts b/src/tokens.ts index f9fa2c3e..9b77a6e1 100644 --- a/src/tokens.ts +++ b/src/tokens.ts @@ -373,7 +373,8 @@ export namespace Tokens { [ChainId.MOONBEAM]: "0xA1f8890E39b4d8E33efe296D698fe42Fb5e59cC3", [ChainId.AVALANCHE]: "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", [ChainId.DFK]: "0xB57B60DeBDB0b8172bb6316a9164bd3C695F133a", - [ChainId.HARMONY]: "0xD9eAA386cCD65F30b77FF175F6b52115FE454fD6" // synAVAX, but here for compat. + [ChainId.HARMONY]: "0xD9eAA386cCD65F30b77FF175F6b52115FE454fD6", // synAVAX, but here for compat. + [ChainId.KLAYTN]: "0xCd8fE44A29Db9159dB36f96570d7A4d91986f528" }, swapType: SwapType.AVAX, underlyingToken: AVAX, diff --git a/test/synapsebridge/getEstimatedBridgeOutput-test.ts b/test/synapsebridge/getEstimatedBridgeOutput-test.ts index 8b4522f2..cbe31177 100644 --- a/test/synapsebridge/getEstimatedBridgeOutput-test.ts +++ b/test/synapsebridge/getEstimatedBridgeOutput-test.ts @@ -255,6 +255,7 @@ describe("SynapseBridge - getEstimatedBridgeOutput tests", function(this: Mocha. makeTestCase(Tokens.GAS_JEWEL, Tokens.JEWEL, ChainId.DFK, ChainId.KLAYTN), makeTestCase(Tokens.BTCB, Tokens.BTCB, ChainId.DFK, ChainId.KLAYTN), makeTestCase(Tokens.BTCB, Tokens.BTCB, ChainId.AVALANCHE, ChainId.DFK), + makeTestCase(Tokens.WAVAX, Tokens.WAVAX, ChainId.DFK, ChainId.KLAYTN) ].forEach((tc: TestCase) => { const [describeTitle, bridgeOutputTestTitle, transactionTestTitle, approveTestTitle] = makeTestName(tc); From c965f54f3d16d1869a43da1d95aa41ecd0e473a3 Mon Sep 17 00:00:00 2001 From: Trajan0x Date: Mon, 5 Dec 2022 19:56:24 -0500 Subject: [PATCH 2/2] new sdk --- src/tokenswap.ts | 3 ++- test/synapsebridge/getEstimatedBridgeOutput-test.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tokenswap.ts b/src/tokenswap.ts index a491305b..025411fd 100644 --- a/src/tokenswap.ts +++ b/src/tokenswap.ts @@ -102,6 +102,7 @@ export namespace UnsupportedSwapErrors { } export namespace TokenSwap { + import DFK_ETH = Tokens.DFK_ETH; const BRIDGE_CONFIG_INSTANCE: BridgeConfigV3Contract = BridgeConfigV3ContractInstance(); export interface SwapParams { @@ -640,7 +641,7 @@ export namespace TokenSwap { } } - if (chainId === ChainId.KLAYTN) { + if (chainId === ChainId.KLAYTN && token.name != DFK_ETH.name) { // For bridging WETH from L2s, it must be swapped to nETH and redeemed // 'bridgeConfigIntermediateToken' is just WETH, whose address is used to calculate swap price if (BridgeUtils.isL2ETHChain(otherChainId) && token.swapType === SwapType.ETH) { diff --git a/test/synapsebridge/getEstimatedBridgeOutput-test.ts b/test/synapsebridge/getEstimatedBridgeOutput-test.ts index cbe31177..5bb7e95f 100644 --- a/test/synapsebridge/getEstimatedBridgeOutput-test.ts +++ b/test/synapsebridge/getEstimatedBridgeOutput-test.ts @@ -255,7 +255,8 @@ describe("SynapseBridge - getEstimatedBridgeOutput tests", function(this: Mocha. makeTestCase(Tokens.GAS_JEWEL, Tokens.JEWEL, ChainId.DFK, ChainId.KLAYTN), makeTestCase(Tokens.BTCB, Tokens.BTCB, ChainId.DFK, ChainId.KLAYTN), makeTestCase(Tokens.BTCB, Tokens.BTCB, ChainId.AVALANCHE, ChainId.DFK), - makeTestCase(Tokens.WAVAX, Tokens.WAVAX, ChainId.DFK, ChainId.KLAYTN) + makeTestCase(Tokens.WAVAX, Tokens.WAVAX, ChainId.DFK, ChainId.KLAYTN), + makeTestCase(Tokens.DFK_ETH, Tokens.NETH, ChainId.DFK, ChainId.KLAYTN) ].forEach((tc: TestCase) => { const [describeTitle, bridgeOutputTestTitle, transactionTestTitle, approveTestTitle] = makeTestName(tc);