This repository houses the Soroban smart contracts for Zendvo, a decentralized time-locked gifting platform built on Stellar.
zendvocontract/
├── contracts/
│ └── time_lock/ # Core gift escrow contract
│ ├── src/
│ │ ├── lib.rs # Module definitions & exports
│ │ ├── contract.rs # Main contract implementation (Entry point)
│ │ ├── storage.rs # Centralized storage access & TTL management
│ │ ├── oracle.rs # Oracle logic & price caching
│ │ ├── slippage.rs # Slippage validation logic
│ │ ├── types.rs # Shared data structures
│ │ ├── events.rs # Standardized event definitions
│ │ ├── errors.rs # Contract-specific error codes
│ │ ├── constants.rs# Business rules & limits
│ │ └── test.rs # Modular unit tests
│ └── Cargo.toml # Contract dependencies
├── Cargo.toml # Workspace configuration
├── Makefile # Standardized development workflows
└── README.md # You are here
The time_lock contract follows a modular architecture for high maintainability:
- Storage Layer (
storage.rs): Centralizes all interactions with Soroban storage. Implements structuredDataKeyusage and proactive TTL management to avoid state expiration. - Oracle Layer (
oracle.rs): Manages external price feed integration and implements efficient in-memory caching for exchange rates within a ledger. - Slippage Layer (
slippage.rs): Strictly enforces slippage bounds to protect users from volatile market conditions during gift creation and claims. - Event-Driven: Emits standardized events for all critical state changes (Initialization, Gift Claims, Config Updates).
- Rust Toolchain:
rustupwithwasm32-unknown-unknowntarget. - Soroban CLI: Recommended for network interaction.
- Make: Used for standard workflows.
This project includes a Makefile to simplify development:
make build # Build all contracts for WASM
make test # Run all unit tests
make fmt # Format the codebase
make lint # Run clippy for static analysis
make clean # Remove build artifactsZendvo showcases the power of Stellar through:
- Stablecoin Infrastructure: Utilizing USDC for value preservation.
- Modular Soroban Design: Demonstrating senior-level architecture patterns like storage centralization and TTL management.
- Low-Cost Transactions: Leveraging Stellar's efficiency for digital gifting.
The contracts serve as the backend execution layer for the Zendvo Web App. The app interacts with these contracts via the TimeLockContractClient generated by the Soroban SDK.