diff --git a/.gitattributes b/.gitattributes index 56b287ff348fa8336580252f3515a3b88614111c..d1afe86c0d569549b79298231e752d907afa907c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -189,3 +189,6 @@ reference_files/6cc99749ed5bed4887184afa367bf58d/LISA[[:space:]]STUDENT[[:space: reference_files/7fad57bbfa86d10ca8801bee5d034817/Reference[[:space:]]Inventory.xlsx filter=lfs diff=lfs merge=lfs -text reference_files/ca6c768fe272f61c00d001c884c42237/INPUT[[:space:]]4[[:space:]]BridgeMind[[:space:]]AI[[:space:]]POC[[:space:]]deployment[[:space:]]PROJECT[[:space:]]LOG.docx filter=lfs diff=lfs merge=lfs -text reference_files/de2375f30dc2f1a6155cda663e6f48fa/BOB[[:space:]]W2[[:space:]]COMPANY[[:space:]]X[[:space:]]edit.pdf filter=lfs diff=lfs merge=lfs -text +_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02314fc6-a24e-42f4-a8cd-362cae0f0ec1/Monthly_Safety_Compliance_Checklist.pdf filter=lfs diff=lfs merge=lfs -text +_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0353ee0c-18b5-4ad3-88e8-e001d223e1d7/Veterans[[:space:]]PACT[[:space:]]Act[[:space:]]Comprehensive[[:space:]]Guide.pdf filter=lfs diff=lfs merge=lfs -text +_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/1d4672c8-b0a7-488f-905f-9ab4e25a19f7/NexVen_International_Correlation_Analysis.pdf filter=lfs diff=lfs merge=lfs -text diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0112fc9b-c3b2-4084-8993-5a4abb1f54f1/CS_SOAP_Note_2024-03-01.docx b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0112fc9b-c3b2-4084-8993-5a4abb1f54f1/CS_SOAP_Note_2024-03-01.docx new file mode 100644 index 0000000000000000000000000000000000000000..47c670385b2723e8b34198542fd7cac9f655b088 Binary files /dev/null and b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0112fc9b-c3b2-4084-8993-5a4abb1f54f1/CS_SOAP_Note_2024-03-01.docx differ diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0112fc9b-c3b2-4084-8993-5a4abb1f54f1/CS_SOAP_Note_2024-03-01.md b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0112fc9b-c3b2-4084-8993-5a4abb1f54f1/CS_SOAP_Note_2024-03-01.md new file mode 100644 index 0000000000000000000000000000000000000000..58277d267e2b658c6dddaf3b9fdfea8c8896c35f --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0112fc9b-c3b2-4084-8993-5a4abb1f54f1/CS_SOAP_Note_2024-03-01.md @@ -0,0 +1,85 @@ +# SOAP Note — Acute Head Injury + +**Date of service:** 03/01/2024 +**Patient:** C.S., 16-year-old male +**History source:** Patient + +## S — Subjective + +**Chief complaint:** “Headache after falling off my skateboard” approximately 2 hours ago. + +**History of present illness:** C.S. is a 16-year-old male with a persistent headache that began immediately after a skateboard fall 2 hours before this visit. He reports striking a pothole and falling while riding alone without protective equipment. He landed primarily on his left leg and the left side of his face; his head struck the pavement. He denies loss of consciousness. Since the fall, he has had mild nausea without vomiting and soreness of the left face and left leg. Symptoms have remained unchanged. He denies photophobia, phonophobia, difficulty focusing, or “brain fog.” + +His current glasses broke during the fall, and he is wearing an older prescription. He reports blurred vision, which he attributes to the older glasses, and is observed squinting. A traumatic cause of the visual complaint has not yet been excluded. Headache severity, quality, exact location, and modifying factors were not provided. He drove himself to the office. + +**Relevant review of systems:** + +- **Neurologic:** Positive for persistent post-traumatic headache. Denies loss of consciousness, difficulty focusing, and brain fog. +- **Gastrointestinal:** Positive for mild nausea; negative for vomiting. +- **Eyes:** Positive for blurred vision and squinting; negative for light sensitivity. +- **ENT:** Negative for sound sensitivity. +- **Musculoskeletal:** Positive for left facial and left leg soreness after the fall. +- Other systems are reported as within normal limits in the encounter summary. + +**Past medical history:** Intermittent headaches since age 14. No other medical conditions provided. + +**Past surgical history:** Bilateral myringotomy tube placement (2013); tonsillectomy (2015). + +**Medications:** Daily multivitamin. No anticoagulant or antiplatelet medication reported. + +**Allergies:** No known allergies. + +**Family history:** Father, age 42, with GERD; mother, age 41, noncontributory; maternal grandmother, age 62, with arthritis; maternal grandfather died at age 68 and had type 2 diabetes mellitus; paternal grandmother, age 60, with hypertension; paternal grandfather died in a motor-vehicle accident at age 55; sister, age 14, healthy; brother, age 18, healthy. + +**Social history:** Denies alcohol, tobacco, and illicit drug use. Was not wearing protective equipment at the time of the fall. + +## O — Objective + +**Vital signs:** Temperature 98.6 °F; heart rate 95 beats/min; blood pressure 110/84 mm Hg; respiratory rate 18 breaths/min; weight 56.8 kg (125 lb); height 5 ft 7 in; BMI 19.6 kg/m². + +**General:** Sitting upright on the examination table. Alert, in mild discomfort, and squinting behind glasses. + +**Mental status:** Alert and oriented to person, place, time, and situation. A formal Glasgow Coma Scale score was not provided. + +**Eyes:** Pupils equal, round, reactive to light, and accommodating. Visual acuity and a detailed ocular/funduscopic examination were not provided. + +**Ears:** Tympanic membranes bilaterally pearly gray with normal light reflex and landmarks. + +**Mouth/throat:** Hard and soft palates intact; no drainage or exudate. + +**Cardiovascular:** Within normal limits. + +**Respiratory:** Within normal limits. + +**Musculoskeletal:** Full range of motion in all four extremities; strength documented as 5+ in all four extremities. + +**Neurologic:** Cranial nerves III, IV, VI, VIII, IX, X, XI, and XII intact as assessed. Mild coordination deficit noted with heel walking. Cranial nerves II, V, and VII and a full gait/balance examination were not specifically documented. + +**Other:** Remaining examination reported as within normal limits in the encounter summary. Focused scalp, facial/orbital, and cervical-spine findings were not specifically provided. + +## A — Assessment + +1. **Acute closed head injury, initial encounter (S09.90XA), clinically concerning for concussion without reported loss of consciousness.** Direct unhelmeted head impact was followed immediately by headache, nausea, blurred vision, and an abnormal heel-walk/coordination finding. A more serious intracranial injury cannot be excluded in the primary care setting. +2. **Acute post-traumatic headache, not intractable (G44.319).** This headache is temporally associated with the fall despite a history of intermittent headaches. +3. **Abnormal coordination/heel walking (R27.8).** This is an abnormal neurologic finding after head trauma and requires urgent higher-level assessment. +4. **Blurred vision (H53.8).** The older corrective-lens prescription may contribute, but trauma-related neurologic or ocular injury must be excluded. +5. **Nausea without vomiting (R11.0).** +6. **Left facial and left leg pain after fall.** Strength and range of motion are preserved, but the supplied examination does not fully characterize these injuries. +7. **Single elevated diastolic blood-pressure reading for age (R03.0).** This does not establish hypertension and may be influenced by pain or stress. + +**Differential diagnosis:** Concussion; intracranial hemorrhage or cerebral contusion; skull, facial, or orbital injury; cervical injury; ocular injury; and primary headache disorder. The immediate onset after head impact makes a purely primary headache less likely for this episode. + +## P — Plan + +1. **Immediate disposition:** Recommend immediate transfer to an emergency department for higher-level evaluation. The documented coordination abnormality and visual complaint after a direct head strike make routine outpatient observation alone inappropriate. Maintain direct observation in the office while transfer is arranged. +2. **Transportation and supervision:** C.S. must not drive. Contact a parent/legal guardian immediately and recommend EMS transport because he is a minor with a post-traumatic neurologic abnormality and blurred vision. Provide a direct clinical handoff to the receiving emergency department. +3. **Emergency evaluation:** Recommend serial neurologic examinations and a complete assessment including Glasgow Coma Scale, the cranial nerves not yet documented, gait/balance, cognition and memory, visual acuity and ocular/funduscopic examination, scalp/head/facial/orbital examination, and cervical-spine assessment. The emergency clinician should determine the need for noncontrast head CT and any facial/orbital, cervical, or extremity imaging. The absence of reported loss of consciousness or vomiting does not negate the abnormal neurologic finding. +4. **Activity restrictions:** No driving, skateboarding, bicycling, sports, physical education, climbing, machinery use, or other activity with risk of another head impact. No same-day return to play. After an emergency condition is excluded, begin 24–48 hours of relative physical and cognitive rest followed by a clinician-guided, gradual return to school and activity. Return to contact/collision activity only after completing a stepwise return-to-play protocol and receiving medical clearance. +5. **Medication:** No new medication is initiated before emergency assessment. Avoid aspirin. Analgesic use should follow emergency-department guidance; acetaminophen is generally preferred initially if the evaluating clinician approves it. +6. **Emergency precautions:** Call 911 immediately for worsening or severe headache, repeated vomiting, increasing drowsiness or difficulty awakening, confusion or unusual behavior, slurred speech, seizure, loss of consciousness, weakness or numbness, unequal pupils, worsening balance, new or worsening vision symptoms, neck pain, or blood/clear fluid from the nose or ears. +7. **Follow-up:** Schedule primary care or concussion follow-up within 24–48 hours after emergency-department discharge. Reassess symptoms, full neurologic and balance examination, vision, blood pressure, and readiness for return to learn/activity. If blurred vision persists after urgent traumatic causes are excluded, arrange optometry/ophthalmology evaluation and replacement of the broken glasses. Provide school accommodations as indicated. +8. **Prevention counseling:** Counsel patient and guardian regarding consistent use of a properly fitted, certified helmet and other protective equipment for skateboarding. + +**Procedures/medications administered in office:** None provided in the encounter summary. + +**Disposition outcome:** The supplied information does not state whether EMS transfer was accepted, which emergency department received the patient, or when/with whom the patient left; these details should be added to the finalized medical record. diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/01d7e53e-0513-4109-a242-8ccaf442cd21/RecFit_Space_Use_and_Program_Agreement_Draft.docx b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/01d7e53e-0513-4109-a242-8ccaf442cd21/RecFit_Space_Use_and_Program_Agreement_Draft.docx new file mode 100644 index 0000000000000000000000000000000000000000..bd791fb9dbb002f5ae2793d58c47d6bea4fa511f Binary files /dev/null and b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/01d7e53e-0513-4109-a242-8ccaf442cd21/RecFit_Space_Use_and_Program_Agreement_Draft.docx differ diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02314fc6-a24e-42f4-a8cd-362cae0f0ec1/Monthly_Safety_Compliance_Checklist.pdf b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02314fc6-a24e-42f4-a8cd-362cae0f0ec1/Monthly_Safety_Compliance_Checklist.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b2dc09ae02ca632b246e4615010ddd90aed1b26e --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02314fc6-a24e-42f4-a8cd-362cae0f0ec1/Monthly_Safety_Compliance_Checklist.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9896c6847435af820e3749b56157a8ced4e09a9346db6e1ebd2182a9967ddf1a +size 612498 diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02314fc6-a24e-42f4-a8cd-362cae0f0ec1/build_safety_checklist.py b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02314fc6-a24e-42f4-a8cd-362cae0f0ec1/build_safety_checklist.py new file mode 100644 index 0000000000000000000000000000000000000000..72a2f21ae817eee83997b848509b2535edbb5dba --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02314fc6-a24e-42f4-a8cd-362cae0f0ec1/build_safety_checklist.py @@ -0,0 +1,1256 @@ +#!/usr/bin/env python3 +"""Build the fillable Monthly Safety Compliance Checklist PDF.""" + +from __future__ import annotations + +from dataclasses import dataclass +from pathlib import Path +from typing import Iterable, Sequence + +from reportlab.lib import colors +from reportlab.lib.pagesizes import letter +from reportlab.pdfbase.pdfmetrics import stringWidth +from reportlab.pdfgen import canvas + + +OUT = Path(__file__).with_name("Monthly_Safety_Compliance_Checklist.pdf") + +PAGE_W, PAGE_H = letter +TOTAL_PAGES = 15 +MARGIN = 32 + +NAVY = colors.HexColor("#17324D") +NAVY_2 = colors.HexColor("#244E6F") +TEAL = colors.HexColor("#087E8B") +TEAL_LIGHT = colors.HexColor("#E7F4F4") +GREEN = colors.HexColor("#2E7D5B") +GREEN_LIGHT = colors.HexColor("#E9F5EF") +ORANGE = colors.HexColor("#D97706") +ORANGE_LIGHT = colors.HexColor("#FFF4E5") +RED = colors.HexColor("#B42318") +RED_LIGHT = colors.HexColor("#FDECEC") +INK = colors.HexColor("#17212B") +MUTED = colors.HexColor("#566573") +LINE = colors.HexColor("#C8D2DA") +LIGHT = colors.HexColor("#F4F7F9") +LIGHT_2 = colors.HexColor("#EAF0F4") +WHITE = colors.white + + +@dataclass(frozen=True) +class Section: + code: str + title: str + purpose: str + items: Sequence[tuple[str, str]] + chunks: Sequence[int] + + +SECTIONS: list[Section] = [ + Section( + "A", + "Parking Lot, Sidewalks & Ramps", + "Exterior walking, driving and accessible routes from the property edge to the entrance.", + [ + ("A01", "Parking, pedestrian and entrance lighting operates; lenses, poles and bases are secure. Verify at dusk/night or from the lighting control/alarm log."), + ("A02", "Pavement is free of hazardous potholes, heaving, large cracks, loose material and abrupt level changes; defects are isolated until repaired."), + ("A03", "Curbs, wheel stops, bollards and protective posts are anchored, visible and free of sharp edges, protruding hardware or impact damage."), + ("A04", "Sidewalks and entrance approaches are clean, dry, unobstructed and free of trip hazards; transitions and expansion joints are sound."), + ("A05", "Ramps, landings and handrails/guardrails are stable, slip resistant and unobstructed; slopes and edge protection meet applicable accessibility requirements."), + ("A06", "Accessible parking spaces, access aisles, signs and striping are visible and available; a continuous accessible route to the entrance is maintained."), + ("A07", "Crosswalks, directional arrows, stop/speed signs and speed-control devices are visible, intact and positioned to guide vehicles and pedestrians safely."), + ("A08", "Cart corrals are anchored and undamaged; loose carts are retrieved often enough to prevent rolling, traffic, accessible-route or emergency-access hazards."), + ("A09", "Drains, grates and utility covers are seated and intact; drainage is clear and standing water or runoff does not create a slip or icing hazard."), + ("A10", "Rain, snow and ice controls are timely and documented; de-icer, plowing, cones and absorbent mats are deployed and monitored as conditions require."), + ("A11", "Oil, spills, litter, broken glass, needles/sharps and other debris are removed using appropriate PPE and disposal procedures; affected areas are isolated meanwhile."), + ("A12", "Landscaping, signs, fencing and site fixtures do not block sight lines, lighting or walkways and present no falling-branch, sharp-edge or pest-harborage hazard."), + ("A13", "Curbside pickup, delivery and loading approaches separate vehicles from pedestrians; barriers, mirrors and markings are intact and staging does not block routes."), + ("A14", "Fire lanes, emergency vehicle routes, hydrants and fire department connections are marked and unobstructed; unauthorized parking is addressed promptly."), + ], + [14], + ), + Section( + "B", + "General Store Conditions", + "Customer, sales-floor and back-of-house physical conditions and fixed equipment.", + [ + ("B01", "Entrance, exit and automatic doors open, close and latch safely; sensors, emergency breakaway features and glass visibility markings are functional."), + ("B02", "Vestibules and floor mats are dry, flat, secured and sized for conditions; curled edges, gaps and saturated mats are corrected immediately."), + ("B03", "Floors and stairs are clean, dry and in good repair; spills, loose tiles, torn carpet, holes and uneven transitions are attended and tracked to repair."), + ("B04", "Spill stations, cones and barricades are available; active spills are guarded continuously until dry, and warning devices are removed when the hazard is gone."), + ("B05", "Shopping aisles, queue lines and routes to exits maintain required width and headroom; stock, displays, cords and equipment do not obstruct travel."), + ("B06", "Shelving and storage racks are anchored, plumb and free of bent uprights, missing beams, damaged connectors or unsafe loads; rated capacities are observed."), + ("B07", "Merchandise, displays and promotional stacks are stable; heavy/bulky goods are placed low or restrained and items do not overhang into travel paths."), + ("B08", "Top stock is stable and within approved height and sprinkler clearances; falling-object controls and approved retrieval equipment are used."), + ("B09", "Endcaps, fixtures, signs, hooks and guardrails are secure and free of sharp edges, pinch points, exposed fasteners and impact damage."), + ("B10", "Lighting is adequate; fixtures and ceiling materials are secure. Roof/plumbing leaks, stained tiles, mold indicators and falling-material hazards are controlled and repaired."), + ("B11", "Plugs, outlets, cords and power strips are approved and undamaged; no exposed wiring, overloaded outlets, daisy chains or extension cords used as permanent wiring."), + ("B12", "Electrical panels, disconnects and shutoffs are labeled, closed and unobstructed for required clearance; unused openings have covers and no storage is inside rooms."), + ("B13", "Customer and employee restrooms are clean, dry and functional; grab bars, dispensers, fixtures and baby-changing stations are secure and leaks are corrected."), + ("B14", "Stockrooms, receiving, offices, breakrooms and trash areas have orderly housekeeping, stable storage and clear walking/working and emergency routes."), + ("B15", "Cooler/freezer floors, doors, gaskets, shelving and lighting are sound; condensation, ice buildup and leaks do not create slip, struck-by or entrapment hazards."), + ("B16", "Carts, baskets, child restraints, checkout fixtures and customer-use equipment are clean, stable and free of sharp edges, broken parts or defective wheels."), + ("B17", "Ladders and step stools are the correct type, inspected, labeled and stored securely; no makeshift climbing devices are present."), + ("B18", "Dock doors, plates, levelers, bumpers, guards and warning systems are serviceable; open dock edges and trailer gaps are protected."), + ("B19", "Balers, compactors and powered doors have effective guards, interlocks, emergency stops and warning signs; keys/access are controlled to authorized staff."), + ("B20", "Elevators, escalators and lifts (if present) have current inspections, clear landings, operating emergency stops/phones and no damaged comb plates or handrails."), + ], + [20], + ), + Section( + "C", + "First Aid & Emergency Procedures", + "Readiness to provide first aid, communicate, evacuate, shelter and report an emergency.", + [ + ("C01", "First-aid kits are visible, accessible and sealed/organized; the documented inventory is complete and sterile supplies and medications are in date."), + ("C02", "Required eyewash/drench equipment is unobstructed, identified and within the hazard-area travel time; activation, flow and inspection records are current."), + ("C03", "AED is accessible and identified; readiness indicator is normal, cabinet alarm works, pads/battery are in date and inspection/trained-responder records are current."), + ("C04", "911, poison control, utilities, security, Store/DM/LP and other emergency contacts are current; phones, radios, paging and panic devices function."), + ("C05", "A current, site-specific Emergency Action Plan covers reporting, evacuation, shelter, accountability, shutdown duties and emergency-service coordination."), + ("C06", "Evacuation maps show accurate routes, exits, 'you are here,' assembly areas and shelter locations; maps are visible to employees and customers as appropriate."), + ("C07", "Emergency coordinators, alternates, first-aid/AED responders and department roles are assigned; employees can explain alarms, reporting and assembly expectations."), + ("C08", "Required fire, evacuation, severe-weather and other drills are completed on schedule; attendance, results and corrective actions are documented."), + ("C09", "Procedures account for employees, visitors and contractors and assist people with disabilities; assembly areas remain safe and accessible."), + ("C10", "Severe-weather, earthquake or other local-hazard procedures identify safe shelter, monitoring, customer movement and all-clear authority; supplies are ready."), + ("C11", "Plans address power/refrigeration loss, gas odor/leak, water interruption, sewage backup and other utility failures, including food protection and closure criteria."), + ("C12", "Bloodborne-pathogen/exposure-control materials are available: PPE, disinfectant, sharps container and spill kit; exposed staff know reporting and evaluation steps."), + ("C13", "Employee injury, customer incident and near-miss procedures preserve the scene/evidence, obtain care, notify leaders and complete required reports promptly."), + ("C14", "Workplace-violence/active-threat, robbery and suspicious-package procedures are current; staff know alarms/code words, escape/shelter choices and when to call 911."), + ], + [14], + ), + Section( + "D", + "Safety & Compliance", + "Core occupational-safety programs, safe work practices and controlled hazardous tasks.", + [ + ("D01", "Open findings from the prior monthly inspection and regulator, LP, insurance or internal audits have owners, due dates, interim controls and verified closure evidence."), + ("D02", "Employees know how to report hazards/near misses and stop unsafe work without retaliation; reports are logged, triaged and communicated through closure."), + ("D03", "New-hire, job-specific and refresher safety training is current; competency is verified before employees perform restricted or hazardous work."), + ("D04", "The PPE hazard assessment is current and required gloves, eye/face, hearing, footwear and other PPE fit, remain serviceable and are consistently used."), + ("D05", "Original and secondary chemical containers have legible product and hazard labels; no unidentified spray bottles, buckets or transferred products are present."), + ("D06", "The written Hazard Communication program, current chemical inventory and Safety Data Sheets match products onsite and are readily accessible on every shift."), + ("D07", "Chemicals are compatible, capped and secured with spill containment; food/customer exposure is prevented and spill kits/PPE match the hazards."), + ("D08", "Lockout/tagout procedures, energy-control devices and authorized/affected employee training cover each serviced machine; annual reviews are current where required."), + ("D09", "Slicers, saws, mixers, grinders, compactors and other machines have guards/interlocks in place; damaged safeguards remove equipment from service."), + ("D10", "Forklift/powered industrial truck and powered pallet-jack operators are authorized; pre-use checks are complete and defects are tagged out and repaired."), + ("D11", "Battery-charging/fueling areas are ventilated, signed and ignition-free; chargers, cables and connectors are sound and required eyewash/PPE/spill control is present."), + ("D12", "Manual-handling limits and safe lifting practices are understood; team lifts, carts, lift tables and other ergonomic aids are available and used."), + ("D13", "Pallets, totes and case stacks are sound, square and stable within approved height/load limits; damaged pallets and falling-object hazards are removed."), + ("D14", "Trailers are secured by restraints/chocks before entry, keys/status are controlled and departure communication prevents drive-away and dock-fall incidents."), + ("D15", "Compressed-gas and propane cylinders are upright, capped as applicable, separated and secured from impact/ignition; cages/signs and exchange procedures are sound."), + ("D16", "Contractors and vendors sign in, receive site rules and isolate work areas; permits, PPE and fire watch are used for hot work and other high-risk tasks."), + ("D17", "Minor-age and task restrictions are enforced for balers, slicers, powered equipment, ladders and other prohibited or limited duties."), + ("D18", "Broken glass, knives and found needles/sharps are isolated, picked up with tools/PPE and placed in approved containers; never handled by bare hand."), + ("D19", "Safety cutters/knives are approved, maintained, carried/stored safely and cut away from the body; employees receive task-specific blade training."), + ("D20", "Employees do not climb racks, pallets, carts or displays; approved elevating equipment and fall protection are used where exposure requires them."), + ], + [20], + ), + Section( + "E", + "Food Safety", + "Controls for receiving, storing, preparing, displaying and disposing of food. Apply the stricter current code or company standard.", + [ + ("E01", "A designated Person in Charge is present as required, demonstrates food-safety knowledge and holds current manager/handler certifications and establishment permits."), + ("E02", "Employee illness reporting agreements are current; symptoms/diagnoses are screened and exclusion/restriction and return-to-work decisions follow code."), + ("E03", "Hand sinks are accessible and used only for handwashing, with running hot/cold water, soap, disposable towels/hand dryer and required signage."), + ("E04", "Hands are washed at required times; gloves/utensils prevent bare-hand contact with ready-to-eat food and are changed between tasks and contamination events."), + ("E05", "Food employees wear clean clothing and effective hair restraints; personal items, drinks, eating, tobacco/vaping and jewelry are controlled in food areas."), + ("E06", "Food is received from approved sources; vehicle/product condition, seals, package integrity, dates and required temperatures are checked and exceptions documented."), + ("E07", "Time/temperature-control-for-safety food is cold held at 41°F/5°C or below (or stricter applicable standard); frozen food remains frozen without thaw/refreeze evidence."), + ("E08", "Hot-held TCS food is maintained at 135°F/57°C or above (or stricter applicable standard); out-of-range product receives documented corrective action."), + ("E09", "Cooking and reheating temperatures/times meet the current Food Code, validated company process or approved plan; required batch records are complete."), + ("E10", "Cooling uses approved time/temperature limits and shallow pans, rapid equipment or other effective methods; start/end temperatures and corrective actions are recorded."), + ("E11", "Any time-as-a-public-health-control process has prior written procedures, clear start/discard time marking and product disposal at the required limit."), + ("E12", "Calibrated, accurate food thermometers with suitable probes are available and sanitized; calibration frequency/results and failed-device actions are documented."), + ("E13", "Refrigeration/hot-unit temperature logs and alarms are complete at required frequency; deviations document product evaluation, disposition and equipment repair."), + ("E14", "Ready-to-eat TCS foods are date marked; FIFO/FEFO rotation, use-by/sell-by controls and end-of-life disposal are accurate throughout storage and display."), + ("E15", "Raw animal foods are separated from ready-to-eat foods and stored by required final cook temperature; covered food and clean utensils prevent cross-contamination."), + ("E16", "Major allergens are identified and controlled through labels, recipes, segregation, changeover/cleaning and accurate customer communication; staff know escalation steps."), + ("E17", "Food, ice and single-service packaging are covered/protected and stored at least 6 in/15 cm off the floor (or per local code), away from splash and contamination."), + ("E18", "Damaged, swollen, leaking, adulterated, expired and recalled goods are promptly identified, segregated in a labeled hold area and disposed/returned with traceable records."), + ("E19", "Food-contact surfaces, slicers, prep tools, produce equipment and ice machines are clean to sight/touch and sanitized at required frequency; test strips verify strength."), + ("E20", "Three-compartment sinks and dish machines have correct wash/rinse/sanitize setup, temperature or concentration, clean storage and air drying; logs are complete."), + ("E21", "Wiping cloths and in-use utensils are held by approved methods; sanitizer containers are labeled, at correct concentration and protected from food contamination."), + ("E22", "Cleaning chemicals, lubricants and pesticides are approved, labeled and stored away from food/packaging; only authorized application and dilution methods are used."), + ("E23", "No live pests, droppings, gnawing or harborage conditions are evident; doors/penetrations are sealed and licensed service reports document device checks and corrections."), + ("E24", "Applicable special-process controls are current: shellstock tags, parasite destruction, consumer advisories, reduced-oxygen packaging, variances, sampling and self-service protection."), + ("E25", "Potable water, hot water, sewage and ice systems are safe and operational; backups/advisories trigger approved food protection, alternate supply and closure decisions."), + ("E26", "Trash, cardboard, grease and organic waste are removed often; containers are leakproof, covered as required and clean, and waste areas do not attract pests or contaminate food."), + ], + [13, 13], + ), + Section( + "F", + "Fire Prevention & Protection", + "Means of egress, detection/suppression systems and control of ignition and fuel sources.", + [ + ("F01", "Required exit doors are identified, unlocked during occupancy and open readily from inside without special knowledge; hardware and exterior discharge paths are clear."), + ("F02", "Exit access, corridors and egress aisles maintain required width/headroom from every area; stock, carts, locks and displays do not delay evacuation."), + ("F03", "Exit signs and emergency lighting are visible, illuminated and unobstructed; required functional tests and battery/power records are current."), + ("F04", "Portable extinguishers are correct for the hazard, mounted, signed, visible and accessible; pins/seals, hoses, gauges and cylinders show ready condition."), + ("F05", "Monthly extinguisher visual checks and annual/periodic professional service are current and documented; discharged, damaged or missing units are replaced promptly."), + ("F06", "Sprinkler heads are unobstructed, undamaged and unpainted; storage maintains at least 18 in/46 cm clearance or the greater applicable requirement."), + ("F07", "Sprinkler risers, control valves and fire pumps are accessible, identified, secured in normal position and professionally inspected/tested on schedule."), + ("F08", "Fire alarm panel shows normal status; pull stations, detectors and notification devices are unobstructed, and inspection/test and impairment records are current."), + ("F09", "Hydrants and fire department connections are identified, capped and accessible; fire department access and required clearance are maintained."), + ("F10", "Cooking hood suppression is armed and in date; nozzles/caps, links and manual pull are accessible and appliances remain in their protected positions."), + ("F11", "Cooking hoods, filters, ducts and surrounding surfaces are free of unsafe grease buildup; professional cleaning and service records meet the required schedule."), + ("F12", "Combustibles, aerosols and flammable liquids remain within allowed quantities and approved cabinets/areas, separated from ignition, heat and electrical equipment."), + ("F13", "Fire/smoke doors self-close and latch and are not propped; rated penetrations are sealed, and heaters/decorations do not compromise exits or suppression systems."), + ("F14", "Hot-work permits/fire watch and fire-system impairment procedures are followed; affected leaders and emergency services are notified and compensating controls documented."), + ], + [14], + ), + Section( + "G", + "Record Keeping & Posters", + "Required postings and auditable evidence that safety and food controls are operating.", + [ + ("G01", "Current OSHA/state-plan, workers' compensation and other required safety/emergency posters are complete, legible and placed where employees can readily view them."), + ("G02", "OSHA 300/301 or state-equivalent records are current where required; certified Form 300A is posted during the required period with privacy cases protected."), + ("G03", "Employee/customer incidents and near misses are timely, factual and investigated; required fatality/severe-injury regulator notices and internal escalations meet deadlines."), + ("G04", "Training records identify topic, date, instructor, attendees and competency/authorization for each role and shift; expired or missing training is scheduled and restricted meanwhile."), + ("G05", "Monthly safety inspections, meeting/communication records and prior corrective-action evidence are retained; overdue items show escalation and effective interim controls."), + ("G06", "Equipment pre-use, preventive-maintenance and certification records are current for lifts, powered trucks, docks, balers, compactors, ladders and other applicable equipment."), + ("G07", "First-aid kit, AED, eyewash and exposure-control inspection/service logs are current; replenishment, failed checks and responder qualifications are documented."), + ("G08", "Fire permits, alarm/sprinkler/extinguisher/hood service, emergency-light tests and drill records are current and available for authority inspection."), + ("G09", "Food receiving, temperature, cooking/cooling, sanitizer, calibration, cleaning and corrective-action logs are complete, legible and reviewed by the Person in Charge."), + ("G10", "Health permits, food-manager certificates, pest-control reports and other regulator/vendor service records are current; cited items have closure evidence."), + ("G11", "Written Hazard Communication and other required safety programs, current SDS files and chemical inventories are accessible and match actual operations."), + ("G12", "Records follow retention and confidentiality rules; controlled procedures show current revision/approval and this checklist has complete GM, DM and LP distribution/review evidence."), + ], + [12], + ), +] + + +def wrap_text(text: str, font: str, size: float, max_width: float) -> list[str]: + words = text.split() + lines: list[str] = [] + current = "" + for word in words: + trial = word if not current else f"{current} {word}" + if stringWidth(trial, font, size) <= max_width: + current = trial + else: + if current: + lines.append(current) + current = word + if current: + lines.append(current) + return lines or [""] + + +def draw_wrapped( + c: canvas.Canvas, + text: str, + x: float, + y: float, + max_width: float, + font: str = "Helvetica", + size: float = 8, + leading: float | None = None, + color=INK, + max_lines: int | None = None, +) -> float: + leading = leading or size * 1.25 + lines = wrap_text(text, font, size, max_width) + if max_lines is not None: + lines = lines[:max_lines] + c.setFont(font, size) + c.setFillColor(color) + for line in lines: + c.drawString(x, y, line) + y -= leading + return y + + +def text_field( + c: canvas.Canvas, + name: str, + x: float, + y: float, + w: float, + h: float, + *, + tooltip: str, + value: str = "", + size: float = 8, + multiline: bool = False, + border_color=LINE, + fill_color=WHITE, + maxlen: int = 500, +) -> None: + c.acroForm.textfield( + name=name, + tooltip=tooltip, + value=value, + x=x, + y=y, + width=w, + height=h, + fontName="Helvetica", + fontSize=size, + textColor=INK, + fillColor=fill_color, + borderColor=border_color, + borderWidth=0.65, + borderStyle="solid", + forceBorder=True, + fieldFlags="multiline" if multiline else "", + maxlen=maxlen, + annotationFlags="print", + ) + + +def radio( + c: canvas.Canvas, + name: str, + value: str, + x: float, + y: float, + *, + tooltip: str, + size: float = 10, + border_color=NAVY_2, + fill_color=WHITE, +) -> None: + c.acroForm.radio( + name=name, + value=value, + selected=False, + x=x, + y=y, + size=size, + buttonStyle="check", + shape="square", + fillColor=fill_color, + borderColor=border_color, + textColor=NAVY, + borderWidth=0.8, + forceBorder=True, + tooltip=tooltip, + fieldFlags="noToggleToOff radio", + annotationFlags="print", + ) + + +def checkbox( + c: canvas.Canvas, + name: str, + x: float, + y: float, + *, + tooltip: str, + size: float = 10, +) -> None: + c.acroForm.checkbox( + name=name, + checked=False, + x=x, + y=y, + size=size, + buttonStyle="check", + shape="square", + fillColor=WHITE, + borderColor=NAVY_2, + textColor=NAVY, + borderWidth=0.8, + forceBorder=True, + tooltip=tooltip, + fieldFlags="", + annotationFlags="print", + ) + + +def label(c: canvas.Canvas, text: str, x: float, y: float, *, size: float = 6.7, color=MUTED) -> None: + c.setFillColor(color) + c.setFont("Helvetica-Bold", size) + c.drawString(x, y, text.upper()) + + +def draw_brand_mark(c: canvas.Canvas, x: float, y: float, scale: float = 1.0, inverse: bool = True) -> None: + stroke = WHITE if inverse else NAVY + accent = colors.HexColor("#5FD0C9") if inverse else TEAL + c.setLineWidth(1.5 * scale) + c.setStrokeColor(stroke) + c.roundRect(x, y, 30 * scale, 34 * scale, 8 * scale, stroke=1, fill=0) + c.setStrokeColor(accent) + c.setLineWidth(2.3 * scale) + c.line(x + 7 * scale, y + 17 * scale, x + 13 * scale, y + 10 * scale) + c.line(x + 13 * scale, y + 10 * scale, x + 24 * scale, y + 24 * scale) + + +def draw_page_header(c: canvas.Canvas, page: int, title: str, kicker: str = "MONTHLY SAFETY") -> None: + c.setFillColor(NAVY) + c.rect(0, PAGE_H - 46, PAGE_W, 46, stroke=0, fill=1) + draw_brand_mark(c, MARGIN, PAGE_H - 40, 0.82, True) + c.setFillColor(colors.HexColor("#8FE3DD")) + c.setFont("Helvetica-Bold", 6.5) + c.drawString(MARGIN + 36, PAGE_H - 17, kicker) + c.setFillColor(WHITE) + c.setFont("Helvetica-Bold", 12.5) + c.drawString(MARGIN + 36, PAGE_H - 33, title) + c.setFont("Helvetica-Bold", 5.2) + c.setFillColor(colors.HexColor("#DDE7EE")) + c.drawString(405, PAGE_H - 16, "STORE #") + c.drawString(493, PAGE_H - 16, "AUDIT MONTH") + text_field(c, f"nav_store_p{page}", 405, PAGE_H - 37, 78, 15, tooltip=f"Store number, page {page}", size=6.2) + text_field(c, f"nav_month_p{page}", 493, PAGE_H - 37, 87, 15, tooltip=f"Audit month, page {page}", size=6.2) + + +def draw_footer(c: canvas.Canvas, page: int) -> None: + c.setStrokeColor(LINE) + c.setLineWidth(0.5) + c.line(MARGIN, 25, PAGE_W - MARGIN, 25) + c.setFont("Helvetica", 6.3) + c.setFillColor(MUTED) + c.drawString(MARGIN, 13, "MSCL-120 • Rev 2026.11 • Complete one packet per store • Retain per company policy") + c.drawRightString(PAGE_W - MARGIN, 13, f"PAGE {page} OF {TOTAL_PAGES}") + + +def rounded_card(c: canvas.Canvas, x: float, y: float, w: float, h: float, fill=WHITE, stroke=LINE, radius: float = 7) -> None: + c.setFillColor(fill) + c.setStrokeColor(stroke) + c.setLineWidth(0.7) + c.roundRect(x, y, w, h, radius, stroke=1, fill=1) + + +def draw_cover(c: canvas.Canvas, page: int) -> None: + c.bookmarkPage("cover") + c.addOutlineEntry("Cover & store information", "cover", level=0) + c.setFillColor(NAVY) + c.rect(0, PAGE_H - 174, PAGE_W, 174, stroke=0, fill=1) + c.setFillColor(NAVY_2) + c.circle(PAGE_W - 45, PAGE_H - 12, 118, stroke=0, fill=1) + draw_brand_mark(c, MARGIN, PAGE_H - 91, 1.55, True) + c.setFillColor(colors.HexColor("#8FE3DD")) + c.setFont("Helvetica-Bold", 8.5) + c.drawString(MARGIN + 58, PAGE_H - 52, "STORE OPERATIONS • CONTROLLED MONTHLY MASTER") + c.setFillColor(WHITE) + c.setFont("Helvetica-Bold", 25) + c.drawString(MARGIN + 58, PAGE_H - 81, "MONTHLY SAFETY") + c.drawString(MARGIN + 58, PAGE_H - 111, "COMPLIANCE CHECKLIST") + c.setFont("Helvetica", 9.2) + c.setFillColor(colors.HexColor("#D9E6EE")) + c.drawString(MARGIN + 58, PAGE_H - 132, "GENERAL MERCHANDISE • FRESH FOODS • GROCERY") + c.setFont("Helvetica-Bold", 7) + c.drawRightString(PAGE_W - MARGIN, PAGE_H - 154, "120 CONTROLS | 7 SAFETY AREAS | 1 MONTHLY RECORD") + + y = PAGE_H - 194 + rounded_card(c, MARGIN, y - 179, PAGE_W - 2 * MARGIN, 174, LIGHT) + c.setFont("Helvetica-Bold", 10.5) + c.setFillColor(NAVY) + c.drawString(MARGIN + 14, y - 20, "STORE & AUDIT INFORMATION") + + x1 = MARGIN + 14 + x2 = MARGIN + 276 + row_y = y - 47 + label(c, "Store name", x1, row_y + 17) + text_field(c, "cover_store_name", x1, row_y - 3, 248, 18, tooltip="Store name") + label(c, "Store number", x2, row_y + 17) + text_field(c, "cover_store_number", x2, row_y - 3, 105, 18, tooltip="Store number") + label(c, "District / region", x2 + 119, row_y + 17) + text_field(c, "cover_district", x2 + 119, row_y - 3, 119, 18, tooltip="District or region") + + row_y -= 42 + label(c, "Street address / city / state", x1, row_y + 17) + text_field(c, "cover_address", x1, row_y - 3, 367, 18, tooltip="Store street address, city and state") + label(c, "Audit month (YYYY-MM)", x1 + 381, row_y + 17) + text_field(c, "cover_audit_month", x1 + 381, row_y - 3, 119, 18, tooltip="Audit month in YYYY-MM format") + + row_y -= 42 + label(c, "Safety Coordinator / auditor", x1, row_y + 17) + text_field(c, "cover_auditor", x1, row_y - 3, 195, 18, tooltip="Safety Coordinator or auditor name") + label(c, "Store Manager", x1 + 209, row_y + 17) + text_field(c, "cover_manager", x1 + 209, row_y - 3, 158, 18, tooltip="Store Manager name") + label(c, "Audit date / time", x1 + 381, row_y + 17) + text_field(c, "cover_audit_datetime", x1 + 381, row_y - 3, 119, 18, tooltip="Audit date and time") + + row_y -= 42 + label(c, "Exterior weather / surface conditions", x1, row_y + 17) + text_field(c, "cover_weather", x1, row_y - 3, 248, 18, tooltip="Weather and exterior surface conditions") + label(c, "Accompanying leader(s)", x2, row_y + 17) + text_field(c, "cover_accompanying", x2, row_y - 3, 238, 18, tooltip="Leaders accompanying the inspection") + + workflow_y = 281 + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 10.5) + c.drawString(MARGIN, workflow_y + 91, "MONTHLY WORKFLOW") + box_w = 96 + gap = 8 + steps = [ + ("01", "INSPECT", "Observe all 120 controls"), + ("02", "CLASSIFY", "Mark C, NC or N/A"), + ("03", "COUNT", "Total missed items"), + ("04", "CORRECT", "Control hazards & assign"), + ("05", "SUBMIT", "GM • DM • LP review"), + ] + for i, (num, head, body) in enumerate(steps): + bx = MARGIN + i * (box_w + gap) + rounded_card(c, bx, workflow_y + 4, box_w, 70, WHITE, LINE, 6) + c.setFillColor(TEAL) + c.circle(bx + 15, workflow_y + 57, 9, stroke=0, fill=1) + c.setFillColor(WHITE) + c.setFont("Helvetica-Bold", 6.5) + c.drawCentredString(bx + 15, workflow_y + 55, num) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 7.5) + c.drawString(bx + 29, workflow_y + 55, head) + draw_wrapped(c, body, bx + 9, workflow_y + 36, box_w - 18, size=7.1, leading=8.7, color=MUTED) + if i < len(steps) - 1: + ax = bx + box_w + 1 + c.setStrokeColor(TEAL) + c.setLineWidth(1.1) + c.line(ax, workflow_y + 39, ax + 6, workflow_y + 39) + c.line(ax + 4, workflow_y + 42, ax + 7, workflow_y + 39) + c.line(ax + 4, workflow_y + 36, ax + 7, workflow_y + 39) + + score_y = 174 + rounded_card(c, MARGIN, score_y, 259, 88, GREEN_LIGHT, colors.HexColor("#9AC9B3"), 7) + c.setFillColor(GREEN) + c.setFont("Helvetica-Bold", 15) + c.drawString(MARGIN + 14, score_y + 57, "0–10 MISSED ITEMS") + c.setFont("Helvetica-Bold", 9) + c.drawString(MARGIN + 14, score_y + 38, "MEETS THE MONTHLY THRESHOLD") + draw_wrapped(c, "Correct every finding and track it to verified closure.", MARGIN + 14, score_y + 22, 228, size=7.5, color=INK) + + rounded_card(c, MARGIN + 271, score_y, 277, 88, ORANGE_LIGHT, colors.HexColor("#E9B66D"), 7) + c.setFillColor(RED) + c.setFont("Helvetica-Bold", 15) + c.drawString(MARGIN + 285, score_y + 57, "11+ MISSED ITEMS") + c.setFont("Helvetica-Bold", 9) + c.drawString(MARGIN + 285, score_y + 38, "DETAILED CAP REQUIRED") + draw_wrapped(c, "Submit to the DM; DM follows up and verifies completion. Copy GM and LP.", MARGIN + 285, score_y + 22, 248, size=7.5, color=INK) + + rounded_card(c, MARGIN, 74, PAGE_W - 2 * MARGIN, 78, RED_LIGHT, colors.HexColor("#E3A5A0"), 7) + c.setFillColor(RED) + c.setFont("Helvetica-Bold", 9.5) + c.drawString(MARGIN + 14, 131, "IMMEDIATE-DANGER OVERRIDE") + draw_wrapped( + c, + "Do not wait for the final score. Stop, isolate or remove any imminent hazard; protect food and people; call emergency services when warranted; and escalate fire-system impairment, blocked egress, electrical/gas danger, serious injury or food-safety risk under company and legal procedures.", + MARGIN + 14, + 114, + PAGE_W - 2 * MARGIN - 28, + size=8.1, + leading=10.2, + color=INK, + ) + draw_footer(c, page) + c.showPage() + + +def draw_instructions(c: canvas.Canvas, page: int) -> None: + c.bookmarkPage("instructions") + c.addOutlineEntry("Instructions, scoring & responsibilities", "instructions", level=0) + draw_page_header(c, page, "How to Use, Score & Escalate") + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 16) + c.drawString(MARGIN, 720, "One status for every item. Evidence before assumption.") + draw_wrapped(c, "Use this packet once each month and after a major incident, remodel or significant operational change when directed.", MARGIN, 701, 548, size=8.4, color=MUTED) + + left_x, right_x = MARGIN, 314 + col_w = 266 + rounded_card(c, left_x, 470, col_w, 205, WHITE) + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 9.5) + c.drawString(left_x + 14, 655, "INSPECTION METHOD") + method = [ + ("1", "Prepare", "Enter store/audit details; review open actions, incidents and service records."), + ("2", "Observe", "Walk exterior, sales floor, backroom and food/fire areas; test or sample where safe."), + ("3", "Verify", "Review current records and ask employees to demonstrate knowledge or safe practice."), + ("4", "Control", "Guard, remove, shut down or otherwise control active hazards immediately."), + ("5", "Close", "Score, assign every NC, submit the packet and verify lasting completion."), + ] + my = 630 + for num, head, body in method: + c.setFillColor(TEAL_LIGHT) + c.circle(left_x + 23, my + 2, 10, stroke=0, fill=1) + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 7) + c.drawCentredString(left_x + 23, my, num) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 8) + c.drawString(left_x + 41, my + 5, head.upper()) + draw_wrapped(c, body, left_x + 41, my - 6, 205, size=7.3, leading=8.8, color=INK) + my -= 36 + + rounded_card(c, right_x, 470, col_w, 205, LIGHT) + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 9.5) + c.drawString(right_x + 14, 655, "STATUS DEFINITIONS") + status_blocks = [ + (GREEN, GREEN_LIGHT, "C • COMPLIANT", "Fully met at inspection and required evidence is current."), + (RED, RED_LIGHT, "NC • NON-COMPLIANT", "Deficient, missing, inaccessible, expired, unsafe or not verified. Each NC—and any blank at closeout—is one missed item."), + (MUTED, LIGHT_2, "N/A • NOT APPLICABLE", "The activity/equipment is genuinely absent. Briefly explain in the finding/reference field."), + ] + sy = 620 + for accent, fill, head, body in status_blocks: + c.setFillColor(fill) + c.roundRect(right_x + 14, sy - 37, col_w - 28, 48, 5, stroke=0, fill=1) + c.setFillColor(accent) + c.rect(right_x + 14, sy - 37, 4, 48, stroke=0, fill=1) + c.setFont("Helvetica-Bold", 7.8) + c.drawString(right_x + 27, sy - 3, head) + draw_wrapped(c, body, right_x + 27, sy - 16, col_w - 54, size=7.1, leading=8.4, color=INK) + sy -= 57 + rounded_card(c, MARGIN, 355, PAGE_W - 2 * MARGIN, 94, NAVY, NAVY) + c.setFillColor(colors.HexColor("#8FE3DD")) + c.setFont("Helvetica-Bold", 9) + c.drawString(MARGIN + 15, 430, "SCORING RULE") + c.setFillColor(WHITE) + c.setFont("Helvetica-Bold", 10) + c.drawString(MARGIN + 15, 405, "APPLICABLE = 120 − N/A") + c.drawString(MARGIN + 204, 405, "MISS COUNT = TOTAL NC") + c.drawString(MARGIN + 389, 405, "SCORE = C ÷ APPLICABLE × 100") + c.setFont("Helvetica", 7.6) + c.setFillColor(colors.HexColor("#DDE7EE")) + c.drawString(MARGIN + 15, 381, "The policy trigger is the total NC count, not the percentage. N/A does not excuse a condition that exists but cannot be verified.") + c.setFillColor(colors.HexColor("#8FE3DD")) + c.setFont("Helvetica-Bold", 8) + c.drawString(MARGIN + 15, 365, "0–10 NC: THRESHOLD MET • 11+ NC: TARGETED IMPROVEMENT + DETAILED CAP TO DM • ALL NC: CORRECT AND VERIFY") + + rounded_card(c, MARGIN, 200, 352, 137, WHITE) + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 9.5) + c.drawString(MARGIN + 14, 317, "ACCOUNTABILITY") + responsibilities = [ + ("Safety Coordinator", "Inspect, document, score, assign and submit the monthly packet to GM, DM and LP."), + ("Store Manager", "Control hazards, provide owners/resources, certify accuracy and drive all actions to closure."), + ("District Manager", "Review every packet; when NC >10, follow up and verify the submitted CAP is completed."), + ("GM & Loss Prevention", "Review results/trends, support escalation and challenge overdue or repeat conditions."), + ] + ry = 296 + for role, duty in responsibilities: + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 7.4) + c.drawString(MARGIN + 14, ry, role) + draw_wrapped(c, duty, MARGIN + 105, ry, 225, size=7.1, leading=8.3, color=INK) + ry -= 28 + + rounded_card(c, 396, 200, 184, 137, ORANGE_LIGHT, colors.HexColor("#E9B66D")) + c.setFillColor(ORANGE) + c.setFont("Helvetica-Bold", 9.5) + c.drawString(410, 317, "REQUIRED TIMING") + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 7.4) + c.drawString(410, 294, "Immediate") + draw_wrapped(c, "Control imminent danger and make required notifications.", 410, 282, 153, size=7.1, leading=8.3, color=INK) + c.setFont("Helvetica-Bold", 7.4) + c.setFillColor(NAVY) + c.drawString(410, 253, "After audit") + draw_wrapped(c, "Enter the company/local submission and action deadlines on the scorecard and CAP.", 410, 241, 153, size=7.1, leading=8.3, color=INK) + c.setFont("Helvetica-Bold", 7.4) + c.setFillColor(NAVY) + c.drawString(410, 223, "No silent carryover") + draw_wrapped(c, "Escalate overdue/repeat items; keep interim controls documented.", 410, 211, 153, size=7.1, leading=8.1, color=INK) + + rounded_card(c, MARGIN, 56, PAGE_W - 2 * MARGIN, 122, LIGHT) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 9) + c.drawString(MARGIN + 14, 158, "SCOPE, LOCAL REQUIREMENTS & SAFE VERIFICATION") + scope = ( + "This checklist is a management control, not a substitute for current law, fire/health code, manufacturer instructions or company policy. " + "Apply the stricter requirement and add site-specific items when needed. Do not create exposure to test a control: use records or a qualified service provider for live electrical, fire-system, roof, confined-space or other specialist work. " + "Record only what was observed or verified. Attach photographs, work orders, logs or service reports when they materially support a finding or closure." + ) + draw_wrapped(c, scope, MARGIN + 14, 140, PAGE_W - 2 * MARGIN - 28, size=7.6, leading=9.5, color=INK) + c.setFillColor(RED) + c.setFont("Helvetica-Bold", 7.5) + c.drawString(MARGIN + 14, 71, "A SCORE NEVER OVERRIDES THE DUTY TO PROTECT PEOPLE, FOOD AND PROPERTY NOW.") + draw_footer(c, page) + c.showPage() + + +def header_context_fields(c: canvas.Canvas, page: int) -> None: + """Legacy no-op: page context fields are rendered inside the navy header.""" + return None + + +def draw_section_summary(c: canvas.Canvas, section: Section, y: float) -> None: + x = MARGIN + w = PAGE_W - 2 * MARGIN + h = 74 + rounded_card(c, x, y, w, h, LIGHT) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 8.5) + c.drawString(x + 12, y + 57, f"SECTION {section.code} CLOSEOUT • TRANSFER TOTALS TO THE FINAL SCORECARD") + fields = [ + ("Items", str(len(section.items)), 48), + ("C", "", 48), + ("NC / missed", "", 64), + ("N/A", "", 48), + ("Applicable", "", 63), + ("Score %", "", 58), + ("Reviewer initials", "", 80), + ] + fx = x + 12 + for title, value, fw in fields: + label(c, title, fx, y + 39, size=5.8) + text_field( + c, + f"section_{section.code}_{title.lower().replace(' ', '_').replace('/', '')}", + fx, + y + 15, + fw, + 19, + tooltip=f"Section {section.code} {title}", + value=value, + size=8, + fill_color=WHITE, + ) + fx += fw + 10 + c.setFillColor(MUTED) + c.setFont("Helvetica-Oblique", 6.4) + c.drawRightString(x + w - 12, y + 5, "Applicable = items − N/A • Score = C ÷ applicable × 100 • Every NC requires an action reference") + + +def draw_checklist_page( + c: canvas.Canvas, + page: int, + section: Section, + items: Sequence[tuple[str, str]], + part: int, + parts: int, + final_part: bool, +) -> None: + key = f"section_{section.code}" if part == 1 else f"section_{section.code}_{part}" + c.bookmarkPage(key) + if part == 1: + c.addOutlineEntry(f"{section.code}. {section.title}", key, level=0) + draw_page_header(c, page, f"{section.code}. {section.title}", "INSPECTION CHECKLIST") + header_context_fields(c, page) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 15) + suffix = "" if part == 1 else " • CONTINUED" + c.drawString(MARGIN, 720, f"{section.code}. {section.title}{suffix}") + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 7) + c.drawRightString(PAGE_W - MARGIN, 691, f"PART {part} OF {parts} • {len(section.items)} SECTION ITEMS") + draw_wrapped(c, section.purpose, MARGIN, 699, 435, size=7.5, leading=9, color=MUTED, max_lines=2) + + x0 = MARGIN + widths = [31, 291, 29, 31, 32, 133] + xs = [x0] + for width in widths: + xs.append(xs[-1] + width) + table_top = 674 + head_h = 25 + c.setFillColor(NAVY) + c.rect(x0, table_top - head_h, sum(widths), head_h, stroke=0, fill=1) + headers = ["ID", "VERIFICATION CRITERION", "C", "NC", "N/A", "FINDING / ACTION ID"] + for i, head in enumerate(headers): + c.setFillColor(colors.HexColor("#8FE3DD") if head in {"C", "NC", "N/A"} else WHITE) + c.setFont("Helvetica-Bold", 6.3 if head != "VERIFICATION CRITERION" else 6.7) + if i in (0, 2, 3, 4): + c.drawCentredString(xs[i] + widths[i] / 2, table_top - 16, head) + else: + c.drawString(xs[i] + 6, table_top - 16, head) + c.setFont("Helvetica", 5.5) + c.setFillColor(colors.HexColor("#DDE7EE")) + c.drawRightString(xs[6] - 5, table_top - 23, "Short note or action-register reference") + + y = table_top - head_h + criterion_font = 7.15 + criterion_leading = 8.65 + for idx, (item_id, text) in enumerate(items): + lines = wrap_text(text, "Helvetica", criterion_font, widths[1] - 12) + row_h = max(26, len(lines) * criterion_leading + 8) + if y - row_h < (111 if final_part else 37): + raise RuntimeError(f"Checklist rows do not fit: section {section.code}, page {part}, item {item_id}") + fill = WHITE if idx % 2 == 0 else LIGHT + c.setFillColor(fill) + c.rect(x0, y - row_h, sum(widths), row_h, stroke=0, fill=1) + c.setFillColor(GREEN_LIGHT) + c.rect(xs[2], y - row_h, widths[2], row_h, stroke=0, fill=1) + c.setFillColor(RED_LIGHT) + c.rect(xs[3], y - row_h, widths[3], row_h, stroke=0, fill=1) + c.setFillColor(LIGHT_2) + c.rect(xs[4], y - row_h, widths[4], row_h, stroke=0, fill=1) + c.setStrokeColor(LINE) + c.setLineWidth(0.45) + c.rect(x0, y - row_h, sum(widths), row_h, stroke=1, fill=0) + for xx in xs[1:-1]: + c.line(xx, y - row_h, xx, y) + + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 7.1) + c.drawCentredString(xs[0] + widths[0] / 2, y - row_h / 2 - 2.3, item_id) + ty = y - 9 + c.setFont("Helvetica", criterion_font) + c.setFillColor(INK) + for line in lines: + c.drawString(xs[1] + 6, ty, line) + ty -= criterion_leading + + radio_y = y - row_h / 2 - 5 + group_name = f"status_{item_id}" + radio(c, group_name, "C", xs[2] + (widths[2] - 10) / 2, radio_y, tooltip=f"{item_id} Compliant") + radio(c, group_name, "NC", xs[3] + (widths[3] - 10) / 2, radio_y, tooltip=f"{item_id} Non-compliant") + radio(c, group_name, "NA", xs[4] + (widths[4] - 10) / 2, radio_y, tooltip=f"{item_id} Not applicable") + field_h = min(18, row_h - 8) + text_field( + c, + f"finding_{item_id}", + xs[5] + 5, + y - row_h / 2 - field_h / 2, + widths[5] - 10, + field_h, + tooltip=f"{item_id} finding note or corrective action reference", + size=6.8, + fill_color=WHITE, + maxlen=90, + ) + y -= row_h + + notes_bottom = 116 if final_part else 81 + notes_height = y - notes_bottom - 25 + if notes_height >= 34: + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 6.7) + c.drawString(MARGIN, y - 13, "PAGE NOTES • IMMEDIATE CONTROLS • EVIDENCE / ATTACHMENT REFERENCES") + text_field( + c, + f"page_notes_{page}", + MARGIN, + notes_bottom, + PAGE_W - 2 * MARGIN, + notes_height, + tooltip=f"Page {page} notes, immediate controls, and evidence or attachment references", + size=7.1, + multiline=True, + fill_color=LIGHT, + ) + + if final_part: + draw_section_summary(c, section, 34) + else: + c.setFillColor(ORANGE_LIGHT) + c.setStrokeColor(colors.HexColor("#E9B66D")) + c.roundRect(MARGIN, 37, PAGE_W - 2 * MARGIN, 36, 5, stroke=1, fill=1) + c.setFillColor(ORANGE) + c.setFont("Helvetica-Bold", 7) + c.drawString(MARGIN + 10, 59, "CONTINUE TO NEXT PAGE") + c.setFillColor(INK) + c.setFont("Helvetica", 6.8) + c.drawString(MARGIN + 10, 46, "Do not total this section until every item has one status and each NC has an action reference.") + draw_footer(c, page) + c.showPage() + + +def draw_scorecard(c: canvas.Canvas, page: int) -> None: + c.bookmarkPage("scorecard") + c.addOutlineEntry("Final scorecard & threshold decision", "scorecard", level=0) + draw_page_header(c, page, "Final Scorecard & Threshold Decision", "SCORING & FOLLOW-UP") + header_context_fields(c, page) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 15) + c.drawString(MARGIN, 720, "Reconcile all seven sections before choosing the outcome.") + draw_wrapped(c, "Enter the section closeout totals. The total NC count controls the required CAP decision.", MARGIN, 700, 500, size=7.8, color=MUTED) + + x0 = MARGIN + widths = [190, 43, 45, 45, 45, 58, 58, 64] + xs = [x0] + for w in widths: + xs.append(xs[-1] + w) + top = 666 + head_h = 36 + c.setFillColor(NAVY) + c.rect(x0, top - head_h, sum(widths), head_h, stroke=0, fill=1) + heads = ["SAFETY AREA", "ITEMS", "C", "NC", "N/A", "APPLIC.", "SCORE %", "FOCUS FLAG"] + for i, head in enumerate(heads): + c.setFillColor(WHITE if i < 2 else colors.HexColor("#8FE3DD")) + c.setFont("Helvetica-Bold", 6.2) + if i == 0: + c.drawString(xs[i] + 7, top - 22, head) + else: + c.drawCentredString(xs[i] + widths[i] / 2, top - 22, head) + rows = [(s.code, s.title, len(s.items)) for s in SECTIONS] + row_h = 38 + y = top - head_h + for ri, (code, title, count) in enumerate(rows): + c.setFillColor(WHITE if ri % 2 == 0 else LIGHT) + c.rect(x0, y - row_h, sum(widths), row_h, stroke=0, fill=1) + c.setStrokeColor(LINE) + c.setLineWidth(0.5) + c.rect(x0, y - row_h, sum(widths), row_h, stroke=1, fill=0) + for xx in xs[1:-1]: + c.line(xx, y - row_h, xx, y) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 7.6) + c.drawString(xs[0] + 7, y - 15, f"{code}. {title}") + c.setFont("Helvetica", 6.3) + c.setFillColor(MUTED) + c.drawString(xs[0] + 7, y - 27, "Flag every area with NC for targeted correction/trending.") + vals = [str(count), "", "", "", "", "", ""] + names = ["items", "c", "nc", "na", "applicable", "score", "focus"] + for j in range(1, len(widths)): + text_field( + c, + f"score_{code}_{names[j-1]}", + xs[j] + 5, + y - row_h + 8, + widths[j] - 10, + 21, + tooltip=f"Section {code} {heads[j]}", + value=vals[j-1], + size=7.4, + fill_color=WHITE, + ) + y -= row_h + + total_h = 42 + c.setFillColor(NAVY) + c.rect(x0, y - total_h, sum(widths), total_h, stroke=0, fill=1) + c.setFillColor(WHITE) + c.setFont("Helvetica-Bold", 8) + c.drawString(x0 + 7, y - 25, "TOTAL / OVERALL") + total_vals = ["120", "", "", "", "", "", ""] + total_names = ["items", "c", "nc", "na", "applicable", "score", "focus"] + for j in range(1, len(widths)): + text_field( + c, + f"score_total_{total_names[j-1]}", + xs[j] + 5, + y - total_h + 9, + widths[j] - 10, + 22, + tooltip=f"Overall {heads[j]}", + value=total_vals[j-1], + size=7.5, + fill_color=WHITE, + border_color=colors.HexColor("#8FE3DD"), + ) + y -= total_h + + decision_y = 215 + rounded_card(c, MARGIN, decision_y, PAGE_W - 2 * MARGIN, 115, LIGHT) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 9.5) + c.drawString(MARGIN + 14, decision_y + 94, "REQUIRED OUTCOME DECISION") + radio(c, "overall_threshold_outcome", "MEETS", MARGIN + 16, decision_y + 62, tooltip="Overall outcome: 0 to 10 missed items") + c.setFillColor(GREEN) + c.setFont("Helvetica-Bold", 8.5) + c.drawString(MARGIN + 32, decision_y + 65, "0–10 NC • MONTHLY THRESHOLD MET") + c.setFillColor(INK) + c.setFont("Helvetica", 7) + c.drawString(MARGIN + 32, decision_y + 51, "Correct and verify every NC; no detailed threshold CAP is required solely by score.") + + radio(c, "overall_threshold_outcome", "CAP_REQUIRED", MARGIN + 286, decision_y + 62, tooltip="Overall outcome: 11 or more missed items, corrective action plan required") + c.setFillColor(RED) + c.setFont("Helvetica-Bold", 8.5) + c.drawString(MARGIN + 302, decision_y + 65, "11+ NC • DETAILED CAP REQUIRED") + c.setFillColor(INK) + c.setFont("Helvetica", 7) + c.drawString(MARGIN + 302, decision_y + 51, "Submit to DM; copy GM/LP. DM follows up and verifies completion.") + + fields = [ + ("Total NC", "decision_total_nc", 52), + ("CAP due", "decision_cap_due", 73), + ("DM follow-up", "decision_dm_followup", 78), + ("Next review", "decision_next_review", 73), + ("Open actions", "decision_open_actions", 64), + ] + fx = MARGIN + 14 + for title, name, fw in fields: + label(c, title, fx, decision_y + 31, size=5.8) + text_field(c, name, fx, decision_y + 8, fw, 19, tooltip=title, size=7.2) + fx += fw + 18 + + rounded_card(c, MARGIN, 83, 335, 119, WHITE) + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 8.5) + c.drawString(MARGIN + 12, 181, "TARGETED IMPROVEMENT AREAS / REPEAT CONDITIONS") + text_field(c, "score_target_areas", MARGIN + 12, 97, 311, 72, tooltip="Areas with non-compliance, below local thresholds, repeat conditions, or trend concerns", size=7.2, multiline=True) + c.setFillColor(MUTED) + c.setFont("Helvetica-Oblique", 6.3) + c.drawString(MARGIN + 12, 87, "List sections with NC, any local section-threshold miss, and repeat/overdue patterns.") + + rounded_card(c, 379, 83, 201, 119, ORANGE_LIGHT, colors.HexColor("#E9B66D")) + c.setFillColor(ORANGE) + c.setFont("Helvetica-Bold", 8.5) + c.drawString(391, 181, "RECONCILIATION CHECK") + checks = [ + ("recon_all_status", "All 120 items have a status"), + ("recon_counts", "C + NC + N/A = 120"), + ("recon_actions", "Every NC has an action ID"), + ("recon_attachments", "Evidence/attachments indexed"), + ] + cy = 155 + for name, wording in checks: + checkbox(c, name, 392, cy - 3, tooltip=wording, size=9) + c.setFillColor(INK) + c.setFont("Helvetica", 6.9) + c.drawString(407, cy, wording) + cy -= 20 + draw_footer(c, page) + c.showPage() + + +def draw_action_register_page(c: canvas.Canvas, page: int, start_no: int, end_no: int, part: int) -> None: + key = f"action_register_{part}" + c.bookmarkPage(key) + if part == 1: + c.addOutlineEntry("Corrective action register", key, level=0) + draw_page_header(c, page, f"Corrective Action Register • {start_no:02d}–{end_no:02d}", "SCORING & FOLLOW-UP") + header_context_fields(c, page) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 15) + c.drawString(MARGIN, 720, "Assign, control, complete and independently verify.") + draw_wrapped(c, "Use one card per action; link all relevant checklist IDs. Duplicate this page if more actions are needed.", MARGIN, 700, 500, size=7.8, color=MUTED) + + y = 682 + card_h = 101 + for action_no in range(start_no, end_no + 1): + y -= card_h + rounded_card(c, MARGIN, y, PAGE_W - 2 * MARGIN, card_h - 6, WHITE) + c.setFillColor(NAVY) + c.roundRect(MARGIN, y + card_h - 31, 42, 25, 6, stroke=0, fill=1) + c.setFillColor(WHITE) + c.setFont("Helvetica-Bold", 8) + c.drawCentredString(MARGIN + 21, y + card_h - 22, f"CA-{action_no:02d}") + + top_y = y + card_h - 27 + header_fields = [ + ("Item ID(s)", f"ca_{action_no}_items", 72), + ("Priority", f"ca_{action_no}_priority", 53), + ("Owner", f"ca_{action_no}_owner", 94), + ("Due date", f"ca_{action_no}_due", 67), + ("Status", f"ca_{action_no}_status", 67), + ("Verified by / date", f"ca_{action_no}_verify", 103), + ] + fx = MARGIN + 50 + for title, name, fw in header_fields: + label(c, title, fx, top_y + 14, size=5.2) + text_field(c, name, fx, top_y - 5, fw, 16, tooltip=f"Corrective action {action_no}: {title}", size=6.5) + fx += fw + 5 + + label(c, "Finding & immediate control", MARGIN + 10, y + 51, size=5.4) + text_field(c, f"ca_{action_no}_finding", MARGIN + 10, y + 32, 240, 17, tooltip=f"Corrective action {action_no}: finding and immediate control", size=6.4) + label(c, "Corrective action / completion evidence", MARGIN + 260, y + 51, size=5.4) + text_field(c, f"ca_{action_no}_action", MARGIN + 260, y + 32, 278, 17, tooltip=f"Corrective action {action_no}: corrective action and completion evidence", size=6.4) + + label(c, "Root cause / recurrence control", MARGIN + 10, y + 24, size=5.4) + text_field(c, f"ca_{action_no}_root", MARGIN + 10, y + 6, 240, 16, tooltip=f"Corrective action {action_no}: root cause or recurrence control", size=6.4) + label(c, "Completion date / work order / attachment", MARGIN + 260, y + 24, size=5.4) + text_field(c, f"ca_{action_no}_evidence", MARGIN + 260, y + 6, 278, 16, tooltip=f"Corrective action {action_no}: completion date, work order or attachment", size=6.4) + y -= 5 + draw_footer(c, page) + c.showPage() + + +def draw_cap(c: canvas.Canvas, page: int) -> None: + c.bookmarkPage("detailed_cap") + c.addOutlineEntry("Detailed CAP (required at 11+ NC)", "detailed_cap", level=0) + draw_page_header(c, page, "Detailed Corrective Action Plan", "REQUIRED WHEN TOTAL NC IS 11+") + header_context_fields(c, page) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 15) + c.drawString(MARGIN, 720, "Target the system causes—not only the visible defects.") + c.setFillColor(RED) + c.setFont("Helvetica-Bold", 7.5) + c.drawString(MARGIN, 697, "REQUIRED FOR 11+ MISSED ITEMS • SUBMIT TO DM • COPY GM & LP • DM VERIFIES COMPLETION") + + rounded_card(c, MARGIN, 626, PAGE_W - 2 * MARGIN, 55, LIGHT) + top_fields = [ + ("Total NC", "cap_total_nc", 55), + ("Prepared date", "cap_prepared_date", 80), + ("Submit due", "cap_submit_due", 76), + ("DM follow-up due", "cap_dm_due", 94), + ("Target closure", "cap_target_close", 83), + ("CAP owner", "cap_owner", 91), + ] + fx = MARGIN + 10 + for title, name, fw in top_fields: + label(c, title, fx, 662, size=5.3) + text_field(c, name, fx, 636, fw, 21, tooltip=title, size=6.8) + fx += fw + 6 + + blocks = [ + ("1 PROBLEM STATEMENT & PATTERN", "cap_problem", "Summarize affected areas, repeat/overdue conditions, incidents or trends and business impact.", 550, 62), + ("2 ROOT CAUSE ANALYSIS", "cap_root_cause", "Identify contributing management-system, process, people, equipment, vendor and environmental causes. State evidence, not blame.", 466, 62), + ("3 IMMEDIATE CONTAINMENT", "cap_containment", "Describe controls already in place, who confirmed them and when; include shutdown/food disposition/escalation where relevant.", 382, 62), + ("4 CORRECTIVE & PREVENTIVE ACTIONS", "cap_actions", "Reference CA IDs; include repair/process/training/resource changes, responsible owners, milestones and completion measures.", 286, 74), + ("5 EFFECTIVENESS & SUSTAINMENT", "cap_effectiveness", "Define evidence, inspection/metric cadence, sample size, success criteria, verification owner and response if the fix fails.", 190, 74), + ] + for title, name, prompt, y, h in blocks: + rounded_card(c, MARGIN, y, PAGE_W - 2 * MARGIN, h, WHITE) + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 7.6) + c.drawString(MARGIN + 10, y + h - 15, title) + c.setFillColor(MUTED) + c.setFont("Helvetica-Oblique", 6.2) + c.drawString(MARGIN + 10, y + h - 28, prompt) + text_field(c, name, MARGIN + 10, y + 7, PAGE_W - 2 * MARGIN - 20, h - 38, tooltip=title, size=7, multiline=True) + + rounded_card(c, MARGIN, 71, PAGE_W - 2 * MARGIN, 99, ORANGE_LIGHT, colors.HexColor("#E9B66D")) + c.setFillColor(ORANGE) + c.setFont("Helvetica-Bold", 8) + c.drawString(MARGIN + 10, 151, "DISTRICT MANAGER REVIEW & VERIFICATION") + radio(c, "cap_dm_decision", "ACCEPTED", MARGIN + 11, 125, tooltip="District Manager accepts the CAP") + c.setFillColor(INK) + c.setFont("Helvetica-Bold", 7) + c.drawString(MARGIN + 27, 128, "ACCEPTED") + radio(c, "cap_dm_decision", "REVISION", MARGIN + 93, 125, tooltip="District Manager requests CAP revision") + c.drawString(MARGIN + 109, 128, "REVISION REQUIRED") + radio(c, "cap_dm_decision", "CLOSED", MARGIN + 211, 125, tooltip="District Manager verified the CAP complete") + c.drawString(MARGIN + 227, 128, "COMPLETION VERIFIED") + label(c, "DM name", MARGIN + 351, 136, size=5.3) + text_field(c, "cap_dm_name", MARGIN + 351, 115, 96, 17, tooltip="District Manager name", size=6.7) + label(c, "Review / verify date", MARGIN + 455, 136, size=5.3) + text_field(c, "cap_dm_review_date", MARGIN + 455, 115, 83, 17, tooltip="District Manager review or verification date", size=6.7) + label(c, "DM comments / required revision / evidence reviewed", MARGIN + 10, 105, size=5.3) + text_field(c, "cap_dm_comments", MARGIN + 10, 80, PAGE_W - 2 * MARGIN - 20, 20, tooltip="District Manager comments, required revisions, or evidence reviewed", size=6.7) + draw_footer(c, page) + c.showPage() + + +def draw_review(c: canvas.Canvas, page: int) -> None: + c.bookmarkPage("review") + c.addOutlineEntry("Certification, review & distribution", "review", level=0) + draw_page_header(c, page, "Certification, Review & Distribution", "MONTHLY CLOSEOUT") + header_context_fields(c, page) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 15) + c.drawString(MARGIN, 720, "Complete the record, route it, then verify closure.") + + rounded_card(c, MARGIN, 575, 265, 113, WHITE) + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 8.5) + c.drawString(MARGIN + 12, 668, "PRE-SUBMISSION CERTIFICATION") + checks = [ + ("cert_status", "All 120 items have one status"), + ("cert_actions", "Every NC is in the action register"), + ("cert_immediate", "Immediate hazards are controlled/escalated"), + ("cert_score", "Section and overall totals reconcile"), + ("cert_cap", "Detailed CAP attached when total NC is 11+"), + ] + cy = 642 + for name, wording in checks: + checkbox(c, name, MARGIN + 12, cy - 2, tooltip=wording, size=9) + c.setFillColor(INK) + c.setFont("Helvetica", 6.9) + c.drawString(MARGIN + 28, cy + 1, wording) + cy -= 15 + + rounded_card(c, 309, 575, 271, 113, LIGHT) + c.setFillColor(TEAL) + c.setFont("Helvetica-Bold", 8.5) + c.drawString(321, 668, "CLOSURE SNAPSHOT") + snapshot = [ + ("Total NC", "review_total_nc", 52), + ("Open", "review_open", 46), + ("Overdue", "review_overdue", 52), + ("Repeat", "review_repeat", 52), + ] + fx = 321 + for title, name, fw in snapshot: + label(c, title, fx, 645, size=5.4) + text_field(c, name, fx, 620, fw, 20, tooltip=title, size=7) + fx += fw + 10 + label(c, "Final verified closure date (enter when all actions are complete)", 321, 607, size=5.2) + text_field(c, "review_final_close", 321, 584, 247, 19, tooltip="Final verified closure date", size=7) + + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 9) + c.drawString(MARGIN, 552, "REVIEW & ACKNOWLEDGMENT") + c.setFillColor(MUTED) + c.setFont("Helvetica", 6.8) + c.drawRightString(PAGE_W - MARGIN, 552, "Typed names acknowledge review; use the signature line per company electronic/wet-signature policy.") + + reviewers = [ + ("Safety Coordinator", "Prepared and submitted a complete, accurate inspection record.", "sc"), + ("Store Manager", "Reviewed findings, accepted action ownership and certified immediate controls.", "sm"), + ("District Manager", "Reviewed score/CAP and will follow up; verified completion when applicable.", "dm"), + ("General Manager", "Reviewed results, resources and material trends/escalations.", "gm"), + ("Loss Prevention", "Reviewed loss, liability and repeat-risk implications and follow-up.", "lp"), + ] + y = 466 + card_h = 76 + for role, statement, prefix in reviewers: + rounded_card(c, MARGIN, y, PAGE_W - 2 * MARGIN, card_h - 6, WHITE) + c.setFillColor(NAVY) + c.setFont("Helvetica-Bold", 8.4) + c.drawString(MARGIN + 11, y + 52, role) + c.setFillColor(MUTED) + c.setFont("Helvetica", 6.4) + c.drawString(MARGIN + 11, y + 39, statement) + label(c, "Printed / typed name", MARGIN + 11, y + 25, size=5.1) + text_field(c, f"review_{prefix}_name", MARGIN + 11, y + 7, 137, 15, tooltip=f"{role} printed or typed name", size=6.4) + label(c, "Signature", MARGIN + 159, y + 25, size=5.1) + c.setStrokeColor(MUTED) + c.setLineWidth(0.5) + c.line(MARGIN + 159, y + 8, MARGIN + 350, y + 8) + label(c, "Review date", MARGIN + 365, y + 25, size=5.1) + text_field(c, f"review_{prefix}_date", MARGIN + 365, y + 7, 78, 15, tooltip=f"{role} review date", size=6.4) + label(c, "Initials", MARGIN + 454, y + 25, size=5.1) + text_field(c, f"review_{prefix}_initials", MARGIN + 454, y + 7, 73, 15, tooltip=f"{role} initials", size=6.4) + y -= card_h + + rounded_card(c, MARGIN, 54, PAGE_W - 2 * MARGIN, 43, NAVY, NAVY) + c.setFillColor(colors.HexColor("#8FE3DD")) + c.setFont("Helvetica-Bold", 7.2) + c.drawString(MARGIN + 10, 81, "DISTRIBUTION RECORD") + c.setFillColor(WHITE) + c.setFont("Helvetica", 6.4) + c.drawString(MARGIN + 10, 66, "GM sent:") + text_field(c, "dist_gm", MARGIN + 54, 59, 74, 16, tooltip="Date checklist sent to General Manager", size=6.2) + c.drawString(MARGIN + 140, 66, "DM sent:") + text_field(c, "dist_dm", MARGIN + 184, 59, 74, 16, tooltip="Date checklist sent to District Manager", size=6.2) + c.drawString(MARGIN + 270, 66, "LP sent:") + text_field(c, "dist_lp", MARGIN + 309, 59, 74, 16, tooltip="Date checklist sent to Loss Prevention", size=6.2) + c.drawString(MARGIN + 395, 66, "Attachments / link:") + text_field(c, "dist_link", MARGIN + 477, 59, 61, 16, tooltip="Attachment count or repository link/reference", size=5.8) + draw_footer(c, page) + c.showPage() + + +def build() -> None: + if sum(len(s.items) for s in SECTIONS) != 120: + raise RuntimeError("Checklist must contain exactly 120 controls") + if sum(sum(s.chunks) for s in SECTIONS) != 120: + raise RuntimeError("Section page chunks do not match checklist controls") + + c = canvas.Canvas(str(OUT), pagesize=letter, pageCompression=1) + c.setTitle("Monthly Safety Compliance Checklist") + c.setAuthor("Store Operations Safety") + c.setSubject("Monthly retail store safety, food safety and fire compliance audit") + c.setKeywords("retail safety, food safety, fire prevention, corrective action, monthly checklist") + c.setCreator("Store Operations MSCL-120") + + page = 1 + draw_cover(c, page) + page += 1 + draw_instructions(c, page) + page += 1 + + for section in SECTIONS: + offset = 0 + parts = len(section.chunks) + for part, count in enumerate(section.chunks, start=1): + chunk = section.items[offset : offset + count] + draw_checklist_page(c, page, section, chunk, part, parts, part == parts) + page += 1 + offset += count + + draw_scorecard(c, page) + page += 1 + draw_action_register_page(c, page, 1, 6, 1) + page += 1 + draw_action_register_page(c, page, 7, 12, 2) + page += 1 + draw_cap(c, page) + page += 1 + draw_review(c, page) + + if page != TOTAL_PAGES: + raise RuntimeError(f"Page count mismatch: built {page}, expected {TOTAL_PAGES}") + c.save() + + +if __name__ == "__main__": + build() + print(OUT) diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02aa1805-c658-4069-8a6a-02dec146063a/Email_to_Manager_Well_Recommendations.eml b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02aa1805-c658-4069-8a6a-02dec146063a/Email_to_Manager_Well_Recommendations.eml new file mode 100644 index 0000000000000000000000000000000000000000..e11ee050c0dae6ec708e59188b77918a84799a1f --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02aa1805-c658-4069-8a6a-02dec146063a/Email_to_Manager_Well_Recommendations.eml @@ -0,0 +1,418 @@ +From: Senior Project Manager +To: Manager +Date: Tue, 10 Nov 2026 12:00:00 +0000 +Subject: + Recommendation: Illinois water-well screening for green hydrogen facility +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="===============0422992753696001247==" + +--===============0422992753696001247== +Content-Type: multipart/alternative; + boundary="===============1822521353667222261==" + +--===============1822521353667222261== +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: quoted-printable + +Hi, + +I completed a preliminary screen of the recoverable Illinois EPA Source Water= + Assessment Program factsheet-derived well records for the requested water sy= +stems. The attached workbook contains the source fields, individual screening= + flags and a separate Potential Wells tab. + +I applied all three required criteria: +- depth of 160=E2=80=93200 feet, inclusive; +- Aquifer Description containing both =E2=80=9Csand=E2=80=9D and =E2=80=9Cgra= +vel=E2=80=9D; and +- an active Well Description, excluding =E2=80=9Cabandoned,=E2=80=9D =E2=80= +=9Cinactive,=E2=80=9D =E2=80=9Cdisconnected,=E2=80=9D =E2=80=9Cemergency=E2= +=80=9D and =E2=80=9Csealed=E2=80=9D (case-insensitive). + +Seven wells in the recoverable extract pass all three criteria. I recommend a= +dvancing these options first: +1. Farmer City =E2=80=94 WL47648: 188 ft, Sand & Gravel, status A, reported p= +umpage 26,478,500. +2. Farmer City =E2=80=94 WL47646: 180 ft, Sand & Gravel, status A, reported p= +umpage 21,976,200. +3. Weldon =E2=80=94 WL45047: 167 ft, Sand & Gravel, status A, reported pumpag= +e 5,500,000; leading secondary option. + +The other wells passing the screen are Waynesville =E2=80=94 WL40006, Weldon = +=E2=80=94 WL45048, Farmer City =E2=80=94 WL01130 and Farmer City =E2=80=94 WL= +47647. All seven appear on the Potential Wells tab. + +Recommendation: move WL47648 and WL47646 into first-pass technical and commer= +cial diligence, with WL45047 as the leading alternate. Reported pumpage is on= +ly a prioritization signal; it is not confirmation of available or sustainabl= +e project yield. + +Coverage hold point: the recoverable extract contains rows for Farmer City, B= +artlett, Weldon and Waynesville, but not Springerton, Enfield, Crossville or = +Norris City. The live Illinois EPA factsheet host was unavailable from the wo= +rking environment on 2026-11-10. I do not recommend final source selection un= +til those four systems are retrieved from the official site and the full shor= +tlist is re-screened. + +Before any commitment, we should confirm owner willingness and available capa= +city, permitted sustainable yield and seasonal drawdown, water quality and pr= +etreatment demand, water rights/supply terms, conveyance distance and redunda= +ncy. + +Illinois EPA factsheets: https://dataservices.epa.illinois.gov/swap/factsheet= +.aspx +Attachment: Illinois_Green_Hydrogen_Well_Screening.xlsx + +Please let me know if you would like me to initiate the validation workstream= + or contact the shortlisted system owners. + +Best regards, + +Senior Project Manager +Green Hydrogen Development + +--===============1822521353667222261== +Content-Type: text/html; charset="utf-8" +Content-Transfer-Encoding: quoted-printable +MIME-Version: 1.0 + + + +
+
Illinois water-well screening= + recommendation
+
Green hydrogen facility develop= +ment
+
+
+

Hi,

+

I completed a preliminary screen of the recoverable Illinois EPA So= +urce Water Assessment Program factsheet-derived well records. The attached wo= +rkbook contains the source fields, individual screening flags and a separate = +Potential Wells tab.

+

Screen applied

+
    +
  • depth of 160=E2=80=93200 feet, inclusive;
  • +
  • Aquifer Description containing both sand and gravel; and<= +/li> +
  • an active Well Description, excluding abandoned, inactive, disconnec= +ted, emergency and sealed (case-insensitive).
  • +
+

Seven wells pass all three criteria. I recommend the following orde= +r for initial diligence:

+ + + + + +<= +/table> +

The other wells passing the screen are Waynesville =E2=80=94 WL40006, Weldon =E2=80=94 WL45048, Farmer City =E2=80=94 WL01130 and = +Farmer City =E2=80=94 WL47647. All seven appear on the Potential Wells= + tab.

+

Recommendation: advance Farmer City WL47648 and WL47646 into first-pass technical and commercial diligence, with Weldon WL45047= + as the leading alternate. Reported pumpage is only a prioritization sign= +al; it is not confirmation of available or sustainable project yield.

+
+Coverage hold point. The recoverable extract contains rows for Farmer = +City, Bartlett, Weldon and Waynesville, but not Springerton, Enfield, Crossvi= +lle or Norris City. The live Illinois EPA factsheet host was unavailable from= + the working environment on 2026-11-10. Do not make final source selection un= +til those four systems are retrieved from the official site and the full shor= +tlist is re-screened. +
+

Before any commitment, we should confirm owner willingness and available c= +apacity, permitted sustainable yield and seasonal drawdown, water quality and= + pretreatment demand, water rights/supply terms, conveyance distance and redu= +ndancy.

+

Illi= +nois EPA Source Water Assessment Program Factsheets
+Attachment: Illinois_Green_Hydrogen_Well_Screening.xlsx

+

Please let me know if you would like me to initiate the validation workstr= +eam or contact the shortlisted system owners.

+

Best regards,

Senior Project Manager
Green Hydrogen Devel= +opment

+ + +--===============1822521353667222261==-- + +--===============0422992753696001247== +Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; + filename="Illinois_Green_Hydrogen_Well_Screening.xlsx" +MIME-Version: 1.0 + +UEsDBBQAAAAIAMxYal1Gx01IlQAAAM0AAAAQAAAAZG9jUHJvcHMvYXBwLnhtbE3PTQvCMAwG4L9S +dreZih6kDkQ9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wvd29ya3NoZWV0cy9f +cmVscy9zaGVldDIueG1sLnJlbHNQSwECFAMUAAAACADMWGpdJbNXWUcEAACqHwAADQAAAAAAAAAA +AAAAgAHVKgAAeGwvc3R5bGVzLnhtbFBLAQIUAxQAAAAIAMxYal2XirscwAAAABMCAAALAAAAAAAA +AAAAAACAAUcvAABfcmVscy8ucmVsc1BLAQIUAxQAAAAIAMxYal1BtcsIzgEAADMFAAAPAAAAAAAA +AAAAAACAATAwAAB4bC93b3JrYm9vay54bWxQSwECFAMUAAAACADMWGpdjfcsWrQAAACJAgAAGgAA +AAAAAAAAAAAAgAErMgAAeGwvX3JlbHMvd29ya2Jvb2sueG1sLnJlbHNQSwECFAMUAAAACADMWGpd +lv20mlABAADGBgAAEwAAAAAAAAAAAAAAgAEXMwAAW0NvbnRlbnRfVHlwZXNdLnhtbFBLBQYAAAAA +EgASANIEAACYNAAAAAA= + +--===============0422992753696001247==-- diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02aa1805-c658-4069-8a6a-02dec146063a/Illinois_Green_Hydrogen_Well_Screening.xlsx b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02aa1805-c658-4069-8a6a-02dec146063a/Illinois_Green_Hydrogen_Well_Screening.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c4376b720659dc162df7f10f72d549c6036ea718 Binary files /dev/null and b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/02aa1805-c658-4069-8a6a-02dec146063a/Illinois_Green_Hydrogen_Well_Screening.xlsx differ diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0353ee0c-18b5-4ad3-88e8-e001d223e1d7/Veterans PACT Act Comprehensive Guide.pdf b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0353ee0c-18b5-4ad3-88e8-e001d223e1d7/Veterans PACT Act Comprehensive Guide.pdf new file mode 100644 index 0000000000000000000000000000000000000000..248dad02e1b5a9f3ad16fca8d6cee6bae40642ad --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0353ee0c-18b5-4ad3-88e8-e001d223e1d7/Veterans PACT Act Comprehensive Guide.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c93d95ce0998cb6bc1f8aa71474e5473178dce648281919d1264b24a79a406f0 +size 115786 diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0419f1c3-d669-45d0-81cd-f4d5923b06a5/John_Miller_Performance_Improvement_Plan.docx b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0419f1c3-d669-45d0-81cd-f4d5923b06a5/John_Miller_Performance_Improvement_Plan.docx new file mode 100644 index 0000000000000000000000000000000000000000..a2fd8d6d4df8cb04a5f14946d9fdb5519cf747f5 Binary files /dev/null and b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0419f1c3-d669-45d0-81cd-f4d5923b06a5/John_Miller_Performance_Improvement_Plan.docx differ diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/05389f78-589a-473c-a4ae-67c61050bfca/Juvoxa_Model_A_Termination_Email.docx b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/05389f78-589a-473c-a4ae-67c61050bfca/Juvoxa_Model_A_Termination_Email.docx new file mode 100644 index 0000000000000000000000000000000000000000..cd4071bd230b49ba2d2e67d64c6a848ab8989536 Binary files /dev/null and b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/05389f78-589a-473c-a4ae-67c61050bfca/Juvoxa_Model_A_Termination_Email.docx differ diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/05389f78-589a-473c-a4ae-67c61050bfca/Model_A_Headlamp_Supplier_Recovery_Report_to_CPO.docx b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/05389f78-589a-473c-a4ae-67c61050bfca/Model_A_Headlamp_Supplier_Recovery_Report_to_CPO.docx new file mode 100644 index 0000000000000000000000000000000000000000..76692edecc65b78ec43dd75001e9830dd9203856 Binary files /dev/null and b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/05389f78-589a-473c-a4ae-67c61050bfca/Model_A_Headlamp_Supplier_Recovery_Report_to_CPO.docx differ diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix.zip b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix.zip new file mode 100644 index 0000000000000000000000000000000000000000..cefb80a767ada6c6430451b12ee140008bb43df9 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:743af6401bd5b92f3b16a11aa9ee20833adb34b5956c7ba213ae5aa38fd756ea +size 104222 diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/LICENSE b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9134cf49564da203dc78684ce6f2e4d2b486a107 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 PrivateCrypMix contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/Makefile b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..c3d68819cb0c706e0725bf934f05cf9090483cca --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/Makefile @@ -0,0 +1,22 @@ +.PHONY: install build test local-node local-deploy circuit clean + +install: + npm install + +build: + npm run build + +test: + npm test + +local-node: + npm run chain + +local-deploy: + npm run deploy:local + +circuit: + npm run circuit:build + +clean: + npm run clean diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/README.md b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e27c140b58a4993bf983755efeff41917b6964fc --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/README.md @@ -0,0 +1,162 @@ +# PrivateCrypMix + +PrivateCrypMix is a fixed-denomination, privacy-preserving transfer system for +Polygon. A deposit joins a Poseidon Merkle tree and is supplied to Aave. After a +mandatory round-wide holding period, the position is redeemed and every valid +zkSNARK note receives the same principal-plus-yield payout, either on Polygon +or through a Connext `xcall` to an allowlisted EVM chain. + +This repository contains the complete application source: + +- React + TypeScript + ethers dApp with injected, WalletConnect, and Coinbase + wallet connections +- Solidity mixer, Aave V3 and Connext integration, Poseidon root history, + production deployment tooling, mocks, and tests +- Circom 2 Groth16 circuit plus multi-party ceremony and export tooling +- browser/Node SDK for recovery notes, Merkle paths, and proof calldata +- optional proof-only relayer with durable retries, validation, metrics, and + privacy-conscious logging +- local deployment, Docker, operations documentation, and threat model + +> **Security status:** experimental and unaudited. The repository intentionally +> excludes a final Groth16 zkey. A production zkey must come from a published +> multi-party ceremony; shipping an opaque developer key would let its holder +> forge withdrawals. See [SECURITY.md](SECURITY.md) before using real assets. + +## Why mixer rounds? + +A continuously accruing yield mixer tends to reveal either a note's age or a +unique payout amount. PrivateCrypMix instead uses finite rounds: + +1. one ERC-20 and one exact deposit denomination; +2. a public entry deadline; +3. a full minimum lock after entry closes; +4. a permissionless Aave snapshot at unlock; and +5. one equal payout amount for every note. + +Earlier deposits subsidize later deposits slightly, but neither deposit time nor +individual yield appears in withdrawal calldata. This trade-off is shown before +the wallet approval. + +## Repository map + +```text +apps/ + web/ React dApp; note creation and proving stay in the browser + relayer/ Optional Express proof submission and retry service +packages/ + contracts/ Solidity, Hardhat deployment scripts, mocks, tests + circuits/ Circom circuit, ceremony scripts, witness tests + sdk/ Shared note, Merkle, proof, ABI, and config primitives +docs/ + architecture.md protocol data flow and proof statement + runbook.md ceremony, deployment, monitoring, lifecycle + threat-model.md privacy/security assumptions and residual risks +``` + +## Prerequisites + +- Node.js 20 or newer and npm 10 or newer +- a Polygon/Amoy RPC endpoint +- verified Aave V3 Pool and Connext router addresses for that network +- a Powers of Tau file large enough for the compiled circuit + +## Run locally + +Install dependencies: + +```bash +cp .env.example .env +npm install +npm test +``` + +Start a local EVM in terminal one: + +```bash +npm run chain +``` + +Deploy mocks and a demo round in terminal two: + +```bash +npm run deploy:local +``` + +The deployer writes both `packages/contracts/deployments/local.json` and the web +manifest at `apps/web/public/config/pools.json`. Then start the dApp: + +```bash +npm run dev:web +``` + +The local contract uses a **mock verifier**, so it is useful for transaction and +UI development but cannot validate browser-generated production proofs. + +## Build a production proof system + +```bash +npm run circuit:build +npm run ceremony:prepare -w @privatecrypmix/circuits -- /path/to/powersOfTau.ptau +npm run ceremony:contribute -w @privatecrypmix/circuits -- contributor-name +CEREMONY_BEACON= npm run ceremony:finalize -w @privatecrypmix/circuits +npm run ceremony:export -w @privatecrypmix/circuits +``` + +The exporter checks that the verifier has exactly eight public signals, then +places its Solidity source under `packages/contracts/contracts/verifiers/` and +the WASM/zkey under `apps/web/public/circuits/`. Publish hashes and the ceremony +transcript independently. Deploy the exported verifier with +`npm run deploy:verifier:polygon -w @privatecrypmix/contracts`. + +## Deploy a Polygon round + +Fill the production variables in `.env`, including the exported verifier. A +circomlibjs-compatible two-input Poseidon contract can be deployed with +`npm run deploy:poseidon:polygon -w @privatecrypmix/contracts`; put the resulting +address in `POSEIDON_ADDRESS`. Then run: + +```bash +npm run deploy:polygon -w @privatecrypmix/contracts +``` + +The script validates that every dependency has bytecode, rejects the development +mock-verifier ABI, deploys immutable round parameters, enables configured Connext +domains, and writes a deployment manifest. Add a UI-friendly pool entry (with +the deployment block and official domain IDs) to `apps/web/public/config/pools.json`. + +## Relayer + +The relayer is optional. Configure a dedicated low-balance key and start it with: + +```bash +npm run build -w @privatecrypmix/sdk +npm run dev:relayer +``` + +Its API surface is intentionally small: + +- `GET /v1/quote` — current asset-denominated relayer fee +- `POST /v1/withdrawals` — completed proof and public fields only +- `GET /v1/withdrawals/:jobId` — sanitized status +- `GET /health`, `/ready`, `/metrics` — operations + +Recovery notes are rejected by the strict request schema. Run the service behind +TLS and avoid upstream access logs that could correlate proofs with IP addresses. + +## Tests and build + +```bash +npm test # SDK, contracts, circuit, relayer, frontend +npm run build # all TypeScript/Solidity/application bundles +npm run lint +``` + +The circuit test recompiles a witness generator and may take longer than ordinary +unit tests. Production readiness also requires independent audit, testnet soak, +ceremony verification, dependency address verification, reproducible frontend +builds, a timelocked multisig owner, and jurisdiction-specific legal review. + +## License + +MIT. See [LICENSE](LICENSE). diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/SECURITY.md b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/SECURITY.md new file mode 100644 index 0000000000000000000000000000000000000000..b26061ad05d245d6eaaf4e6b53a5a618fcc7d7e9 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/SECURITY.md @@ -0,0 +1,34 @@ +# Security policy + +PrivateCrypMix moves real assets and relies on zero-knowledge cryptography. The +repository is a production-oriented reference implementation, not an audit. +Do not deploy it with valuable funds until the Solidity contracts, Circom +circuit, ceremony output, relayer, and frontend have each received independent +review. + +Deployment operators must publish a monitored private disclosure address before +launch. Do not include live secrets or user notes in a report. + +## Operational invariants + +- A pool accepts one ERC-20 and one exact denomination during a finite deposit + window. Fee-on-transfer and rebasing-underlying assets are unsupported. +- The withdrawal time is `depositDeadline + minimumLockDuration`, so every + depositor waits at least the advertised duration. +- The first post-lock snapshot exits the entire Aave position. Every note then + receives the same `snapshotAssets / depositCount` amount. Equal outputs are + intentional: individualized yield would link a withdrawal to its deposit. +- The on-chain verifier address must be produced by the ceremony for the exact + circuit in this repository. The deploy script rejects a mock verifier. +- A recovery note contains spend authority. It must never be sent to analytics, + logs, support staff, or the relayer. Only a completed proof is relayed. +- Relayers cannot alter a proof's recipient, destination domain, fee, mixer, + or chain because all are Groth16 public inputs. + +## Known trust assumptions + +Users depend on Aave, the selected ERC-20, Polygon consensus, and Connext for +cross-chain delivery. The pool owner can pause entry/exit and update the +destination allowlist, but cannot withdraw pool assets. A pause is therefore a +temporary availability risk. Ownership should be placed behind a timelock and +multisig, then renounced when destination configuration is final. diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/Dockerfile b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..0832a29d40f75ed23e79714dbd0a3a8d3cba0c8a --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/Dockerfile @@ -0,0 +1,16 @@ +FROM node:22-alpine AS build +WORKDIR /app +COPY . . +RUN npm install --ignore-scripts \ + && npm run build -w @privatecrypmix/sdk \ + && npm run build -w @privatecrypmix/relayer \ + && npm prune --omit=dev + +FROM node:22-alpine +RUN addgroup -S app && adduser -S -G app app +WORKDIR /app +COPY --from=build --chown=app:app /app /app +USER app +WORKDIR /app/apps/relayer +EXPOSE 8787 +CMD ["node", "dist/server.js"] diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/README.md b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/README.md new file mode 100644 index 0000000000000000000000000000000000000000..19c59cbfb8bdd4cb3787becbd310e36818ac1325 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/README.md @@ -0,0 +1,16 @@ +# Optional privacy relayer + +The relayer accepts only a completed Groth16 proof and its public withdrawal +fields. The API schema rejects recovery-note secrets and unknown properties. +Every request is checked against an allowlisted deployment manifest, current +root history, nullifier status, fee policy, destination allowlist, and an +on-chain `eth_call` before it enters the durable queue. + +Jobs survive restarts in an atomic mode-0600 JSON store. A single worker avoids +nonce races, polls broadcast receipts, waits for configured confirmations, and +uses bounded exponential retry. Confirmed remote jobs expose the Connext transfer +ID for delivery diagnostics. `/metrics`, `/health`, and `/ready` support +operations without exposing proofs or request bodies. + +Run behind TLS. Do not add access logs containing IP addresses, full request +bodies, or proof identifiers; those can become a timing-correlation dataset. diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/package.json b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2d482cafd7b080206842531b57ba264c63d5a826 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/package.json @@ -0,0 +1,37 @@ +{ + "name": "@privatecrypmix/relayer", + "version": "1.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "tsx watch src/server.ts", + "prebuild": "npm run build -w @privatecrypmix/sdk", + "pretest": "npm run build -w @privatecrypmix/sdk", + "build": "tsc -p tsconfig.json", + "start": "node dist/server.js", + "test": "vitest run", + "lint": "tsc -p tsconfig.json --noEmit", + "clean": "rm -rf dist coverage" + }, + "dependencies": { + "@privatecrypmix/sdk": "1.0.0", + "cors": "^2.8.5", + "dotenv": "^16.4.7", + "ethers": "^6.13.5", + "express": "^4.21.2", + "express-rate-limit": "^7.5.0", + "helmet": "^8.0.0", + "pino": "^9.6.0", + "prom-client": "^15.1.3", + "zod": "^3.24.1" + }, + "devDependencies": { + "@types/cors": "^2.8.17", + "@types/express": "^4.17.21", + "@types/node": "^22.10.5", + "supertest": "^7.0.0", + "tsx": "^4.19.2", + "typescript": "^5.7.3", + "vitest": "^2.1.8" + } +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/app.ts b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/app.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1c378eacbd10f0aa7fd5841de7bb70c02a88a4a --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/app.ts @@ -0,0 +1,88 @@ +import cors from "cors"; +import express, { type ErrorRequestHandler } from "express"; +import rateLimit from "express-rate-limit"; +import helmet from "helmet"; +import type { Logger } from "pino"; +import { ZodError } from "zod"; +import { requests, registry } from "./metrics.js"; +import { parseWithdrawal } from "./schema.js"; +import { RelayerService, ValidationError } from "./service.js"; +import { publicJob } from "./store.js"; + +export function createApp(service: RelayerService, logger: Logger) { + const app = express(); + app.disable("x-powered-by"); + app.set("trust proxy", false); + app.use(helmet({ contentSecurityPolicy: false })); + app.use(cors({ + origin(origin, callback) { + if (!origin || service.config.allowedOrigins.includes(origin)) callback(null, true); + else callback(new ValidationError("Origin is not allowed", 403)); + }, + methods: ["GET", "POST"], + allowedHeaders: ["content-type"] + })); + app.use(express.json({ limit: "64kb", strict: true })); + app.use(rateLimit({ windowMs: 60_000, limit: 30, standardHeaders: "draft-7", legacyHeaders: false })); + app.use((request, response, next) => { + response.on("finish", () => { + requests.inc({ method: request.method, route: request.route?.path ?? request.path, status: String(response.statusCode) }); + }); + next(); + }); + + app.get("/health", (_request, response) => response.json({ status: "ok" })); + app.get("/ready", async (_request, response, next) => { + try { + await service.provider.getBlockNumber(); + response.json({ status: "ready", chainId: service.config.chainId, relayer: service.wallet.address }); + } catch (error) { next(error); } + }); + app.get("/metrics", async (_request, response) => { + response.type(registry.contentType).send(await registry.metrics()); + }); + + app.get("/v1/quote", async (request, response, next) => { + try { + const mixer = String(request.query.mixer ?? ""); + const destinationDomain = Number(request.query.destinationDomain); + if (!Number.isInteger(destinationDomain) || destinationDomain < 0 || destinationDomain > 0xffff_ffff) { + throw new ValidationError("Invalid destinationDomain query parameter"); + } + response.set("cache-control", "no-store").json(await service.quote(mixer, destinationDomain)); + } catch (error) { next(error); } + }); + + app.post("/v1/withdrawals", async (request, response, next) => { + try { + const bundle = parseWithdrawal(request.body); + const { job, created } = await service.enqueue(bundle); + response.status(created ? 202 : 200).set("cache-control", "no-store").json({ jobId: job.id, status: job.status, created }); + } catch (error) { next(error); } + }); + + app.get("/v1/withdrawals/:jobId", (request, response, next) => { + try { + if (!/^0x[0-9a-fA-F]{64}$/u.test(request.params.jobId)) throw new ValidationError("Invalid job ID"); + const job = service.store.get(request.params.jobId); + if (!job) throw new ValidationError("Job not found", 404); + response.set("cache-control", "no-store").json(publicJob(job)); + } catch (error) { next(error); } + }); + + app.use((_request, response) => response.status(404).json({ error: "Not found" })); + const errors: ErrorRequestHandler = (error, _request, response, _next) => { + if (error instanceof ValidationError) { + response.status(error.status).json({ error: error.message }); + return; + } + if (error instanceof ZodError) { + response.status(400).json({ error: "Malformed withdrawal request", details: error.issues.map((issue) => issue.path.join(".")) }); + return; + } + logger.error({ error: error instanceof Error ? error.message : "unknown" }, "request failed"); + response.status(500).json({ error: "Internal relayer error" }); + }; + app.use(errors); + return app; +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/config.ts b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/config.ts new file mode 100644 index 0000000000000000000000000000000000000000..ec00a6ed29855e3bcf4f4b42840bd35bea98e031 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/config.ts @@ -0,0 +1,113 @@ +import "dotenv/config"; +import { getAddress } from "ethers"; +import { readFile } from "node:fs/promises"; +import path from "node:path"; +import { z } from "zod"; +import type { PoolConfig } from "@privatecrypmix/sdk"; + +const integer = (fallback: string) => z.string().default(fallback).transform((value, context) => { + const parsed = Number(value); + if (!Number.isSafeInteger(parsed) || parsed < 0) { + context.addIssue({ code: z.ZodIssueCode.custom, message: "must be a non-negative integer" }); + return z.NEVER; + } + return parsed; +}); + +const schema = z.object({ + POLYGON_RPC_URL: z.string().url(), + POLYGON_CHAIN_ID: integer("137"), + RELAYER_PRIVATE_KEY: z.string().regex(/^0x[0-9a-fA-F]{64}$/u), + RELAYER_PORT: integer("8787"), + RELAYER_HOST: z.string().default("127.0.0.1"), + RELAYER_DATA_FILE: z.string().default("./data/jobs.json"), + RELAYER_POOLS_FILE: z.string().default("../web/public/config/pools.json"), + RELAYER_ALLOWED_ORIGINS: z.string().default("http://localhost:5173"), + RELAYER_FEE_BPS: integer("50"), + RELAYER_MAX_FEE_BPS: integer("200"), + RELAYER_MIN_FEE_WEI: z.string().regex(/^\d+$/u).default("0").transform(BigInt), + RELAYER_XCALL_NATIVE_FEE_WEI: z.string().regex(/^\d+$/u).default("0").transform(BigInt), + RELAYER_CONFIRMATIONS: integer("2"), + RELAYER_POLL_MS: integer("5000"), + RELAYER_STUCK_TX_MS: integer("600000"), + RELAYER_MAX_ATTEMPTS: integer("8"), + RELAYER_LOG_LEVEL: z.enum(["fatal", "error", "warn", "info", "debug", "trace", "silent"]).default("info") +}); + +export interface RelayerConfig { + rpcUrl: string; + chainId: number; + privateKey: string; + port: number; + host: string; + dataFile: string; + poolsFile: string; + allowedOrigins: string[]; + feeBps: number; + maxFeeBps: number; + minimumFee: bigint; + xcallNativeFee: bigint; + confirmations: number; + pollMs: number; + stuckTransactionMs: number; + maxAttempts: number; + logLevel: string; +} + +export function loadConfig(environment: NodeJS.ProcessEnv = process.env): RelayerConfig { + const value = schema.parse(environment); + if (value.RELAYER_FEE_BPS > value.RELAYER_MAX_FEE_BPS || value.RELAYER_MAX_FEE_BPS > 10_000) { + throw new Error("RELAYER_FEE_BPS must not exceed RELAYER_MAX_FEE_BPS or 10,000"); + } + if ( + value.RELAYER_CONFIRMATIONS < 1 || value.RELAYER_POLL_MS < 250 + || value.RELAYER_STUCK_TX_MS < value.RELAYER_POLL_MS || value.RELAYER_MAX_ATTEMPTS < 1 + ) { + throw new Error("Invalid relayer confirmation, polling, or retry configuration"); + } + return { + rpcUrl: value.POLYGON_RPC_URL, + chainId: value.POLYGON_CHAIN_ID, + privateKey: value.RELAYER_PRIVATE_KEY, + port: value.RELAYER_PORT, + host: value.RELAYER_HOST, + dataFile: path.resolve(value.RELAYER_DATA_FILE), + poolsFile: path.resolve(value.RELAYER_POOLS_FILE), + allowedOrigins: value.RELAYER_ALLOWED_ORIGINS.split(",").map((entry) => entry.trim()).filter(Boolean), + feeBps: value.RELAYER_FEE_BPS, + maxFeeBps: value.RELAYER_MAX_FEE_BPS, + minimumFee: value.RELAYER_MIN_FEE_WEI, + xcallNativeFee: value.RELAYER_XCALL_NATIVE_FEE_WEI, + confirmations: value.RELAYER_CONFIRMATIONS, + pollMs: value.RELAYER_POLL_MS, + stuckTransactionMs: value.RELAYER_STUCK_TX_MS, + maxAttempts: value.RELAYER_MAX_ATTEMPTS, + logLevel: value.RELAYER_LOG_LEVEL + }; +} + +export async function loadPoolAllowlist(file: string, chainId: number): Promise> { + const parsed = JSON.parse(await readFile(file, "utf8")) as { pools?: unknown }; + if (!Array.isArray(parsed.pools)) throw new Error("Relayer pools file must contain a pools array"); + const allowlist = new Map(); + for (const candidate of parsed.pools) { + if (!candidate || typeof candidate !== "object") throw new Error("Relayer pool entry is not an object"); + const pool = candidate as PoolConfig; + if ( + !Number.isSafeInteger(pool.chainId) || !Number.isSafeInteger(pool.originDomain) + || pool.originDomain < 0 || pool.originDomain > 0xffff_ffff + || typeof pool.mixerAddress !== "string" || !Array.isArray(pool.destinations) + ) throw new Error("Relayer pool entry has invalid chain, domain, address, or destinations"); + if (pool.chainId !== chainId) continue; + const address = getAddress(pool.mixerAddress); + if (pool.destinations.length === 0 || pool.destinations.some((destination) => + !Number.isSafeInteger(destination.domain) || destination.domain < 0 || destination.domain > 0xffff_ffff + )) { + throw new Error(`Allowed pool ${address} has invalid destinations`); + } + if (allowlist.has(address.toLowerCase())) throw new Error(`Duplicate allowed pool ${address}`); + allowlist.set(address.toLowerCase(), { ...pool, mixerAddress: address }); + } + if (allowlist.size === 0) throw new Error(`No relayer pools configured for chain ${chainId}`); + return allowlist; +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/fees.ts b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/fees.ts new file mode 100644 index 0000000000000000000000000000000000000000..2d7042ace8c4175cb687f8cf08e9db97ff0606de --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/fees.ts @@ -0,0 +1,12 @@ +export function calculateFee(payout: bigint, feeBps: number, minimumFee: bigint): bigint { + if (payout < 0n || !Number.isInteger(feeBps) || feeBps < 0 || feeBps > 10_000 || minimumFee < 0n) { + throw new Error("Invalid fee inputs"); + } + const proportional = payout * BigInt(feeBps) / 10_000n; + return proportional > minimumFee ? proportional : minimumFee; +} + +export function feeWithinLimit(fee: bigint, payout: bigint, maximumBps: number): boolean { + if (fee < 0n || payout <= 0n || maximumBps < 0 || maximumBps > 10_000) return false; + return fee * 10_000n <= payout * BigInt(maximumBps); +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/metrics.ts b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/metrics.ts new file mode 100644 index 0000000000000000000000000000000000000000..c505481bbfea0188e2d11b06a71a493a0ed58f64 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/metrics.ts @@ -0,0 +1,37 @@ +import { Counter, Gauge, Histogram, Registry, collectDefaultMetrics } from "prom-client"; + +export const registry = new Registry(); +collectDefaultMetrics({ register: registry, prefix: "privatecrypmix_relayer_" }); + +export const requests = new Counter({ + name: "privatecrypmix_relayer_http_requests_total", + help: "HTTP requests by route and status", + labelNames: ["method", "route", "status"] as const, + registers: [registry] +}); + +export const jobs = new Gauge({ + name: "privatecrypmix_relayer_jobs", + help: "Durable relay jobs by status", + labelNames: ["status"] as const, + registers: [registry] +}); + +export const transactionLatency = new Histogram({ + name: "privatecrypmix_relayer_transaction_seconds", + help: "Time from broadcast to confirmation", + buckets: [1, 2, 5, 10, 20, 40, 80, 160, 320], + registers: [registry] +}); + +export const nativeBalance = new Gauge({ + name: "privatecrypmix_relayer_native_balance", + help: "Relayer native-token balance in whole token units", + registers: [registry] +}); + +export const oldestActionableJob = new Gauge({ + name: "privatecrypmix_relayer_oldest_actionable_job_seconds", + help: "Age of the oldest queued or retrying job", + registers: [registry] +}); diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/schema.ts b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/schema.ts new file mode 100644 index 0000000000000000000000000000000000000000..858351aa6edd81318d9d69931c9a985845621346 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/schema.ts @@ -0,0 +1,55 @@ +import { getAddress } from "ethers"; +import { z } from "zod"; +import type { WithdrawalBundle } from "@privatecrypmix/sdk"; + +const decimal = z.string().regex(/^\d{1,80}$/u); +const hex32 = z.string().regex(/^0x[0-9a-fA-F]{64}$/u); +const address = z.string().transform((value, context) => { + try { + return getAddress(value); + } catch { + context.addIssue({ code: z.ZodIssueCode.custom, message: "invalid EVM address" }); + return z.NEVER; + } +}); + +const pair = z.tuple([decimal, decimal]); +export const withdrawalSchema = z.object({ + proof: z.object({ + a: pair, + b: z.tuple([pair, pair]), + c: pair + }).strict(), + root: hex32, + nullifierHash: hex32, + recipient: address, + relayer: address, + fee: decimal, + destinationDomain: z.number().int().nonnegative().max(0xffff_ffff), + mixerAddress: address, + chainId: z.number().int().positive(), + publicSignals: z.array(decimal).length(8) +}).strict(); + +export function parseWithdrawal(value: unknown): WithdrawalBundle { + return withdrawalSchema.parse(value) as WithdrawalBundle; +} + +export function expectedPublicSignals(bundle: WithdrawalBundle): string[] { + return [ + BigInt(bundle.root), + BigInt(bundle.nullifierHash), + BigInt(bundle.recipient), + BigInt(bundle.relayer), + BigInt(bundle.fee), + BigInt(bundle.destinationDomain), + BigInt(bundle.mixerAddress), + BigInt(bundle.chainId) + ].map(String); +} + +export function publicSignalsMatch(bundle: WithdrawalBundle): boolean { + const expected = expectedPublicSignals(bundle); + return bundle.publicSignals.length === expected.length + && bundle.publicSignals.every((value, index) => value === expected[index]); +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/server.ts b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/server.ts new file mode 100644 index 0000000000000000000000000000000000000000..4877f3e80f27ddd74d5df94cf7850e1b9e7aec9b --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/server.ts @@ -0,0 +1,37 @@ +import pino from "pino"; +import { createApp } from "./app.js"; +import { loadConfig, loadPoolAllowlist } from "./config.js"; +import { RelayerService } from "./service.js"; +import { JobStore } from "./store.js"; + +async function main(): Promise { + const config = loadConfig(); + const logger = pino({ level: config.logLevel, redact: ["privateKey", "bundle", "req.headers.authorization"] }); + const pools = await loadPoolAllowlist(config.poolsFile, config.chainId); + const store = new JobStore(config.dataFile); + const service = new RelayerService(config, pools, store, logger); + await service.initialize(); + service.start(); + const app = createApp(service, logger); + const server = app.listen(config.port, config.host, () => { + logger.info({ host: config.host, port: config.port, chainId: config.chainId, pools: pools.size }, "relayer listening"); + }); + const shutdown = (signal: string) => { + logger.info({ signal }, "relayer shutting down"); + service.stop(); + server.close((error) => { + service.provider.destroy(); + if (error) { + logger.error({ error: error.message }, "shutdown failed"); + process.exitCode = 1; + } + }); + }; + process.once("SIGINT", () => shutdown("SIGINT")); + process.once("SIGTERM", () => shutdown("SIGTERM")); +} + +main().catch((error: unknown) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/service.ts b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..aba021ec2e73bfba4a725284ac028f198f463bfa --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/service.ts @@ -0,0 +1,295 @@ +import { Contract, Interface, JsonRpcProvider, Wallet, formatEther, getAddress, keccak256, solidityPacked } from "ethers"; +import { PRIVATE_CRYP_MIX_ABI, type PoolConfig, type WithdrawalBundle } from "@privatecrypmix/sdk"; +import type { Logger } from "pino"; +import type { RelayerConfig } from "./config.js"; +import { calculateFee, feeWithinLimit } from "./fees.js"; +import { publicSignalsMatch } from "./schema.js"; +import { JobStore, type RelayJob } from "./store.js"; +import { jobs as jobGauge, nativeBalance, oldestActionableJob, transactionLatency } from "./metrics.js"; + +export class ValidationError extends Error { + constructor(message: string, readonly status = 400) { super(message); } +} + +const safeErrorMessage = (error: unknown): string => { + if (!error || typeof error !== "object") return "Unknown relay error"; + const candidate = error as { shortMessage?: unknown; reason?: unknown; code?: unknown; message?: unknown }; + const raw = typeof candidate.shortMessage === "string" + ? candidate.shortMessage + : typeof candidate.reason === "string" + ? candidate.reason + : typeof candidate.code === "string" + ? candidate.code + : typeof candidate.message === "string" + ? candidate.message + : "Unknown relay error"; + // Provider messages may embed full calldata. Do not turn proof payloads into logs. + return raw.replace(/0x[0-9a-fA-F]{16,}/gu, "[hex]").slice(0, 300); +}; + +export class RelayerService { + readonly provider: JsonRpcProvider; + readonly wallet: Wallet; + #running = false; + #timer?: NodeJS.Timeout; + + constructor( + readonly config: RelayerConfig, + readonly pools: Map, + readonly store: JobStore, + readonly logger: Logger + ) { + this.provider = new JsonRpcProvider(config.rpcUrl, config.chainId, { staticNetwork: true }); + this.wallet = new Wallet(config.privateKey, this.provider); + } + + async initialize(): Promise { + const network = await this.provider.getNetwork(); + if (Number(network.chainId) !== this.config.chainId) { + throw new Error(`RPC chain ${network.chainId} does not match configured chain ${this.config.chainId}`); + } + for (const pool of this.pools.values()) { + const mixer = new Contract(pool.mixerAddress, PRIVATE_CRYP_MIX_ABI, this.provider); + const onchainOrigin = Number(await mixer.originDomain()); + if (onchainOrigin !== pool.originDomain) { + throw new Error(`Pool manifest origin domain mismatch for ${pool.mixerAddress}`); + } + } + await this.store.initialize(); + this.#updateJobMetrics(); + nativeBalance.set(Number(formatEther(await this.provider.getBalance(this.wallet.address)))); + } + + getPool(address: string): PoolConfig { + let normalized: string; + try { normalized = getAddress(address); } catch { throw new ValidationError("Invalid mixer address"); } + const pool = this.pools.get(normalized.toLowerCase()); + if (!pool) throw new ValidationError("Mixer is not allowlisted", 404); + return pool; + } + + async quote(mixerAddress: string, destinationDomain: number): Promise<{ relayer: string; fee: string; payout: string; expiresAt: string }> { + const pool = this.getPool(mixerAddress); + if (!pool.destinations.some((destination) => destination.domain === destinationDomain)) { + throw new ValidationError("Destination domain is not allowlisted"); + } + const mixer = new Contract(pool.mixerAddress, PRIVATE_CRYP_MIX_ABI, this.provider); + const [snapshotted, supported, payout] = await Promise.all([ + mixer.snapshotted() as Promise, + mixer.supportedDomains(destinationDomain) as Promise, + mixer.payoutPerNote() as Promise + ]); + if (!snapshotted) throw new ValidationError("Mixer round is not snapshotted", 409); + if (!supported) throw new ValidationError("Destination is disabled on-chain", 409); + const fee = calculateFee(payout, this.config.feeBps, this.config.minimumFee); + if (fee >= payout || !feeWithinLimit(fee, payout, this.config.maxFeeBps)) { + throw new Error("Configured fee violates the relayer fee ceiling"); + } + return { + relayer: this.wallet.address, + fee: fee.toString(), + payout: payout.toString(), + expiresAt: new Date(Date.now() + 15 * 60_000).toISOString() + }; + } + + async validate(bundle: WithdrawalBundle): Promise { + const pool = this.getPool(bundle.mixerAddress); + if (bundle.chainId !== this.config.chainId) throw new ValidationError("Wrong origin chain"); + if (getAddress(bundle.relayer) !== this.wallet.address) throw new ValidationError("Proof does not pay this relayer"); + if (!publicSignalsMatch(bundle)) throw new ValidationError("Public signal list does not match withdrawal fields"); + if (!pool.destinations.some((destination) => destination.domain === bundle.destinationDomain)) { + throw new ValidationError("Destination domain is not allowlisted"); + } + + const mixer = new Contract(pool.mixerAddress, PRIVATE_CRYP_MIX_ABI, this.wallet); + const [knownRoot, spent, supported, snapshotted, payout] = await Promise.all([ + mixer.isKnownRoot(bundle.root) as Promise, + mixer.nullifierHashes(bundle.nullifierHash) as Promise, + mixer.supportedDomains(bundle.destinationDomain) as Promise, + mixer.snapshotted() as Promise, + mixer.payoutPerNote() as Promise + ]); + if (!knownRoot) throw new ValidationError("Merkle root is no longer known", 409); + if (spent) throw new ValidationError("Nullifier is already spent", 409); + if (!supported) throw new ValidationError("Destination is disabled on-chain", 409); + if (!snapshotted) throw new ValidationError("Mixer round is not snapshotted", 409); + const fee = BigInt(bundle.fee); + const expectedFee = calculateFee(payout, this.config.feeBps, this.config.minimumFee); + if (fee !== expectedFee || !feeWithinLimit(fee, payout, this.config.maxFeeBps)) { + throw new ValidationError("Proof contains an invalid or expired relayer fee"); + } + + const nativeValue = bundle.destinationDomain === pool.originDomain ? 0n : this.config.xcallNativeFee; + try { + await mixer.withdraw.staticCall( + bundle.proof, + bundle.root, + bundle.nullifierHash, + bundle.recipient, + bundle.relayer, + bundle.fee, + bundle.destinationDomain, + { value: nativeValue } + ); + } catch { + throw new ValidationError("On-chain preflight rejected the proof", 422); + } + return pool; + } + + async enqueue(bundle: WithdrawalBundle): Promise<{ job: RelayJob; created: boolean }> { + await this.validate(bundle); + const jobId = keccak256(solidityPacked( + ["uint256", "address", "bytes32"], + [bundle.chainId, bundle.mixerAddress, bundle.nullifierHash] + )); + const now = new Date().toISOString(); + const result = await this.store.create({ + id: jobId, + status: "queued", + bundle, + attempts: 0, + createdAt: now, + updatedAt: now, + nextAttemptAt: now + }); + this.#updateJobMetrics(); + return result; + } + + start(): void { + if (this.#timer) return; + this.#timer = setInterval(() => void this.tick(), this.config.pollMs); + this.#timer.unref(); + void this.tick(); + } + + stop(): void { + if (this.#timer) clearInterval(this.#timer); + this.#timer = undefined; + } + + async tick(): Promise { + if (this.#running) return; + this.#running = true; + try { + const now = Date.now(); + const candidates = this.store.list().filter((job) => + (job.status === "queued" || job.status === "retrying" || job.status === "broadcast") + && Date.parse(job.nextAttemptAt) <= now + ).sort((a, b) => a.createdAt.localeCompare(b.createdAt)); + const job = candidates[0]; + if (!job) return; + if (job.status === "broadcast") await this.#checkBroadcast(job); + else await this.#broadcast(job); + } finally { + this.#running = false; + this.#updateJobMetrics(); + void this.provider.getBalance(this.wallet.address) + .then((balance) => nativeBalance.set(Number(formatEther(balance)))) + .catch(() => undefined); + } + } + + async #broadcast(job: RelayJob): Promise { + const pool = this.getPool(job.bundle.mixerAddress); + const mixer = new Contract(pool.mixerAddress, PRIVATE_CRYP_MIX_ABI, this.wallet); + const nativeValue = job.bundle.destinationDomain === pool.originDomain ? 0n : this.config.xcallNativeFee; + try { + // Revalidate immediately before spending gas. + await this.validate(job.bundle); + const transaction = await mixer.withdraw( + job.bundle.proof, + job.bundle.root, + job.bundle.nullifierHash, + job.bundle.recipient, + job.bundle.relayer, + job.bundle.fee, + job.bundle.destinationDomain, + { value: nativeValue } + ); + await this.store.update(job.id, { + status: "broadcast", + attempts: job.attempts + 1, + txHash: transaction.hash, + broadcastAt: new Date().toISOString(), + error: undefined, + nextAttemptAt: new Date(Date.now() + this.config.pollMs).toISOString() + }); + this.logger.info({ jobId: job.id, txHash: transaction.hash }, "relay transaction broadcast"); + } catch (error) { + await this.#retryOrFail(job, error, true); + } + } + + async #checkBroadcast(job: RelayJob): Promise { + if (!job.txHash) { + await this.#retryOrFail(job, new Error("Broadcast job has no transaction hash"), false); + return; + } + try { + const receipt = await this.provider.getTransactionReceipt(job.txHash); + if (!receipt) { + const transaction = await this.provider.getTransaction(job.txHash); + const broadcastAge = Date.now() - Date.parse(job.broadcastAt ?? job.updatedAt); + if (!transaction && broadcastAge >= this.config.stuckTransactionMs) { + await this.#retryOrFail(job, new Error("Broadcast transaction was dropped"), false); + return; + } + await this.store.update(job.id, { nextAttemptAt: new Date(Date.now() + this.config.pollMs).toISOString() }); + return; + } + if (receipt.status !== 1) throw new Error("Relay transaction reverted"); + const latest = await this.provider.getBlockNumber(); + if (latest - receipt.blockNumber + 1 < this.config.confirmations) { + await this.store.update(job.id, { nextAttemptAt: new Date(Date.now() + this.config.pollMs).toISOString() }); + return; + } + const parser = new Interface(PRIVATE_CRYP_MIX_ABI); + let transferId: string | undefined; + for (const log of receipt.logs) { + try { + const event = parser.parseLog(log); + if (event?.name === "Withdrawal" && String(event.args.nullifierHash).toLowerCase() === job.bundle.nullifierHash.toLowerCase()) { + transferId = String(event.args.transferId); + break; + } + } catch { + // Receipt also contains ERC-20 and Connext logs. + } + } + await this.store.update(job.id, { status: "confirmed", confirmedBlock: receipt.blockNumber, transferId, error: undefined }); + transactionLatency.observe((Date.now() - Date.parse(job.updatedAt)) / 1_000); + this.logger.info({ jobId: job.id, txHash: job.txHash, blockNumber: receipt.blockNumber }, "relay transaction confirmed"); + } catch (error) { + await this.#retryOrFail(job, error, false); + } + } + + async #retryOrFail(job: RelayJob, error: unknown, countAttempt: boolean): Promise { + const attempts = job.attempts + (countAttempt ? 1 : 0); + const terminal = attempts >= this.config.maxAttempts; + const reason = safeErrorMessage(error); + await this.store.update(job.id, { + status: terminal ? "failed" : "retrying", + attempts, + error: reason, + nextAttemptAt: new Date(Date.now() + Math.min(300_000, this.config.pollMs * 2 ** Math.min(attempts, 6))).toISOString() + }); + if (terminal) this.logger.error({ jobId: job.id, attempts, reason }, "relay job failed"); + else this.logger.warn({ jobId: job.id, attempts, reason }, "relay job scheduled for retry"); + } + + #updateJobMetrics(): void { + const counts = new Map(); + const storedJobs = this.store.list(); + for (const job of storedJobs) counts.set(job.status, (counts.get(job.status) ?? 0) + 1); + for (const status of ["queued", "broadcast", "confirmed", "retrying", "failed"]) { + jobGauge.set({ status }, counts.get(status) ?? 0); + } + const actionable = storedJobs.filter((job) => job.status === "queued" || job.status === "retrying"); + const oldest = actionable.reduce((age, job) => Math.max(age, (Date.now() - Date.parse(job.createdAt)) / 1_000), 0); + oldestActionableJob.set(oldest); + } +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/store.ts b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/store.ts new file mode 100644 index 0000000000000000000000000000000000000000..49f0730a832a7a0dd3b951595f54cf7de73e05cf --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/src/store.ts @@ -0,0 +1,92 @@ +import { mkdir, readFile, rename, writeFile } from "node:fs/promises"; +import path from "node:path"; +import type { WithdrawalBundle } from "@privatecrypmix/sdk"; + +export type JobStatus = "queued" | "broadcast" | "confirmed" | "retrying" | "failed"; + +export interface RelayJob { + id: string; + status: JobStatus; + bundle: WithdrawalBundle; + attempts: number; + createdAt: string; + updatedAt: string; + nextAttemptAt: string; + txHash?: string | undefined; + error?: string | undefined; + confirmedBlock?: number | undefined; + transferId?: string | undefined; + broadcastAt?: string | undefined; +} + +interface StoreFile { version: 1; jobs: RelayJob[] } + +export class JobStore { + readonly #file: string; + readonly #jobs = new Map(); + #writeQueue: Promise = Promise.resolve(); + + constructor(file: string) { + this.#file = file; + } + + async initialize(): Promise { + await mkdir(path.dirname(this.#file), { recursive: true }); + try { + const parsed = JSON.parse(await readFile(this.#file, "utf8")) as StoreFile; + if (parsed.version !== 1 || !Array.isArray(parsed.jobs)) throw new Error("Unsupported job-store format"); + for (const job of parsed.jobs) this.#jobs.set(job.id, job); + } catch (error) { + if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error; + await this.#persist(); + } + } + + get(id: string): RelayJob | undefined { + const job = this.#jobs.get(id); + return job ? structuredClone(job) : undefined; + } + + list(): RelayJob[] { + return [...this.#jobs.values()].map((job) => structuredClone(job)); + } + + async create(job: RelayJob): Promise<{ job: RelayJob; created: boolean }> { + const existing = this.#jobs.get(job.id); + if (existing) return { job: structuredClone(existing), created: false }; + this.#jobs.set(job.id, structuredClone(job)); + await this.#persist(); + return { job: structuredClone(job), created: true }; + } + + async update(id: string, patch: Partial>): Promise { + const current = this.#jobs.get(id); + if (!current) throw new Error(`Relay job ${id} does not exist`); + const updated: RelayJob = { ...current, ...patch, updatedAt: new Date().toISOString() }; + this.#jobs.set(id, updated); + await this.#persist(); + return structuredClone(updated); + } + + async #persist(): Promise { + this.#writeQueue = this.#writeQueue.then(async () => { + const temporary = `${this.#file}.tmp`; + const body: StoreFile = { version: 1, jobs: [...this.#jobs.values()] }; + await writeFile(temporary, `${JSON.stringify(body, null, 2)}\n`, { mode: 0o600 }); + await rename(temporary, this.#file); + }); + await this.#writeQueue; + } +} + +export const publicJob = (job: RelayJob) => ({ + id: job.id, + status: job.status, + attempts: job.attempts, + createdAt: job.createdAt, + updatedAt: job.updatedAt, + txHash: job.txHash ?? null, + confirmedBlock: job.confirmedBlock ?? null, + transferId: job.transferId ?? null, + error: job.status === "failed" ? job.error ?? "Submission failed" : null +}); diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/test/fees.test.ts b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/test/fees.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..b8940726e3e02b44537fb18649b357e7d1b1e743 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/test/fees.test.ts @@ -0,0 +1,65 @@ +import { afterEach, describe, expect, it } from "vitest"; +import { mkdtemp, readFile, rm } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import { calculateFee, feeWithinLimit } from "../src/fees.js"; +import { expectedPublicSignals, parseWithdrawal, publicSignalsMatch } from "../src/schema.js"; +import { JobStore, type RelayJob } from "../src/store.js"; +import type { WithdrawalBundle } from "@privatecrypmix/sdk"; + +const address = "0x1111111111111111111111111111111111111111"; +const bundle: WithdrawalBundle = { + proof: { a: ["1", "2"], b: [["3", "4"], ["5", "6"]], c: ["7", "8"] }, + root: `0x${"01".padStart(64, "0")}`, + nullifierHash: `0x${"02".padStart(64, "0")}`, + recipient: address, + relayer: address, + fee: "5", + destinationDomain: 9999, + mixerAddress: address, + chainId: 137, + publicSignals: [] +}; +bundle.publicSignals = expectedPublicSignals(bundle); + +describe("relayer fee policy", () => { + it("uses the greater of proportional and minimum fees", () => { + expect(calculateFee(1_000_000n, 50, 0n)).toBe(5_000n); + expect(calculateFee(1_000_000n, 50, 9_000n)).toBe(9_000n); + }); + it("enforces the configured ceiling without rounding surprises", () => { + expect(feeWithinLimit(20_000n, 1_000_000n, 200)).toBe(true); + expect(feeWithinLimit(20_001n, 1_000_000n, 200)).toBe(false); + }); +}); + +describe("withdrawal request boundary", () => { + it("accepts a proof-only request whose public signals match", () => { + const parsed = parseWithdrawal(bundle); + expect(publicSignalsMatch(parsed)).toBe(true); + }); + it("rejects secret-note fields and mismatched public signals", () => { + expect(() => parseWithdrawal({ ...bundle, secret: "do-not-send" })).toThrow(); + expect(publicSignalsMatch({ ...bundle, fee: "6" })).toBe(false); + }); +}); + +describe("durable job store", () => { + let directory: string | undefined; + afterEach(async () => { if (directory) await rm(directory, { recursive: true, force: true }); }); + + it("atomically persists and deduplicates jobs", async () => { + directory = await mkdtemp(path.join(tmpdir(), "pcm-relayer-")); + const file = path.join(directory, "jobs.json"); + const store = new JobStore(file); + await store.initialize(); + const now = new Date().toISOString(); + const job: RelayJob = { id: `0x${"ab".repeat(32)}`, status: "queued", bundle, attempts: 0, createdAt: now, updatedAt: now, nextAttemptAt: now }; + expect((await store.create(job)).created).toBe(true); + expect((await store.create(job)).created).toBe(false); + await store.update(job.id, { status: "confirmed", confirmedBlock: 10 }); + const disk = JSON.parse(await readFile(file, "utf8")) as { jobs: RelayJob[] }; + expect(disk.jobs).toHaveLength(1); + expect(disk.jobs[0]?.status).toBe("confirmed"); + }); +}); diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/tsconfig.json b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..07319fa86cd4eff38ff36e2e7f35cac90732732c --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/relayer/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "NodeNext", + "moduleResolution": "NodeNext", + "rootDir": "src", + "outDir": "dist", + "lib": ["ES2022"], + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["test"] +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/Dockerfile b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..05633dd02910355d012884e1bc6a9bd263dcdf37 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/Dockerfile @@ -0,0 +1,11 @@ +FROM node:22-alpine AS build +WORKDIR /app +COPY . . +RUN npm install \ + && npm run build -w @privatecrypmix/sdk \ + && npm run build -w @privatecrypmix/web + +FROM nginx:1.27-alpine +COPY apps/web/nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/apps/web/dist /usr/share/nginx/html +EXPOSE 8080 diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/index.html b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/index.html new file mode 100644 index 0000000000000000000000000000000000000000..6d5564c60a8dbdc2a01b28fcabc9c82c75280063 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/index.html @@ -0,0 +1,17 @@ + + + + + + + + + + PrivateCrypMix + + + +
+ + + diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/nginx.conf b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..c156a7473759dc87562a766d7fb0e4ec0ff65a9a --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/nginx.conf @@ -0,0 +1,26 @@ +server { + listen 8080; + server_name _; + root /usr/share/nginx/html; + index index.html; + + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Frame-Options "DENY" always; + add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always; + add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' https: wss:; worker-src 'self' blob:; object-src 'none'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" always; + + location = /config/pools.json { + add_header Cache-Control "no-store"; + try_files $uri =404; + } + + location /circuits/ { + add_header Cache-Control "public, max-age=3600, must-revalidate"; + try_files $uri =404; + } + + location / { + try_files $uri $uri/ /index.html; + } +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/package.json b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9fca57ed7d4f7cf3902df371306a5ac43e4b46dc --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/package.json @@ -0,0 +1,35 @@ +{ + "name": "@privatecrypmix/web", + "version": "1.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "prebuild": "npm run build -w @privatecrypmix/sdk", + "pretest": "npm run build -w @privatecrypmix/sdk", + "build": "tsc -b && vite build", + "preview": "vite preview", + "test": "vitest run", + "lint": "tsc -b --pretty false", + "clean": "rm -rf dist .vite" + }, + "dependencies": { + "@coinbase/wallet-sdk": "^4.2.3", + "@privatecrypmix/sdk": "1.0.0", + "@walletconnect/ethereum-provider": "^2.17.3", + "ethers": "^6.13.5", + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@testing-library/jest-dom": "^6.6.3", + "@testing-library/react": "^16.1.0", + "@types/react": "^18.3.18", + "@types/react-dom": "^18.3.5", + "@vitejs/plugin-react": "^4.3.4", + "jsdom": "^25.0.1", + "typescript": "^5.7.3", + "vite": "^6.0.7", + "vitest": "^2.1.8" + } +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/circuits/README.md b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/circuits/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6a51d2a1de96684388457e20b0ca868e64deb708 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/circuits/README.md @@ -0,0 +1,11 @@ +# Proof artifacts + +Run the circuit ceremony exporter to place these production files here: + +- `private_crypmix.wasm` +- `private_crypmix_final.zkey` +- `verification_key.json` +- `manifest.json` + +The web application refuses to generate a proof when either required binary is +missing. Never substitute development mock data on a public deployment. diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/config/pools.example.json b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/config/pools.example.json new file mode 100644 index 0000000000000000000000000000000000000000..daf4b15a9ac771b8c9a8e2655de7df0194f94c67 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/config/pools.example.json @@ -0,0 +1,27 @@ +{ + "pools": [ + { + "id": "polygon-usdc-100-round-1", + "chainId": 137, + "chainName": "Polygon", + "rpcUrl": "https://replace-with-a-private-rpc.example", + "mixerAddress": "0x1111111111111111111111111111111111111111", + "assetAddress": "0x2222222222222222222222222222222222222222", + "assetSymbol": "USDC", + "assetDecimals": 6, + "denomination": "100000000", + "depositDeadline": 1800000000, + "unlockTimestamp": 1800604800, + "originDomain": 1886350457, + "merkleLevels": 20, + "zeroValue": "2166383900441693294538235590879055178496491962798346838098565412938054257279", + "explorerUrl": "https://polygonscan.com", + "aaveApy": 3.2, + "deploymentBlock": 70000000, + "destinations": [ + { "name": "Polygon", "chainId": 137, "domain": 1886350457 }, + { "name": "Optimism", "chainId": 10, "domain": 1869640809 } + ] + } + ] +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/config/pools.json b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/config/pools.json new file mode 100644 index 0000000000000000000000000000000000000000..e092e468f4cbcf0bbd5b849a103284e76a81c75e --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/config/pools.json @@ -0,0 +1,3 @@ +{ + "pools": [] +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/favicon.svg b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/favicon.svg new file mode 100644 index 0000000000000000000000000000000000000000..30ba54f95d8ac397514b632eb6a16cc8a8ccf566 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/public/favicon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/src/App.tsx b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/src/App.tsx new file mode 100644 index 0000000000000000000000000000000000000000..0f808745cee45cfc1d0bdd7561466a71f912e941 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/src/App.tsx @@ -0,0 +1,116 @@ +import { Contract, JsonRpcProvider } from "ethers"; +import { useCallback, useEffect, useState } from "react"; +import { PRIVATE_CRYP_MIX_ABI, type PoolConfig } from "@privatecrypmix/sdk"; +import { ConnectWallet } from "./components/ConnectWallet"; +import { DepositPanel } from "./components/DepositPanel"; +import { PoolSummary } from "./components/PoolSummary"; +import { WithdrawPanel } from "./components/WithdrawPanel"; +import { loadPools } from "./lib/config"; +import { errorMessage, formatToken } from "./lib/format"; + +type View = "deposit" | "withdraw"; + +export function App() { + const [pools, setPools] = useState([]); + const [selected, setSelected] = useState(null); + const [view, setView] = useState("deposit"); + const [loading, setLoading] = useState(true); + const [configError, setConfigError] = useState(null); + const [depositCount, setDepositCount] = useState(null); + const [snapshot, setSnapshot] = useState(null); + const [payout, setPayout] = useState(null); + const [refreshKey, setRefreshKey] = useState(0); + + useEffect(() => { + const controller = new AbortController(); + loadPools(controller.signal).then((configured) => { + setPools(configured); + setSelected(configured[0] ?? null); + }).catch((error: unknown) => setConfigError(errorMessage(error))).finally(() => setLoading(false)); + return () => controller.abort(); + }, []); + + const refresh = useCallback(() => setRefreshKey((value) => value + 1), []); + useEffect(() => { + if (!selected) return; + let active = true; + setDepositCount(null); + setSnapshot(null); + setPayout(null); + const provider = new JsonRpcProvider(selected.rpcUrl, selected.chainId, { staticNetwork: true }); + const mixer = new Contract(selected.mixerAddress, PRIVATE_CRYP_MIX_ABI, provider); + Promise.all([mixer.depositCount(), mixer.snapshotted(), mixer.payoutPerNote()]).then(([count, snapshotted, payoutValue]) => { + if (!active) return; + setDepositCount(Number(count)); + setSnapshot(Boolean(snapshotted)); + setPayout(BigInt(payoutValue)); + }).catch(() => { + if (!active) return; + setDepositCount(null); + setSnapshot(null); + setPayout(null); + }); + return () => { active = false; }; + }, [selected, refreshKey]); + + if (loading) return
P
Loading private pools…
; + if (configError) return
P

Configuration error

{configError}

; + if (!selected) return ( +
+
P
+

No mixer rounds configured

+

Deploy a round, then copy its manifest entry to apps/web/public/config/pools.json.

+ docs/runbook.md +
+ ); + + return ( +
+
+ PPrivateCrypMix +
{selected.chainName}source
+ + +
+ +
+
+
◈ Fixed outputs · local proofs · cross-chain exits
+

Move value without
leaving a trail.

+

Join a fixed-size anonymity set on Polygon. Your funds earn through Aave during the mandatory privacy window, then exit locally or across supported chains.

+
+
{depositCount ?? "—"}notes in this round
+
{snapshot && payout !== null ? formatToken(payout, selected.assetDecimals) : "Variable"}{snapshot ? `${selected.assetSymbol} per note` : "final payout"}
+
20Merkle levels
+
+
+ +
+
+
+ + +
+ +
+
+ {view === "deposit" + ? + : } + +
+
+ +
+
01Generate

A nullifier and secret are created only on your device.

+
02Wait & earn

A common unlock time broadens the set and hides deposit age.

+
03Prove & exit

A zero-knowledge proof spends the note without revealing its leaf.

+
+
+ +
PrivateCrypMix · Experimental software, unauditedNo analytics · No note custody · Open source
+
+ ); +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/src/components/ConnectWallet.tsx b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/src/components/ConnectWallet.tsx new file mode 100644 index 0000000000000000000000000000000000000000..8bc88f8cdbc4ac5a69297d2c201b745ce5be63c0 --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/src/components/ConnectWallet.tsx @@ -0,0 +1,61 @@ +import { useState } from "react"; +import type { PoolConfig } from "@privatecrypmix/sdk"; +import { useWallet, type WalletKind } from "../providers/WalletProvider"; +import { errorMessage } from "../lib/format"; + +const choices: Array<{ id: WalletKind; title: string; detail: string; mark: string }> = [ + { id: "injected", title: "Browser wallet", detail: "MetaMask and injected wallets", mark: "↗" }, + { id: "walletconnect", title: "WalletConnect", detail: "Scan from a mobile wallet", mark: "◎" }, + { id: "coinbase", title: "Coinbase Wallet", detail: "Extension or smart wallet", mark: "C" } +]; + +export function ConnectWallet({ pool, compact = false }: { pool: PoolConfig; compact?: boolean }) { + const wallet = useWallet(); + const [open, setOpen] = useState(false); + const [error, setError] = useState(null); + + if (wallet.account) { + return ( + + ); + } + const choose = async (kind: WalletKind) => { + setError(null); + try { + await wallet.connect(kind, pool); + setOpen(false); + } catch (reason) { + setError(errorMessage(reason)); + } + }; + return ( + <> + + {open && ( +
setOpen(false)}> +
event.stopPropagation()}> + +
Secure connection
+

Choose a wallet

+

A connection is required only to approve deposits or submit transactions. Note secrets stay in this browser.

+
+ {choices.map((choice) => ( + + ))} +
+ {error &&
{error}
} +
+
+ )} + + ); +} diff --git a/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/src/components/DepositPanel.tsx b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/src/components/DepositPanel.tsx new file mode 100644 index 0000000000000000000000000000000000000000..307d1befe2018c65614f2dfdbaec78ece6eb60ac --- /dev/null +++ b/_checkpoint/lineages/6a0b96274dc7423f8d0f5a5548172bf2b7ddb79e91829028ef77d6be90ef24ee/generations/e992db6a774f725d37e91c1e4514815fd275a2fc0ae967d5e2e9685d579f11ce/deliverable_files/0e386e32-df20-4d1f-b536-7159bc409ad5/PrivateCrypMix/apps/web/src/components/DepositPanel.tsx @@ -0,0 +1,177 @@ +import { Contract, Interface } from "ethers"; +import { useEffect, useMemo, useState } from "react"; +import { + ERC20_ABI, + PRIVATE_CRYP_MIX_ABI, + createNote, + finalizeNote, + serializeNote, + type PoolConfig, + type PrivacyNoteV1 +} from "@privatecrypmix/sdk"; +import { useWallet } from "../providers/WalletProvider"; +import { ConnectWallet } from "./ConnectWallet"; +import { errorMessage, formatDate, formatToken } from "../lib/format"; + +type Stage = "idle" | "creating" | "ready" | "approving" | "depositing" | "confirmed"; + +const downloadText = (filename: string, contents: string) => { + const url = URL.createObjectURL(new Blob([`${contents}\n`], { type: "text/plain;charset=utf-8" })); + const anchor = document.createElement("a"); + anchor.href = url; + anchor.download = filename; + anchor.click(); + URL.revokeObjectURL(url); +}; + +export function DepositPanel({ pool, onConfirmed }: { pool: PoolConfig; onConfirmed: () => void }) { + const wallet = useWallet(); + const [stage, setStage] = useState("idle"); + const [note, setNote] = useState(null); + const [serialized, setSerialized] = useState(""); + const [backedUp, setBackedUp] = useState(false); + const [error, setError] = useState(null); + const [transactionHash, setTransactionHash] = useState(null); + + useEffect(() => { + setStage("idle"); + setNote(null); + setSerialized(""); + setBackedUp(false); + setError(null); + setTransactionHash(null); + }, [pool.id]); + + const closed = Date.now() / 1_000 >= pool.depositDeadline; + const amountLabel = `${formatToken(pool.denomination, pool.assetDecimals)} ${pool.assetSymbol}`; + const stageNumber = stage === "idle" || stage === "creating" ? 1 : stage === "ready" || stage === "approving" || stage === "depositing" ? 2 : 3; + const noteFilename = useMemo(() => `privatecrypmix-${pool.assetSymbol.toLowerCase()}-${note?.commitment.slice(2, 10) ?? "note"}.txt`, [note, pool.assetSymbol]); + + const makeNote = async () => { + setError(null); + setStage("creating"); + try { + const next = await createNote(pool); + setNote(next); + setSerialized(serializeNote(next)); + setStage("ready"); + } catch (reason) { + setError(errorMessage(reason)); + setStage("idle"); + } + }; + + const submitDeposit = async () => { + if (!note || !wallet.signer || !wallet.account) return; + setError(null); + try { + if (wallet.chainId !== pool.chainId) await wallet.switchTo(pool); + const token = new Contract(pool.assetAddress, ERC20_ABI, wallet.signer); + const mixer = new Contract(pool.mixerAddress, PRIVATE_CRYP_MIX_ABI, wallet.signer); + const denomination = BigInt(pool.denomination); + const allowance = await token.allowance(wallet.account, pool.mixerAddress) as bigint; + const confirmations = Math.max(1, Number(import.meta.env.VITE_CONFIRMATIONS ?? 1)); + if (allowance < denomination) { + setStage("approving"); + const approval = await token.approve(pool.mixerAddress, denomination); + await approval.wait(confirmations); + } + setStage("depositing"); + const transaction = await mixer.deposit(note.commitment); + const receipt = await transaction.wait(confirmations); + if (!receipt) throw new Error("Deposit receipt was not returned"); + const parser = new Interface(PRIVATE_CRYP_MIX_ABI); + let leafIndex: number | null = null; + for (const log of receipt.logs) { + try { + const decoded = parser.parseLog(log); + if (decoded?.name === "Deposit" && String(decoded.args.commitment).toLowerCase() === note.commitment.toLowerCase()) { + leafIndex = Number(decoded.args.leafIndex); + break; + } + } catch { + // Receipt also includes ERC-20/Aave logs. + } + } + if (leafIndex === null) throw new Error("Deposit event was not found in the confirmed receipt"); + const finalNote = finalizeNote(note, leafIndex, receipt.hash); + setNote(finalNote); + setSerialized(serializeNote(finalNote)); + setTransactionHash(receipt.hash); + setStage("confirmed"); + setBackedUp(false); + onConfirmed(); + } catch (reason) { + setError(errorMessage(reason)); + setStage("ready"); + } + }; + + return ( +
+
+
Private entry

Deposit {amountLabel}

+
= 2 ? "active" : ""} />= 3 ? "active" : ""} />
+
+ + {stage === "idle" || stage === "creating" ? ( + <> +
+ ⌛ +
Funds unlock no earlier than {formatDate(pool.unlockTimestamp)}

The round first closes to new deposits, then remains invested through the full privacy delay. Early withdrawal is impossible.

+
+
+
You deposit{amountLabel}
+
Yield sourceAave on {pool.chainName}
+
Withdrawal routes{pool.destinations.length} supported chains
+
+ {!wallet.account ? ( + + ) : ( + + )} +

Secret material is generated locally using your browser's secure random source.

+ + ) : ( + <> +
+ {stage === "confirmed" ? "✓" : "!"} +
+ {stage === "confirmed" ? "Deposit confirmed — save the updated note" : "Back up this recovery note before depositing"} +

{stage === "confirmed" ? "The leaf index and transaction reference are now included." : "It is the only way to withdraw. PrivateCrypMix cannot recover it."}

+
+
+ +
SystemWell IDDepth (ft)AquiferReported pumpagePriority
Farmer CityWL47648188S= +and & Gravel26,478,500First-pass
Farme= +r CityWL47646180Sand & Gravel21,976,2= +00First-pass
WeldonWL45047167Sand & Gravel5,500,000Secondary