Contract 8de494f9dbef2103a52538f664d03521802959efbdb91fc30769c81cebf65c0d

← Back to Index 📥 Download WASM

Meta

cliver 23.4.1#a152ec2488c25136808ad28277c24b3a0765ffd4
rssdkver 23.4.0#673d6c4f2368d282d25da29bda55c21b8be69ca6
rsver 1.92.0

Instances

  • CBCTZAZJBG5TZEC2WHHAD4J4JKPQCUNTMULVYMUYLDQMAXUAIQPOOMKI

Interface

Mint a new NFT to the specified address

Arguments

  • to - The address that will receive the newly minted NFT

Returns

Returns the token ID of the newly minted NFT (sequential, starting from 1)

Note

Any user can mint NFTs. The function automatically transfers 1 XLM (10,000,000 stroops) from the recipient (to) to the contract as payment. The recipient must have sufficient XLM balance and must authorize the transaction (sign it).

If minting fails after payment, the payment will be refunded to the recipient. In Soroban, if sequential_mint panics, the entire transaction reverts, so the payment transfer will also be reverted automatically. No explicit refund needed.

fn mint(env: soroban_sdk::Env, to: soroban_sdk::Address) -> u32

Withdraw XLM from the contract to the owner

Arguments

  • amount - The amount of XLM (in stroops) to withdraw. If None, withdraws all available balance.

Note

Only the contract owner can call this function. The function transfers XLM from the contract address to the owner's address. This allows the owner to withdraw minting fees collected by the contract.

fn withdraw(env: soroban_sdk::Env, amount: Option) -> i128

Constructor to initialize the NFT contract

Arguments

  • owner - The address that will own the contract (for administrative purposes)
  • native_asset_address - The XLM native asset contract address for your network
  • max_supply - Maximum number of NFTs that can be minted (0 = unlimited)

Note

Sets the contract metadata (name, symbol, URI) and assigns the owner. The owner can be used for future administrative functions, but any user can mint NFTs.

To get the XLM contract address for your network:

soroban contract id asset --asset native --network <network>
fn __constructor(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    native_asset_address: soroban_sdk::Address,
    max_supply: u32,
)

Imports

WebAssembly Text (WAT) ▶