agents/skills/solana/economic-design-audit/SKILL.md
Trigger Pattern MONETARY_PARAMETER flag (required) - Inject Into Breadth agents (merged via M4 hierarchy)
npx skillsauth add plamentsv/plamen economic-design-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Trigger Pattern: MONETARY_PARAMETER flag (required) Inject Into: Breadth agents (merged via M4 hierarchy) Finding prefix:
[EDA-N]Rules referenced: S1, S4, S9, R2, R10, R13, R14
rate|rebase|supply|mint_authority|burn|emission|inflation|peg|price.*cap|price.*floor|
fee|reward.*rate|basis_points|bps
For every monetary parameter setter (rate, fee, reward rate, emission, cap, floor, BPS values):
| Parameter | Setter Instruction | Min Value | Max Value | Enforced? | Impact at Min | Impact at Max | |-----------|-------------------|-----------|-----------|-----------|---------------|---------------|
For each parameter: substitute min and max into ALL consuming instructions.
Tag: [BOUNDARY:param=val -> outcome]
Solana-specific boundary checks:
u64/u128 operations? (Solana uses Rust's checked math by default in debug, but unchecked_* or release mode may overflow silently)List all economic invariants the protocol must maintain:
| Invariant | Parameters Involved | Can Authority Break It? | Instructions That Assume It | |-----------|--------------------|-----------------------|---------------------------|
For each setter: can changing this parameter break an invariant that user-facing instructions depend on? If yes -> finding.
Solana-specific invariants:
For protocols with multiple monetary parameters that interact:
| Parameter A | Parameter B | Interaction | Can A x B Produce Extreme Output? | |-------------|-----------|-------------|----------------------------------|
Check: can two independently-valid parameter settings combine to create an extreme or invalid economic state? (Rule 14 constraint coherence)
Example: reward_rate_bps = 5000 (valid alone) and boost_multiplier = 20 (valid alone) combine to effective_rate = 100000 BPS = 1000%, draining the reward vault in one epoch.
For every fee-related computation (fee calculation, fee deduction, fee distribution):
Pick 3 representative fee rates (e.g., 1% = 100 BPS, 5% = 500 BPS, 10% = 1000 BPS) and trace through the actual code formula:
| Fee Param | Value | Formula | Input Amount | Expected Output | Actual Output | Match? | |-----------|-------|---------|-------------|----------------|---------------|--------| | {fee_bps} | 100 | {code formula} | 10000 | {expected} | {computed} | YES/NO | | {fee_bps} | 500 | {code formula} | 10000 | {expected} | {computed} | YES/NO | | {fee_bps} | 1000 | {code formula} | 10000 | {expected} | {computed} | YES/NO |
Tag: [BOUNDARY:fee_bps={val} → effective_rate={computed_rate}]
Red flags:
amount * MAX / (MAX - fee) charges effective rate of fee/(MAX-fee), not fee/MAX. At 5% this is 5.26%, not 5%. Document whether this is intentional.For every fee computation, trace the base amount (the value the fee is computed on) through ALL subsequent code paths:
| Fee Site | Base Amount Variable | Modified After Fee? | Modified How | Fee Recomputed? | Overcharge? | |----------|---------------------|--------------------:|-------------|-----------------|-------------|
Methodology:
amount, depositAmount)fee = amount * feeRate / MAX, then amount is reduced to leftover (e.g., remaining allocation), the user paid fee on amount but only leftover was processed - overcharge of fee * (1 - leftover/amount)For protocols with multiple fee types:
| Fee A | Fee B | A Output Feeds B Input? | Combined Effective Rate | Independent Rate Sum | Discrepancy? | |-------|-------|------------------------|------------------------|---------------------|-------------|
If the protocol uses share-based accounting:
For protocols with emission/inflation/reward distribution mechanics:
| Emission Parameter | Max Rate | Vault Balance Required | Time to Depletion at Max | Cap Exists? | |-------------------|----------|----------------------|------------------------|-------------|
For batch operations (mass distributions, multi-user updates, reward claims):
| Operation | Per-User CU Cost | Users at Design Limit | Total CU | Exceeds 1.4M Limit? | Exceeds 200k/Ix Limit? | |-----------|-----------------|----------------------|----------|---------------------|----------------------|
Solana-specific cost analysis:
set_compute_unit_limit)For protocols that create accounts on behalf of users:
| Account Type | Size (bytes) | Rent-Exempt Cost (SOL) | Who Pays | Max Accounts at Design Limit | Total Rent Cost | |-------------|-------------|----------------------|----------|----------------------------|----------------|
Checks:
**ID**: [EDA-N]
**Verdict**: CONFIRMED / PARTIAL / REFUTED / CONTESTED
**Step Execution**: (see checklist below)
**Rules Applied**: [S1:___, S4:___, S9:___, R2:___, R10:___, R13:___, R14:___]
**Severity**: Critical/High/Medium/Low/Info
**Location**: programs/{program}/src/{file}.rs:LineN
**Title**: {parameter boundary violation / invariant break / economic unsustainability}
**Description**: {specific issue with code reference and numerical example}
**Impact**: {quantified at worst-state operational parameters -- Rule 10}
| Section | Required | Completed? | Notes | |---------|----------|------------|-------| | 1. Parameter Boundary Analysis | YES | | | | 2. Economic Invariant Identification | YES | | | | 3. Rate/Supply Interaction Matrix | IF >1 monetary param | | | | 4. Fee Formula Verification at Normal Values | IF fee parameters detected | | | | 5. Emission/Inflation Sustainability | IF emission/reward detected | | | | 6. Compute Unit Cost Modeling | YES | | | | 7. Rent and Account Creation Economics | IF protocol creates accounts | | |
If any step skipped, document valid reason (N/A, single parameter, no emissions, no account creation).
development
Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project documentation checks. Generates a scored Audit Readiness Report and optionally runs static analysis. Trigger on: "prepare for audit", "audit readiness", "pre-audit check", "audit prep", "NatSpec check", or any request to review a Solidity codebase before a security review.
development
Launch the Plamen deterministic Web3 security audit pipeline
development
Run the Plamen smart-contract audit wizard in Codex
testing
Launch the Plamen deterministic L1 infrastructure audit pipeline