-
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 logic #271
add hard quote logic #271
Conversation
parse order, run secondary quote, and cosign order
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! just a few questions
@@ -76,16 +80,24 @@ export class HardQuoteRequest { | |||
return utils.getAddress(this.order.info.baseOutputs[0].token); | |||
} | |||
|
|||
public get totalOutputAmountStart(): BigNumber { | |||
let amount = BigNumber.from(0); | |||
for (const output of this.order.info.baseOutputs) { |
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 assumes all outputs are same token which is not necessarily true right?
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.
Assumed true anyways for now in main rfq flownsince quoters can only be for one token
const outputAmounts = request.order.info.baseOutputs.map(() => BigNumber.from(0)); | ||
|
||
// if the quote is better, then increase amounts by the difference | ||
if (request.type === TradeType.EXACT_INPUT) { |
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.
What's the expected behavior if less outputs are required for EXACT_INPUT but more input is required? Apply the output adjustment but not the input? Wonder if we should explicitly throw / error on this case if its undesired behavior
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.
Hmm interesting, I think the api contract should disallow changing the EXACT_X side in any case yea
This PR adds the internal logic for hard quotes! Effectively:
Still remaining TODOs: