feat/ponder-lm-indexing (#142)

This commit is contained in:
johba 2026-02-18 00:19:05 +01:00
parent de3c8eef94
commit 31063379a8
107 changed files with 12517 additions and 367 deletions

View file

@ -87,7 +87,7 @@ EOCONTRACTS
fund_liquidity_manager() {
bootstrap_log "Funding LiquidityManager"
cast send --rpc-url "$ANVIL_RPC" --private-key "$DEPLOYER_PK" \
"$LIQUIDITY_MANAGER" --value 0.1ether >>"$LOG_FILE" 2>&1
"$LIQUIDITY_MANAGER" --value 10ether >>"$LOG_FILE" 2>&1
}
grant_recenter_access() {
@ -121,14 +121,14 @@ call_recenter() {
seed_application_state() {
bootstrap_log "Wrapping ETH to WETH"
cast send --rpc-url "$ANVIL_RPC" --private-key "$DEPLOYER_PK" \
"$WETH" "deposit()" --value 0.02ether >>"$LOG_FILE" 2>&1
"$WETH" "deposit()" --value 2ether >>"$LOG_FILE" 2>&1
bootstrap_log "Approving router"
cast send --rpc-url "$ANVIL_RPC" --private-key "$DEPLOYER_PK" \
"$WETH" "approve(address,uint256)" "$SWAP_ROUTER" "$MAX_UINT" >>"$LOG_FILE" 2>&1
bootstrap_log "Executing initial KRK swap"
cast send --legacy --gas-limit 300000 --rpc-url "$ANVIL_RPC" --private-key "$DEPLOYER_PK" \
"$SWAP_ROUTER" "exactInputSingle((address,address,uint24,address,uint256,uint256,uint160))" \
"($WETH,$KRAIKEN,10000,$DEPLOYER_ADDR,10000000000000000,0,0)" >>"$LOG_FILE" 2>&1
"($WETH,$KRAIKEN,10000,$DEPLOYER_ADDR,1000000000000000000,0,4295128740)" >>"$LOG_FILE" 2>&1
}
fund_txn_bot_wallet() {

130
scripts/run-usertest.sh Executable file
View file

@ -0,0 +1,130 @@
#!/bin/bash
# Quick-start script for running user testing suite
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_ROOT"
echo "🧪 Kraiken User Testing Suite"
echo "=============================="
echo ""
# Check if stack is running
echo "📊 Checking stack health..."
if ! curl -s http://localhost:8081/api/rpc > /dev/null 2>&1; then
echo "❌ Stack is not running!"
echo ""
echo "Please start the stack first:"
echo " ./scripts/dev.sh start"
echo ""
exit 1
fi
echo "✅ Stack is running"
echo ""
# Create output directories
echo "📁 Creating output directories..."
mkdir -p tmp/usertest-results
mkdir -p test-results/usertest
echo "✅ Directories ready"
echo ""
# Parse arguments
PERSONA=""
DEBUG_MODE=""
HEADED_MODE=""
while [[ $# -gt 0 ]]; do
case $1 in
--persona)
PERSONA="$2"
shift 2
;;
--debug)
DEBUG_MODE="--debug"
shift
;;
--headed)
HEADED_MODE="--headed"
shift
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 [--persona <name>] [--debug] [--headed]"
echo ""
echo "Personas:"
echo " marcus - Marcus 'Flash' Chen (Degen/MEV Hunter)"
echo " sarah - Sarah Park (Cautious Yield Farmer)"
echo " tyler - Tyler 'Bags' Morrison (Retail Degen)"
echo " priya - Dr. Priya Malhotra (Institutional)"
echo " alex - Alex Rivera (Newcomer)"
echo ""
exit 1
;;
esac
done
# Determine which tests to run
if [ -z "$PERSONA" ]; then
echo "🎭 Running ALL personas..."
TEST_PATTERN="tests/e2e/usertest/"
else
case $PERSONA in
marcus)
echo "🎭 Running Marcus 'Flash' Chen (Degen)..."
TEST_PATTERN="tests/e2e/usertest/marcus-degen.spec.ts"
;;
sarah)
echo "🎭 Running Sarah Park (Yield Farmer)..."
TEST_PATTERN="tests/e2e/usertest/sarah-yield-farmer.spec.ts"
;;
tyler)
echo "🎭 Running Tyler 'Bags' Morrison (Retail)..."
TEST_PATTERN="tests/e2e/usertest/tyler-retail-degen.spec.ts"
;;
priya)
echo "🎭 Running Dr. Priya Malhotra (Institutional)..."
TEST_PATTERN="tests/e2e/usertest/priya-institutional.spec.ts"
;;
alex)
echo "🎭 Running Alex Rivera (Newcomer)..."
TEST_PATTERN="tests/e2e/usertest/alex-newcomer.spec.ts"
;;
*)
echo "❌ Unknown persona: $PERSONA"
echo ""
echo "Available personas: marcus, sarah, tyler, priya, alex"
exit 1
;;
esac
fi
echo ""
echo "▶️ Starting tests..."
echo ""
# Run tests with workers=1 to avoid account conflicts
npx playwright test "$TEST_PATTERN" --workers=1 $DEBUG_MODE $HEADED_MODE
echo ""
echo "✅ Tests complete!"
echo ""
echo "📊 Results:"
echo " - Screenshots: test-results/usertest/"
echo " - JSON reports: tmp/usertest-results/"
echo ""
# Show report files
if [ -d "tmp/usertest-results" ]; then
echo "Generated reports:"
ls -lh tmp/usertest-results/*.json 2>/dev/null | awk '{print " - " $9 " (" $5 ")"}'
fi
echo ""
echo "🔍 To analyze results:"
echo " cat tmp/usertest-results/<persona-name>.json | jq"
echo ""