feat(shade): implement financial penalties for malicious campaigns (#360) - #414
Open
graceful-tech12 wants to merge 2 commits into
Open
feat(shade): implement financial penalties for malicious campaigns (#360)#414graceful-tech12 wants to merge 2 commits into
graceful-tech12 wants to merge 2 commits into
Conversation
…hadeProtocol#360) - Add CampaignPenaltyReport, CampaignPenaltyState, PenaltyReportStatus types - Add CampaignParticipant and CampaignAffiliate types - Consolidate Campaign struct with penalty fields (total_slashed, penalty_count, status) - Fix duplicate DataKey variants in types.rs (use StakeableCampaign for campaign.rs) - Add unique error codes for penalty operations (CampaignNotPenalizable, PenaltyReportNotFound, etc.) - Add penalty events: CampaignSlashedEvent, CampaignStakedEvent, Affiliate events, PenaltyReport events - Add comprehensive tests for staking, slashing, affiliates, and leaderboard - Fix campaigns.rs Campaign construction with new fields - Clean up shade.rs structure removing duplicate imports and function definitions
…gn.rs signatures - Remove ~90 non-trait functions from shade.rs (governance, bridge, escrow, NFTs, backer rewards, multi-sig, search, campaign categories, leaderboard, cross-chain pledges) - Fix create_campaign signature in campaign.rs to match trait's 7-param format - Add configure_campaign_fee_policy and calculate_campaign_discounted_amount back to campaign.rs - Add fee_waiver_bps, discount_bps, stake_required fields to Campaign struct - Update campaigns.rs Campaign construction with new fields - Rename unused charity param to _charity to suppress compiler warning - Add clear comment for placeholder token in campaign.rs create_campaign
|
@graceful-tech12 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Collaborator
|
Hello @graceful-tech12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements financial penalties for malicious campaigns as described in Issue #360. This adds core slashing/staking mechanics, affiliate tracking, leaderboard functionality, and a penalty reporting system.
Changes
New Types & DataKeys
total_slashed,penalty_count,status(CampaignStatus),fee_waiver_bps,discount_bps,stake_requiredfieldsStakeableCampaign,CampaignPenaltyReport,CampaignPenaltyStateFinancial Penalty Functions
stake_campaign: Stake tokens to increase participant scoreslash_campaign_stake: Slash (penalize) a participant's stake — core penalty mechanism, callable by campaign owner or adminregister_affiliate/pay_affiliate_commission: Affiliate/referral systemget_campaign_leaderboard: Top participants sorted by scoreconfigure_campaign_fee_policy: Set per-campaign fee waivers and discountscalculate_campaign_discounted_amount: Compute discounted contribution amountCode Quality Improvements
StakeableCampaignDataKey to avoid conflicts with campaigns.rsTests
test_campaign_penalties.rscovering staking, slashing, affiliates, leaderboard, authorization checks, and edge casesFiles Changed
Closes #360