Agents: `admin_deactivate_agent` and `flag_agent` share duplicated admin-check code
Débutant
good first issuerefactorarea: contract-agentsP3-loweffort: small
4 ★
Poids du clone léger
Mise à jour
Description
## Context
The same seven-line load-admin-and-compare block appears in `flag_agent`, `admin_deactivate_agent`, and `transfer_admin`.
## Problem
Duplication means a future fix to the admin check has three places to land and two chances to be missed. It is also the kind of thing that makes the file harder to read than it needs to be.
## Proposed approach
Extract a private `fn require_admin(env: &Env, caller: &Address)` helper and call it from all three sites.
## Acceptance criteria
- [ ] A single helper implements the admin check
- [ ] All three call sites use it
- [ ] Existing admin tests pass unchanged
## Where to look
- `contract/agents/src/lib.rs:396`
---
_Newcomers welcome._ Comment to claim this before you start so we avoid duplicate work. Setup instructions are in `CONTRIBUTING.md`; ask here if anything is unclear and someone will help.
Issues similaires
Tout voir
JavaScript
Débutant
[BOUNTY · OPEN FOR CONTRIBUTORS] Crea il fumetto visuale “Come funziona MyZubster” — 300 MYZ proposed
# 🎨 Bounty — Crea il fumetto visuale “Come funziona MyZubster” ## Status **OPEN FOR CONTRIBUTORS / PROPOSED*…
Mise à jour
JavaScript
Débutant
Psychology subsection has only 4 entries
The `### Psychology` subsection under By Subject currently has only 4 entries (CrashCourse, Fiveable, Seneca …
Mise à jour
JavaScript
Débutant
Foreign Languages subsection has only 4 entries
The `### Foreign Languages` subsection under By Subject currently has only 4 entries (Duolingo, italki, Langu…
Mise à jour