Skip to content

Commit

Permalink
Merge pull request #292 from EdgeApp/matthew/fixEthSwaps
Browse files Browse the repository at this point in the history
If swap requires a wrap function then correctly use the wrapped address
  • Loading branch information
peachbits authored Sep 28, 2023
2 parents e3260c3 + 236deba commit 4e528ba
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/swap/defi/defiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ export const getInOutTokenAddresses = (
? undefined
: allTokens[toTokenId]

const fromTokenAddress =
asMaybe(asContractLocation)(fromToken?.networkLocation)?.contractAddress ??
''
const toTokenAddress =
asMaybe(asContractLocation)(toToken?.networkLocation)?.contractAddress ?? ''
const fromTokenAddress = isFromNativeCurrency
? wrappedMainnetAddress
: asMaybe(asContractLocation)(fromToken?.networkLocation)
?.contractAddress ?? ''
const toTokenAddress = isToNativeCurrency
? wrappedMainnetAddress
: asMaybe(asContractLocation)(toToken?.networkLocation)?.contractAddress ??
''

const isFromWrappedCurrency =
fromTokenAddress.toLowerCase() === wrappedMainnetAddress.toLowerCase()
Expand Down

0 comments on commit 4e528ba

Please sign in to comment.