Skip to content

itodo001/StellarSwipe-Contract

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

787 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributing to StellarSwipe-Contract

Scaffold a new contract crate

Use the scaffold generator to create a new contract crate already wired with the shared Pausable, Initializable, and StorageTrait conventions:

# From the repository root
./stellar-swipe/scripts/scaffold_contract.sh <contract_name>

Example

./stellar-swipe/scripts/scaffold_contract.sh reward_distributor

This creates:

stellar-swipe/contracts/reward_distributor/
├── Cargo.toml          # depends on soroban-sdk + stellar-swipe-common
└── src/
    ├── lib.rs          # initialize / pause / unpause / storage_write / storage_read
    └── tests.rs        # starter tests covering init, pause, storage round-trip

The workspace Cargo.toml is updated automatically to include the new crate.

Verify the scaffold

cd stellar-swipe
cargo test   -p stellar-swipe-reward-distributor
cargo clippy -p stellar-swipe-reward-distributor -- -D warnings

Both should pass with no manual fixes required.

What the scaffold includes

Feature Implementation
Initializable guard initialize() panics/returns error on double-init
Pausable pause() / unpause() / is_paused() with events
StorageTrait pattern storage_write(key, value) / storage_read(key) blocked while paused
Starter test file tests.rs with 5 tests covering all three features

Extend DataKey and {ContractName}Error with your contract-specific variants before adding business logic.

About

Soroban smart contracts powering StellarSwipe — a decentralized, swipe-to-copy-trade DApp on the Stellar network.

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 94.3%
  • TypeScript 3.3%
  • Shell 2.0%
  • CSS 0.2%
  • Python 0.2%
  • Makefile 0.0%