Skip to content

Implement connection.rs Soroban contract (scout-player agreements) #220

Description

@Petah1

Summary

Implement the connection Soroban smart contract that records trial offer agreements between scouts and players on-chain, and advances a player to Elite Tier (Level 3) when a trial offer is logged.

Category

  • Feature

Priority

  • P0 – Blocks deployment

Depends On

#216 (workspace scaffold), #217 (register.rs — must update player progress level), #218 (progress.rs — shares validator registry)

Description

Function Description
log_trial_offer(scout, player_id, details_uri) Scout records a trial offer; advances player to Level 3; emits trial_offer_logged
get_connections(player_id) Read-only: returns all scout-player connection records for a player
get_trial_offers(scout) Read-only: returns all trial offers made by a scout

Level 3 promotion logic:
When log_trial_offer is called:

  1. Verify caller is a scout with an active subscription OR has paid the contact fee for this player.
  2. Write a TrialOffer record to persistent storage.
  3. Call into register contract storage to set player's progress_level = 3.
  4. Emit trial_offer_logged event with topics ["trial_offer_logged", scout, player_id].

Storage:

  • Key: TrialOfferKey(scout, player_id)TrialOfferData { details_uri, created_at }

Test Cases Required

  • log_trial_offer promotes player from Level 2 to Level 3
  • log_trial_offer requires scout to be subscribed or have paid contact fee
  • Duplicate trial offer for same (scout, player) is idempotent
  • get_connections returns correct records

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignenhancementNew feature or request

Type

No type
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