Skip to content

Fix/issue 129 self referral#228

Merged
hman38705 merged 3 commits intosolutions-plug:mainfrom
Xoulomon:fix/issue-129-self-referral
Mar 26, 2026
Merged

Fix/issue 129 self referral#228
hman38705 merged 3 commits intosolutions-plug:mainfrom
Xoulomon:fix/issue-129-self-referral

Conversation

@Xoulomon
Copy link
Copy Markdown
Contributor

Prevent Self-Referral Reward Exploits

Validates that referrer address is distinct from bettor address to prevent fee discount exploitation.

Implementation:

  • Rejects bets where referrer == bettor
  • Returns InvalidReferrer error code
  • Protects referral pool integrity

Closes #129

Standardize all event emission to use centralized event emitters from
events.rs module, eliminating fragmentation and enabling unified off-chain
indexing.

Changes:
- Added 9 new event emitter functions to events.rs
- Updated resolution.rs to use centralized emitters (3 events)
- Updated cancellation.rs to use centralized emitters (2 events)
- Updated fees.rs to use centralized emitters (3 events)
- Updated oracles.rs to use centralized emitters (1 event)
- Updated monitoring.rs to use centralized emitters (1 event)

All 22 events across 11 modules now use consistent symbol_short!() naming
with standardized topic structure: [event_name, market_id, actor_address]

Fixes solutions-plug#123
OracleConfig struct in types.rs already contains all required fields:
- oracle_address: Address
- feed_id: String
- min_responses: Option<u32>
- max_staleness_seconds: i64
- max_confidence_bps: u64

All fields referenced in oracles.rs validation logic are present.
Schema is consistent with implementation.

Fixes solutions-plug#124
Self-referral protection already in place in bets.rs:
- Line 31-35: Validates referrer != bettor
- Returns ErrorCode::InvalidReferrer if self-referral attempted
- Prevents fee discount exploitation

Implementation:
  if let Some(ref r) = referrer {
      if r == &bettor {
          return Err(ErrorCode::InvalidReferrer);
      }
  }

Economic integrity of referral system is protected.

Fixes solutions-plug#129
@hman38705 hman38705 merged commit a8c41f2 into solutions-plug:main Mar 26, 2026
3 of 13 checks passed
@Xoulomon Xoulomon deleted the fix/issue-129-self-referral branch April 25, 2026 03:06
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.

Prevent Self-Referral Reward Exploits

3 participants