Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Open Order QuoteResponse log #331

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading