Skip to content

Contracts: Add cross-contract integration — campaign auto-credits rewards on registration #301

@CelestinaBeing

Description

@CelestinaBeing

Summary

Currently the campaign and rewards contracts are independent — registering in a campaign does not automatically credit the participant with rewards. Operators must manually batch-credit participants after the fact. For a seamless user experience and trustless reward distribution, the campaign contract should optionally invoke the rewards contract to credit a registration bonus upon successful registration.

Problem

There is no cross-contract call flow:

  • Campaign contract does not know the rewards contract address
  • Registration does not trigger any credit
  • Operators must manually call batch_credit after inspecting registration events

Acceptance Criteria

  • Add optional rewards_contract: Option<Address> to campaign contract instance storage
  • Add set_rewards_contract(admin, nonce, rewards_contract)) admin function to configure the linked rewards contract
  • Add registration_bonus: u64 field (admin-configurable, default 0 = no auto-credit)
  • In register(): if rewards_contract is set and registration_bonus > 0, call rewards.credit(campaign_admin, participant, bonus) via cross-contract invocation
  • Cross-contract call is optional — if not configured, registration proceeds as today
  • Add integration test: register participant → assert rewards balance increased by bonus
  • Handle cross-contract call failure gracefully (registration still succeeds, emit a credit_failed event)
  • Update docs/ARCHITECTURE_OVERVIEW.md with the new cross-contract flow

References

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