Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Merge branch 'relay-quotes' into relay-quotes-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongeric committed Jan 25, 2024
2 parents 6391d43 + e61b3a8 commit 4107767
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/entities/quote/RelayQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BigNumber, ethers } from 'ethers';
import { PermitBatchTransferFromData } from '@uniswap/permit2-sdk';
import { v4 as uuidv4 } from 'uuid';
import { IQuote } from '.';
import { DEFAULT_START_TIME_BUFFER_SECS, NATIVE_ADDRESS, RELAY_BASE_GAS, RoutingType } from '../../constants';
import { DEFAULT_START_TIME_BUFFER_SECS, RELAY_BASE_GAS, RoutingType } from '../../constants';
import { generateRandomNonce } from '../../util/nonce';
import { currentTimestampInMs, timestampInMstoSeconds } from '../../util/time';
import { RelayRequest } from '../request/RelayRequest';
Expand Down Expand Up @@ -39,6 +39,8 @@ export type RelayQuoteJSON = {
gasToken: string;
amountInGasToken: string;
swapper: string;
classicAmountInGasAndPortionAdjusted: string;
classicAmountOutGasAndPortionAdjusted: string;
};

type Amounts = {
Expand Down Expand Up @@ -101,7 +103,8 @@ export class RelayQuote implements IQuote {
startAmounts.amountInGasToken,
endAmounts.amountInGasToken,
request.config.swapper,
NATIVE_ADDRESS, // synthetic quote has no filler
quote.amountInGasAndPortionAdjusted,
quote.amountOutGasAndPortionAdjusted,
generateRandomNonce() // synthetic quote has no nonce
);
}
Expand All @@ -124,7 +127,9 @@ export class RelayQuote implements IQuote {
public readonly amountInGasTokenStart: BigNumber,
public readonly amountInGasTokenEnd: BigNumber,
public readonly swapper: string,
public readonly filler?: string,
// Used to compare X quotes vs Relay quotes
public readonly classicAmountInGasAndPortionAdjusted: BigNumber,
public readonly classicAmountOutGasAndPortionAdjusted: BigNumber,
public readonly nonce?: string,
derived?: RelayQuoteDerived
) {
Expand Down Expand Up @@ -193,7 +198,6 @@ export class RelayQuote implements IQuote {
amountInGasToken: this.amountInGasTokenStart.toString(),
endAmountInGasToken: this.amountInGasTokenEnd.toString(),
swapper: this.swapper,
filler: this.filler,
routing: RoutingType[this.routingType],
slippage: parseFloat(this.request.info.slippageTolerance),
createdAt: this.createdAt,
Expand Down

0 comments on commit 4107767

Please sign in to comment.