Skip to content

[contracts] IStrategy interface: TargetPosition struct + computePositions + shouldRebalance #20

@ozpool

Description

@ozpool

Context

Strategy API. Purity contract (ADR #12) enforced by: no state-reading params. BellStrategy and future strategies implement this.

Ref: PRISM_PRD_v1.0.html §Day 3.

Scope

In scope:

  • packages/contracts/src/interfaces/IStrategy.sol
  • struct TargetPosition { int24 tickLower; int24 tickUpper; uint256 weight; }
  • computePositions(int24 currentTick, int24 tickSpacing, uint256 amount0, uint256 amount1)
  • shouldRebalance(int24 currentTick, int24 lastTick, uint256 lastTs)

Out of scope:

  • Strategy storage helpers

Acceptance Criteria

  • NatSpec declares pure/view where applicable
  • weight type documented as basis points summing to exactly 10_000
  • Compiles with forge build (Solidity 0.8.25)
  • Custom errors only (Errors.sol); no string reverts
  • ReentrancyGuardTransient on PoolManager-facing externals where applicable
  • NatSpec on every external/public
  • Unit tests: happy + reverts + access control
  • forge test -vvv passes; forge fmt --check clean
  • Slither + Aderyn: no new findings
  • Gas snapshot saved; no regression vs CLAUDE.md §Gas Targets

Dependencies

References

  • PRD §Day 3 IStrategy

Estimate

S

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions