Stellar Contract Utils
Utilities for Stellar contracts.
Modules
Pausable
The pausable module provides functionality to pause and unpause contract operations for emergency situations or maintenance.
Usage Examples
use ;
use ;
use ;
use ;
;
Upgradeable
The upgradeable module provides a framework for safe contract upgrades and migrations with version control.
Usage Examples
Simple Upgrade (Upgradeable):
use ;
use ;
use UpgradeableInternal;
use ;
;
Crypto
The crypto module provides cryptographic utilities including hash functions and Merkle tree verification.
Usage Examples
use ;
use ;
Features
- Hash Functions: SHA-256 and Keccak-256 implementations
- Merkle Verification: Verify Merkle proofs for data integrity
- Utility Functions: Hash pairs and commutative hashing
Merkle Distributor
The merkle_distributor module implements a Merkle-based claim distribution system for snapshot-based voting and token distributions.
Features
- Indexed Claims: Claims are indexed by position in the Merkle tree
- Flexible Leaf Structure: Support for custom claim data structures
- Use Cases: Token airdrops, NFT distributions, allowlists, snapshot voting
Installation
Add this to your Cargo.toml:
[]
# We recommend pinning to a specific version, because rapid iterations are expected as the library is in an active development phase.
= "=0.6.0"
# Add this if you want to use macros
= "=0.6.0"
Examples
See the following examples in the repository:
examples/pausable/- Pausable contract functionalityexamples/upgradeable/- Contract upgrade patternsexamples/fungible-merkle-airdrop/- Merkle-based token distribution
License
This package is part of the Stellar Contracts library and follows the same licensing terms.