Contract d8d1e3c135ed2cea40a157066e9ea035cee6052614ad0706362b0d46a48e5560

← Back to Index 📥 Download WASM

Meta

cliver 26.1.0#1228cff8022b804659750b94b315932b0e0f3f6a
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.96.0

Instances

  • CDRDWRB2OM6EERL64QBRY7OJ4J5HLNLFLTW6KS6Q6SRTZNKJTAKILMSJ

Interface

Mint a new Vehicle Digital Twin NFT. Only admin can call. VIN must be unique. Returns the new token_id.

fn mint(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
    vin: soroban_sdk::String,
    metadata_ipfs_hash: soroban_sdk::String,
) -> u64

Write a health score attestation for a vehicle. Admin only. Keeps a rolling window of the last 90 attestations.

fn attest(
    env: soroban_sdk::Env,
    token_id: u64,
    master_score: u32,
    legal_score: u32,
    mechanical_score: u32,
    driving_score: u32,
    maintenance_score: u32,
    event_type: soroban_sdk::Symbol,
)

Transfer vehicle NFT ownership. Admin only (escrow-mediated). Updates owner, records transfer, and moves token between owner lists.

fn transfer(
    env: soroban_sdk::Env,
    token_id: u64,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    escrow_id: soroban_sdk::String,
)

Get the current owner of a token.

fn get_owner(env: soroban_sdk::Env, token_id: u64) -> soroban_sdk::Address

Initialize the contract with an admin address. Only the admin can mint, attest, add documents, and transfer.

fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Add a verified document record to the vehicle's on-chain vault.

fn add_document(
    env: soroban_sdk::Env,
    token_id: u64,
    doc_type: soroban_sdk::Symbol,
    ipfs_hash: soroban_sdk::String,
    is_verified: bool,
)

Get vehicle metadata by token ID.

fn get_metadata(env: soroban_sdk::Env, token_id: u64) -> VehicleMetadata

Get the total number of minted tokens.

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

Get all documents linked to a vehicle NFT.

fn get_documents(
    env: soroban_sdk::Env,
    token_id: u64,
) -> soroban_sdk::Vec

Get all attestation history for a vehicle.

fn get_attestations(
    env: soroban_sdk::Env,
    token_id: u64,
) -> soroban_sdk::Vec

Resolve a VIN to its token ID.

fn get_token_by_vin(env: soroban_sdk::Env, vin: soroban_sdk::String) -> u64

Get all token IDs owned by an address.

fn get_tokens_by_owner(
    env: soroban_sdk::Env,
    owner: soroban_sdk::Address,
) -> soroban_sdk::Vec

Get the latest attestation for a vehicle.

fn get_latest_attestation(env: soroban_sdk::Env, token_id: u64) -> HealthAttestation

Imports

WebAssembly Text (WAT) ▶