Skip to content

Angstrom Hooks with tests#1

Merged
joaobrunoah merged 50 commits intomainfrom
router-tests-and-renaming
Sep 19, 2025
Merged

Angstrom Hooks with tests#1
joaobrunoah merged 50 commits intomainfrom
router-tests-and-renaming

Conversation

@joaobrunoah
Copy link
Collaborator

@joaobrunoah joaobrunoah commented Sep 5, 2025

Description

This PR implements Angstrom Hooks.
The requirements are:

For Swaps:

  1. If router/hook is already unlocked, any swap can be executed
  2. If router/hook is locked:
    a) Check if the message signer is a registered node
    b) Check if the signature matches the expected hash with current block number, following EIP-712
    c) If everything matches, unlock router/hook and execute swap

For add/remove liquidity:

  1. If the liquidity operation is proportional, execute
  2. If router/hook is unlocked, execute
  3. If router/hook is locked, follow the same flow as the swap.

Notice that the Angstrom router and hook will be in the same file, and the unlock will be the same for both entities. Therefore, it doesn't make sense to call the contract AngstromRouter, and it also doesn't make sense to call the unlock function _unlockRouter, as it actually unlocks both the router and the hook.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Dependency changes
  • Code refactor / cleanup
  • Optimization: [ ] gas / [ ] bytecode
  • Documentation or wording changes
  • Other

Checklist:

  • The diff is legible and has no extraneous changes
  • Complex code has been commented, including external interfaces
  • Tests have 100% code coverage
  • The base branch is either main, or there's a description of how to merge

@EndymionJkb
Copy link
Contributor

EndymionJkb commented Sep 9, 2025

I didn't see the follow on. In light of that, maybe just AngstromHook, since it is primarily a Hook (i.e., the main functionality requires that it be a hook vs. a plain router). When we have other dual contracts (e.g., a pool and a hook), we don't call it PoolAndHook, just Pool, since that's the primary thing it is.

_unlockAngstrom makes sense.

@joaobrunoah joaobrunoah changed the title Fix contracts names and implement swap tests Angstrom Hooks with tests Sep 10, 2025
@joaobrunoah
Copy link
Collaborator Author

I didn't see the follow on. In light of that, maybe just AngstromHook, since it is primarily a Hook (i.e., the main functionality requires that it be a hook vs. a plain router). When we have other dual contracts (e.g., a pool and a hook), we don't call it PoolAndHook, just Pool, since that's the primary thing it is.

_unlockAngstrom makes sense.

We've changed to AngstromBalancer. This contract is more than just a hook or a router; these two entities have their specific endpoints. They are together only to share variables and make the management of the node registry and unlocking easier. Calling it AngstromHook would be misleading (like, where is the router?).

@EndymionJkb EndymionJkb mentioned this pull request Sep 12, 2025
12 tasks
Copy link
Contributor

@jubeira jubeira left a comment

Choose a reason for hiding this comment

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

First pass done.

Great job overall, this is taking shape really fast!
I have just a few rather minor comments and questions, otherwise LGTM.

Besides this, we might need to ask a few questions about how to properly settle between nodes and vault; permit2 seems suboptimal for this use case. That's out of scope for this PR anyway.

Again, great job! Thanks for pushing this.

Copy link
Contributor

@EndymionJkb EndymionJkb left a comment

Choose a reason for hiding this comment

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

Looks good; just the usual suspects - and some questions about naming.

@joaobrunoah joaobrunoah requested a review from jubeira September 18, 2025 16:06
joaobrunoah and others added 2 commits September 18, 2025 13:13
Co-authored-by: EndymionJkb <EndymionJkb@gmail.com>
Copy link
Contributor

@jubeira jubeira left a comment

Choose a reason for hiding this comment

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

LGTM, good stuff! 🚢

@joaobrunoah joaobrunoah merged commit ff96022 into main Sep 19, 2025
3 checks passed
@joaobrunoah joaobrunoah deleted the router-tests-and-renaming branch October 6, 2025 20:14
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.

3 participants