Skip to content

add support for TWÅP orders#345

Open
0xnonso wants to merge 15 commits intoSorellaLabs:mainfrom
0xnonso:main
Open

add support for TWÅP orders#345
0xnonso wants to merge 15 commits intoSorellaLabs:mainfrom
0xnonso:main

Conversation

@0xnonso
Copy link
Copy Markdown

@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
Copy Markdown
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.

console.log("updated pools");
reader = _validateAndExecuteToBOrders(reader, pairs);
console.log("exectued tob");
console.log("executed tob");
Copy link
Copy Markdown
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. | No newline at end of file
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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