Skip to content

Commit

Permalink
chore: SIR detailed time logging, other modules not so much
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Jan 13, 2025
1 parent 75582aa commit 30a246e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/sdk-router/src/rfq/fastBridgeRouterSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { ONE_HOUR, TEN_MINUTES } from '../utils/deadlines'
import { isSameAddress } from '../utils/addressUtils'
import { marshallTicker, Ticker } from './ticker'
import { getAllQuotes, getBestRelayerQuote } from './api'
import { logExecutionTime } from '../utils/logger'

export class FastBridgeRouterSet extends SynapseModuleSet {
static readonly MAX_QUOTE_AGE_MILLISECONDS = 5 * 60 * 1000 // 5 minutes
Expand Down Expand Up @@ -88,6 +89,7 @@ export class FastBridgeRouterSet extends SynapseModuleSet {
/**
* @inheritdoc SynapseModuleSet.getBridgeRoutes
*/
@logExecutionTime('SynapseRFQ.getBridgeRoutes')
public async getBridgeRoutes(
originChainId: number,
destChainId: number,
Expand Down
4 changes: 4 additions & 0 deletions packages/sdk-router/src/rfq/sirSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class SynapseIntentRouterSet extends SynapseModuleSet {
/**
* @inheritdoc SynapseModuleSet.getBridgeRoutes
*/
@logExecutionTime('SynapseIntents.getBridgeRoutes')
public async getBridgeRoutes(
originChainId: number,
destChainId: number,
Expand Down Expand Up @@ -387,6 +388,7 @@ export class SynapseIntentRouterSet extends SynapseModuleSet {
return amount.sub(protocolFee)
}

@logExecutionTime('SynapseIntents.getOriginQuotes')
private async getOriginQuotes(
originChainId: number,
tickers: Ticker[],
Expand Down Expand Up @@ -427,6 +429,7 @@ export class SynapseIntentRouterSet extends SynapseModuleSet {
.filter(({ originQuote }) => originQuote.expectedAmountOut.gt(Zero))
}

@logExecutionTime('SynapseIntents.getDestinationQuotes')
private async getDestinationQuotes(
originIntents: OriginIntent[],
tokenOut: string
Expand Down Expand Up @@ -462,6 +465,7 @@ export class SynapseIntentRouterSet extends SynapseModuleSet {
.filter(({ destQuote }) => destQuote.expectedAmountOut.gt(Zero))
}

@logExecutionTime('SynapseIntents.getFullQuotes')
private async getFullQuotes(
intents: FullIntent[],
originUserAddress?: string
Expand Down
24 changes: 23 additions & 1 deletion packages/sdk-router/src/router/synapseCCTPRouterSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import { BigNumber } from '@ethersproject/bignumber'

import { SynapseCCTPRouter } from './synapseCCTPRouter'
import { ChainProvider, RouterSet } from './routerSet'
import { CCTP_ROUTER_ADDRESS_MAP, MEDIAN_TIME_CCTP } from '../constants'
import {
BigintIsh,
CCTP_ROUTER_ADDRESS_MAP,
MEDIAN_TIME_CCTP,
} from '../constants'
import { BridgeRoute } from '../module'
import { logExecutionTime } from '../utils/logger'

/**
* Wrapper class for interacting with a SynapseCCTPRouter contracts deployed on multiple chains.
Expand All @@ -20,6 +25,23 @@ export class SynapseCCTPRouterSet extends RouterSet {
super(chains, CCTP_ROUTER_ADDRESS_MAP, SynapseCCTPRouter)
}

@logExecutionTime('SynapseCCTP.getBridgeRoutes')
public async getBridgeRoutes(
originChainId: number,
destChainId: number,
tokenIn: string,
tokenOut: string,
amountIn: BigintIsh
): Promise<BridgeRoute[]> {
return super.getBridgeRoutes(
originChainId,
destChainId,
tokenIn,
tokenOut,
amountIn
)
}

/**
* @inheritdoc RouterSet.getOriginAmountOut
*/
Expand Down
20 changes: 19 additions & 1 deletion packages/sdk-router/src/router/synapseRouterSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { Zero } from '@ethersproject/constants'

import { BridgeTokenType, SynapseRouter } from './synapseRouter'
import { ChainProvider, RouterSet } from './routerSet'
import { MEDIAN_TIME_BRIDGE, ROUTER_ADDRESS_MAP } from '../constants'
import { BigintIsh, MEDIAN_TIME_BRIDGE, ROUTER_ADDRESS_MAP } from '../constants'
import { BridgeRoute } from '../module'
import { logExecutionTime } from '../utils/logger'

/**
* Wrapper class for interacting with a SynapseRouter contracts deployed on multiple chains.
Expand All @@ -29,6 +30,23 @@ export class SynapseRouterSet extends RouterSet {
super(chains, ROUTER_ADDRESS_MAP, SynapseRouter)
}

@logExecutionTime('SynapseBridge.getBridgeRoutes')
public async getBridgeRoutes(
originChainId: number,
destChainId: number,
tokenIn: string,
tokenOut: string,
amountIn: BigintIsh
): Promise<BridgeRoute[]> {
return super.getBridgeRoutes(
originChainId,
destChainId,
tokenIn,
tokenOut,
amountIn
)
}

/**
* @inheritdoc RouterSet.getOriginAmountOut
*/
Expand Down

0 comments on commit 30a246e

Please sign in to comment.