The PetChain smart contract suite manages pet registration, medical records, ownership, and related services on the Stellar (Soroban) network. This document covers all public functions in the main PetChainContract and the VetRegistryContract.
- Contract Statistics
- Admin & Multisig Management
- Pet Management
- Owner Management
- Vet Management
- Medical Records
- Vaccinations
- Lab Results
- Medications
- Treatments
- Insurance
- Grooming
- Nutrition
- Behavior & Training
- Activity Tracking
- Breeding
- Access Control
- Emergency Contacts
- Lost Pet Alerts
- Tag Linking
- Consent Management
- Vet Availability
- Vet Reviews
- Pet Multisig Transfer
- Contract Upgrade
- Vet Registry Contract
Returns the total number of pets ever registered.
- Parameters:
env: Env - Returns:
u64
Returns the number of registered pets for a given species.
- Parameters:
env: Env,species: String - Returns:
u64
Returns the number of currently active (non-archived) pets.
- Parameters:
env: Env - Returns:
u64
Initialize a single admin for the contract.
- Auth:
adminmust sign - Parameters:
env: Env,admin: Address - Panics: If admin already set
Initialize multi-signature admin control.
- Auth:
invokermust sign and must be inadminslist - Parameters:
env: Env,invoker: Address,admins: Vec<Address>,threshold: u32 - Panics: If admin already set, threshold is 0 or > admins.len(), or invoker not in list
Propose a multi-signature admin action.
- Auth:
proposermust be an admin - Parameters:
env: Env,proposer: Address,action: ProposalAction,expires_in: u64 - Returns:
u64— proposal ID
Approve a pending multi-signature proposal.
- Auth:
adminmust be an admin - Parameters:
env: Env,admin: Address,proposal_id: u64 - Panics: If proposal not found, already executed, or expired
Execute a proposal once threshold approvals are met.
- Parameters:
env: Env,proposal_id: u64 - Panics: If threshold not met, already executed, or expired
Initialize multi-signature admin control.
Auth: invoker must sign and must be in admins list
Parameters:
env: Envinvoker: Addressadmins: Vec<Address>threshold: u32
Panics: If admin already set, threshold is 0 or > admins.len(), or invoker not in list
Propose a multi-signature admin action.
Auth: proposer must be an admin
Parameters:
Returns the activity statistics for a given vet.
Parameters:
env: Env- Contract environmentvet_address: Address- The vet's address
Returns: VetStats - Stats struct with the following fields:
total_records: u64- Total medical records added by this vettotal_vaccinations: u64- Total vaccinations administeredtotal_treatments: u64- Total treatments recordedpets_treated: u64- Number of unique pets treated
Returns a zeroed VetStats if the vet has no recorded activity.
Example:
let stats = client.get_vet_stats(&vet_address);Returns: u64 —