Skip to content

Commit

Permalink
chore: engine name, more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Jan 23, 2025
1 parent 639542f commit 071f674
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/sdk-router/src/operations/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Query,
applyDeadlineToQuery,
} from '../module'
import { logger } from '../utils/logger'

/**
* Creates a populated bridge transaction ready for signing and submission to the origin chain.
Expand Down Expand Up @@ -169,6 +170,10 @@ export async function allBridgeQuotes(
amountIn,
options.originUserAddress
)
logger.info(
{ routes },
`Found ${routes.length} routes for ${moduleSet.bridgeModuleName}`
)
// Filter out routes with zero minAmountOut and finalize the rest
return Promise.all(
routes
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-router/src/rfq/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export const getBestRelayerQuote = async (
logger.info({ rfqRequest, rfqResponse }, 'No RFQ quote returned')
return ZeroQuote
}
logger.info({ rfqRequest, rfqResponse }, 'Received RFQ quote')
return {
destAmount,
relayerAddress: rfqResponse.relayer_address,
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-router/src/rfq/engine/defaultEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class DefaultEngine implements SwapEngine {
// Remove extra fields before the encoding
return {
engineID: this.id,
engineName: EngineID[this.id],
chainId,
expectedAmountOut: amountOut,
steps: stepsOutput.map(({ token, amount, msgValue, zapData }) => ({
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk-router/src/rfq/engine/kyberSwapEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type KyberSwapQuote = SwapEngineQuote & {

const EmptyKyberSwapQuote: KyberSwapQuote = {
engineID: EngineID.KyberSwap,
engineName: EngineID[EngineID.KyberSwap],
chainId: 0,
expectedAmountOut: Zero,
routeSummary: {
Expand Down Expand Up @@ -129,6 +130,7 @@ export class KyberSwapEngine implements SwapEngine {
}
return {
engineID: this.id,
engineName: EngineID[this.id],
chainId,
expectedAmountOut,
routeSummary: kyberSwapQuoteResponse.data.routeSummary,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk-router/src/rfq/engine/liFiEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type LiFiQuote = SwapEngineQuote & {

const EmptyLiFiQuote: LiFiQuote = {
engineID: EngineID.LiFi,
engineName: EngineID[EngineID.LiFi],
chainId: 0,
expectedAmountOut: Zero,
}
Expand Down Expand Up @@ -84,6 +85,7 @@ export class LiFiEngine implements SwapEngine {
}
return {
engineID: this.id,
engineName: EngineID[this.id],
chainId,
expectedAmountOut: BigNumber.from(liFiResponse.estimate.toAmount),
tx: liFiResponse.transactionRequest,
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-router/src/rfq/engine/noOpEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class NoOpEngine implements SwapEngine {
}
return {
engineID: this.id,
engineName: EngineID[this.id],
chainId,
expectedAmountOut: BigNumber.from(amountIn),
steps: [],
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk-router/src/rfq/engine/paraSwapEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type ParaSwapQuote = SwapEngineQuote & {

const EmptyParaSwapQuote: ParaSwapQuote = {
engineID: EngineID.ParaSwap,
engineName: EngineID[EngineID.ParaSwap],
chainId: 0,
expectedAmountOut: Zero,
priceRoute: {
Expand Down Expand Up @@ -127,6 +128,7 @@ export class ParaSwapEngine implements SwapEngine {
}
return {
engineID: this.id,
engineName: EngineID[this.id],
chainId,
expectedAmountOut: BigNumber.from(paraSwapResponse.priceRoute.destAmount),
priceRoute: paraSwapResponse.priceRoute,
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-router/src/rfq/engine/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const generateAPIRoute = (

return {
engineID,
engineName: EngineID[engineID],
chainId: input.chainId,
expectedAmountOut: response.amountOut,
steps: [
Expand Down
3 changes: 3 additions & 0 deletions packages/sdk-router/src/rfq/engine/swapEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export enum EngineID {

export type SwapEngineQuote = {
engineID: EngineID
engineName: string
chainId: number
expectedAmountOut: BigNumber
steps?: StepParams[]
Expand Down Expand Up @@ -120,6 +121,7 @@ export const applySlippage = (
export const getEmptyQuote = (engineID: EngineID): SwapEngineQuote => {
return {
engineID,
engineName: EngineID[engineID],
chainId: 0,
expectedAmountOut: Zero,
}
Expand All @@ -128,6 +130,7 @@ export const getEmptyQuote = (engineID: EngineID): SwapEngineQuote => {
export const getEmptyRoute = (engineID: EngineID): SwapEngineRoute => {
return {
engineID,
engineName: EngineID[engineID],
chainId: 0,
expectedAmountOut: Zero,
steps: [],
Expand Down

0 comments on commit 071f674

Please sign in to comment.