Soroban smart contract for a multi-cloud storage marketplace on Stellar. Providers offer storage buckets; consumers create deals and fund them with tokens. The contract holds escrowed funds and pays providers based on consumption and SLA metrics reported by an off-chain oracle.
The scripts in scripts/ use Soroban identities for deployment, upgrades, and oracle operations. Configure these identities locally before running:
- flashback – Used for contract deploy, upgrade, and oracle invocations (mainnet/testnet).
- issuer – Used by
faucet.shfor USDC minting on testnet.
Add identities with soroban keys add <name>, or import from a secret key. Identities and keys are stored in .soroban/ (gitignored) and never committed.
Key entities:
- Owner – Contract admin; sets stable asset, platform fee, upgrades contract, deletes entities, triggers oracle-driven payments
- Provider – Registers, creates buckets, accepts/rejects deals, cancels deals
- Consumer – Registers, creates deals, funds deals, completes deals
- Oracle – Off-chain; supplies consumption and SLA data to Owner for
update_deal_consumptionandupdate_deal_sla
Deal flow:
- Consumer creates a deal for a bucket (
create_deal) → Pending - Provider accepts or rejects → Accepted or Cancelled
- Consumer funds the deal (
set_deal_funded) → Funded - Oracle updates consumption/SLA; Owner calls
pay_pending_consumptionto settle payments - Consumer completes the deal → Completed; or breaches lead to BreachedConsumer / BreachedProvider
Buckets – Providers create buckets with pricing (storage/egress per GB), SLA (latency, uptime), and API compatibility. Buckets have status: Active, Inactive, Deleted.
Reputation – Providers and consumers have a reputation score (0–100). It is updated on deal completion and breach; future tokenomics may use it more heavily.
Flashback Network gathers consumption stats from network node telemetry. An oracle process reads those stats and, for active deals, calls:
update_deal_sla– Updates SLA metrics (latency, uptime)update_deal_consumption– Reports storage and egress consumedpay_pending_consumption– Settles payments from escrowed funds to the provider (with platform fee deduction)
The Owner identity must sign these oracle invocations.
- STRIDE threat model – Security analysis
- Scout audit reports – Static analysis findings
- Data flow diagram, deal flow diagram
soroban contract build
cargo testFor mainnet deployment, use --no-default-features to exclude testnet-only features (faucets, minting).