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

feat(twap): twap order creation services #2504

Merged
merged 5 commits into from
May 24, 2023
Merged

Conversation

shoom3301
Copy link
Collaborator

@shoom3301 shoom3301 commented May 22, 2023

Summary

The process follows common pattern: collect context -> execute logic.
Usage example.

image

@vercel
Copy link

vercel bot commented May 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
swap-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback

🌃 Cosmos ↗︎

@shoom3301 shoom3301 requested a review from a team May 22, 2023 14:03
@shoom3301 shoom3301 marked this pull request as ready for review May 22, 2023 14:07

if (!context) return null

return settleTwapOrder(order, context)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Usage example

Copy link
Collaborator

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

Some comments, plus the build is failling
image

src/abis/ComposableCoW.json Outdated Show resolved Hide resolved

const createOrderTx = {
to: COMPOSABLE_COW_ADDRESS[chainId],
data: composableCowContract.interface.encodeFunctionData('create', [creationParams, true]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion for a different way of creating the tx data, which uses the types and parameters more in a TS fashion https://github.com/cowprotocol/cowswap/blob/ed50eb839629d7df29a404a5d4663b56330d1900/src/modules/operations/bundle/buildPresignTx.ts#L12-L11

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I'm aware of it. I don't have a strong opinion on it,but there are some differences:

  • encodeFunctionData returns string
  • populateTransaction returns Promise<string>
  • encodeFunctionData has type overloads, so, the interface consistency is safe
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool, didn't know
I don't mind also to use this version.

Then, do you think we should update the method I linked?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just to make it synchronous - yes, it make sense

src/modules/twap/types.ts Show resolved Hide resolved
@shoom3301 shoom3301 merged commit 6c73de7 into develop May 24, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2023
@alfetopito alfetopito deleted the feature/create-twap branch May 24, 2023 09:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants