Skip to content

feat: implement collaborator revenue split with basis points #1

Description

@brightpixel-dev

Overview

Co-produced beats need automatic on-chain revenue splitting. When a producer uploads a beat, they should be able to specify up to 3 collaborator addresses with associated basis point shares. The contract distributes earnings proportionally on every sale.

Acceptance Criteria

  • New Collaborator struct: { address: Address, share_bps: u32 }
  • upload_sample accepts optional collaborators: Vec<Collaborator>
  • Validate that collaborator shares sum to ≤ 10000 bps (100%)
  • Remaining share goes to the primary uploader
  • purchase_license distributes producer cut proportionally across all collaborators
  • Each collaborator can independently call withdraw_earnings

Example

// Beat uploaded with 60/40 split between two producers
upload_sample(
  uploader,  // gets 60% of producer cut (54% of sale)
  ...,
  collaborators: vec![
    Collaborator { address: collab, share_bps: 4000 },  // 40% of producer cut (36% of sale)
  ]
)

Storage Consideration

Store collaborators as part of SampleData or as a separate DataKey::Collaborators(sample_id) entry to keep the main struct lean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions