-
Notifications
You must be signed in to change notification settings - Fork 80
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
fix(v4-sdk): V4 planner accommodates exactOut + granular take/settles #97
Conversation
Graphite Automations"Request reviewers once CI passes on sdks monorepo" took an action on this PR • (09/12/24)1 reviewer was added and 1 assignee was added to this PR based on 's automation. |
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.
quick approval to unblock since requires 2
|
||
describe('RouterPlanner', () => { | ||
let planner: V4Planner | ||
|
||
beforeEach(() => { | ||
planner = new V4Planner() | ||
// console.log(planner) |
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.
do you need this still?
const FULL_DELTA_AMOUNT = 0 | ||
const MSG_SENDER = '0x0000000000000000000000000000000000000001' | ||
const ADDRESS_THIS = '0x0000000000000000000000000000000000000002' | ||
|
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.
ooh nice I made an ActionsConstant utils file, I can put these in there later when my PR gets merged
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.
yah feel free to move around. this file is def pretty cray
? { | ||
currencyOut, | ||
path: encodeRouteToPath(trade.route, exactOutput), | ||
amountInMaximum: trade.maximumAmountIn(slippageTolerance ?? new Percent(0)).quotient.toString(), |
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.
it looks like on 128 we check that slippageTolerance is required? so can we just pass it in directly here?
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.
typescript gets mad
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.
hahah ok got it
const actionType = trade.tradeType === TradeType.EXACT_INPUT ? Actions.SWAP_EXACT_IN : Actions.SWAP_EXACT_OUT | ||
const exactOutput = trade.tradeType === TradeType.EXACT_OUTPUT | ||
|
||
if (exactOutput) invariant(!!slippageTolerance, 'ExactOut requires slippageTolerance') |
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.
how come we only check this for exactOuput? just curious
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.
good question I can leave a comment. on exactInput sometimes we do agg slippage checks so we don't need to know slippage, but we enver do that on exactOutput
]) | ||
} | ||
|
||
addSettle(currency: Currency, payerIsUser: boolean, amount?: BigNumber): void { |
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: should we add comment headers?
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.
LGTM!
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
No description provided.