-
Notifications
You must be signed in to change notification settings - Fork 16
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
add hard quote #270
Conversation
marktoda
commented
Feb 22, 2024
- 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
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
2eca92b
to
d6a7d80
Compare
d6a7d80
to
3b1797c
Compare
There was a problem hiding this 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 }), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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>) => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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