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 hard quote #270

Merged
merged 2 commits into from
Feb 23, 2024
Merged

add hard quote #270

merged 2 commits into from
Feb 23, 2024

Conversation

marktoda
Copy link
Collaborator

  • feat: add hard quote initial
  • fix: tests

this commit adds the initial data required for hard quotes
- hard quote entity and schema
- hard quote basic handler
Copy link

socket-security bot commented Feb 22, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@uniswap/[email protected] Transitive: environment, network +52 20.5 MB akarys01, alicehenshaw, andrewmohawk, ...21 more

View full report↗︎

Copy link
Collaborator

@zhongeric zhongeric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

// switch tradeType
type: TradeType[type],
numOutputs: this.numOutputs,
...(this.quoteId && { quoteId: this.quoteId }),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we change quoteId? Otherwise first quoteId = real quote?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keeping same semantics as the v1 quote, interesting point tho - I think quoters can disintermediate it themselves by storing both quotes under same quoteId and assuming only one or the other will end up as an order

encodedInnerOrder: Joi.string().required(),
innerSig: FieldValidator.rawSignature.required(),
tokenInChainId: FieldValidator.chainId.required(),
tokenOutChainId: Joi.number().integer().valid(Joi.ref('tokenInChainId')).required(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why can't we do FieldValidator.chainId here too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a superset of the validation, since tokenInChainId runs checks first and this one ensures it's the same as tokenIn. if we did chainId for both then it would be valid to pass in separate values


// A Raw Signature is a common Signature format where the r, s and v
// are concatenated into a 65 byte(130 nibble) DataHexString
public static readonly rawSignature = Joi.string().custom((value: string, helpers: CustomHelpers<string>) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i thought sig length details were handled under the hood by ethers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are, but that wouldn't throw a nice early validation result - we do this for several things, put a coarse validation check in joi so it catches obvious errors early

@marktoda marktoda merged commit fa4ed34 into main Feb 23, 2024
5 checks passed
@marktoda marktoda deleted the add-hard-quote branch February 23, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants