# Reporting An Advertiser

***

### 1. Purpose

The reporting system protects users and the platform by providing a community-driven mechanism to flag ads that violate policy during an active rental period. It balances three goals:

1. Fast reaction to harmful content.
2. Economic deterrence against malicious or frivolous reports.
3. Fair remediation for advertisers who are incorrectly flagged.

***

### 2. Key Variables (Admin-Configurable)

| Variable                  | Description                                                                                      |
| ------------------------- | ------------------------------------------------------------------------------------------------ |
| Report Fee                | Small fee paid per report to discourage spam.                                                    |
| Report Threshold          | Number of reports required before an ad can be forcibly removed.                                 |
| Removal Deposit           | Stake the reporter must lock when calling removeFlaggedAd. Ensures only confident reporters act. |
| Successful Removal Reward | Bonus paid to a reporter when a valid removal is confirmed.                                      |

> All four values are on-chain variables that can be adjusted through an adminSetConfig instruction.

***

### 3. Lifecycle Overview

```flow
flowchart LR
    A[Advertiser wins auction & starts rental period] --> B[reportCount = 0]
    B --> C[Users may submit reports (pay Report Fee)]
    C -->|reportCount ≥ threshold| D[removeFlaggedAd may be invoked <br> (reporter locks Removal Deposit)]
    D --> E{Admin review}
    E -->|Ad OK| F[Return full escrow + Removal Deposit to Advertiser]
    E -->|Ad violates| G[Return Removal Deposit + Reward to Reporter]\nSend remaining escrow to Treasury
```

***

### 4. Detailed Workflow

#### 4.1 Rental Period Begins

* The advertiser wins an auction and sends rental payment to an escrow account.
* reportCount for that advertiser’s slot is reset to 0.

#### 4.2 Submitting Reports

* Any wallet can call reportAd(adSlot).
* The caller pays the Report Fee (burned or sent to treasury).
* On success, reportCount += 1 for the current rental period.

#### 4.3 Reaching the Threshold

* When reportCount ≥ Report Threshold, the ad becomes flagged.
* Flagged status alone does not remove the ad; it only unlocks the next step.

#### 4.4 Initiating Removal

* Any wallet may now call removeFlaggedAd(adSlot).
* The caller must attach the Removal Deposit.
* If the instruction is accepted:
  * The remaining rental time is forfeited.
  * A new auction for that slot begins immediately.
  * Remaining escrowed funds from the original rental are moved to a holding escrow controlled by the admin.

#### 4.5 Admin Review

The admin periodically batches flagged ads for manual review:

| Outcome                 | Funds to Advertiser                         | Funds to Reporter                           | Funds to Treasury |
| ----------------------- | ------------------------------------------- | ------------------------------------------- | ----------------- |
| Ad wrongfully removed   | 100 % of remaining escrow + Removal Deposit | —                                           | —                 |
| Ad legitimately removed | —                                           | Removal Deposit + Successful Removal Reward | Remaining escrow  |

***

### 5. Economic Rationale

* Report Fee deters low-effort spam but is small enough not to block genuine users.
* Removal Deposit ensures only reporters confident in a clear violation will escalate.
* Successful Removal Reward motivates community policing and covers gas costs.
* Escrow Forfeiture penalizes advertisers for policy violations, offsetting the cost of disrupted inventory.

***

### 6. Edge Cases & Notes

1. Threshold Reset – reportCount resets to 0 automatically at the start of every new rental period (i.e., when an auction is won).
2. Multiple Removals – If multiple users race to call removeFlaggedAd, only the first successful transaction locks the Removal Deposit; others fail.
3. Admin Failure to Review – Until an admin decision is recorded, funds remain safely in the holding escrow.

***

### 7. Instruction Reference

| Instruction         | Signers  | Key Arguments                                             | Description                                       |
| ------------------- | -------- | --------------------------------------------------------- | ------------------------------------------------- |
| reportAd            | reporter | adSlot                                                    | Submit a single report and pay Report Fee.        |
| removeFlaggedAd     | reporter | adSlot                                                    | Escalate a flagged ad by staking Removal Deposit. |
| adminSetConfig      | admin    | reportFee, removalDeposit, removalReward, reportThreshold | Update any economic parameter.                    |
| adminResolveRemoval | admin    | adSlot, decision                                          | Finalize funds flow after manual review.          |

***

### 8. Example Timeline

1. T0 – Advertiser A wins Slot #1 for 7 days.
2. T+1 d – 3 users each call reportAd. reportCount = 3 (threshold).
3. T+1 d 5 min – User X calls removeFlaggedAd and stakes 1 SOL deposit.
4. T+1 d 5 min – Slot #1 auction restarts; Y wins it later.
5. T+3 d – Admin reviews and confirms ad violation.
6. Outcome – User X receives 1 SOL deposit + 0.2 SOL reward; treasury keeps remaining escrow.

***

### 9. FAQ<br>

Q: *Can advertisers dispute a removal before admin review?*

> Not on-chain—their funds are already isolated. They may reach out off-chain to supply extra context for the admin decision.

Q: *Why not automate the review?*

> Content violations often require human judgment. Manual review minimizes false positives.

Intended design (based on your description):

* ✅ Suspending user puts up ad\_removal\_deposit
* ✅ All advertiser's remaining funds go to suspension escrow
* ✅ Admin moderator decides: funds → advertiser (wrongful) or treasury (justified)
* ✅ If justified: treasury gets advertiser funds + suspender gets deposit back + reward
* ✅ If wrongful: advertiser gets funds back + suspender's deposit

1. Security: Fixed critical vulnerability where ads could be suspended without meeting report thresholds
2. Financial Model: No more incorrect refunds - proper deposit/escrow system with admin review
3. Open Bounty: Anyone can suspend (not just group members) if they pay deposit and threshold met
4. Immediate Reset: Auction resets immediately for new cycle - no state preservation needed
5. Proper Compensation: Suspenders get rewarded for justified suspensions, advertisers get compensated for wrongful ones
