Skip to content

zendvolabs/zendvocontract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zendvo | Soroban Smart Contracts

https://www.zendvo.com/

This repository houses the Soroban smart contracts for Zendvo, a decentralized time-locked gifting platform built on Stellar.

Project Structure

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

Architecture: time_lock

The time_lock contract follows a modular architecture for high maintainability:

  • Storage Layer (storage.rs): Centralizes all interactions with Soroban storage. Implements structured DataKey usage 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).

Development Guide

Prerequisites

  • Rust Toolchain: rustup with wasm32-unknown-unknown target.
  • Soroban CLI: Recommended for network interaction.
  • Make: Used for standard workflows.

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 artifacts

Benefits to the Stellar Ecosystem

Zendvo showcases the power of Stellar through:

  1. Stablecoin Infrastructure: Utilizing USDC for value preservation.
  2. Modular Soroban Design: Demonstrating senior-level architecture patterns like storage centralization and TTL management.
  3. Low-Cost Transactions: Leveraging Stellar's efficiency for digital gifting.

Integration

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.

About

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors