Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #145 from synapsecns/fix/dfk--eth
Browse files Browse the repository at this point in the history
Fix/dfk  eth
  • Loading branch information
aureliusbtc authored Dec 6, 2022
2 parents f0489ef + c965f54 commit e50b1bb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/swappools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,14 +775,16 @@ 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},
[SwapType.WBTC]: {poolTokens: [Tokens.WBTC], swapType: SwapType.WBTC},
[SwapType.KLAY]: KLAY_Pool,
[SwapType.JEWEL]: JEWEL_POOL,
[SwapType.BTCB]: BTCB_Pool,
[SwapType.AVAX]: WAVAX_Pool,
},
},
};
Expand Down
3 changes: 2 additions & 1 deletion src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/tokenswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions test/synapsebridge/getEstimatedBridgeOutput-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +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.DFK_ETH, Tokens.NETH, ChainId.DFK, ChainId.KLAYTN)
].forEach((tc: TestCase) => {
const [describeTitle, bridgeOutputTestTitle, transactionTestTitle, approveTestTitle] = makeTestName(tc);

Expand Down

0 comments on commit e50b1bb

Please sign in to comment.