Commit graph

322 commits

Author SHA1 Message Date
openhands
3fceb4145a feat: replace tax with holders in ring buffer, add sparkline charts (#170)
Ring buffer slot 3 now stores holderCount snapshots instead of tax deltas.
Tax tracking simplified to a totalTaxPaid counter on the stats record.
Removed unbounded ethReserveHistory and feeHistory tables; 7d ETH reserve
growth is now computed from the ring buffer. LiveStats renders inline SVG
sparklines for ETH reserve, supply, and holders with holder growth %.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 18:56:36 +00:00
johba
4206f3bc63 Merge pull request 'feat: make How It Works CTA prominent, add crypto-native tagline (#175)' (#182) from fix/issue-175 into master 2026-02-22 19:40:41 +01:00
openhands
8e93253b5c feat: make How It Works CTA prominent, add crypto-native tagline (#175) 2026-02-22 17:39:33 +00:00
johba
20a808a507 Merge pull request 'fix: replace Start Earning messaging with accurate staking positioning (#173)' (#180) from fix/issue-173 into master 2026-02-22 18:33:40 +01:00
openhands
ecbd167997 fix: address review — extract inline style, tighten disclaimer copy 2026-02-22 17:16:54 +00:00
openhands
533c5755b5 fix: remove staking references from landing page
Landing page sells the token, not staking. Staking is password-protected
for insiders — not advertised to casual visitors.

- 'Stake in 30 Seconds' → 'Get $KRK in 30 Seconds' (Mixed)
- 'Stake & Grow' → 'Get $KRK' (Offensive)
- Remove 'staker sentiment' from HomeView copy
- Add staking visibility rule to UX-DECISIONS.md
2026-02-22 16:49:02 +00:00
openhands
57deaaaf8f ci: fix clone auth with codeberg_token secret 2026-02-22 16:07:07 +00:00
openhands
6304cca556 fix: replace Start Earning messaging with accurate staking positioning (#173) 2026-02-22 11:34:48 +00:00
johba
1e0822eaa2 fix: clean URLs, contract addresses, gitmodule (#16, #58, #147) (#162) 2026-02-20 17:28:59 +01:00
johba
79c9c8571a fix: retry bootstrap swap with recenter (#134, #13, #12) (#166) 2026-02-20 09:19:13 +01:00
johba
d9b5131101 fix: Get KRK local swap, WalletCard on all variants (#146, #150) (#165) 2026-02-20 09:18:51 +01:00
johba
b3b7ab72f9 feat: wallet transaction history table (#155) (#164) 2026-02-20 09:18:10 +01:00
johba
396f2b5f90 docs: layered information architecture (#140) (#163) 2026-02-20 09:01:11 +01:00
johba
fe02ffd12d copy: remove AI claims, reframe as adaptive protocol (#160) 2026-02-20 09:00:34 +01:00
johba
9e69dcdcac fix: copy hoisted node_modules in CI Dockerfile (#161) 2026-02-20 02:36:00 +01:00
openhands
6893d4065f chore: remove unused assets (header-imageold.png, test artifacts) 2026-02-19 20:07:49 +00:00
johba
db3633425a feat: shared @harb/web3 package + landing wallet connect (#157) (#159) 2026-02-19 20:18:27 +01:00
johba
66106077ba feat: wallet P&L with average cost basis tracking (#156) (#158) 2026-02-19 16:22:23 +01:00
johba
76b2635e63 Replace UBI with ETH reserve in ring buffer, fix Dockerfile HEALTHCHECK, enhance LiveStats (#154) 2026-02-19 14:47:15 +01:00
johba
31063379a8 feat/ponder-lm-indexing (#142) 2026-02-18 00:19:05 +01:00
openhands
de3c8eef94 docs: consolidate and update all documentation for launch readiness
- Rewrite root README.md with proper project overview, tech stack, and repo structure
- Remove duplicate CLAUDE.md files (root, onchain, ponder) — AGENTS.md is the standard
- Update HARBERG.md to reflect Stage 1 completion and Stage 2 evolution
- Delete stale onchain/testing_todos.md (all high-priority items completed)
- Update VERSION_VALIDATION.md for VERSION=2
- Trim root AGENTS.md: replace Docker duplication with docs/docker.md reference
- Trim onchain/AGENTS.md (129→71 lines): reference TECHNICAL_APPENDIX for formulas
- Trim web-app/AGENTS.md (278→55 lines): remove internal API docs, keep architecture
- Rewrite onchain/README.md: add contract table, deployment addresses, analysis links
- Trim services/ponder/README.md: remove stale subgraph comparison
- Add otterscan to docs/docker.md service topology
- Update TECHNICAL_APPENDIX.md references

Net: -388 lines across documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 19:22:34 +00:00
openhands
b7260b2eaf chore: analysis tooling, research artifacts, and code quality
- Analysis: parameter sweep scripts, adversarial testing, 2D frontier maps
- Research: KRAIKEN_RESEARCH_REPORT, SECURITY_REVIEW, STORAGE_LAYOUT
- FuzzingBase: consolidated fuzzing helper, BackgroundLP simulation
- Sweep results: CSV data for full 4D sweep (1050 combos), bull-bear,
  AS sweep, VWAP fix validation
- Code quality: .gitignore for fuzz CSVs, gas snapshot, updated docs
- Remove dead analysis helpers (CSVHelper, CSVManager, ScenarioRecorder)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 18:22:03 +00:00
openhands
d64b63aff4 feat: deployment scripts, E2E tests, and documentation
- DeployBase: shared deployment logic with OptimizerV3 UUPS proxy
- DeployBaseMainnet: Base mainnet configuration (feeDest, WETH, factory)
- DeployLocal: local Anvil deployment with OptimizerV3
- UpgradeOptimizer: UUPS upgrade script for existing proxy
- DEPLOYMENT_RUNBOOK: step-by-step mainnet deployment guide
- E2E tests: recenter position verification, optimizer integration
- Landing page: updated docs for OptimizerV3 and protocol changes
- Remove dead DeployScript2.sol

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 18:21:49 +00:00
openhands
85350caf52 feat: OptimizerV3 with direct 2D staking-to-LP parameter mapping
Core protocol changes for launch readiness:

- OptimizerV3: binary bear/bull mapping from (staking%, avgTax) — avoids
  exploitable AW 30-90 kill zone. Bear: AS=30%, AW=100, CI=0, DD=0.3e18.
  Bull: AS=100%, AW=20, CI=0, DD=1e18. UUPS upgradeable with __gap[48].
- Directional VWAP: only records prices on ETH inflow (buys), preventing
  sell-side dilution of price memory
- Floor formula: unified max(scarcity, mirror, clamp) — VWAP mirror uses
  distance from adjusted VWAP as floor distance, no branching
- PriceOracle (M-1 fix): correct fallback TWAP divisor (60000s, not 300s)
- Access control (M-2 fix): deployer-only guard on one-time setters
- Recenter rate limit (M-3 fix): 60-second cooldown for open recenters
- Safe fallback params: recenter() optimizer-failure defaults changed from
  exploitable CI=50%/AW=50 to safe bear-mode CI=0/AW=100
- Recentered event for monitoring and indexing
- VERSION bump to 2, kraiken-lib COMPATIBLE_CONTRACT_VERSIONS updated

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 18:21:18 +00:00
openhands
21857ae8ca feat: protocol stats display + parameter sweep fuzzing infrastructure (#106)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 18:09:11 +00:00
openhands
37b1002dae feat: add Otterscan block explorer to dev environment (#109)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 14:55:07 +00:00
openhands
61b7ee435f chore: remove unused pt-v5-twab-controller submodule (54MB) 2026-02-13 14:37:20 +00:00
openhands
d581b8394b fix(onchain): resolve KRK token supply corruption during recenter (#98)
PROBLEM:
Recenter operations were burning ~137,866 KRK tokens instead of minting
them, causing severe deflation when inflation should occur. This was due
to the liquidity manager burning ALL collected tokens from old positions
and then minting tokens for new positions separately, causing asymmetric
supply adjustments to the staking pool.

ROOT CAUSE:
During recenter():
1. _scrapePositions() collected tokens from old positions and immediately
   burned them ALL (+ proportional staking pool adjustment)
2. _setPositions() minted tokens for new positions (+ proportional
   staking pool adjustment)
3. The burn and mint operations used DIFFERENT totalSupply values in
   their proportion calculations, causing imbalanced adjustments
4. When old positions had more tokens than new positions needed, the net
   result was deflation

WHY THIS HAPPENED:
When KRK price increases (users buying), the same liquidity depth
requires fewer KRK tokens. The old code would:
- Burn 120k KRK from old positions (+ 30k from staking pool)
- Mint 10k KRK for new positions (+ 2.5k to staking pool)
- Net: -137.5k KRK total supply (WRONG!)

FIX:
1. Modified uniswapV3MintCallback() to use existing KRK balance first
   before minting new tokens
2. Removed burn() from _scrapePositions() - keep collected tokens
3. Removed burn() from end of recenter() - don't burn "excess"
4. Tokens held by LiquidityManager are already excluded from
   outstandingSupply(), so they don't affect staking calculations

RESULT:
Now during recenter, only the NET difference is minted or used:
- Collect old positions into LiquidityManager balance
- Use that balance for new positions
- Only mint additional tokens if more are needed
- Keep any unused balance for future recenters
- No more asymmetric burn/mint causing supply corruption

VERIFICATION:
- All 107 existing tests pass
- Added 2 new regression tests in test/SupplyCorruption.t.sol
- testRecenterDoesNotCorruptSupply: verifies single recenter preserves supply
- testMultipleRecentersPreserveSupply: verifies no accumulation over time

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 16:20:57 +00:00
johba
e5e1308e72 refactor: consolidate CI and local dev orchestration (#108)
## Summary
- Extract shared bootstrap functions into `scripts/bootstrap-common.sh` (eliminates ~120 lines of duplicated forge/cast commands from e2e.yml)
- Create reusable `scripts/wait-for-service.sh` for health checks (replaces 60-line inline wait-for-stack)
- Merge dev and CI entrypoints into unified scripts branching on `CI` env var (delete `docker/ci-entrypoints/`)
- Replace 4 per-service CI Dockerfiles with parameterized `docker/Dockerfile.service-ci`
- Add `sync-tax-rates.mjs` to CI image builder stage
- Fix: CI now grants txnBot recenter access (was missing)
- Fix: txnBot funding parameterized (CI=10eth, local=1eth)
- Delete 5 obsolete migration docs and 4 DinD integration files

Net: -1540 lines removed

Closes #107

## Test plan
- [ ] E2E pipeline passes (bootstrap sources shared script, services use old images with commands override)
- [ ] build-ci-images pipeline builds all 4 services with unified Dockerfile
- [ ] Local dev stack boots via `./scripts/dev.sh start`

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

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/108
2026-02-03 12:07:28 +01:00
johba
4277f19b68 feature/ci (#84)
Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/84
2026-02-02 19:24:57 +01:00
traddoo
beefe22f90 fix(web-app): position ID, issuance earned (#96)
Bug #1: Position ID Transformation Issue (#95)

  Problem: Frontend applied incorrect byte conversion to position IDs, causing transactions to fail with "NoPermission"
  errors.

  Root Cause: formatId() function did little-endian byte conversion on already-correct numeric strings from GraphQL.

  Fix: Direct conversion BigInt(obj.id) instead of formatId(obj.id as Hex) in usePositions.ts.

  Result: Users can now successfully stake/unstake positions.

  ---
  Bug #2: Issuance Earned Calculation Error (#97)

  Problem: Frontend showed negative "Issuance Earned" values (e.g., -4,991 KRK) due to wrong mathematical formula.

  Root Cause: Formula calculated position.totalSupplyInit - currentTotalSupply (always negative when supply increases).

  Fix: Correct formula (currentTotalSupply - position.totalSupplyInit) × position.share in Vue components.

  Result: Shows realistic positive earnings and enables proper economic monitoring.

Co-authored-by: steve <steve@harberg.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/96
Co-authored-by: traddoo <traddoo@noreply.codeberg.org>
Co-committed-by: traddoo <traddoo@noreply.codeberg.org>
2025-11-20 19:44:10 +01:00
johba
a555a2fdd1 refactor: migrate kraiken-lib to explicit subpath imports (BREAKING CHANGE) (#89)
Removes the barrel export pattern in favor of explicit subpath imports
for better tree-shaking and clearer dependencies.

## Breaking Changes
- Removed `src/helpers.ts` barrel export
- Removed `./helpers` from package.json exports
- Root `kraiken-lib` import now raises build errors
- Consumers MUST use explicit subpaths:
  - `kraiken-lib/abis` - Contract ABIs
  - `kraiken-lib/staking` - Staking helpers
  - `kraiken-lib/snatch` - Snatch selection
  - `kraiken-lib/ids` - Position ID utilities
  - `kraiken-lib/subgraph` - Byte conversion utilities
  - `kraiken-lib/taxRates` - Tax rate constants
  - `kraiken-lib/version` - Version validation

## Changes
- kraiken-lib:
  - Bumped version to 1.0.0 (breaking change)
  - Updated src/index.ts to raise build errors
  - Added backward-compatible ABI aliases (KraikenAbi, StakeAbi)
  - Updated all test files to use .js extensions and new imports
  - Updated documentation (README, AGENTS.md)

- Consumer updates:
  - services/ponder: Updated ponder.config.ts to use kraiken-lib/abis
  - web-app: Updated all imports to use subpaths
    - composables/usePositions.ts: kraiken-lib/subgraph
    - contracts/harb.ts: kraiken-lib/abis
    - contracts/stake.ts: kraiken-lib/abis

## Migration Guide
```typescript
// OLD
import { getSnatchList } from 'kraiken-lib/helpers';
import { KraikenAbi } from 'kraiken-lib';

// NEW
import { getSnatchList } from 'kraiken-lib/snatch';
import { KraikenAbi } from 'kraiken-lib/abis';
```

Fixes #86

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/89
2025-11-20 18:54:53 +01:00
johba
1c6f118f6b fix/node-modules-named-volumes (#94)
Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/94
2025-11-13 18:17:56 +01:00
johba
19bac420d0 fix/docker-log-rotation-disk-management (#93)
Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/93
2025-11-09 12:57:49 +01:00
johba
5d71753086 migrate/podman-to-docker (#92)
podman to docker

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/92
2025-11-08 14:08:46 +01:00
johba
c2720c35a5 fix: configure Jest for ES modules in kraiken-lib (#88)
Updates Jest configuration to properly handle ES module syntax:
- Switch to ts-jest/presets/default-esm preset
- Add custom resolver to map .js imports to .ts source files
- Configure extensionsToTreatAsEsm for TypeScript files
- Enable useESM in ts-jest globals

This resolves module resolution errors when running tests in
kraiken-lib which uses "type": "module" in package.json.

Fixes #85

Co-authored-by: openhands <openhands@all-hands.dev>
Reviewed-on: https://codeberg.org/johba/harb/pulls/88
2025-11-08 12:03:48 +01:00
johba
07a522e3fb Merge pull request 'fix: correct ProcessEnv type import in txnBot' (#91) from fix/txnbot-processenv-type into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/91
2025-11-08 11:58:49 +01:00
openhands
a8786f6460 fix: correct ProcessEnv type import in txnBot
Changes ProcessEnv import from non-existent 'node:process' module
to use built-in NodeJS.ProcessEnv type.

Fixes TypeScript compilation error:
  Module '"node:process"' has no exported member 'ProcessEnv'

Also adds NodeJS to ESLint globals to resolve no-undef warning.

All services now healthy and operational.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 10:39:27 +00:00
johba
9852e55d40 Merge pull request 'config: add configurable RPC timeout for Ponder stability' (#90) from config/ponder-rpc-timeout into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/90
2025-11-06 12:27:13 +01:00
openhands
3564a36408 config: add configurable RPC timeout for Ponder stability
Adds PONDER_RPC_TIMEOUT environment variable to improve Ponder
stability on slow RPC connections or under load. Default is 20000ms
(20 seconds).

## Changes
- containers/ponder-dev-entrypoint.sh: Export PONDER_RPC_TIMEOUT with default of 20000ms
- podman-compose.yml: Add PONDER_RPC_TIMEOUT to ponder service environment

## Configuration
The timeout can be overridden by setting PONDER_RPC_TIMEOUT in your
environment before starting the stack:
```bash
export PONDER_RPC_TIMEOUT=30000  # 30 seconds
./scripts/dev.sh start
```

## Impact
- Low risk: Configuration-only change
- No breaking changes
- Improves stability on slower networks or forked environments
- Defaults to 20 seconds if not specified

Fixes #87

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 08:58:31 +00:00
johba
c8162b2f3f Merge pull request 'fill stake e2e' (#82) from feature/e2e-max-stake-test into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/82
2025-10-12 10:35:38 +02:00
johba
aa1ddfcecd fill stake e2e 2025-10-11 17:54:49 +00:00
johba
30ed4aa072 Merge pull request 'feat: surface stack versions in app footer' (#81) from feature/expose-stack-versions into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/81
2025-10-11 19:22:46 +02:00
johba
d8119da65b feat: surface stack versions in app footer 2025-10-11 17:21:45 +00:00
johba
beea5f67f9 Merge pull request 'feature/txn-bot-service-refactor' (#80) from feature/txn-bot-service-refactor into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/80
2025-10-11 17:50:00 +02:00
johba
f039221d4a txnbot refactor 2025-10-11 15:47:16 +00:00
johba
bd475c2271 min stake from backend (#78)
resolves #74

Co-authored-by: johba <johba@harb.eth>
Reviewed-on: https://codeberg.org/johba/harb/pulls/78
2025-10-11 15:30:08 +02:00
johba
0b3545091f Merge pull request 'position stream' (#77) from feature/ponder-position-stream into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/77
2025-10-11 14:35:58 +02:00
johba
55321eff65 position stream 2025-10-11 12:33:35 +00:00
johba
0674648044 Merge pull request 'improve web-app config' (#76) from fix/rpc-api-paths into master
Reviewed-on: https://codeberg.org/johba/harb/pulls/76
2025-10-11 12:57:23 +02:00