Skip to content

Contracts: Add multi-campaign rewards multiplier with campaign ID linkage #329

@CelestinaBeing

Description

@CelestinaBeing

Summary

The rewards contract supports campaign multipliers via campaign_multiplier(campaign_id), but the campaign_id is a u64 with no on-chain linkage to an actual campaign contract address. This loose coupling means any caller can claim any campaign_id multiplier without proving they are associated with that campaign.

Problem

In contracts/rewards/src/lib.rs:159:

pub fn campaign_multiplier(env: Env, campaign_id: u64) -> u32 {
  • campaign_id is arbitrary; there is no validation that it corresponds to a real deployed campaign
  • A caller could abuse a high-multiplier campaign_id to credit themselves at an inflated rate
  • No on-chain record linking campaign contract address ↔ campaign_id

Acceptance Criteria

  • Change campaign_id type from u64 to Address (the actual campaign contract address)
  • set_campaign_multiplier(admin, campaign_contract: Address, multiplier_bps) now takes an Address
  • credit_for_campaign(from, user, campaign_contract: Address, base_amount) — validate that campaign_contract.is_active() returns true before applying multiplier (cross-contract read)
  • Emit updated events with Address instead of u64 campaign_id
  • Update all tests to use Address-typed campaign identifiers
  • Update frontend/src/stellar.js accordingly
  • Add migration note in CHANGELOG.md (breaking change in campaign_id type)

References

  • contracts/rewards/src/lib.rs:139-165
  • contracts/campaign/src/lib.rs:339is_active()

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

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