smart-contracts

Solid

Stellar smart contract development (Rust, soroban-sdk). Covers project setup, contract anatomy, storage/TTL, authorization, cross-contract calls, events, errors, upgrades, and comprehensive testing strategies.

AI & Automation 18 stars 0 forks Updated 3 days ago MIT

Install

View on GitHub

Quality Score: 84/100

Stars 20%
43
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Smart Contracts (Soroban) ## Source Files | File | Contents | |------|----------| | `contracts/hello-world/src/lib.rs` | Minimal contract scaffold | | `contracts/hello-world/src/test.rs` | Unit + auth + event tests | | `contracts/token/src/lib.rs` | Full SEP-41 token | | `contracts/token/src/test.rs` | Token unit + integration tests | --- ## Testing Guide ### Setup ```rust #![cfg(test)] extern crate std; use soroban_sdk::{ testutils::{Address as _, Events}, Address, Env, String, Symbol, }; ``` ### Pattern 1: Unit Test with Setup Helper Extract shared setup into a helper function: ```rust fn setup() -> (Env, Address, Address, MyContractClient<'static>) { let env = Env::default(); env.mock_all_auths(); let admin = Address::generate(&env); let user = Address::generate(&env); let contract_id = env.register(MyContract, (&admin, 1000u32)); let client = MyContractClient::new(&env, &contract_id); (env, admin, user, client) } #[test] fn test_initial_state() { let (_, _, _, client) = setup(); assert_eq!(client.get_count(), 0); } ``` ### Pattern 2: Auth Testing (without mock_all_auths) Test that only authorized callers can invoke privileged functions: ```rust #[test] fn test_auth_required() { let env = Env::default(); // Do NOT call mock_all_auths() — test auth failures let admin = Address::generate(&env); let attacker = Address::generate(&env); let contract_id = env.register(MyContract, (&admin,)); let c...

Details

Author
rylsherdamz-rgb
Repository
rylsherdamz-rgb/stellar-agentic-framework
Created
3 weeks ago
Last Updated
3 days ago
Language
Python
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category