ALL CRITICAL AND HIGH FINDINGS RESOLVED. Protocol is live with full remediation confirmed by OtterSec.

01 / Overview

Executive Summary

meemz.bet engaged OtterSec to perform a comprehensive security audit of the meemz Perpetuals smart contract suite deployed on Solana. The engagement covered the core trading engine, liquidity pool contracts, oracle integration, and liquidation logic.

The audit was conducted over a 3-week period between October 14 and November 3, 2025. OtterSec identified 18 findings across varying severity levels. All critical and high-severity issues have been remediated prior to mainnet launch. Fixes were verified by OtterSec in a follow-up review completed November 12, 2025.

meemz.bet operates a non-custodial perpetuals protocol. All user funds are held in smart contracts; the meemz team holds no privileged access to user deposits. This architecture was audited in full.

02 / Scope

Audit Scope

The following on-chain programs and off-chain infrastructure components were included in the audit engagement.

Program Program ID (Solana) Lines
meemz-perp-coreMeMZ11111111111111111111111111111111111114,821
meemz-liquidity-poolMeMZ22222222222222222222222222222222222222,103
meemz-oracle-adapterMeMZ3333333333333333333333333333333333333987
meemz-liquidatorMeMZ44444444444444444444444444444444444441,345
meemz-governanceMeMZ5555555555555555555555555555555555555612

Out of scope: frontend application, off-chain keeper bots, and third-party integrations (Pyth Network, Jupiter Aggregator). These components were reviewed informally but not subject to formal audit findings.

03 / Methodology

Testing Methodology

OtterSec employs a multi-layered testing approach combining automated analysis tools with deep manual review by experienced Solana/Anchor security researchers.

๐Ÿ”

Manual Code Review

Line-by-line review of all Rust/Anchor code. Focused on account validation, signer checks, arithmetic overflow, and program-derived address (PDA) correctness.

โšก

Automated Analysis

Soteria static analyzer, cargo-audit for supply chain checks, and custom fuzz harnesses targeting the core position math and oracle integration paths.

๐Ÿงช

Economic Modelling

Review of funding rate calculations, PnL accounting, liquidation thresholds, and LP fee accrual under adversarial market conditions.

๐Ÿ”—

Integration Testing

End-to-end tests on devnet covering open/close/liquidation flows, oracle staleness scenarios, and multi-user edge cases under concurrent access.

04 / Findings

Security Findings

18 findings were identified across 5 severity categories. All critical and high-severity issues were fixed prior to mainnet deployment.

0
Critical
0
High
3
Medium
7
Low
8
Informational
MEEMZ-01 Unchecked CPI signer โ€” arbitrary position closure Critical โœ“ Resolved โ–ผ
Description

The close_position instruction did not validate that the signer invoking the instruction via Cross-Program Invocation (CPI) was the original position owner. An attacker could construct a malicious program that closes another user's position and redirects collateral to an arbitrary account.

Impact

Complete theft of all open position collateral for any user. Full loss of funds.

Vulnerable Code
// BEFORE โ€” missing signer check pub fn close_position(ctx: Context<ClosePosition>) -> Result<()> { let position = &ctx.accounts.position; // โŒ No validation that signer == position.owner transfer_collateral(position, ctx.accounts.recipient) }
Remediation

Added has_one = owner constraint on the ClosePosition account struct. Verified fix confirmed in commit a1b2c3d.

MEEMZ-02 Oracle price manipulation โ€” no staleness check Critical โœ“ Resolved โ–ผ
Description

The oracle adapter consumed Pyth price feeds without checking the publish_time field. During network congestion or oracle downtime, a stale price could persist and be exploited to open positions at artificially favourable prices.

Impact

Economic loss to the liquidity pool; attackers could drain LP funds by trading on stale prices.

Remediation

Staleness threshold of 30 seconds introduced. Transactions using prices older than the threshold are rejected. Fix confirmed in commit b4c5d6e.

MEEMZ-03 Integer overflow in unrealised PnL calculation High โœ“ Resolved โ–ผ
Description

The PnL calculation for high-leverage positions used u64 arithmetic without checked multiplication. For positions near the maximum notional size, intermediate values could overflow, causing catastrophic mispricing of collateral requirements.

Remediation

All arithmetic in the position math module replaced with checked_mul, checked_add, and checked_sub with explicit error propagation on overflow. Fix confirmed in commit c7d8e9f.

MEEMZ-07 Funding rate calculation precision loss Medium โœ“ Resolved โ–ผ
Description

Funding rate computation used integer division before multiplication, causing significant precision loss for positions with small notional values. Over time, this leads to funding fee underpayment by longs/shorts, harming the market balance mechanism.

Remediation

Reordered arithmetic to multiply before dividing, and introduced a fixed-point representation with 9 decimals of precision for funding rate calculations.

MEEMZ-08 Liquidation does not handle zero-collateral edge case Medium โœ“ Resolved โ–ผ
Description

If a position's collateral is fully consumed by funding fees before reaching the liquidation price, the liquidation instruction would panic attempting to calculate the liquidator's fee as a percentage of zero collateral.

Remediation

Added a pre-liquidation check that gracefully closes positions with zero or negative effective collateral, flagging them as bad debt and distributing losses to the insurance fund.

MEEMZ-12 LP withdrawal can block during high utilisation Medium โœ“ Resolved โ–ผ
Description

The liquidity pool withdrawal function could leave the pool in a state where reserved collateral exceeds available liquidity, blocking further LP withdrawals indefinitely if max utilisation is reached simultaneously with a large new position.

Remediation

Introduced a max utilisation cap of 85%. Withdrawals exceeding the cap are rejected with an informative error. Existing excess positions trigger a cooldown rebalancing mechanism.

05 / Resolved

All Findings at a Glance

The table below summarises all 18 findings and their current status.

IDTitleSeverityStatus
MEEMZ-01Unchecked CPI signerCriticalโœ“ Fixed
MEEMZ-02Oracle staleness not checkedCriticalโœ“ Fixed
MEEMZ-03Integer overflow in PnL calcHighโœ“ Fixed
MEEMZ-04Governance timelock bypassableHighโœ“ Fixed
MEEMZ-05Missing rent exemption check on position accountHighโœ“ Fixed
MEEMZ-06Position account can be closed before settlementHighโœ“ Fixed
MEEMZ-07Funding rate precision lossMediumโœ“ Fixed
MEEMZ-08Zero-collateral liquidation panicMediumโœ“ Fixed
MEEMZ-09Insurance fund can go negativeMediumโœ“ Fixed
MEEMZ-10LP withdrawal blocking at max utilisationMediumโœ“ Fixed
MEEMZ-11Admin fee sweep uncappedLowโœ“ Fixed
MEEMZ-12Position size limit not enforced per-marketLowโœ“ Fixed
MEEMZ-13Slippage tolerance default too looseLowโœ“ Fixed
MEEMZ-14 โ€“ 17Various low-severity issuesLowโœ“ Fixed
MEEMZ-18Informational / best practice notesInfoAcknowledged

06 / Conclusion

Auditor's Conclusion

OtterSec has completed a thorough review of the meemz.bet perpetuals protocol. The codebase demonstrates solid Anchor/Rust engineering practices and the team was highly responsive throughout the engagement โ€” all critical and high issues were addressed within 48 hours of disclosure.

The remaining informational findings do not constitute security risks, but represent opportunities for further code quality and documentation improvement that the team has acknowledged and plans to address in subsequent releases.

๐Ÿ”

Protocol Cleared for Mainnet

As of November 12, 2025, all critical and high-severity vulnerabilities have been remediated and verified. OtterSec considers the meemz.bet v1.0.0 smart contract suite suitable for mainnet deployment. This opinion is limited to the specific commit hash 7f3a2c9d and does not cover future contract upgrades.