This document covers every read-only (get_* / is_*) entrypoint in the creator-keys contract. For each method it describes the return type, unit and precision, and what callers should expect on edge-case inputs.
For fee split math, see fee-assumptions.md. For integration boundaries, see contract-consumer-boundaries.md.
Returns the current quote for purchasing one key for a creator.
| Field | Type | Semantics |
|---|---|---|
price |
i128 |
Raw key price as stored (stroops or protocol-defined unit). |
creator_fee |
i128 |
Creator's share of the fee at the stored fee config bps. Always ≥ 0. |
protocol_fee |
i128 |
Protocol share. Always ≥ 0. |
total_amount |
i128 |
price + creator_fee + protocol_fee — the amount the buyer must supply. |
Edge cases:
- Returns
Err(ContractError::NotRegistered)ifcreatoris not registered. - Returns
Err(ContractError::KeyPriceNotSet)if no key price has been stored. - Returns
Err(ContractError::FeeConfigNotSet)if no fee config has been stored. - A zero key price is not storable (enforced by
set_key_price), sopriceis always> 0for a successful quote. total_amount ≥ pricealways holds because fees are additive on the buy path.
Returns the current quote for selling one key held by holder for creator.
| Field | Type | Semantics |
|---|---|---|
price |
i128 |
Raw key price (same source as buy). |
creator_fee |
i128 |
Creator's share deducted from the sell proceeds. |
protocol_fee |
i128 |
Protocol share deducted from the sell proceeds. |
total_amount |
i128 |
price - creator_fee - protocol_fee — the net amount the seller receives. |
Edge cases:
- Returns
Err(ContractError::InsufficientBalance)ifholderholds zero keys forcreator. - Returns
Err(ContractError::NotRegistered)ifcreatoris not registered. - Returns
Err(ContractError::KeyPriceNotSet)/Err(ContractError::FeeConfigNotSet)if configuration is absent. total_amountmay be0when fees equal the full price (e.g., 100% protocol fee, allowed within config constraints).total_amountis never negative:checked_format_quote_responsereturnsErr(ContractError::Overflow)rather than allow underflow.
The following invariants are guaranteed for successful quote responses:
- Registration: The
creatoraddress must be registered viaregister_creator. - Pricing: A global key price must be set via
set_key_price.priceis always> 0. - Fees: A global fee configuration must be set via
set_fee_config.
- Non-negativity: All fee fields (
creator_fee,protocol_fee) andpriceare always≥ 0. - Total Amount Consistency:
- Buy:
total_amount = price + creator_fee + protocol_fee. - Sell:
total_amount = price - (creator_fee + protocol_fee).
- Buy:
- Net Receivables: On a sell quote,
total_amountis guaranteed to be non-negative. The contract returnsErr(ContractError::SellUnderflow)if fees would result in a negative payout. - Rounding:
protocol_feeis calculated asfloor(price * protocol_bps / 10000).creator_feereceives any remainder from integer division to ensurecreator_fee + protocol_feeexactly matches the intended total fee application whencreator_bps + protocol_bps = 10000.
- All monetary values are raw
i128integers in the base unit (stroops or protocol-defined). - No on-chain decimal scaling is performed. Callers should use
get_key_decimals()for display formatting.
Returns the current total supply of keys for creator.
- Returns
0for unregistered creators (no panic). - Precision: integer key count; no decimals at the supply level.
- Equivalent to
read_key_balancehelper output.
Returns the supply for a registered creator.
- Returns
Err(ContractError::NotRegistered)for unknown creators — useget_total_key_supplyif you need a zero-safe fallback.
Returns the number of keys wallet holds for creator.
- Returns
0if eithercreatoris unregistered orwallethas never bought a key. - No error variant; always returns a
u32.
Returns a struct view of a holder's key count.
| Field | Type | Semantics |
|---|---|---|
creator |
Address |
Echo of the input creator address. |
holder |
Address |
Echo of the input holder address. |
key_count |
u32 |
Number of keys held; 0 when creator is unregistered or holder has no keys. |
creator_exists |
bool |
true if the creator is registered. |
Edge cases: Never panics. When creator_exists is false, key_count is always 0 regardless of any storage state.
Returns the number of distinct addresses holding at least one key for creator.
- Returns
0for unregistered creators. - Decrements when a holder sells their last key.
Returns the full profile for a registered creator.
- Returns
Err(ContractError::NotRegistered)for unregistered creators. CreatorProfile.supplyequalsget_total_key_supplyoutput.
Returns a non-optional creator details snapshot.
| Field | Type | Semantics |
|---|---|---|
creator |
Address |
Echo of input. |
handle |
String |
Display handle; empty string when is_registered is false. |
supply |
u32 |
Current key supply; 0 when unregistered. |
is_registered |
bool |
true if the creator is registered. |
Edge cases: Never panics. Prefer this over get_creator when you want a stable shape without Result branching.
Returns the creator's handle as the key display name.
- Returns
Err(ContractError::NotRegistered)for unregistered creators.
Returns the creator's handle as the key ticker symbol.
- Returns
Err(ContractError::NotRegistered)for unregistered creators. - Returns the same string as
get_key_name— both reflect the handle.
Returns true if a creator profile exists for creator, false otherwise.
- Does not mutate state.
- Preferred over
get_creatorwhen you only need a boolean check.
Returns a non-optional protocol fee configuration snapshot.
| Field | Type | Semantics |
|---|---|---|
creator_bps |
u32 |
Creator share in basis points (0–10000). |
protocol_bps |
u32 |
Protocol share in basis points. |
is_configured |
bool |
true once set_fee_config has been called. |
Edge cases: When is_configured is false, both bps fields are 0. Never returns None — safe for indexers that require a stable schema.
Returns the raw FeeConfig if set, None otherwise.
- Lower-level than
get_protocol_fee_view; avoid in indexer code whereNonehandling adds complexity.
Returns the fee configuration view scoped to a creator.
| Field | Type | Semantics |
|---|---|---|
creator_bps |
u32 |
Creator share; 0 if unregistered or fee config absent. |
protocol_bps |
u32 |
Protocol share; 0 if unregistered or fee config absent. |
is_registered |
bool |
false if the creator is not registered. |
is_configured |
bool |
false if no global fee config has been set. |
Edge cases: Never panics. When is_registered is false, all numeric fields are 0 regardless of any stored fee config.
Returns the creator-facing share of the protocol fee in basis points.
- Unit: basis points (1 bps = 1/10000). Example:
9000= 90%. - Valid range:
0–10000. When a fee config is stored,creator_bps + protocol_bps == 10000always holds. - Returns
Err(ContractError::NotRegistered)for unregistered creators. - Returns
Err(ContractError::FeeConfigNotSet)if no protocol fee config exists.
Alias for get_creator_fee_bps. Returns the same creator-facing bps value from the global fee config.
- Unit and range: identical to
get_creator_fee_bps(basis points,0–10000). - Same error conditions as
get_creator_fee_bps.
Returns the protocol treasury share from the global fee configuration in basis points.
- Unit: basis points (1 bps = 1/10000). Example:
500= 5%. - Valid range:
0–5000. The protocol share is capped atPROTOCOL_BPS_MAX(5000) byset_fee_config. - When a fee config is stored,
creator_bps + protocol_bps == 10000always holds, soprotocol_bpsis at most half the total. - Returns
Err(ContractError::FeeConfigNotSet)if no protocol fee config has been stored. - Does not require a creator argument — reads directly from the global protocol config.
Returns the fee recipient address for creator (defaults to the creator's own address at registration).
- Returns
Err(ContractError::NotRegistered)for unregistered creators.
Returns true if a protocol fee configuration has been stored; false otherwise.
- Does not mutate state.
Returns the fixed PROTOCOL_STATE_VERSION constant (1 currently).
- Does not read or mutate storage.
- Bump this value (in the source constant) when externally visible protocol semantics change.
Returns KEY_DECIMALS (7), matching the standard Soroban token decimal convention.
- Does not read or mutate storage.
- Use this to format key amounts for display (divide raw value by
10^7).
Returns the configured treasury address, or None if not yet set.
Returns the configured protocol admin address, or None if not yet set.
Returns the configured protocol fee recipient address, or None if not yet set.
All monetary values (price, creator_fee, protocol_fee, total_amount) are raw i128 integers in the same unit as the stored key price. No decimal conversion is performed on-chain. Off-chain callers should divide by 10^get_key_decimals() for human-readable display.
Basis points fields (creator_bps, protocol_bps) are in units of 1/10000 (e.g., 1000 = 10%). The sum creator_bps + protocol_bps always equals 10000 when a valid fee config is stored.