Skip to content

Commit

Permalink
bandaid for token-to-token swap (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben2x4 authored Nov 3, 2022
1 parent 76bd64d commit 596a098
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,23 @@ export function selectEligiblePoolsForTokenToTokenSwap({
const intermediaryToken =
tokenA.symbol === poolAssetA.symbol ? poolAssetB : poolAssetA

const intermediaryTokenPositionInputPool =
intermediaryToken.denom === poolAssetA.denom ? 'a' : 'b'

const passThroughSwapOutputPool = poolsList.find(
({ pool_assets: [assetA, assetB] }) => {
const intermediaryTokenPositionOutputPool =
intermediaryToken.denom === assetA.denom ? 'a' : 'b'

const intermediaryTokenInSamePosition =
intermediaryTokenPositionInputPool ==
intermediaryTokenPositionOutputPool
return (
(intermediaryToken.symbol === assetA.symbol &&
((intermediaryToken.symbol === assetA.symbol &&
tokenB.symbol === assetB.symbol) ||
(tokenB.symbol === assetA.symbol &&
intermediaryToken.symbol === assetB.symbol)
(tokenB.symbol === assetA.symbol &&
intermediaryToken.symbol === assetB.symbol)) &&
intermediaryTokenInSamePosition
)
}
)
Expand Down

0 comments on commit 596a098

Please sign in to comment.