## Summary
- add a useSnatchSelection composable that centralises snatch shortfall calculations, position filtering, and RPC memoisation
- refactor StakeHolder.vue to consume the composable instead of reimplementing the flow inline
- introduce Vitest config and first composable tests (useSnatchSelection.spec.ts) to cover empty/partial fills and ownership edge cases
- wire up project tooling updates so the new tests run (jsdom dep, updated package metadata)
## Testing
- cd web-app && npm install
- npm test
resolves#24
Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/30
- Updated all ponder event handlers to use proper TypeScript types
- Removed all 'any' type annotations from event handlers
- Handlers now properly leverage TypeScript's type inference
- Improved type safety across the ponder indexer
Fixes#22
- Updated kraiken-lib tsconfig and yarn.lock
- Added package.json with playwright-mcp dependency
- Updated uni-v3-lib submodule
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed service dependencies (removed bootstrap dependency for runtime services)
- Added landing service for documentation site at root path
- Moved web-app to /app path, landing to / path
- Fixed permission issues with lowercase 'z' SELinux context
- Added kraiken-lib compilation in txn-bot container
- Fixed TypeScript build for kraiken-lib with proper volumes
- Updated entrypoint scripts to handle npm installs properly
- Added locale fixes to Containerfiles
- Changed Caddy port from 80 to 8081 for external access
- Updated Docs link to point to local landing page
All services now working:
- Landing page at /
- Web app at /app/
- GraphQL at /graphql
- Transaction bot at /txn
- Anvil RPC at /rpc/anvil
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
- Integrate staking and exitPosition actions into fuzzing scenarios
- Add staking metrics (percentageStaked, avgTaxRate) to CSV output
- Implement snatching mechanism when stake pool reaches capacity
- Add configurable staking parameters (enable/disable, buy bias, staking bias)
- Support configurable number of trades per run
- Simplify to single trader account with proportional ETH funding
- Configure tax rates: 0-15 for initial stakes, 28 for snatching
- Clean up debug logging and verbose output
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add staking/unstaking actions to fuzzing scenarios (stake every 3rd trade)
- Implement snatching logic when stake pool reaches capacity (uses max tax rate)
- Add configurable parameters:
- buyBias: Control buy vs sell ratio (0-100%)
- stakingBias: Control stake vs unstake ratio (0-100%)
- tradesPerRun: Configure number of trades per scenario
- staking: Enable/disable staking entirely
- Simplify to single trading strategy (_executeRandomLargeTrades)
- Fix memory issues by recording only every 5th trade to CSV
- Track staking metrics (stakes attempted/succeeded, snatches attempted/succeeded)
- Update CLAUDE.md with new fuzzing parameters and usage examples
- Clean up old TODO files and unused code
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added BUY_BIAS environment variable (0-100%) to control trading direction
- Implemented biased trading logic in all strategies (Random, Whale, Volatile, etc.)
- Created run-improved-fuzzing.sh script with buy bias support
- Fixed memory issues in CSV generation by simplifying string concatenation
- Fixed console.log parameter issues in staking functions
- Updated run-recorded-fuzzing.sh to accept buybias parameter
- Testing shows up to 99% of authorized stake reached with 100% buy bias
Co-Authored-By: Claude <noreply@anthropic.com>
- Deploy Uniswap factory once before all runs (saves ~1.16M gas per run)
- Fix CSV buffer accumulation bug by clearing buffer between runs
- Add clearCSV() function to CSVManager for proper buffer management
- Each fuzzing run now gets its own clean CSV with correct token0isWeth values
- Comment out failing console.log in Optimizer.t.sol to fix compilation
The token ordering now correctly alternates:
- Even seeds: token0isWeth = true (WETH < KRAIKEN)
- Odd seeds: token0isWeth = false (KRAIKEN < WETH)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
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>
- Updated all production code references from 'harb' to 'kraiken'
- Changed 'Harberger tax' references to 'self-assessed tax'
- Updated function names (_getHarbToken -> _getKraikenToken)
- Modified documentation and comments to reflect new branding
- Updated token symbol from HARB to KRAIKEN in tests
- Maintained backward compatibility with test variable names
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
The fuzzing script was failing with out-of-gas errors when large KRAIKEN sells
tried to traverse many tick ranges in Uniswap V3. Fixed by adding the
--disable-block-gas-limit flag to forge script execution.
Also fixed the CSV symlink path for the visualizer to work correctly.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Increased gas limit to 100M to prevent out-of-gas errors during large swaps
- Fixed symlink path for profitable_scenario.csv to work with visualizer
- Position CSVs are now always generated when recording profitable scenarios
The out-of-gas error was occurring when large KRAIKEN sells tried to traverse
many tick ranges in Uniswap V3. The visualizer couldn't display data because
the CSV symlink was created in the wrong directory.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>