Skip to content

Commit

Permalink
Add Open Order QuoteResponse log (#331)
Browse files Browse the repository at this point in the history
* Add Open Order QuoteResponse log

* log response directly

* Fix linting errors
  • Loading branch information
codyborn authored Jun 4, 2024
1 parent 2de18fb commit f3e564a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
8 changes: 7 additions & 1 deletion lib/config/chains.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import { ChainId } from '../util/chains';

export const SUPPORTED_CHAINS: ChainId[] = [ChainId.MAINNET, ChainId.GÖRLI, ChainId.POLYGON, ChainId.SEPOLIA, ChainId.ARBITRUM_ONE];
export const SUPPORTED_CHAINS: ChainId[] = [
ChainId.MAINNET,
ChainId.GÖRLI,
ChainId.POLYGON,
ChainId.SEPOLIA,
ChainId.ARBITRUM_ONE,
];
2 changes: 1 addition & 1 deletion lib/entities/HardQuoteResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { CosignedV2DutchOrder } from '@uniswap/uniswapx-sdk';
import { BigNumber } from 'ethers';
import { v4 as uuidv4 } from 'uuid';

import { HardQuoteRequest } from '.';
import { HardQuoteResponseData } from '../handlers/hard-quote/schema';
import { currentTimestampInMs, timestampInMstoSeconds } from '../util/time';
import { HardQuoteRequest } from '.';

// data class for hard quote response helpers and conversions
export class HardQuoteResponse {
Expand Down
11 changes: 11 additions & 0 deletions lib/handlers/hard-quote/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ export class QuoteHandler extends APIGLambdaHandler<
metric.putMetric(Metric.QUOTE_200, 1, MetricLoggerUnit.Count);
metric.putMetric(Metric.QUOTE_LATENCY, Date.now() - start, MetricLoggerUnit.Milliseconds);
const hardResponse = new HardQuoteResponse(request, cosignedOrder);
if (!bestQuote) {
// The RFQ responses are logged in getBestQuote()
// we log the Open Orders here
log.info({
eventType: 'QuoteResponse',
body: {
...hardResponse.toLog(),
offerer: request.swapper,
},
});
}
return {
statusCode: 200,
body: hardResponse.toResponseJSON(),
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/hard-quote/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { QuoteHandler as HardQuoteHandler } from './handler';
export { RequestInjected, ContainerInjected, QuoteInjector as HardQuoteInjector } from './injector';
export { ContainerInjected, QuoteInjector as HardQuoteInjector, RequestInjected } from './injector';
export * from './schema';
2 changes: 1 addition & 1 deletion lib/providers/analytics/firehose.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FirehoseClient, PutRecordCommand } from '@aws-sdk/client-firehose';
import { default as Logger } from 'bunyan';

import { AnalyticsEvent } from '../../entities/analytics-events';
import { IAnalyticsLogger } from '.';
import { AnalyticsEvent } from '../../entities/analytics-events';

export class FirehoseLogger implements IAnalyticsLogger {
private log: Logger;
Expand Down
4 changes: 2 additions & 2 deletions lib/util/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const ID_TO_NETWORK_NAME = (id: number): ChainName => {
return ChainName.POLYGON;
case 11155111:
return ChainName.SEPOLIA;
case 42161:
return ChainName.ARBITRUM_ONE;
case 42161:
return ChainName.ARBITRUM_ONE;
default:
throw new Error(`Unknown chain id: ${id}`);
}
Expand Down

0 comments on commit f3e564a

Please sign in to comment.