π‘ Priority: Medium | Difficulty: LowβMedium | Estimated Effort: 1β2 days
The royalty distribution contract for the Afristore Marketplace β extracted from the monorepo into its own dedicated repository.
This Soroban smart contract implements:
initializeβ Set up the contract with admin address and initial recipient splitsdistribute_royaltiesβ Distribute incoming royalty tokens proportionally to all recipientsupdate_royalty_splitβ Admin-only function to update the percentage allocations per recipientget_splitβ Query the current split configuration
Invariants enforced by the contract:
- All recipient shares must sum to exactly 100%
- Only the admin can call
update_royalty_split(enforced viarequire_auth) - Invalid splits (not summing to 100%) are rejected on initialization and update
# Build the contract WASM
cargo build --target wasm32-unknown-unknown --release
# Run all tests
cargo test --features testutils
# Check formatting and linting
cargo fmt --check
cargo clippy -- -D warnings
# Optimize the WASM binary
stellar contract optimize --wasm target/wasm32-unknown-unknown/release/royalty_splitter.wasm
# Deploy to testnet
stellar contract deploy --wasm target/wasm32-unknown-unknown/release/royalty_splitter.optimized.wasm --network testnet- Rust (stable)
wasm32-unknown-unknowntarget:rustup target add wasm32-unknown-unknown- Stellar CLI:
cargo install --locked stellar-cli
update_royalty_splitrequires admin authorization viarequire_authβ non-admin calls will panic.- Any split configuration where shares do not sum to 100% is rejected.
This repository is being extracted from afristore/contracts/royalty-splitter/ in the main monorepo.
Tracked in: ui-ux-issues.md β Issue 125
- Fork this repository
- Create a feature branch:
git checkout -b feat/your-feature - Make your changes and ensure all CI checks pass:
cargo fmt --checkβ must exit 0cargo clippy -- -D warningsβ zero warningscargo test --features testutilsβ full royalty lifecycle tests must pass (initialize β distribute β update split β distribute again)- Non-admin
update_royalty_splitcalls must panic/fail with auth error - Invalid splits (not summing to 100%) must be rejected
cargo build --target wasm32-unknown-unknown --releaseβ must produce a valid WASM
- Open a PR β all CI must pass before a PR is eligible for review and merge
- Rust +
soroban-sdk v25.3.0 - Stellar / Soroban smart contract platform
MIT β see LICENSE