curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shAfter installation, restart your terminal or run:
source $HOME/.cargo/envrustup target add wasm32-unknown-unknownFor deployment and interaction with the Stellar network:
cargo install --locked soroban-cliFrom the contracts directory:
cargo build --target wasm32-unknown-unknown --releaseOptimized builds will be located in:
target/wasm32-unknown-unknown/release/*.wasm
cargo testRun tests with output:
cargo test -- --nocaptureRun specific test:
cargo test test_initialize_admininitialize(admin: Address)- Initialize contract with admin addressupdate_admin(new_admin: Address)- Transfer admin roleget_admin() -> Address- Get current admin addressapprove_contract(contract: Address)- Approve contract for registry operationsrevoke_contract(contract: Address)- Revoke contract approvalis_contract_approved(contract: Address) -> bool- Check contract approval status
record_activity(campaign_id: u64, actor: Address, action_type: ActivityAction)- Record campaign activityget_campaign_activities(campaign_id: u64) -> Vec<ActivityRecord>- Get all activities for a campaign
CampaignCreatedCampaignFundedCampaignStatusChangedFundsReleasedHarvestReportedDisputeInitiatedDisputeResolvedCampaignSettled
Using Soroban CLI:
soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/registry.wasm \
--source <your-stellar-account> \
--network testnetInitialize after deployment:
soroban contract invoke \
--id <deployed-contract-id> \
--source <admin-account> \
--network testnet \
-- \
initialize \
--admin <admin-address>The test suite covers:
- Admin initialization and management
- Admin transfer functionality
- Contract approval and revocation
- Activity record creation
- Activity retrieval
- Multi-campaign activity tracking
- Authorization checks
- All activity action types
- Timestamp and ledger sequence recording
- Deterministic ordering of activity records
- Admin can only be set once during initialization
- Admin operations require proper authorization
- Approved contracts have limited registry access
- Activity records include actor verification
- All state changes emit events for indexing
- Storage TTL management prevents data expiration