Skip to content

Bonizozo/stellar-tipjar-contracts

Repository files navigation

Stellar Tip Jar Contracts

Rust + Soroban starter repository for a Stellar-based tipping application.

The tipjar smart contract lets supporters tip creators with a Stellar token, tracks creator totals in contract storage, emits on-chain events, and supports creator withdrawals from escrowed balances.

Repository Structure

contracts/
	tipjar/
		src/
			lib.rs
		Cargo.toml

tests/
scripts/

README.md
CONTRIBUTING.md

Contract Capabilities

  • init(token): one-time token configuration.
  • tip(sender, creator, amount): transfers tokens from sender into contract escrow for creator and updates storage totals.
  • get_total_tips(creator): returns total historical tips for creator.
  • withdraw(creator): allows creator to withdraw escrowed tips.

Storage Model

The contract stores:

  • token contract address (DataKey::Token)
  • creator withdrawable balance (DataKey::CreatorBalance)
  • creator total historical tips (DataKey::CreatorTotal)

Events

  • ("tip", creator) with data (sender, amount)
  • ("withdraw", creator) with data amount

Prerequisites

  • Rust toolchain
  • Stellar CLI (stellar)
  • Soroban target support for WASM:
rustup target add wasm32v1-none

Build

cargo build -p tipjar --target wasm32v1-none --release

Test

cargo test -p tipjar

Unit tests use Soroban's test framework and cover:

  • tipping flow
  • total and withdrawable balance tracking
  • invalid tip amount rejection

Deploy (Testnet)

Use the helper script:

bash scripts/deploy.sh

Or run commands manually with stellar contract deploy and stellar contract invoke.

Contributing

See CONTRIBUTING.md for:

  • branching strategy
  • coding standards
  • test requirements
  • pull request checklist

License

MIT

About

This repository contains the Soroban smart contracts that power the Stellar Tip Jar platform. The contracts are responsible for securely handling tip payments between supporters and creators on the Stellar blockchain. These contracts ensure that funds are transferred transparently and securely without relying on centralized intermediaries.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors