harb/onchain/test/mocks
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
..
BearMarketOptimizer.sol whale mode 2025-08-10 16:37:58 +02:00
BullMarketOptimizer.sol docs: Replace debugging reflection with actionable TODOs 2025-08-18 17:47:59 +02:00
ExtremeOptimizer.sol feat: Add scenario recording and replay system for invariant debugging 2025-08-18 20:31:39 +02:00
MaliciousOptimizer.sol feat: Add scenario recording and replay system for invariant debugging 2025-08-18 20:31:39 +02:00
MockKraiken.sol feat: Dynamic anchorWidth based on staking metrics 2025-08-19 11:41:02 +02:00
MockOptimizer.sol half-way working analysis 2025-07-25 10:52:56 +02:00
MockStake.sol feat: Dynamic anchorWidth based on staking metrics 2025-08-19 11:41:02 +02:00
MockVWAPTracker.sol Consolidate duplicate helper functions and improve test maintainability 2025-07-18 20:30:50 +02:00
NeutralMarketOptimizer.sol whale mode 2025-08-10 16:37:58 +02:00
RandomScenarioOptimizer.sol half-way working analysis 2025-07-25 10:52:56 +02:00
WhaleOptimizer.sol wip 2025-08-09 18:03:31 +02:00