{
  "module": "TRACK_LAYER",
  "version": "1.0",
  "description": "The Hands of Calculatiks – Web3 execution engine. Manual (EOA) or Delegated (Smart Account via ERC-4337).",
  "mantra": "The agent watches. The user decides. The chain enforces. The spread is king.",
  "wallet": {
    "manual": {
      "type": "EOA",
      "provider": "window.ethereum",
      "chainId": 8453,
      "private_key": "never stored – user signs directly"
    },
    "delegated": {
      "type": "Smart Account (ERC-4337)",
      "requires": ["delegation_layer.json", "session_key_module"],
      "private_key": "never stored – session key signs UserOperations",
      "session_key": "generated locally, encrypted, on-chain permissions"
    }
  },
  "execution": {
    "mode_manual": {
      "name": "MANUAL",
      "user_confirmation": true,
      "auto_execute": false,
      "flow": ["Detect green", "Prepare tx", "Display proposal", "User signs with EOA", "Tx sent"]
    },
    "mode_delegated": {
      "name": "DELEGATED",
      "user_confirmation": false,
      "auto_execute": true,
      "flow": ["Detect green", "Check on-chain permissions", "Agent signs UserOp", "Smart Account validates", "Tx executed", "Notify user"]
    },
    "parameters": {
      "minProfitUSD": 0.001,
      "maxVolumePerTrade": 0.1,
      "gasLimit": 300000,
      "slippagePercent": 0.5,
      "maxDailyTrades": 20,
      "minLiquidityUSD": 99,
      "maxGasCostUSD": 1.0,
      "arbitrageThresholdPercent": 0.1
    }
  },
  "delegation_limits": {
    "max_profit_per_trade_usd": 10,
    "max_daily_trades_delegated": 5,
    "max_volume_per_trade_delegated": 0.05,
    "max_slippage_percent_delegated": 0.3,
    "max_gas_cost_usd_delegated": 0.5,
    "allowed_tokens": ["CCTIKS", "TIKS", "GIKS", "MIKS", "PIKS"],
    "allowed_pools": ["uniswap", "sushiswap", "aerodrome"],
    "emergency_stop": true
  },
  "emergency_stop": {
    "triggers": [
      "negative_profit_on_3_consecutive_trades",
      "extreme_volatility_detected",
      "daily_limit_reached",
      "session_expired",
      "user_revoked_on_chain"
    ]
  },
  "abis": {
    "pair_v2": [
      "function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)",
      "function token0() external view returns (address)",
      "function token1() external view returns (address)",
      "event Sync(uint112 reserve0, uint112 reserve1)"
    ],
    "router_v2": [
      "function swapExactETHForTokens(uint amountOutMin, address[] path, address to, uint deadline) external payable returns (uint[] amounts)",
      "function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] path, address to, uint deadline) external returns (uint[] amounts)",
      "function swapExactTokensForTokens(uint amountIn, uint amountOutMin, address[] path, address to, uint deadline) external returns (uint[] amounts)"
    ],
    "erc20": [
      "function approve(address spender, uint256 amount) external returns (bool)",
      "function allowance(address owner, address spender) external view returns (uint256)",
      "function balanceOf(address account) external view returns (uint256)"
    ],
    "erc4337": [
      "function validateUserOp(UserOperation userOp, bytes32 userOpHash, uint256 missingAccountFunds) returns (uint256 validationData)",
      "function execute(address dest, uint256 value, bytes calldata func)"
    ]
  },
  "thresholds": {
    "CCTIKS": { "seuil": 0.0068, "buyTax": 0.0044, "sellTax": 0.0024, "sendTax": 0.0004 },
    "TIKS": { "seuil": 0.0, "buyTax": 0.0, "sellTax": 0.0, "sendTax": 0.0 },
    "GIKS": { "seuil": 0.0008, "buyTax": 0.0004, "sellTax": 0.0004, "sendTax": 0.0004 },
    "MIKS": { "seuil": 0.0022, "buyTax": 0.0011, "sellTax": 0.0011, "sendTax": 0.0011 },
    "PIKS": { "seuil": 0.0036, "buyTax": 0.0018, "sellTax": 0.0018, "sendTax": 0.0018 }
  },
  "alerts": {
    "on_green_signal": true,
    "on_delegated_trade": true,
    "channels": ["console", "webhook", "telegram"]
  },
  "security": {
    "no_private_key_storage": true,
    "signed_transactions_only": true,
    "max_daily_trades_hard_limit": 20,
    "min_profit_usd_hard_limit": 0.001,
    "slippage_protection": true,
    "gas_price_limit": 100,
    "delegation_non_custodial": true,
    "session_key_revocable_on_chain": true
  },
  "note": "Manual (EOA) or Delegated (Smart Account ERC-4337): you choose. The chain enforces. The spread will never be lost again."
}