You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Source of truth: the doc comments on each method in
src/lib.rs and the per-tier admin/registration/tipping
sections below. This file is a curated, browsable summary; the per-method
rustdoc in target/doc/stellar_tip/index.html (regenerated by CI) is the
authoritative line-by-line reference.
Signatures: every public method takes env: Env as its first
parameter and returns either () or a small return value. We omit
env in the headings below to keep the per-method surface scannable;
the full signature is in src/lib.rs and the per-page rustdoc HTML.
Lints: run cargo doc --no-deps --document-private-items=false (or
make doc) to regenerate rustdoc locally. CI runs the same command and
fails if rustdoc itself errors (broken intra-doc links, syntax errors in
examples). New #![warn(missing_docs)] strictness is intentionally not
enabled — public-facing surfaces are documented here and in rustdoc
comments, but EVENT_* symbol constants are by design undocumented as a
rustdoc concern (their meaning is fully captured in the
Events table below).
Amounts are token base units (e.g. stroops for native XLM)
Errors
All methods return Result<(), TipError>-shaped errors via panic_with_error!.
Error numbers (#N) are stable contract-level codes — they are part of the
ABI and must not be renumbered.
Code (#N)
Variant
Triggered by
#1
CreatorAlreadyExists
register() — caller already has a profile.
#2
CreatorNotFound
update_profile() / withdraw() / tip() — no profile for caller/creator.
unregister() — at least one token balance is non-zero.
#14
CapExceeded
MaxCreators or MaxTipsPerCreator reached.
#15
FeeRecipientNotSet
tip() — non-zero fee_bps but no FeeRecipient in storage.
#16
BelowMinimum
tip() — amount < configured MinTipAmount and MinTipAmount > 0.
Events
All state-changing methods publish exactly one event. Topics are (EVENT_*, ...).
Payload types are listed in method tables below.
Symbol
Method(s)
Topic[1] (caller/admin)
Payload
INIT
init
caller (admin)
(fee_recipient: Address, fee_bps: u32)
CREG
register
caller (creator)
(username: Symbol, registered_at: u64)
PUPD
update_profile
caller
(username: Symbol, display_name: String)
UREG
unregister
caller
()
TIP
tip
from
(creator, token, amount, fee, index)
WDRW
withdraw
caller (creator)
(token, amount)
PAUS
pause
caller (admin)
()
UNPA
unpause
caller (admin)
()
ADMC
set_admin
previous admin
new_admin: Address
FEEC
set_fee_percentage
caller (admin)
fee_bps: u32
FERC
set_fee_recipient
caller (admin)
fee_recipient: Address
CAPMC
set_max_creators
caller (admin)
max_creators: u32
CAPMT
set_max_tips_per_creator
caller (admin)
max_tips: u32
MINTC
set_min_tip_amount
caller (admin)
min_tip_amount: i128
Admin Functions
All admin setters require caller.require_auth() and a match against
DataKey::Admin. init() additionally validates input bounds and rejects a
fee_recipient equal to the contract's own address.
Removes Profile(caller), UsernameToAddress(username), TipCount(caller), all Balance(caller, _) entries, and the CreatorTokens(caller) set. Decrements CreatorCount.
Tipping
tip(from, creator, token, amount, message)
Aspect
Detail
Brief
Move amount of token from from into the contract; credit the creator; record history.
Send amount of token from this contract to caller. The internal balance is decremented atomically; tracking keys are pruned when the balance reaches zero.
Authorization
caller.require_auth()
Parameters
caller: Address (must be a registered creator) · token: Address · amount: i128 (> 0)
Tip history length (TipCount value); 0 if the key is absent.
get_tip(env, creator, index) -> Option<Tip>
None if the index is out of range.
get_tips(env, creator, start, limit) -> Vec<Tip>
Paginated slice of tip history; end = min(start+limit, tip_count).
get_all_tokens(env, creator) -> Vec<Address>
All tokens the creator has received tips in (Map<Address, ()> flattened to keys).
Configuration
Method
Returns
get_contract_version() -> u32
Currently 3.
get_admin() -> Option<Address>
None if init() has not run.
is_paused() -> bool
Defaults to false.
get_fee_percentage() -> u32
Current basis points; default 0.
get_fee_recipient() -> Option<Address>
None when unset.
get_max_creators() -> u32
0 means the cap is disabled (unlimited).
get_max_tips_per_creator() -> u32
0 means the cap is disabled (unlimited).
get_min_tip_amount() -> i128
0 means the minimum is disabled.
get_creator_count() -> u32
Tracked alongside MaxCreators so cap enforcement is O(1).
Type Summary
DataKey (storage key enum)
Defined as a #[contracttype] enum and used as the key for instance/persistent
storage. Public to callers only as a return type of view functions that
re-expose storage; never directly caller-supplied.
Bump on backwards-incompatible WASM shape changes.
MAX_FEE_BPS
10_000
100% in basis points; admin setters reject anything larger.
MAX_DISPLAY_NAME_LEN
64 bytes
Enforced in register() / update_profile() via validate_input.
MAX_BIO_LEN
256 bytes
Same.
DEFAULT_MAX_CREATORS
10_000
Used by init() default tests; can be overridden explicitly.
DEFAULT_MAX_TIPS_PER_CREATOR
10_000
Same.
DEFAULT_MIN_TIP_AMOUNT
1
Equivalent to the prior amount > 0 guard; raise post-deploy.
TTL_THRESHOLD / TTL_EXTEND
15 / 30 days (ledgers)
Internal — applied through extend_instance_ttl / extend_persistent_ttl.
Regenerating This Reference
# Regenerate HTML rustdoc under target/doc/ (CI does the same)
make doc
# Or directly:
cargo doc --no-deps --document-private-items=false
The HTML tree at target/doc/stellar_tip/index.html is the canonical
line-by-line API reference. This markdown file is the curated, browsable
overview and is the one to update when adding or removing public methods.