Skip to content

Commit

Permalink
Merge branch 'feat/sdk-syn-intents' into staging/syn-intents-api-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Dec 20, 2024
2 parents 26b209c + 3380877 commit 9bfec89
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/sdk-router/src/rfq/engine/odosEngine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BigNumber } from 'ethers'
import { Zero } from '@ethersproject/constants'
import { AddressZero, Zero } from '@ethersproject/constants'

import { fetchWithTimeout } from '../api'
import {
Expand All @@ -18,6 +18,7 @@ import {
} from './swapEngine'
import { AddressMap } from '../../constants'
import { isSameAddress } from '../../utils/addressUtils'
import { isNativeToken } from '../../utils/handleNativeToken'
import { logger } from '../../utils/logger'

const ODOS_API_URL = 'https://api.odos.xyz/sor'
Expand Down Expand Up @@ -87,13 +88,13 @@ export class OdosEngine implements SwapEngine {
inputTokens: [
{
amount: amountIn.toString(),
tokenAddress: tokenIn,
tokenAddress: this.handleNativeToken(tokenIn),
},
],
outputTokens: [
{
proportion: 1,
tokenAddress: tokenOut,
tokenAddress: this.handleNativeToken(tokenOut),
},
],
userAddr: tokenZap,
Expand Down Expand Up @@ -184,4 +185,8 @@ export class OdosEngine implements SwapEngine {
return EMPTY_SWAP_API_RESPONSE
}
}

private handleNativeToken(token: string): string {
return isNativeToken(token) ? AddressZero : token
}
}

0 comments on commit 9bfec89

Please sign in to comment.