Skip to content

dev#323

Open
zhongeric wants to merge 36 commits into
mainfrom
dev
Open

dev#323
zhongeric wants to merge 36 commits into
mainfrom
dev

Conversation

@zhongeric

Copy link
Copy Markdown
Contributor

No description provided.

zhongeric and others added 12 commits February 11, 2026 15:41
* feat: add CCALens and TickDataLens

* chore: update deploy script for CCALens

* feat: build buffer in memory instead of preallocating

* chore: natspec

* refactor: optimize TickDataLens memory handling

---------

Co-authored-by: mgretzke <m.gretzke@vimage.de>
Co-authored-by: Mark Gretzke <65617397+mgretzke@users.noreply.github.com>
* feat: only receiver can sweep

* fix: added missing error in interface

* test: fixed and added new

* test: moved tests
* save

* save

* initial implementation

* save

* fix: div by MPS

* save

* save

* save state

* save

* pass most

* save state

* fix: case where remaining supply can be zero

* rollover passes all invariant tests + added comments

* fix requiredDemand* functions and added comments

* chore: add getters to IContinuousClearingAuction

* chore: fix gas by removing console.log statements

* chore: cleanup nits

* nit: naming

* nit: improve comments

* fix: test showing rounding difference when currencyRaised is calculated

* chore: fix wei limit

* fix: required demand at price test

* chore: renaming functions in lib and fixing tests

* chore: gas

* feat: add toPriceCeiling function to DemandLib

* chore: add btt tests for toPriceCeiling function

* chore: fix canClearSupplyAtPrice test

* chore: natspec

* feat: add currencyRaisedAtPrice to DemandLib

* chore: rm using keyword for math

* chore: update canClearSupplyAtPrice test

* comments and fix gas test

* chore: comments

* fix: fuzz tests for canClearSupplyAtPrice

* feat: add currencyRaisedAtPrice test coverage

* fix: stack too deep

* chore: update gas snap
* feat: custody tokens

* refactor: remove unused NotAuthorized error

* fix: added custody tokens to previous tests and scripts

* test: added new tests

* fuzzed custodyTokens

* fuzzed custodyTokens in Constructor tests

* test: tests asserting that the custody tokens are swept

* Added Fuzz tests to Auction.custodyTokens.t.sol

* fix: updated comment

* chore: reworked natspec comments

---------

Co-authored-by: Eric Zhong <eric.zhong@uniswap.org>
* chore: refactor auction storage

* chore: fix

* chore: forge fmt
Comment thread src/ContinuousClearingAuction.sol
zhongeric and others added 9 commits May 11, 2026 10:40
Co-authored-by: Cursor <cursoragent@cursor.com>
* save

* save

* initial implementation

* save

* fix: div by MPS

* save

* save

* save state

* save

* pass most

* save state

* fix: case where remaining supply can be zero

* rollover passes all invariant tests + added comments

* fix requiredDemand* functions and added comments

* chore: add getters to IContinuousClearingAuction

* chore: fix gas by removing console.log statements

* chore: cleanup nits

* nit: naming

* nit: improve comments

* fix: test showing rounding difference when currencyRaised is calculated

* chore: fix wei limit

* fix: required demand at price test

* chore: renaming functions in lib and fixing tests

* chore: gas

* feat: add toPriceCeiling function to DemandLib

* chore: add btt tests for toPriceCeiling function

* chore: fix canClearSupplyAtPrice test

* chore: natspec

* feat: add currencyRaisedAtPrice to DemandLib

* chore: rm using keyword for math

* chore: update canClearSupplyAtPrice test

* comments and fix gas test

* chore: comments

* fix: fuzz tests for canClearSupplyAtPrice

* feat: add currencyRaisedAtPrice test coverage

* save: local

* fix: remainingSupplyZero edge case

* fix: stack too deep

* feat: add test coverage for remainingSupplyZero edge case

* rm plan

* fix: merge conflicts

* fix: check remaining supply is not zero on bid submission

* add: test for remaining supply being zero

* fix: clamp total cleared to total supply

* chore: comments

* fix test

* fix: remove saturating sub and use sub directly and fix tests
Remove the custody token configuration and behavior so CCA returns to total-supply-only token deposits and unsold token sweeps while preserving the newer storage and test refactors.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ensure the documented Q96 reciprocal of MIN_FLOOR_PRICE fits in uint160 for downstream LBP/v4 initialization math.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove thin CheckpointStorage accounting wrappers so bid exits use the underlying library helpers directly, and keep tests/docs aligned with the reduced storage surface.

Co-authored-by: Cursor <cursoragent@cursor.com>
* add liquidity launcher submodule

* update dep

* move up to dev

* fix: imports

* chore: inheritdoc

* feat: add protocol fees to CCA, factory, and storage

* feat: add owner-controlled protocol fee controller

Co-authored-by: Cursor <cursoragent@cursor.com>

* update docs

* fix: address protocol fee review comments

Cache raised currency reads, avoid protocol fee transfer before sweep state is written, and expose the factory fee controller with clearer naming.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: simplify protocol fee controller wiring

Make factory protocol fee controllers immutable, document runtime fee lookups, and add sweep currency gas snapshots.

Co-authored-by: Cursor <cursoragent@cursor.com>

* nit comment

* fix

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: support rollover math in TickDataLens

Use the auction's rollover-aware required demand helper so tick data reflects remaining supply over the remaining issuance schedule.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: cache rollover demand inputs in TickDataLens

Avoid calling requiredDemandQ96 for each initialized tick by caching remaining supply and schedule values once per lens read.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: compute TickDataLens rollover values in Solidity

Keep assembly scoped to tick array construction while using Solady math helpers for rollover demand calculations.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: simplify TickDataLens tick traversal

Use plain Solidity for tick traversal and rollover data calculation now that derived values are computed outside assembly.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: traverse TickDataLens ticks once

Allocate the max buffer once and trim the returned array length after filling rollover tick data in a single pass.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: allocate TickDataLens results by actual tick count

Build the returned tick array in assembly as ticks are discovered to avoid expanding memory for the full max buffer.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: comments

* fix: handle empty TickDataLens tick list

Co-authored-by: Cursor <cursoragent@cursor.com>

* refactor: merged last loop into first loop (#341)

* refactor: merged last loop into first loop

* fix: forge fmt

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Mark Gretzke <65617397+mgretzke@users.noreply.github.com>
* add clearing price max invariant

* fix mock auction setup and add handleExitBid

* optimize exit bid invariant handler

Co-authored-by: Cursor <cursoragent@cursor.com>

* working state for invariant tests

* add new invariants

* rm

* fix up generators

* Simplify fuzz value generation

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix invariant checkpoint mutability

Co-authored-by: Cursor <cursoragent@cursor.com>

* Improve invariant bid generation

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix up

* rm ll

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
@zhongeric zhongeric marked this pull request as ready for review May 21, 2026 21:51
@zhongeric zhongeric requested a review from a team as a code owner May 21, 2026 21:51
zhongeric and others added 6 commits May 21, 2026 17:58
Document changes on the dev branch relative to main, including breaking
changes to the auction and factory constructors, the protocol fee
controller addition, sweep authorization, interface renames, supply
rollover settlement math, and the new lens contracts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Note the immutable protocol fee controller on the factory, add a v2.0.0
row to the factory deployment table, add a separate CCALens deployment
section, and refresh the repo structure to reflect AuctionStorage and
the lens contracts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add a Protocol Overview that walks integrators through the mechanism
end-to-end (issuance schedule, tick book, clearing price, rollover,
checkpoints, graduation, LBP handoff, fees). Rewrite the factory
section: the controller is immutable, there is no factory owner, and
there is no setProtocolFeeController. Add new Protocol Fees and Lens
Contracts sections. Add lbpInitializationParams documentation. Fix
sweep authorization (callable only by the respective recipients) and
note the protocol fee deduction in sweepCurrency. Fix the min tick
spacing (2, not 1), the min floor price bound, the ValueX7 NatSpec to
match the library, and the currencyRaisedAtClearingPriceQ96X7 name.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dianakocsis and others added 9 commits June 3, 2026 17:11
* fix: clamp protocol fee to currency raised in sweepCurrency (L-7)

sweepCurrency() queries the PROTOCOL_FEE_CONTROLLER at sweep time and
computed `currencyRaised - protocolFeeAmount` with no bound. A misbehaving
or misconfigured fee controller returning protocolFeeAmount > currencyRaised
underflowed the subtraction and reverted, permanently bricking the sweep.

Clamp protocolFeeAmount to currencyRaised before the subtraction so the
sweep always proceeds (full amount sent as the protocol fee, zero swept to
the funds recipient).

Adds a BTT fuzz case (and tree branch) asserting the sweep succeeds and
clamps when the controller returns a fee greater than the currency raised.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: snapshots

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: mgretzke <m.gretzke@vimage.de>
N-2: add missing @param _cumulativeMps natspec to
     _iterateOverTicksAndFindClearingPrice
N-3: AuctionStateLens.parseRevertReason now bubbles up any non-empty
     revert reason (incl. the 4-byte CheckpointFailed selector) instead
     of only reasons longer than 32 bytes, so CheckpointFailed is
     reachable from state(); InvalidRevertReasonLength now only fires on
     empty revert data. Adds a lens test covering a reverting checkpoint.
N-4: remove unnecessary `abstract` from StepStorage (all methods implemented)
N-5: fix "can claimed" -> "can be claimed" comment typo
N-6: remove unused imports (IERC20Minimal, BlockNumberish, Currency,
     FixedPoint96, ConstantsLib, FixedPointMathLib) across 5 files

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor: use ValueX7 operators

* chore: remove validation hook mode support

* chore: hide duplicate protocol fee getter

* refactor: make Q96 price naming consistent

* chore: remove unused DemandLib import
* Prevent same-block force iteration admission changes

* fix merge

---------

Co-authored-by: Eric Zhong <eric.zhong@uniswap.org>
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.

4 participants