Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stellasure Smart Contract

Non-custodial recurring payment scheduler on Stellar Soroban.

🚀 Deployed on Stellar Testnet
Contract ID: CAS5UCX4OPDXDSKZN2IM4DMJ6J34YIFKQTONXCW2GBR3P5E6TLKVVNM7

📊 View on Stellar Expert | 🔬 View on Stellar Lab

⚠️ Important: Users must approve tokens separately before creating schedules. The contract no longer handles token approval internally to avoid complex authorization issues.

Overview

Stellasure enables users to set up recurring payments on Stellar without giving up custody of their funds. Users authorize a payment schedule once, and payments are automatically executed at specified intervals by permissionless relayers.

Features

  • Non-custodial: Users maintain full control of their funds
  • Flexible Payment Modes: Equal split or fixed amount per recipient
  • Multi-recipient Support: Send to multiple addresses in one schedule
  • Permissionless Execution: Anyone can trigger due payments
  • Full Control: Payers can reschedule, update, or cancel anytime
  • Event Emissions: All actions emit events for UI/relayer tracking
  • Token Support: Works with USDC, XLM, and any Stellar token

Quick Start

Prerequisites

# Ensure you have stellar-cli installed
stellar --version

Build

stellar contract build

Test

cargo test

Deploy

./deploy.sh testnet alice

See DEPLOYMENT.md for detailed deployment instructions.

Contract Functions

Core Functions

  • create_schedule - Create a new recurring payment schedule
  • execute_schedule - Execute a due payment (permissionless)
  • reschedule - Modify the next payment date
  • update_schedule - Update amount, interval, or split mode
  • cancel - Stop recurring payments permanently

Query Functions

  • get_schedule - Retrieve schedule details by ID
  • get_user_schedules - Get all schedule IDs for a user

Payment Modes

Equal Split

Total amount is divided equally among all recipients.

SplitMode::EqualSplit

Fixed Amount

Each recipient receives the full specified amount.

SplitMode::FixedAmount

Architecture

┌─────────────┐
│   Payer     │ Creates schedule, authorizes token transfers
└──────┬──────┘
       │
       ▼
┌─────────────────────┐
│ Stellasure Contract │ Stores schedules, enforces rules
└─────────┬───────────┘
          │
          ▼
┌─────────────┐
│  Relayer    │ Monitors schedules, triggers execution
└─────────────┘
          │
          ▼
┌─────────────┐
│ Recipients  │ Receive payments automatically
└─────────────┘

Project Structure

stellasure/
├── contracts/
│   └── stellasure/
│       ├── src/
│       │   ├── lib.rs      # Main contract logic
│       │   └── test.rs     # Comprehensive test suite
│       └── Cargo.toml
├── Cargo.toml
├── DEPLOYMENT.md           # Deployment guide
├── deploy.sh               # Deployment script
└── README.md

Security

  • Authorization: Only payers can modify their schedules
  • Timing Enforcement: Payments can only execute when due
  • Event Transparency: All actions emit events
  • Validation: Strict input validation on all parameters

Testing

Run the full test suite:

cargo test

Tests cover:

  • Schedule creation with validation
  • Equal split and fixed amount execution
  • Authorization checks
  • Rescheduling and updates
  • Cancellation
  • Edge cases and error conditions

Events

Event Description
created Schedule created
executed Payment executed
resched Schedule rescheduled
updated Schedule parameters updated
cancel Schedule cancelled

Use Cases

  • Subscriptions: Monthly service payments
  • Payroll: Regular salary distributions
  • DCA: Dollar-cost averaging for investments
  • Allowances: Recurring allowance payments
  • Bill Payments: Automated recurring bills

Usage Example

1. Approve Tokens (One-time)

stellar contract invoke \
  --id <TOKEN_CONTRACT_ID> \
  --source <YOUR_IDENTITY> \
  --network testnet \
  -- \
  approve \
  --from <YOUR_ADDRESS> \
  --spender CAS5UCX4OPDXDSKZN2IM4DMJ6J34YIFKQTONXCW2GBR3P5E6TLKVVNM7 \
  --amount 9223372036854775807 \
  --expiration_ledger 3110400

2. Create Schedule

stellar contract invoke \
  --id CAS5UCX4OPDXDSKZN2IM4DMJ6J34YIFKQTONXCW2GBR3P5E6TLKVVNM7 \
  --source <YOUR_IDENTITY> \
  --network testnet \
  -- \
  create_schedule \
  --payer <YOUR_ADDRESS> \
  --recipients '["<RECIPIENT_ADDRESS>"]' \
  --token <TOKEN_CONTRACT_ID> \
  --amount 10000000 \
  --interval_secs 86400 \
  --start_ts <FUTURE_TIMESTAMP> \
  --split_mode FixedAmount

3. Execute Schedule (Permissionless)

stellar contract invoke \
  --id CAS5UCX4OPDXDSKZN2IM4DMJ6J34YIFKQTONXCW2GBR3P5E6TLKVVNM7 \
  --source <YOUR_IDENTITY> \
  --network testnet \
  -- \
  execute_schedule \
  --schedule_id 1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages