Contract 9c968da6c6e0291439c903ca35891d76b5ade22a490492303a1f4ca25959a192

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#
rssdkver 23.4.1#e671b396f8bacf1370925f722df158b31c0baae5
rsver 1.94.0

Instances

  • CDFBKWPCVDGNELK5GDSWDASQNWRGJIL5W5JV3EIILP2UYUZR5KI4XM2B

Interface

Burn an NFT owned by the caller.

Requires the "burner" role on the from address.

Arguments

  • from - Owner of the NFT (must have burner role)
  • token_id - ID of the token to burn
fn burn(env: soroban_sdk::Env, from: soroban_sdk::Address, token_id: u32)
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn approve(
    env: soroban_sdk::Env,
    approver: soroban_sdk::Address,
    approved: soroban_sdk::Address,
    token_id: u32,
    live_until_ledger: u32,
)
fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> u32
fn has_role(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
) -> Option
fn owner_of(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::Address
fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    token_id: u32,
)

Burn an NFT from another address.

Requires the "burner" role on the spender address and approval from the token owner.

Arguments

  • spender - Address initiating the burn (must have burner role and approval)
  • from - Owner of the NFT
  • token_id - ID of the token to burn
fn burn_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    token_id: u32,
)
fn get_admin(env: soroban_sdk::Env) -> Option
fn token_uri(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::String
fn grant_role(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
    caller: soroban_sdk::Address,
)
fn revoke_role(
    env: soroban_sdk::Env,
    account: soroban_sdk::Address,
    role: soroban_sdk::Symbol,
    caller: soroban_sdk::Address,
)
fn get_approved(env: soroban_sdk::Env, token_id: u32) -> Option

Get the custom metadata for a specific token.

Arguments

  • token_id - ID of the token to query

Returns

The metadata if found, None otherwise

fn get_metadata(env: soroban_sdk::Env, token_id: u32) -> Option

Get the total number of NFTs that have been minted.

Note: This is the total minted count, not the current supply. Burned tokens are still counted in this total.

Returns

The total number of tokens minted

fn total_supply(env: soroban_sdk::Env) -> u32

Initialize the KindFi NFT contract.

Arguments

  • admin - Address that will have admin privileges and can grant roles
  • name - Collection name (e.g., "KindFi NFT")
  • symbol - Collection symbol (e.g., "KFNFT")
  • base_uri - Base URI for token metadata (e.g., "https://api.kindfi.org/nft/")

Errors

  • Error::AlreadyInitialized - If the contract has already been initialized
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    name: soroban_sdk::String,
    symbol: soroban_sdk::String,
    base_uri: soroban_sdk::String,
)
fn renounce_role(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
    caller: soroban_sdk::Address,
)
fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    token_id: u32,
)
fn get_role_admin(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
) -> Option
fn renounce_admin(env: soroban_sdk::Env)
fn set_role_admin(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
    admin_role: soroban_sdk::Symbol,
)
fn approve_for_all(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    operator: soroban_sdk::Address,
    live_until_ledger: u32,
)
fn get_role_member(
    env: soroban_sdk::Env,
    role: soroban_sdk::Symbol,
    index: u32,
) -> soroban_sdk::Address

Update the metadata for an existing NFT.

Requires the "metadata_manager" role.

Arguments

  • caller - Address initiating the update (must have metadata_manager role)
  • token_id - ID of the token to update
  • nft_metadata - New metadata for the NFT

Errors

  • Error::Unauthorized - If caller doesn't have metadata_manager role
fn update_metadata(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    token_id: u32,
    nft_metadata: NFTMetadata,
)

Mint a new NFT with custom metadata.

Requires the "minter" role.

Arguments

  • caller - Address initiating the mint (must have minter role)
  • to - Address to receive the NFT
  • nft_metadata - Custom metadata for this NFT

Returns

The token ID of the newly minted NFT (sequential, starting from 0)

fn mint_with_metadata(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    to: soroban_sdk::Address,
    nft_metadata: NFTMetadata,
) -> u32
fn is_approved_for_all(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    operator: soroban_sdk::Address,
) -> bool
fn transfer_admin_role(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
    live_until_ledger: u32,
)
fn accept_admin_transfer(env: soroban_sdk::Env)
fn get_role_member_count(env: soroban_sdk::Env, role: soroban_sdk::Symbol) -> u32

Get the metadata_manager role symbol. Helper function since the role name exceeds symbol_short! limit.

fn metadata_manager_role(env: soroban_sdk::Env) -> soroban_sdk::Symbol

Imports

WebAssembly Text (WAT) ▶