This document describes the caller restrictions for every public entrypoint in the creator-keys contract. Functions are grouped by access level to help contributors verify that access control is correct and complete.
For return value semantics of read-only methods, see read-only-methods.md. For error codes, see error-codes.md.
| Level | Description |
|---|---|
| Admin | Requires auth from the protocol admin address (admin.require_auth()). The admin address is stored in contract storage and can be changed via set_protocol_admin. |
| Creator | Requires auth from the creator address being registered (creator.require_auth()). |
| Key holder | Requires auth from the buyer or seller address (buyer.require_auth() / seller.require_auth()). |
| Open | No auth required. Read-only view methods that anyone can call. |
These functions modify protocol-wide configuration and require authorization from the stored admin address.
Sets the global fee split between creators and the protocol.
- Auth:
admin.require_auth() - Constraints:
creator_bps + protocol_bpsmust equal10000.protocol_bpsmust not exceed5000(PROTOCOL_BPS_MAX). - No-op: Returns
Ok(())without writing if the new config matches the stored config.
Sets the global key price used for all buy and sell operations.
- Auth:
admin.require_auth() - Constraints:
pricemust be> 0. - No-op: Returns
Ok(())without writing if the new price matches the stored price.
Sets the protocol treasury address used for fee routing.
- Auth:
admin.require_auth() - No-op: Returns without writing if the new address matches the stored address.
Transfers the protocol admin role to a new address.
- Auth:
admin.require_auth() - No-op: Returns without writing if the new admin matches the stored admin.
Registers a new creator profile on-chain.
- Auth:
creator.require_auth() - Constraints: Handle must be 3-32 characters, lowercase alphanumeric or underscores.
- Fails:
AlreadyRegisteredif a profile already exists forcreator.
buyback(creator: Address, caller: Address, amount: u32, payment: i128, max_total_cost: Option<i128>) -> Result<u32, ContractError>
Creator-authorized buyback that burns keys from the creator's own held balance.
- Auth:
caller.require_auth() - Constraints:
callermust equalcreator, otherwiseUnauthorizedamountmust be> 0paymentmust be> 0and>= get_buyback_quote(creator, amount)amountmust not exceed the creator's total supply, otherwiseInsufficientSupply- the creator wallet must already hold at least
amountkeys, otherwiseInsufficientBalance
- Returns: The new total supply for the creator after the burn
These functions require authorization from the buyer or seller, not the creator whose keys are being traded.
Buys one key for creator on behalf of buyer.
- Auth:
buyer.require_auth() - Constraints:
paymentmust be> 0and>=the stored key price. The creator must be registered. - Returns: The new total supply for the creator after the purchase.
Sells one key held by seller for creator.
- Auth:
seller.require_auth() - Fails:
InsufficientBalanceif the seller holds zero keys for the creator. - Returns: The new total supply for the creator after the sale.
transfer_keys(creator: Address, from: Address, to: Address, amount: u32) -> Result<(), ContractError>
Transfers amount keys from from to to for creator. Does not interact with the bonding curve and charges no fee.
- Auth:
from.require_auth()— only the sender authorizes. No recipient approval required. - Rejects: Self-transfers (
from == to) withContractError::SelfTransfer, and zero-amount transfers withContractError::ZeroTransferAmount. - Fails:
InsufficientBalanceiffromholds fewer thanamountkeys. - Fails:
NotRegisteredifcreatoris not registered. - State changes:
KeyBalance(creator, from)decremented,KeyBalance(creator, to)incremented. Creator supply and holder_count are unchanged. - See key-transfer-authorization.md for full details.
These functions require no authorization. Anyone can call them. They do not mutate contract state.
| Method | Returns |
|---|---|
get_buy_quote(creator: Address) |
Result<QuoteResponse, ContractError> |
get_buyback_quote(creator: Address, amount: u32) |
Result<i128, ContractError> |
get_sell_quote(creator: Address, holder: Address) |
Result<QuoteResponse, ContractError> |
compute_fees_for_payment(total: i128) |
Result<(i128, i128), ContractError> |
| Method | Returns |
|---|---|
get_creator(creator: Address) |
Result<CreatorProfile, ContractError> |
get_creator_details(creator: Address) |
CreatorDetailsView |
is_creator_registered(creator: Address) |
bool |
get_creator_fee_recipient(creator: Address) |
Result<Address, ContractError> |
| Method | Returns |
|---|---|
get_key_balance(creator: Address, wallet: Address) |
u32 |
get_holder_key_count(creator: Address, holder: Address) |
HolderKeyCountView |
get_total_key_supply(creator: Address) |
u32 |
get_creator_supply(creator: Address) |
Result<u32, ContractError> |
get_creator_holder_count(creator: Address) |
u32 |
| Method | Returns |
|---|---|
get_key_name(creator: Address) |
Result<String, ContractError> |
get_key_symbol(creator: Address) |
Result<String, ContractError> |
get_key_decimals() |
u32 |
| Method | Returns |
|---|---|
get_fee_config() |
Option<FeeConfig> |
get_creator_fee_config(creator: Address) |
CreatorFeeView |
get_creator_fee_bps(creator: Address) |
Result<u32, ContractError> |
get_creator_treasury_share(creator: Address) |
Result<u32, ContractError> |
get_protocol_treasury_share_bps() |
Result<u32, ContractError> |
get_protocol_fee_view() |
ProtocolFeeView |
is_protocol_config_initialized() |
bool |
| Method | Returns |
|---|---|
get_protocol_state_version() |
u32 |
get_treasury_address() |
Option<Address> |
get_protocol_admin() |
Option<Address> |
get_protocol_fee_recipient() |
Option<Address> |
| Function | Access level | Mutates state |
|---|---|---|
register_creator |
Creator | Yes |
buyback |
Creator | Yes |
buy_key |
Key holder (buyer) | Yes |
sell_key |
Key holder (seller) | Yes |
transfer_keys |
Key holder (sender / from) |
Yes |
set_fee_config |
Admin | Yes |
set_key_price |
Admin | Yes |
set_treasury_address |
Admin | Yes |
set_protocol_admin |
Admin | Yes |
All get_* / is_* methods |
Open | No |
compute_fees_for_payment |
Open | No |