Skip to content

Comments

feat: add co-ownership support for pets#148

Open
Majormaxx wants to merge 2 commits intoDogStark:mainfrom
Majormaxx:feat/co-ownership-support
Open

feat: add co-ownership support for pets#148
Majormaxx wants to merge 2 commits intoDogStark:mainfrom
Majormaxx:feat/co-ownership-support

Conversation

@Majormaxx
Copy link

Description

This PR implements co-ownership support for the PetChain contracts, allowing multiple owners to share custody and management of a pet.

Key Changes

  • Ownership Structure Upgrade: Modified Pet and PetProfile structs to support primary_owner and a Vec<Address> for owners.
  • Authorization Refactor: Replaced single-owner authorization checks with a require_any_owner_auth mechanism. Any registered owner can now perform administrative actions.
  • New Co-Ownership Management Functions:
    • add_co_owner: Allows an owner to add another co-owner.
    • remove_co_owner: Allows an owner to remove co-owners (primary owner removal is protected).
    • get_co_owners: Public view function for ownership lists.
  • Data Integrity & Bug Fixes:
    • Added missing archived and notes fields to Pet and PetProfile.
    • Fixed pre-existing DataKey variant issues for medications.
    • Resolved a duplicate require_admin definition and a missing string_to_species helper.
  • Test Suite: Added src/test_coownership.rs with comprehensive test coverage for all new functionality.

Related Issue

Closes #120

Checklist

  • Code follows project coding standards
  • Changes built successfully
  • New tests added and passed
  • Commit history is modular and atomic

- Replace owner: Address in Pet and PetProfile with primary_owner and owners: Vec<Address>
- Add DataKey::CoOwners(u64) for per-pet co-owner storage
- Add require_any_owner_auth helper and replace pet.owner.require_auth() calls
- Add add_co_owner, remove_co_owner, and get_co_owners functions
- Update accept_pet_transfer and registration functions
- Add missing Pet/PetProfile fields (archived, notes)
- Fix pre-existing DataKey medication variants and missing string_to_species helper

Closes DogStark#120
- Add test_coownership.rs covering co-owner addition, removal, and permissions
- Verify primary_owner removal restriction
- Ensure multi-owner auth logic works correctly
@llinsss
Copy link
Contributor

llinsss commented Feb 20, 2026

you hAVE MERGE conflicts that needs to be resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Co-Ownership Support

2 participants