harb/onchain/test
johba f3047072f6 feat: Dynamic anchorWidth based on staking metrics
Replace hardcoded anchorWidth=100 with dynamic calculation that uses staking data as a decentralized oracle.

Changes:
- Add _calculateAnchorWidth() function to Optimizer.sol
- Base width 40% with adjustments based on staking percentage and average tax rate
- Staking adjustment: -20% to +20% (inverse relationship)
- Tax rate adjustment: -10% to +30% (direct relationship)
- Final range clamped to 10-80% for safety

Rationale:
- High staking % = bullish sentiment → narrower anchor (20-35%) for fee optimization
- Low staking % = bearish/uncertain → wider anchor (60-80%) for defensive positioning
- High tax rates = volatility expected → wider anchor to reduce rebalancing
- Low tax rates = stability expected → narrower anchor for fee collection

The Harberger tax mechanism acts as a prediction market where stakers' self-assessed valuations reveal market expectations.

Tests:
- Add comprehensive unit tests in test/Optimizer.t.sol
- Add mock contracts for testing (MockStake.sol, MockKraiken.sol)
- Manual verification confirms all scenarios calculate correctly

Documentation:
- Add detailed analysis of anchorWidth price ranges
- Add staking-based strategy recommendations
- Add verification of calculation logic

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 11:41:02 +02:00
..
abstracts feat: Optimize discovery position depth calculation 2025-08-16 16:45:24 +02:00
helpers wip 2025-08-09 18:03:31 +02:00
libraries Fix failing test suite by addressing fuzzing bounds and event expectations 2025-07-15 11:57:28 +02:00
mocks feat: Dynamic anchorWidth based on staking metrics 2025-08-19 11:41:02 +02:00
Kraiken.t.sol Complete project rename from HARB/Harberg to KRAIKEN with KRK token symbol 2025-07-11 13:47:42 +02:00
LiquidityManager.t.sol renaming 2025-07-25 19:09:11 +02:00
Optimizer.t.sol feat: Dynamic anchorWidth based on staking metrics 2025-08-19 11:41:02 +02:00
ReplayProfitableScenario.t.sol feat: Add scenario recording and replay system for invariant debugging 2025-08-18 20:31:39 +02:00
Stake.t.sol renaming 2025-07-25 19:09:11 +02:00
VWAPTracker.t.sol Consolidate duplicate helper functions and improve test maintainability 2025-07-18 20:30:50 +02:00