Burn a token. Caller must be the owner.
fn burn(env: soroban_sdk::Env, owner: soroban_sdk::Address, token_id: u32)
Mint a single NFT to to. Returns the new token ID.
fn mint(
env: soroban_sdk::Env,
minter: soroban_sdk::Address,
to: soroban_sdk::Address,
) -> u32
Returns the collection name.
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
Get the current admin address.
fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Pause the contract (admin only). Blocks minting and transfers.
fn pause(env: soroban_sdk::Env)
Returns true if token_id exists (has been minted and not burned).
fn exists(env: soroban_sdk::Env, token_id: u32) -> bool
Returns the collection symbol.
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
Approve approved to transfer token_id.
fn approve(
env: soroban_sdk::Env,
approver: soroban_sdk::Address,
approved: soroban_sdk::Address,
token_id: u32,
live_until_ledger: u32,
)
Returns the number of tokens held by owner.
fn balance(env: soroban_sdk::Env, owner: soroban_sdk::Address) -> u32
Unpause the contract (admin only).
fn unpause(env: soroban_sdk::Env)
Upgrade the contract WASM. Admin only. ⚠️ NEVER REMOVE THIS FUNCTION — doing so bricks the contract permanently.
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Contract version, incremented on each upgrade.
fn version(env: soroban_sdk::Env) -> u32
Returns the owner of token_id. Panics if token does not exist.
fn owner_of(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::Address
Update the collection name (admin only).
fn set_name(env: soroban_sdk::Env, name: soroban_sdk::String)
Transfer a token from from to to. Caller must be the owner.
fn transfer(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
token_id: u32,
)
Burn using an approval. Spender must be approved.
fn burn_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
owner: soroban_sdk::Address,
token_id: u32,
)
Check if a token is frozen.
fn is_frozen(env: soroban_sdk::Env, token_id: u32) -> bool
Check if an address has the minter role.
fn is_minter(env: soroban_sdk::Env, account: soroban_sdk::Address) -> bool
Returns the token URI for token_id.
Checks per-token override first, then falls back to base_uri + token_id.
fn token_uri(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::String
Returns all token IDs owned by owner (requires enumerable=true).
fn tokens_of(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
) -> soroban_sdk::Vec
Returns all token IDs in the collection (requires enumerable=true).
fn all_tokens(env: soroban_sdk::Env) -> soroban_sdk::Vec
Batch mint count sequential NFTs to to. Returns the token IDs.
fn batch_mint(
env: soroban_sdk::Env,
minter: soroban_sdk::Address,
to: soroban_sdk::Address,
count: u32,
) -> soroban_sdk::Vec
Extend instance storage TTL. Anyone can call — always beneficial.
fn extend_ttl(env: soroban_sdk::Env)
Returns the max supply cap (0 = unlimited).
fn max_supply(env: soroban_sdk::Env) -> u32
Freeze/unfreeze a specific token (admin only).
fn set_frozen(env: soroban_sdk::Env, token_id: u32, frozen: bool)
Publicly mint a standard NFT by paying the configured price
fn public_mint(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
uri: soroban_sdk::String,
) -> u32
Returns the approved address for token_id, or None.
fn get_approved(env: soroban_sdk::Env, token_id: u32) -> Option
Grant minter role to an address (admin only).
fn grant_minter(env: soroban_sdk::Env, account: soroban_sdk::Address)
Check if a token is soulbound (non-transferable).
fn is_soulbound(env: soroban_sdk::Env, token_id: u32) -> bool
Mint with a custom token ID (for non-sequential use cases).
fn mint_with_id(
env: soroban_sdk::Env,
minter: soroban_sdk::Address,
to: soroban_sdk::Address,
token_id: u32,
) -> u32
Query royalty info for a token at a given sale price. Returns (receiver, royalty_amount). Checks per-token override first, then collection default.
fn royalty_info(
env: soroban_sdk::Env,
token_id: u32,
sale_price: i128,
) -> (soroban_sdk::Address, i128)
Update the collection base URI (admin only).
fn set_base_uri(env: soroban_sdk::Env, base_uri: soroban_sdk::String)
Returns total number of minted (non-burned) tokens.
fn total_supply(env: soroban_sdk::Env) -> u32
Deploy and initialize a Piko NFT collection.
base_uri - Base URI for metadata (e.g. "https://meta.kpop.rocks/gen1/")name - Collection name (e.g. "KPOP Genesis")symbol - Collection symbol (e.g. "KPOPGEN")admin - Admin address (can mint, pause, manage roles)max_supply - Maximum supply cap (0 = unlimited)enumerable - Enable enumerable extension (all_tokens, tokens_of)attributes - Enable on-chain attributes (per-token key-value store)royalty_receiver - Default royalty receiver addressroyalty_bps - Default royalty in basis points (e.g. 500 = 5%)fn __constructor(
env: soroban_sdk::Env,
base_uri: soroban_sdk::String,
name: soroban_sdk::String,
symbol: soroban_sdk::String,
admin: soroban_sdk::Address,
max_supply: u32,
enumerable: bool,
attributes: bool,
royalty_receiver: soroban_sdk::Address,
royalty_bps: u32,
)
Revoke minter role from an address (admin only).
fn revoke_minter(env: soroban_sdk::Env, account: soroban_sdk::Address)
Set/unset soulbound status on a token (admin only).
fn set_soulbound(env: soroban_sdk::Env, token_id: u32, soulbound: bool)
Set a custom URI for a specific token (overrides base_uri + id).
fn set_token_uri(env: soroban_sdk::Env, token_id: u32, uri: soroban_sdk::String)
Transfer a token using an approval. spender must be approved.
fn transfer_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
token_id: u32,
)
Transfer multiple tokens from from to to in a single transaction.
fn batch_transfer(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
token_ids: soroban_sdk::Vec,
)
Get all attributes for a token as a key-value map.
fn get_attributes(
env: soroban_sdk::Env,
token_id: u32,
) -> soroban_sdk::Map
Read the current router_bps setting.
fn get_router_bps(env: soroban_sdk::Env) -> u32
Mint a soulbound (non-transferable) token.
fn mint_soulbound(
env: soroban_sdk::Env,
minter: soroban_sdk::Address,
to: soroban_sdk::Address,
) -> u32
fn public_mint_v2(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
uri: soroban_sdk::String,
is_standard: bool,
is_soulbound: bool,
) -> u32
Set attributes on a token (admin/minter only). Merges with existing attributes.
fn set_attributes(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
token_id: u32,
attrs: soroban_sdk::Map,
)
Set the revenue split for yield_router in basis points (admin only). e.g. 1500 = 15% to yield_router, 85% to treasury. Default (if never called): 100 bps = 1% (backward compatible).
fn set_router_bps(env: soroban_sdk::Env, bps: u32)
Transfer admin to a new address (admin only).
fn transfer_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
Approve/revoke operator for all of owner's tokens.
fn approve_for_all(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
operator: soroban_sdk::Address,
live_until_ledger: u32,
)
Set public minting configuration (admin only)
fn set_mint_config(
env: soroban_sdk::Env,
payment_token: soroban_sdk::Address,
price: i128,
price_soulbound: i128,
treasury: soroban_sdk::Address,
yield_router: soroban_sdk::Address,
)
Mint with a per-token royalty override.
fn mint_with_royalty(
env: soroban_sdk::Env,
minter: soroban_sdk::Address,
to: soroban_sdk::Address,
royalty_receiver: soroban_sdk::Address,
royalty_bps: u32,
) -> u32
Set a per-token royalty override (admin only).
fn set_token_royalty(
env: soroban_sdk::Env,
token_id: u32,
receiver: soroban_sdk::Address,
bps: u32,
)
Set V2 public minting configuration with pricing tiers (admin only)
fn set_mint_config_v2(
env: soroban_sdk::Env,
payment_token: soroban_sdk::Address,
price_pfp: i128,
price_standard: i128,
price_soulbound_addon: i128,
price_royalty_addon: i128,
treasury: soroban_sdk::Address,
yield_router: soroban_sdk::Address,
)
Returns whether operator is approved to manage all of owner's tokens.
fn is_approved_for_all(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
operator: soroban_sdk::Address,
) -> bool
Update the collection-wide default royalty (admin only).
fn set_default_royalty(env: soroban_sdk::Env, receiver: soroban_sdk::Address, bps: u32)
Remove a per-token royalty override (falls back to collection default).
fn remove_token_royalty(env: soroban_sdk::Env, token_id: u32)
Publicly mint a soulbound NFT by paying the configured soulbound price
fn public_mint_soulbound(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
uri: soroban_sdk::String,
) -> u32
Publicly mint an NFT with per-token royalty by paying the configured price plus a royalty upsell fee. Royalty % is PERMANENT — locked at mint. Creator can update receiver later.
fn public_mint_with_royalty(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
uri: soroban_sdk::String,
royalty_receiver: soroban_sdk::Address,
royalty_bps: u32,
) -> u32
Creator-sovereign: Update the royalty receiver address for a token. Only the CURRENT receiver can call this (self-serve wallet recovery). Royalty % stays locked — only the receiver address changes.
fn update_my_royalty_receiver(
env: soroban_sdk::Env,
token_id: u32,
new_receiver: soroban_sdk::Address,
)
fn public_mint_with_royalty_v2(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
uri: soroban_sdk::String,
is_standard: bool,
royalty_receiver: soroban_sdk::Address,
royalty_bps: u32,
) -> u32