{
  "manifest_type": "pricing",
  "schema_version": "1.1.0",
  "node_id": "nexus.legal.contractdrafter",
  "generated_note": "Static pricing manifest — tariffs, payment rails, and escrow settlement flow for autonomous M2M purchase decisions.",
  "pricing_model": {
    "currency_unit": "USDC",
    "usd_per_credit": 0.01,
    "cred_per_usdc": 100,
    "usdc_decimals": 6,
    "atomic_units_per_credit": 10000,
    "services": {
      "structured_data": {
        "base_credits": 20,
        "description": "Verified Structured Data (~$0.20)"
      },
      "code_modules": {
        "base_credits": 120,
        "description": "EVM Sentinel Quick Scan (~$1.20)"
      },
      "legal_code": {
        "base_credits": 45000,
        "description": "Hybrid Legal-Code Pro (~$450.00 Standard tier; Light $300 / Standard $450 / Enterprise $800)"
      },
      "scan_quick": {
        "base_credits": 5,
        "description": "EVM Sentinel Quick-Check — honeypot/access-control fast scan ($0.05)"
      },
      "scan_deep": {
        "base_credits": 50,
        "description": "EVM Sentinel Deep-Scan — full 9-scenario breach analysis incl. Permit2-drain + arbitrage-manipulation patterns ($0.50)"
      },
      "fitness_attestation": {
        "base_credits": 5,
        "description": "Fitness Attestation — factual GHSA/CVE scan, license check, freshness, SBOM, deterministic score ($0.05)"
      },
      "fitness_lite": {
        "base_credits": 125,
        "description": "Fitness Lite — W4 Gas Efficiency Rank: static heuristic gas estimate vs fixed public cohort ($1.25) [LIVE — specs/w4-gas-efficiency-rank.md]"
      },
      "fitness_full": {
        "base_credits": 225,
        "description": "Fitness Full — W3: gas rank + base attestation + per-advisory Exploitability Score (fixed public formula) + source-match vs explorer-verified on-chain source ($2.25) [LIVE — reference/w3-fitness-full-spec.md]"
      },
      "fitness_forensic": {
        "base_credits": 350,
        "description": "Fitness Forensic — W6: full-tier analysis + top-3 exploit scenario narratives + observable impact + dual-pinned IPFS evidence bundle ($3.50) [LIVE — reference/w6-forensic-spec.md]"
      },
      "error": {
        "base_credits": 0,
        "description": "Fallback Error Payload (FREE)"
      },
      "pull_payment": {
        "base_credits": 0,
        "description": "EIP-712 Pull Payment Top-Up (FREE call, adds credits)"
      }
    },
    "legal_code_tiers": {
      "light": {
        "credits": 30000,
        "usd": 300,
        "description": "Light — basic bilingual legal contract + code mapping"
      },
      "standard": {
        "credits": 45000,
        "usd": 450,
        "description": "Standard — full bilingual legal contract + Solidity + Digital Twin matrix"
      },
      "enterprise": {
        "credits": 80000,
        "usd": 800,
        "description": "Enterprise — escrow/arbiter-grade contract + full audit trail + priority SLA"
      }
    },
    "surge_scaling": [
      {
        "tier": 1,
        "requests_per_minute": "<= 10",
        "multiplier": 1,
        "label": "Base Rate"
      },
      {
        "tier": 2,
        "requests_per_minute": "11 - 50",
        "multiplier": 1.5,
        "label": "Elevated Demand"
      },
      {
        "tier": 3,
        "requests_per_minute": "> 50",
        "multiplier": 2.5,
        "label": "Priority Pass"
      }
    ],
    "trials": {
      "structured_data": {
        "credits": 20,
        "expiry_hours": 24,
        "limit": "1x per client",
        "note": "Full free trial ($0.20 value, covers one structured_data call)"
      },
      "code_modules": {
        "discount_credits": 100,
        "expiry_hours": 24,
        "limit": "1x per client",
        "min_balance_credits": 20,
        "note": "Discount trial: $1.00 off code_modules — client pays $0.20 for a $1.20 service"
      },
      "fitness_attestation": {
        "credits": 5,
        "expiry_hours": 24,
        "limit": "1x per client",
        "note": "Free trial — first fitness attestation call free ($0.05 value), then balance/x402"
      }
    }
  },
  "payment_rails": {
    "primary": {
      "protocol": "EIP-712 / ERC-20 Permit + TransferFrom (Pull Payment)",
      "chain": "polygon-mainnet",
      "chain_id": 137,
      "caip2": "eip155:137",
      "asset": {
        "symbol": "USDC",
        "contract": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
        "decimals": 6
      },
      "gateway_contract": "0x2a3D917379Bf94D7B6f239D6BcbBdD7cD8543683",
      "pay_to_treasury": "0x80963791ce7cb9c5d580fe638c39fdd9ffdae2d5",
      "exchange_rate": "Prices quoted in USDC (Polygon PoS, eip155:137)",
      "how_to_pay": {
        "endpoint": "POST /",
        "service_type": "pull_payment",
        "auth": "x-client-id header required",
        "params": {
          "permit": "EIP-712 {owner, spender, value, deadline, v, r, s} — spender MUST be the Gateway contract",
          "client_id_hash": "keccak256(x-client-id) as 0x-prefixed bytes32"
        }
      },
      "security_parameters": {
        "min_deadline_buffer_s": 1800,
        "max_deadline_buffer_s": 3600,
        "max_gas_price_wei": 500000000000,
        "confirmation_blocks": 2,
        "nonce_anti_replay": "UNIQUE INDEX on (client_address, permit_nonce) in pull_payment_authorizations"
      }
    },
    "x402_signaling": {
      "description": "All 402 Payment Required responses carry an x402 v2 payment-required header (base64 JSON) with accepts[] — exact scheme, eip155:137, USDC atomic amounts, treasury payTo.",
      "spec_compatibility": "x402Version: 2"
    }
  },
  "escrow_settlement_flow": {
    "model": "hold-and-settle virtual credit escrow",
    "description": "Funds are pulled into the virtual balance ledger and held as spendable USDC-denominated balance. Balance is only consumed (settled) when a paid service executes successfully. If a paid call fails after charge, the ledger rolls back the charge (DB-only refund — no on-chain USDC movement).",
    "states": [
      {
        "state": "authorized",
        "description": "Client signs EIP-712 permit; Gateway verifies signature, deadline buffer (30-60 min), gas price cap, and nonce uniqueness.",
        "transition": "pull"
      },
      {
        "state": "pulled",
        "description": "Gateway.sol executes transferFrom; USDC moves client → treasury. 2-block confirmation required before crediting.",
        "transition": "credit"
      },
      {
        "state": "credited",
        "description": "Ledger adds USDC-denominated balance to the client account. Funds now escrowed as spendable balance.",
        "transition": "spend"
      },
      {
        "state": "settled",
        "description": "A paid service call executes successfully; gatekeeper deducts final cost (base x surge multiplier) from balance.",
        "transition": "terminal"
      },
      {
        "state": "rolled_back",
        "description": "Paid call failed after charge — ledger reverses the deduction (DB-only refund, Iron Rule #3). On-chain USDC is NOT returned.",
        "transition": "terminal"
      }
    ],
    "guarantee": "No balance is consumed by failed calls. Unspent balance persists indefinitely and remains spendable on any service.",
    "iron_rules": [
      "Gateway.sol IS the EIP-712 spender (never the treasury wallet directly)",
      "Deadline buffer 30-60 min enforced on-chain + DB (matched to Polygon PoS checkpoint interval)",
      "Virtual Credit Ledger rollback for failed API calls (DB-only refund, no on-chain USDC return)",
      "Cryptographic nonce anti-replay (UNIQUE INDEX on client_address + permit_nonce)",
      "2-block confirmation before crediting",
      "Max Gas Price enforcement (500 gwei cap in Gateway.sol)"
    ]
  },
  "endpoints": {
    "GET /pricing.manifest.json": {
      "description": "This pricing manifest (free)",
      "billing": "FREE",
      "auth": "none"
    },
    "GET /manifest.json": {
      "description": "A2A agent discovery manifest (free)",
      "billing": "FREE",
      "auth": "none"
    },
    "GET /metrics": {
      "description": "Live telemetry — current surge tier can be inferred from throughput stats (free)",
      "billing": "FREE",
      "auth": "none"
    },
    "POST /": {
      "description": "Paid services (structured_data, code_modules, legal_code) + free pull_payment top-up",
      "billing": "per-service USDC charge (x402 exact, eip155:137)",
      "auth": "x-client-id header required"
    }
  },
  "registry": {
    "gateway_contract": "0x2a3D917379Bf94D7B6f239D6BcbBdD7cD8543683",
    "treasury": "0x80963791ce7cb9c5d580fe638c39fdd9ffdae2d5",
    "chain": "polygon-mainnet",
    "source_repo": "https://github.com/rakhmadaa-gif/nexus-core-gateway",
    "docs": "nexus-pull-payment-api-v3.md"
  }
}