Skip to content
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8d0d97d
Fix names of files and implement swap tests
joaobrunoah Sep 5, 2025
24a63a5
Create hook logic and tests to verify signatures
joaobrunoah Sep 8, 2025
3480ff0
Fix signature test
joaobrunoah Sep 9, 2025
b354a32
Test error OnlyOncePerBlock
joaobrunoah Sep 9, 2025
385e966
100% coverage
joaobrunoah Sep 9, 2025
b2b6461
Block unbalanced liquidity operations when Angstrom is locked
joaobrunoah Sep 9, 2025
73c6b13
100% test coverage
joaobrunoah Sep 9, 2025
b48049d
Commit test
joaobrunoah Sep 9, 2025
226cf6f
Run github action
joaobrunoah Sep 9, 2025
d955e5a
Remove unused dependency
joaobrunoah Sep 9, 2025
a6742b9
Natspec
joaobrunoah Sep 9, 2025
77e9d60
Fix solady install
joaobrunoah Sep 9, 2025
78715cf
Fix lint
joaobrunoah Sep 10, 2025
1be7f44
Fix function mutability
joaobrunoah Sep 10, 2025
d08401b
Merge pull request #4 from balancer/angstrom-hook
joaobrunoah Sep 10, 2025
2c21fea
Modify package.json to Angstrom
joaobrunoah Sep 10, 2025
3fedf8e
Readme
joaobrunoah Sep 10, 2025
42f0474
Fix contract names and repo
joaobrunoah Sep 10, 2025
d0e5949
docs: update comments and non-semantics
EndymionJkb Sep 11, 2025
c770e11
refactor: rename `_nodes` for clarity
EndymionJkb Sep 11, 2025
5a325d7
refactor: add `isRegisteredNode` getter; add `fromValidator` modifier…
EndymionJkb Sep 11, 2025
e841b11
refactor: add onlyWhenLocked modifier, and isolate updates in `_unloc…
EndymionJkb Sep 11, 2025
49fd080
refactor: rename validator modifier; simplify unlockAngstrom helper
EndymionJkb Sep 11, 2025
b63265a
refactor: simplify/rename unlock functions; move getters from mock; r…
EndymionJkb Sep 11, 2025
28b2500
test: don't need leading underscores in tests
EndymionJkb Sep 11, 2025
f6bbc67
test: introduce intermediate test
EndymionJkb Sep 11, 2025
793e9a9
fix: createHook in proper place
EndymionJkb Sep 12, 2025
5b41904
test: propagate intermediate test
EndymionJkb Sep 12, 2025
6632cdd
refactor: rename validator modifier; simplify onBeforeSwap
EndymionJkb Sep 12, 2025
5603a14
refactor: remove redundant code
EndymionJkb Sep 12, 2025
4804023
refactor: rename/reorder
EndymionJkb Sep 12, 2025
124194a
refactor: remove unused function
EndymionJkb Sep 12, 2025
1ca3856
refactor: one more simplification - only revert in one place for each…
EndymionJkb Sep 12, 2025
d5b569c
docs: adjust comments after review
EndymionJkb Sep 16, 2025
6b24bc5
Merge pull request #6 from balancer/angstrom-updates-v2
EndymionJkb Sep 16, 2025
459f82a
Merge pull request #7 from balancer/support-hardhat-contracts
joaobrunoah Sep 16, 2025
94c94ac
Fix PR comment
joaobrunoah Sep 17, 2025
d23b3f8
Add event when adding/removing node
joaobrunoah Sep 17, 2025
ecc153e
Use OwnableAuthentication instead of Singleton
joaobrunoah Sep 17, 2025
b8f11ee
Use mcopy instead of a for loop
joaobrunoah Sep 17, 2025
b257566
Update contracts/AngstromBalancer.sol
joaobrunoah Sep 17, 2025
f26e69e
Unify invalid signature errors
joaobrunoah Sep 17, 2025
657ac83
Change toggle to add/remove
joaobrunoah Sep 17, 2025
418d2a0
Revert add/removeNode if node state is inconsistent
joaobrunoah Sep 17, 2025
2f88693
Fix remappings
joaobrunoah Sep 17, 2025
001b761
Fix Angstrom to use only memory signatures
joaobrunoah Sep 18, 2025
eba2693
Add comments
joaobrunoah Sep 18, 2025
e6a55a5
Use unlockAngstromWithSignature directly
joaobrunoah Sep 18, 2025
7af693d
Apply suggestions from code review
joaobrunoah Sep 18, 2025
c0cedc6
Fix register/deregister nodes
joaobrunoah Sep 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Set up environment
uses: ./.github/actions/setup
- name: Test
run: yarn test:forge
run: yarn test:forge-with-hardhat

test-hardhat:
runs-on: ubuntu-latest
Expand Down
53 changes: 46 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,56 @@
# custom-pool-v3
# Balancer V3 Angstrom Router and Hook

Example of external custom pool for Balancer V3. Extend it to create new pool types.
A specialized router and hook system for Balancer V3 that implements node-based access control and block-level unlocking mechanisms for Angstrom pools.

# Requirements
## Overview

The Angstrom Router is a combination of a batch router and hook that provides controlled access to Angstrom pools within the Balancer V3 ecosystem. It ensures that only registered nodes can perform swaps and unbalanced liquidity operations before the network is unlocked for a given block, maintaining price consistency with off-chain computations.

## Key Features

### 🔐 Node-Based Access Control

- Only registered Angstrom nodes can perform the first swap and/or liquidity transaction (before network unlock)
- Node registration is managed through authenticated `toggleNodes()` function
- Prevents unauthorized access to locked pools

### 🔓 Block-Level Unlocking

- Network can only be unlocked once per block
- Unlocking is global - once unlocked, all pools accept operations from any router

### 🔄 Dual Operation Modes

- **Router Mode**: Direct swaps against pools, as a registered node (no signature required)
- **Hook Mode**: Operations through any router with cryptographic signature verification (node register is still required)

### 📊 Comprehensive Swap Support

- Exact amount in swaps (`swapExactIn`)
- Exact amount out swaps (`swapExactOut`)
- Query functions for both swap types
- Support for multi-hop routing through multiple pools

### 🏊 Liquidity Hooks for pools

- Proportional liquidity operations (no unlock required)
- Unbalanced liquidity operations (requires network unlock)
- Hook-based validation for all liquidity operations

## Requirements

- Node.js v18.x (we recommend using nvm to install it)
- Yarn v4.x
- Foundry v1.0.0

# Installation
## Installation

If it's the first time running the project, run `sh ./scripts/install-fresh.sh` to install the dependencies and build the project. It'll download and compile V3 monorepo, creating node_modules folders in the library (these folders will be needed to use monorepo as a submodule of the angstrom project).

## Testing

If it's the first time running the project, run `sh ./scripts/install-fresh.sh` to install the dependencies and build the project. It'll download and compile V3 monorepo, creating node_modules folders in the library (these folders will be needed to use monorepo as a submodule of the custom pool, so tests can use the base test files).
After installing the dependencies, run `yarn test:forge` to run forge tests. Also, run `yarn coverage` to generate a coverage report.

# Testing
## Contributing

After installing the dependencies, run `yarn test` to run forge and hardhat tests.
This project is part of the Balancer ecosystem. Please refer to the main Balancer repository for contribution guidelines.
Loading