Skip to content

ScaffoldRust/SRust-Soroban-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 

Repository files navigation

Soroban Smart Contracts

Maintainers🛠️


Diego Barquero

Sebástian Salazar

Matias Aguilar

Brandon Fernández

📖 Table of Contents

  1. 🔧 Prerequisites
  2. ⚙️ Environment Setup
  3. 💰 Wallet Configuration
  4. 🛠️ Build & Deployment
  5. ✅ Testing & Execution
  6. 📌 Example
  7. ❓ Troubleshooting

🔧 Prerequisites

Before starting, make sure you have the following dependencies installed:

1️⃣ Install Rust

  • For Linux/macOS:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • For Windows:
    Download and install Rust from rust-lang.org.

  • Add WebAssembly Target:

    rustup target add wasm32-unknown-unknown

2️⃣ Install Soroban CLI

  • Using Cargo:

    cargo install --locked soroban-cli
  • Using Homebrew (macOS, Linux):

    brew install soroban-cli

⚙️ Environment Setup

  1. Clone the repository

    git clone https://github.com/your-user/your-repo.git
    cd your-repo/packages/soroban
  2. Build the contract

    soroban build
  3. Run tests

    cargo test

💰 Wallet Configuration

  1. Install a Stellar wallet (e.g., Freighter Wallet).
  2. Create a new wallet and securely store your secret keys.
  3. Connect the wallet to the Stellar testnet.

🛠️ Build & Deployment

  1. Compile the contract in release mode

    cargo build --release --target wasm32-unknown-unknown
  2. Deploy the contract using Soroban CLI

    soroban contract deploy --wasm target/wasm32-unknown-unknown/release/your_contract.wasm

✅ Testing & Execution

Run unit tests:

cargo test

Interact with the deployed contract using Soroban CLI or supported wallet tools.


📌 Example

For a practical example of how to interact with these contracts, check out Stellar’s official documentation on Smart Contracts.


🤝 Contributing

  1. Follow Rust best practices
  2. Ensure all tests pass
  3. Document your changes
  4. Add test cases
  5. Submit a PR

🔗 Useful Links

💡 Tips

  • Use the Soroban CLI for local development
  • Test thoroughly on testnet before mainnet
  • Keep contract size optimized
  • Monitor gas usage
  • Use events for contract state changes

❓ Troubleshooting

If you encounter any issues, try these solutions:

  • Compilation Errors: Ensure all dependencies are installed and updated.
  • Deployment Issues: Verify you’re connected to the correct network (testnet or mainnet) and that your wallet is properly set up.
  • Test Failures: Check detailed error messages from cargo test to debug the issue.

This README is based on Stellar’s official documentation .

🚀 Happy coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 10