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>
This commit is contained in:
parent
21857ae8ca
commit
85350caf52
38 changed files with 3793 additions and 205 deletions
44
.claude/hooks/supervisor/on-notify.sh
Executable file
44
.claude/hooks/supervisor/on-notify.sh
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
# Claude Code Notification hook — fires when Claude is waiting for input.
|
||||
#
|
||||
# Option D: bash pre-filter by notification type.
|
||||
#
|
||||
# - idle_prompt → triage (agent waiting, might need nudge)
|
||||
# - permission_prompt → always triage (might need approval)
|
||||
# - auth_* → skip (internal, transient)
|
||||
# - other → triage
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
SUPERVISOR_DIR="${SCRIPT_DIR%/hooks}"
|
||||
|
||||
INPUT=$(cat)
|
||||
|
||||
NOTIFY_TYPE=$(echo "$INPUT" | jq -r '.type // "unknown"')
|
||||
SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // "unknown"')
|
||||
CWD=$(echo "$INPUT" | jq -r '.cwd // "unknown"')
|
||||
MESSAGE=$(echo "$INPUT" | jq -r '.message // ""' | head -c 300)
|
||||
|
||||
case "$NOTIFY_TYPE" in
|
||||
auth_*)
|
||||
# Auth events are transient, skip
|
||||
exit 0
|
||||
;;
|
||||
permission_prompt)
|
||||
# Agent needs permission — might be able to auto-approve, or escalate
|
||||
"$SUPERVISOR_DIR/triage.sh" "notification:permission" "$CWD" \
|
||||
"Permission requested: $MESSAGE | Session: $SESSION_ID" &
|
||||
;;
|
||||
idle_prompt)
|
||||
# Agent is idle, waiting for human input
|
||||
"$SUPERVISOR_DIR/triage.sh" "notification:idle" "$CWD" \
|
||||
"Agent idle, waiting for input. Message: $MESSAGE | Session: $SESSION_ID" &
|
||||
;;
|
||||
*)
|
||||
"$SUPERVISOR_DIR/triage.sh" "notification:$NOTIFY_TYPE" "$CWD" \
|
||||
"Type: $NOTIFY_TYPE | Message: $MESSAGE | Session: $SESSION_ID" &
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue