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 support for TWÅP orders #345

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

add support for TWÅP orders #345

wants to merge 15 commits into from

Conversation

0xnonso
Copy link

@0xnonso 0xnonso commented Feb 19, 2025

adds support for TWAP orders on Angstrom by allowing users to authorize/sign a single order that can be executed multiple times at fixed intervals.

Copy link
Contributor

@Philogy Philogy left a comment

Choose a reason for hiding this comment

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

Core logic (_invalidatePartTWAPNonceAndCheckDeadline) needs some work, also some details here and there but largely good.

@@ -72,9 +74,11 @@ contract Angstrom is
reader = _updatePools(reader, pairs);
console.log("updated pools");
reader = _validateAndExecuteToBOrders(reader, pairs);
console.log("exectued tob");
console.log("executed tob");
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be there in the first place but remove the console.log

|`start_time: u40`|The unix timestamp from which the order becomes valid (or, after which the order is considered active). |
|`total_parts: u32`| The maximum number of times the twap order can be executed. |
|`time_interval: u32`| The required period between consecutive twap orders. |
|`window: u32`| The specified period when twap orders can be executed. |
Copy link
Contributor

Choose a reason for hiding this comment

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

Not entirely clear what this is just from the docs start_time + window is end time?

Copy link
Author

Choose a reason for hiding this comment

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

yes, but more specifically at each interval.

Comment on lines 119 to 122
nonce := and(nonce, MASK_U64)
mstore(12, div(nonce, MAX_TWAP_NONCE_SIZE))
mstore(4, UNORDERED_TWAP_NONCES_SLOT)
mstore(0, owner)
Copy link
Contributor

Choose a reason for hiding this comment

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

Besides the memory manipulation most of this does not have to be in assembly and in fact it makes it very hard to read

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