How spaceandtimefdn/sxt-zkpay-contracts works
Project type and purpose
• This is a Solidity-based smart contract repository (ZKPay on Space and Time) built with Foundry.
• It provides zero-knowledge payment contracts, plus off-chain deployment and testing scripts, CI/CD checks, and security analysis configs.
File structure
• src/
– interfaces/ : external contract interfaces
– libraries/ : shared Solidity libraries
– (presumed) contracts/ : ZKPay core contracts (not shown but expected under src/)
• test/
– libraries/, mocks/, scenarios/ : Foundry tests, mock contracts, scenario tests
• script/
– input/config.json : parameters and verifying keys for deployment
– output/output.json : deployment metadata
• jobs/ : shell scripts for coverage measurement and deployment
• .github/workflows/ : GitHub Actions for linting, testing, and coverage
• slither*.json : static-analysis configuration
• foundry.toml, remappings.txt, soldeer.lock : Foundry build & dependency configs
Main components
A. On-chain layer
– ZKPay Smart Contracts (grouped into Interfaces, Libraries, Core Contracts)
– Ethereum/Space and Time network (blockchain node)
B. Off-chain tooling & pipeline
– Developer workstation (writes contracts and tests)
– Foundry toolkit (forge build/test)
– slither static analyzer
– Deployment scripts (jobs/deploy.sh, script/*)
– Test harness (jobs/check_coverage.sh)
C. CI/CD platform
– GitHub Actions (runs lint-and-test workflow)
D. External services
– Verifier or ZKP proving service (if separate)
– Config store (config.json inputs)
Relationships and interactions
• Developer commits → GitHub Actions
– Runs lint, slither, forge tests → generates coverage reports
• Deployment pipeline
– config.json → deploy.sh/script → publishes contract bytecode to blockchain → script/output/output.json
• Testing harness
– forge test → exercises contracts on local in-memory chain
• On-chain runtime
– EOA/User → ZKPay contracts → reads libraries & interfaces → writes to blockchain state
• Optional ZK prover
– Off-chain prover service → returns proof → submitted to verifier contract
Architectural patterns and design principles
• Modularity: separate Interfaces vs. Libraries vs. Core Contracts
• Layered workflow: local dev/test environment, CI pipeline, production deployment
• Single responsibility: each deployment script or test scenario does one job
• Defensible security: slither configs for both general and OZ-specific checks
Essential architecture without over-splitting
• Five core domains:
1. Developer & Local Test (Foundry)
2. CI/CD (GitHub Actions + Slither)
3. Deployment Scripts (jobs + script/)
4. On-Chain Contracts (Interfaces, Libraries, Core)
5. External Services (Blockchain, ZK prover)