Contract 3a8a3209697d26671448ad2de7f069493dcff0abe8bda0abbf2a2fe4735b06d7

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.90.0

Instances

  • CBFU472PC3Q4LWTOFNZLBZ7IOEVPX2CJJE6NYQKQS5UQ74AOIVTRKJBR

Interface

Initialize the contract with the address of the OrganizationRegistry.

Parameters

  • env: The contract environment.
  • contract_org: The address of the OrganizationRegistry contract.

Returns

  • Result<(), Error>: Ok if successful, Err if already initialized.
fn initialize(
    env: soroban_sdk::Env,
    contract_org: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
fn ping(env: soroban_sdk::Env) -> u32
fn get_part_root(
    env: soroban_sdk::Env,
    part_uuid: soroban_sdk::BytesN<16>,
) -> Result, soroban_sdk::Error>
fn event_leaf_hash_view(
    env: soroban_sdk::Env,
    leaf: EventLeaf,
) -> soroban_sdk::BytesN<32>
fn recompute_root_from_leaf_view(
    env: soroban_sdk::Env,
    leaf_hash: soroban_sdk::Bytes,
    proof: soroban_sdk::Vec<(soroban_sdk::Bytes, bool)>,
) -> soroban_sdk::BytesN<32>

Create a new aeronautic part.

Parameters

  • env: The contract environment.
  • caller: The address of the caller (must be an OEM).
  • uuid: The unique identifier for the part.
  • manufacturer: The address of the manufacturer.
  • owner: The address of the initial owner.
  • user: The address of the initial user.
  • merkle_root: The initial Merkle root of the part's manifest.
  • isAircraft: Boolean indicating if the part is an aircraft.

Returns

  • Result<(), Error>: Ok if successful, Err if part already exists or caller is not authorized.
fn create_part(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    uuid: soroban_sdk::BytesN<16>,
    manufacturer: soroban_sdk::Address,
    owner: soroban_sdk::Address,
    user: soroban_sdk::Address,
    merkle_root: soroban_sdk::BytesN<32>,
    is_aircraft: bool,
) -> Result<(), soroban_sdk::Error>

Get part details if caller is authorized via Merkle proof.

Parameters

  • env: The contract environment.
  • caller: The address of the caller.
  • uuid: The unique identifier for the part.
  • proof: The Merkle proof to verify caller's authorization.

Returns

  • Result<AeronauticPart, Error>: The part details if authorized, Err otherwise.
fn get_part(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    uuid: soroban_sdk::BytesN<16>,
    proof: soroban_sdk::Vec<(soroban_sdk::Bytes, bool)>,
) -> Result

Change the Merkle root of the part's manifest.

Parameters

  • env: The contract environment.
  • caller: The address of the caller (must be the part owner).
  • uuid: The unique identifier for the part.
  • merkle_root: The new Merkle root to set.

Returns

  • Result<(), Error>: Ok if successful, Err if part not found or caller is not authorized.
fn change_merkle_root(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    uuid: soroban_sdk::BytesN<16>,
    merkle_root: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>

Update a single event leaf with authorization controlled by the event owner (or delegated writers).

This endpoint allows the event owner (or a writer proven to belong to writers_root) to update exactly one event leaf. The contract verifies:

  1. the previous root matches the on-chain root,
  2. the caller is the event owner, or is a delegated writer proven by a membership proof in writers_root,
  3. only this leaf changes (swap with the provided branch).

Parameters

  • env: The contract environment.
  • caller: The address of the caller (must be the event owner or a delegated writer).
  • part_uuid: The unique identifier for the part.
  • prev_root: The previous Merkle root of the part's manifest.
  • branch: The Merkle proof branch as a vector of (sibling hash, is_left) tuples for the event leaf.
  • old_leaf: The previous compact event leaf (owner, data_hash, writers_root).
  • new_leaf: The new compact event leaf (same event_id; owner unchanged).
  • writer_branch: Optional Merkle proof branch for `c
fn update_event_leaf(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    part_uuid: soroban_sdk::BytesN<16>,
    prev_root: soroban_sdk::BytesN<32>,
    branch: soroban_sdk::Vec<(soroban_sdk::BytesN<32>, bool)>,
    old_leaf: EventLeaf,
    new_leaf: EventLeaf,
    _writer_branch: Option>,
) -> Result<(), soroban_sdk::Error>

Add a new event leaf to the part's manifest. This function allows the part owner (or a delegated writer) to append a new event. It verifies:

  1. The previous root matches the on-chain root.
  2. The caller is authorized (owner or delegated writer proven via writer_branch).
  3. Updates the part's Merkle root to the new one provided.

Parameters

  • env: The Soroban environment.
  • caller: Address of the caller (must be owner or writer).
  • part_uuid: UUID of the part.
  • prev_root: Previous Merkle root on-chain.
  • new_root: New Merkle root after adding the event.
  • new_leaf: The new EventLeaf being added.
  • writer_branch: Optional proof that caller ∈ writers_root (if not owner).

Returns

Ok(()) on success, Error otherwise.

fn add_event_leaf(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    part_uuid: soroban_sdk::BytesN<16>,
    prev_root: soroban_sdk::BytesN<32>,
    new_root: soroban_sdk::BytesN<32>,
    new_leaf: EventLeaf,
    _writer_branch: Option>,
) -> Result<(), soroban_sdk::Error>

Transfer ownership of the part to a new owner.

Parameters

  • env: The contract environment.
  • caller: The address of the caller (must be the part owner).
  • uuid: The unique identifier for the part.
  • new_owner: The address of the new owner.

Returns

  • Result<(), Error>: Ok if successful, Err if part not found or caller is not authorized.
fn transfer_part(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    uuid: soroban_sdk::BytesN<16>,
    new_owner: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Change the status of the part.

Parameters

  • env: The contract environment.
  • caller: The address of the caller (must be the part owner).
  • uuid: The unique identifier for the part.
  • new_status: The new status to set for the part.

Returns

  • Result<(), Error>: Ok if successful, Err if part not found or caller is not authorized.
fn change_status(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    uuid: soroban_sdk::BytesN<16>,
    new_status: PartStatus,
) -> Result<(), soroban_sdk::Error>

Imports

WebAssembly Text (WAT) ▶