-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: main
Are you sure you want to change the base?
Conversation
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.
Core logic (_invalidatePartTWAPNonceAndCheckDeadline
) needs some work, also some details here and there but largely good.
contracts/src/Angstrom.sol
Outdated
@@ -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"); |
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.
Shouldn't be there in the first place but remove the console.log
contracts/docs/payload-types.md
Outdated
|`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. | |
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.
Not entirely clear what this is just from the docs start_time + window
is end time?
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.
yes, but more specifically at each interval.
nonce := and(nonce, MASK_U64) | ||
mstore(12, div(nonce, MAX_TWAP_NONCE_SIZE)) | ||
mstore(4, UNORDERED_TWAP_NONCES_SLOT) | ||
mstore(0, owner) |
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.
Besides the memory manipulation most of this does not have to be in assembly and in fact it makes it very hard to read
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.