We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/OpenZeppelin/contracts-wizard'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
# Snapshot report for `src/non-fungible.test.ts`
The actual snapshot is saved in `non-fungible.test.ts.snap`.
Generated by [AVA](https://avajs.dev).
## basic non-fungible
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_tokens::non_fungible::{Base, NonFungibleToken};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Base;β
β
}β
`
## non-fungible burnable
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_tokens::non_fungible::{Base, burnable::NonFungibleBurnable, NonFungibleToken};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Base;β
β
}β
β
//β
// Extensionsβ
//β
β
#[contractimpl(contracttrait)]β
impl NonFungibleBurnable for MyToken {}β
`
## non-fungible pausable
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_contract_utils::pausable::{self as pausable, Pausable};β
use stellar_macros::{only_owner, when_not_paused};β
use stellar_tokens::non_fungible::{Base, NonFungibleToken};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Base;β
β
#[when_not_paused]β
fn transfer(e: &Env, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer(e, &from, &to, token_id);β
}β
β
#[when_not_paused]β
fn transfer_from(e: &Env, spender: Address, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer_from(e, &spender, &from, &to, token_id);β
}β
}β
β
//β
// Utilsβ
//β
β
#[contractimpl(contracttrait)]β
impl Ownable for MyToken {}β
β
#[contractimpl]β
impl Pausable for MyToken {β
fn paused(e: &Env) -> bool {β
pausable::paused(e)β
}β
β
#[only_owner]β
fn pause(e: &Env, _caller: Address) {β
pausable::pause(e);β
}β
β
#[only_owner]β
fn unpause(e: &Env, _caller: Address) {β
pausable::unpause(e);β
}β
}β
`
## non-fungible burnable pausable
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_contract_utils::pausable::{self as pausable, Pausable};β
use stellar_macros::{only_owner, when_not_paused};β
use stellar_tokens::non_fungible::{Base, burnable::NonFungibleBurnable, NonFungibleToken};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Base;β
β
#[when_not_paused]β
fn transfer(e: &Env, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer(e, &from, &to, token_id);β
}β
β
#[when_not_paused]β
fn transfer_from(e: &Env, spender: Address, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer_from(e, &spender, &from, &to, token_id);β
}β
}β
β
//β
// Extensionsβ
//β
β
#[contractimpl(contracttrait)]β
impl NonFungibleBurnable for MyToken {β
#[when_not_paused]β
fn burn(e: &Env, from: Address, token_id: u32) {β
Self::ContractType::burn(e, &from, token_id);β
}β
β
#[when_not_paused]β
fn burn_from(e: &Env, spender: Address, from: Address, token_id: u32) {β
Self::ContractType::burn_from(e, &spender, &from, token_id);β
}β
}β
β
//β
// Utilsβ
//β
β
#[contractimpl(contracttrait)]β
impl Ownable for MyToken {}β
β
#[contractimpl]β
impl Pausable for MyToken {β
fn paused(e: &Env) -> bool {β
pausable::paused(e)β
}β
β
#[only_owner]β
fn pause(e: &Env, _caller: Address) {β
pausable::pause(e);β
}β
β
#[only_owner]β
fn unpause(e: &Env, _caller: Address) {β
pausable::unpause(e);β
}β
}β
`
## non-fungible mintable
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_macros::only_owner;β
use stellar_tokens::non_fungible::{Base, NonFungibleToken};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
β
#[only_owner]β
pub fn mint(e: &Env, to: Address, token_id: u32) {β
Base::mint(e, &to, token_id);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Base;β
β
}β
β
//β
// Utilsβ
//β
β
#[contractimpl(contracttrait)]β
impl Ownable for MyToken {}β
`
## non-fungible enumerable
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_tokens::non_fungible::{β
Base, enumerable::{NonFungibleEnumerable, Enumerable}, NonFungibleTokenβ
};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Enumerable;β
β
}β
β
//β
// Extensionsβ
//β
β
#[contractimpl(contracttrait)]β
impl NonFungibleEnumerable for MyToken {}β
`
## non-fungible consecutive
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_macros::only_owner;β
use stellar_tokens::non_fungible::{β
Base, consecutive::{NonFungibleConsecutive, Consecutive}, NonFungibleTokenβ
};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
β
#[only_owner]β
pub fn batch_mint(e: &Env, to: Address, amount: u32) -> u32 {β
Consecutive::batch_mint(e, &to, amount)β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Consecutive;β
β
}β
β
//β
// Extensionsβ
//β
β
#[contractimpl]β
impl NonFungibleConsecutive for MyToken {}β
β
//β
// Utilsβ
//β
β
#[contractimpl(contracttrait)]β
impl Ownable for MyToken {}β
`
## non-fungible consecutive burnable
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_macros::only_owner;β
use stellar_tokens::non_fungible::{β
Base, burnable::NonFungibleBurnable, consecutive::{NonFungibleConsecutive, Consecutive},β
NonFungibleTokenβ
};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
β
#[only_owner]β
pub fn batch_mint(e: &Env, to: Address, amount: u32) -> u32 {β
Consecutive::batch_mint(e, &to, amount)β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Consecutive;β
β
}β
β
//β
// Extensionsβ
//β
β
#[contractimpl(contracttrait)]β
impl NonFungibleBurnable for MyToken {}β
β
#[contractimpl]β
impl NonFungibleConsecutive for MyToken {}β
β
//β
// Utilsβ
//β
β
#[contractimpl(contracttrait)]β
impl Ownable for MyToken {}β
`
## non-fungible consecutive pausable
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_contract_utils::pausable::{self as pausable, Pausable};β
use stellar_macros::{only_owner, when_not_paused};β
use stellar_tokens::non_fungible::{β
Base, consecutive::{NonFungibleConsecutive, Consecutive}, NonFungibleTokenβ
};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
β
#[when_not_paused]β
#[only_owner]β
pub fn batch_mint(e: &Env, to: Address, amount: u32) -> u32 {β
Consecutive::batch_mint(e, &to, amount)β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Consecutive;β
β
#[when_not_paused]β
fn transfer(e: &Env, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer(e, &from, &to, token_id);β
}β
β
#[when_not_paused]β
fn transfer_from(e: &Env, spender: Address, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer_from(e, &spender, &from, &to, token_id);β
}β
}β
β
//β
// Extensionsβ
//β
β
#[contractimpl]β
impl NonFungibleConsecutive for MyToken {}β
β
//β
// Utilsβ
//β
β
#[contractimpl(contracttrait)]β
impl Ownable for MyToken {}β
β
#[contractimpl]β
impl Pausable for MyToken {β
fn paused(e: &Env) -> bool {β
pausable::paused(e)β
}β
β
#[only_owner]β
fn pause(e: &Env, _caller: Address) {β
pausable::pause(e);β
}β
β
#[only_owner]β
fn unpause(e: &Env, _caller: Address) {β
pausable::unpause(e);β
}β
}β
`
## non-fungible consecutive burnable pausable
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_contract_utils::pausable::{self as pausable, Pausable};β
use stellar_macros::{only_owner, when_not_paused};β
use stellar_tokens::non_fungible::{β
Base, burnable::NonFungibleBurnable, consecutive::{NonFungibleConsecutive, Consecutive},β
NonFungibleTokenβ
};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
β
#[when_not_paused]β
#[only_owner]β
pub fn batch_mint(e: &Env, to: Address, amount: u32) -> u32 {β
Consecutive::batch_mint(e, &to, amount)β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Consecutive;β
β
#[when_not_paused]β
fn transfer(e: &Env, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer(e, &from, &to, token_id);β
}β
β
#[when_not_paused]β
fn transfer_from(e: &Env, spender: Address, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer_from(e, &spender, &from, &to, token_id);β
}β
}β
β
//β
// Extensionsβ
//β
β
#[contractimpl(contracttrait)]β
impl NonFungibleBurnable for MyToken {β
#[when_not_paused]β
fn burn(e: &Env, from: Address, token_id: u32) {β
Self::ContractType::burn(e, &from, token_id);β
}β
β
#[when_not_paused]β
fn burn_from(e: &Env, spender: Address, from: Address, token_id: u32) {β
Self::ContractType::burn_from(e, &spender, &from, token_id);β
}β
}β
β
#[contractimpl]β
impl NonFungibleConsecutive for MyToken {}β
β
//β
// Utilsβ
//β
β
#[contractimpl(contracttrait)]β
impl Ownable for MyToken {}β
β
#[contractimpl]β
impl Pausable for MyToken {β
fn paused(e: &Env) -> bool {β
pausable::paused(e)β
}β
β
#[only_owner]β
fn pause(e: &Env, _caller: Address) {β
pausable::pause(e);β
}β
β
#[only_owner]β
fn unpause(e: &Env, _caller: Address) {β
pausable::unpause(e);β
}β
}β
`
## non-fungible sequential
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_tokens::non_fungible::{Base, NonFungibleToken};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Base;β
β
}β
`
## non-fungible upgradeable
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_contract_utils::upgradeable::UpgradeableInternal;β
use stellar_macros::{only_owner, Upgradeable};β
use stellar_tokens::non_fungible::{Base, NonFungibleToken};β
β
#[derive(Upgradeable)]β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Base;β
β
}β
β
//β
// Utilsβ
//β
β
impl UpgradeableInternal for MyToken {β
fn _require_auth(e: &Env, operator: &Address) {β
ownable::enforce_owner_auth(e);β
operator.require_auth();β
}β
}β
β
#[contractimpl(contracttrait)]β
impl Ownable for MyToken {}β
`
## non-fungible with compatible options
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_contract_utils::pausable::{self as pausable, Pausable};β
use stellar_contract_utils::upgradeable::UpgradeableInternal;β
use stellar_macros::{only_owner, Upgradeable, when_not_paused};β
use stellar_tokens::non_fungible::{β
Base, burnable::NonFungibleBurnable, enumerable::{NonFungibleEnumerable, Enumerable},β
NonFungibleTokenβ
};β
β
#[derive(Upgradeable)]β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
β
#[only_owner]β
#[when_not_paused]β
pub fn mint(e: &Env, to: Address, token_id: u32) {β
Enumerable::non_sequential_mint(e, &to, token_id);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Enumerable;β
β
#[when_not_paused]β
fn transfer(e: &Env, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer(e, &from, &to, token_id);β
}β
β
#[when_not_paused]β
fn transfer_from(e: &Env, spender: Address, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer_from(e, &spender, &from, &to, token_id);β
}β
}β
β
//β
// Extensionsβ
//β
β
#[contractimpl(contracttrait)]β
impl NonFungibleBurnable for MyToken {β
#[when_not_paused]β
fn burn(e: &Env, from: Address, token_id: u32) {β
Self::ContractType::burn(e, &from, token_id);β
}β
β
#[when_not_paused]β
fn burn_from(e: &Env, spender: Address, from: Address, token_id: u32) {β
Self::ContractType::burn_from(e, &spender, &from, token_id);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleEnumerable for MyToken {}β
β
//β
// Utilsβ
//β
β
impl UpgradeableInternal for MyToken {β
fn _require_auth(e: &Env, _operator: &Address) {β
ownable::enforce_owner_auth(e);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl Ownable for MyToken {}β
β
#[contractimpl]β
impl Pausable for MyToken {β
fn paused(e: &Env) -> bool {β
pausable::paused(e)β
}β
β
#[only_owner]β
fn pause(e: &Env, _caller: Address) {β
pausable::pause(e);β
}β
β
#[only_owner]β
fn unpause(e: &Env, _caller: Address) {β
pausable::unpause(e);β
}β
}β
`
## non-fungible - complex name
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_access::ownable::{self as ownable, Ownable};β
use stellar_contract_utils::pausable::{self as pausable, Pausable};β
use stellar_macros::{only_owner, when_not_paused};β
use stellar_tokens::non_fungible::{Base, burnable::NonFungibleBurnable, NonFungibleToken};β
β
#[contract]β
pub struct CustomToken;β
β
#[contractimpl]β
impl CustomToken {β
pub fn __constructor(e: &Env, owner: Address) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "Custom $ Token");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
ownable::set_owner(e, &owner);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for CustomToken {β
type ContractType = Base;β
β
#[when_not_paused]β
fn transfer(e: &Env, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer(e, &from, &to, token_id);β
}β
β
#[when_not_paused]β
fn transfer_from(e: &Env, spender: Address, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer_from(e, &spender, &from, &to, token_id);β
}β
}β
β
//β
// Extensionsβ
//β
β
#[contractimpl(contracttrait)]β
impl NonFungibleBurnable for CustomToken {β
#[when_not_paused]β
fn burn(e: &Env, from: Address, token_id: u32) {β
Self::ContractType::burn(e, &from, token_id);β
}β
β
#[when_not_paused]β
fn burn_from(e: &Env, spender: Address, from: Address, token_id: u32) {β
Self::ContractType::burn_from(e, &spender, &from, token_id);β
}β
}β
β
//β
// Utilsβ
//β
β
#[contractimpl(contracttrait)]β
impl Ownable for CustomToken {}β
β
#[contractimpl]β
impl Pausable for CustomToken {β
fn paused(e: &Env) -> bool {β
pausable::paused(e)β
}β
β
#[only_owner]β
fn pause(e: &Env, _caller: Address) {β
pausable::pause(e);β
}β
β
#[only_owner]β
fn unpause(e: &Env, _caller: Address) {β
pausable::unpause(e);β
}β
}β
`
## non-fungible explicit trait implementations
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_tokens::non_fungible::{Base, ContractOverrides, NonFungibleToken};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env) {β
let uri = String::from_str(e, "https://www.mytoken.com");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
}β
}β
β
#[contractimpl]β
impl NonFungibleToken for MyToken {β
type ContractType = Base;β
β
fn balance(e: &Env, owner: Address) -> u32 {β
Self::ContractType::balance(e, &owner)β
}β
β
fn owner_of(e: &Env, token_id: u32) -> Address {β
Self::ContractType::owner_of(e, token_id)β
}β
β
fn transfer(e: &Env, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer(e, &from, &to, token_id);β
}β
β
fn transfer_from(e: &Env, spender: Address, from: Address, to: Address, token_id: u32) {β
Self::ContractType::transfer_from(e, &spender, &from, &to, token_id);β
}β
β
fn approve(β
e: &Env,β
approver: Address,β
approved: Address,β
token_id: u32,β
live_until_ledger: u32,β
) {β
Self::ContractType::approve(e, &approver, &approved, token_id, live_until_ledger);β
}β
β
fn approve_for_all(e: &Env, owner: Address, operator: Address, live_until_ledger: u32) {β
Self::ContractType::approve_for_all(e, &owner, &operator, live_until_ledger);β
}β
β
fn get_approved(e: &Env, token_id: u32) -> Option<Address> {β
Self::ContractType::get_approved(e, token_id)β
}β
β
fn is_approved_for_all(e: &Env, owner: Address, operator: Address) -> bool {β
Self::ContractType::is_approved_for_all(e, &owner, &operator)β
}β
β
fn name(e: &Env) -> String {β
Self::ContractType::name(e)β
}β
β
fn symbol(e: &Env) -> String {β
Self::ContractType::symbol(e)β
}β
β
fn token_uri(e: &Env, token_id: u32) -> String {β
Self::ContractType::token_uri(e, token_id)β
}β
}β
`
## non-fungible custom token uri
> Snapshot 1
`// SPDX-License-Identifier: MITβ
// Compatible with OpenZeppelin Stellar Soroban Contracts ^0.6.0β
#![no_std]β
β
use soroban_sdk::{Address, contract, contractimpl, Env, String};β
use stellar_tokens::non_fungible::{Base, NonFungibleToken};β
β
#[contract]β
pub struct MyToken;β
β
#[contractimpl]β
impl MyToken {β
pub fn __constructor(e: &Env) {β
let uri = String::from_str(e, "https://example.com/nfts/");β
let name = String::from_str(e, "MyToken");β
let symbol = String::from_str(e, "MTK");β
Base::set_metadata(e, uri, name, symbol);β
}β
}β
β
#[contractimpl(contracttrait)]β
impl NonFungibleToken for MyToken {β
type ContractType = Base;β
β
}β
`