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