H1 2025 Web3 Security Report$3.1B in losses, DeFi hit hardest, AI threats on the rise
Read the full report
  • Hacken
  • Audits
  • opinions-fun
  • [SCA] Opinions.fun | Opinions Dot Fun Contracts| Dec2024

Audit name:

[SCA] Opinions.fun | Opinions Dot Fun Contracts| Dec2024

Date:

Jan 7, 2025

Table of Content

Introduction
Audit Summary
System Overview
Potential Risks
Findings
Appendix 1. Definitions
Appendix 2. Scope
Appendix 3. Additional Valuables
Disclaimer

Want a comprehensive audit report like this?

Introduction

We express our gratitude to the Opinions.fun team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.

Opinions.fun is a token launchpad leveraging a bonding-curve mechanism to enable permissionless creation, trading, and migration of opinion-themed tokens to Raydium pools.

Document

NameSmart Contract Code Review and Security Analysis Report for Opinions.fun
Audited ByPrzemyslaw Swiatowiec
Approved ByGrzegorz Trawinski
Websitehttps://opinions.fun
Changelog02/01/2024 - Preliminary Report, 07/01/2024 - Remediation Review Report
PlatformSolana
LanguageRust
TagsSPL-22, Launchpad, Raydium
Methodologyhttps://hackenio.cc/sc_methodology
  • Document

    Name
    Smart Contract Code Review and Security Analysis Report for Opinions.fun
    Audited By
    Przemyslaw Swiatowiec
    Approved By
    Grzegorz Trawinski
    Changelog
    02/01/2024 - Preliminary Report, 07/01/2024 - Remediation Review Report
    Platform
    Solana
    Language
    Rust
    Tags
    SPL-22, Launchpad, Raydium

Review Scope

Repositoryhttps://github.com/opinionsdotfun
Commit7717f7dbc6f6ea08df52781c7e49e5def418bc3a
Remediation Fixes84c6dd57380f5c434ab775626fa5e588219556b7

Audit Summary

13Total Findings
13Resolved
0Accepted
0Mitigated

The system users should acknowledge all the risks summed up in the risks section of the report

Documentation quality

  • Functional requirements are provided.

  • Technical description is provided.

Code quality

  • Some code quality issues were reported as observations in previous part of this report.

  • The development environment is configured.

Test coverage

The tests are verbose and provide detailed output, but Solana currently lacks a precise tool for measuring test coverage.

System Overview

Opinions.fun is a Solana-based token launchpad that facilitates the creation, trading, and distribution of opinion-themed tokens using a bonding-curve pricing mechanism. Users can create token pools, trade tokens within the protocol, and migrate successful pools to Raydium's AMM for broader market integration. The protocol includes a fee structure for trades and pool setup, with treasury management by an administrator. Core functionalities include token pool creation, trading via exponential bonding curves, fee collection, and migration to Raydium for liquidity expansion.

Key Instructions:

  • initialize - Initializes the program, setting the administrator and initial fee parameters (setup_fee, buy_fees, sell_fees).

  • create_pool - Creates a new token pool by depositing a user's tokens into the pool's associated token account and initializing the pool's state, while charging a setup fee.

  • buy - Allows users to purchase tokens from the pool using the bonding curve, updating the pool's reserves and applying the configured buy fee.

  • sell - Enables users to sell tokens back to the pool for SOL, adjusting the pool's reserves and applying the configured sell fee.

  • prepare_raydium - Prepares a token pool for migration to Raydium by transferring assets and wrapping SOL into WSOL once a predefined reserve threshold is met.

  • initialize_raydium - Finalizes the migration of the token pool to Raydium by creating a liquidity pool on Raydium's AMM.

  • withdraw_from_treasury - Allows the administrator to withdraw accrued fees from the program's treasury account.

Privileged roles

  • Administrator: Responsible for initializing the program and setting key parameters such as setup fees, buy fees, and sell fees. Holds the authority to withdraw accrued fees from the treasury account.

Potential Risks

Dependency on Raydium: The program must remain in sync with Raydium’s token policies, such as allowed token types (e.g., disallowing fee-on-transfer tokens).  If the program is not updated to reflect Raydium’s evolving requirements, tokens created in the protocol may become incompatible with Raydium.

Findings

Code
Title
Status
Severity
F-2024-8018Associated Token Account Initialization Requirement Leading to Potential DoS
fixed

High
F-2025-8059Hardcoded Raydium Fee May Cause Protocol to Stop Working if Adjusted
fixed

Medium
F-2025-8058Lack of Validation for amm_config in Raydium Pool Initialization
fixed

Medium
F-2024-8012Inaccurate Accounting for SPL22 Tokens with Fee-On-Transfer Feature
fixed

Medium
F-2024-8011Lack of Validation for SPL22 Extensions in Token Mints
fixed

Medium
F-2024-8020 Incorrect Rounding Method for SOL Amount in Buy Function
fixed

Low
F-2024-8017Lack of Functionality to Modify Fees
fixed

Observation
F-2024-8016Missing Functionality to Pause Program Operations
fixed

Observation
F-2024-8015Lack of Functionality for Admin Rotation
fixed

Observation
F-2024-8014Treasury Account Can Fall Below Rent Exemption Leading to Transaction Failures
fixed

Observation
1-10 of 13 findings

Identify vulnerabilities in your smart contracts.

Appendix 1. Definitions

Severities

When auditing smart contracts, Hacken is using a risk-based approach that considers Likelihood, Impact, Exploitability and Complexity metrics to evaluate findings and score severities.

Reference on how risk scoring is done is available through the repository in our Github organization:

Severity

Description

Critical
Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.

High
High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.

Medium
Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.

Low
Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution.
  • Severity

    Critical

    Description

    Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.

    Severity

    High

    Description

    High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.

    Severity

    Medium

    Description

    Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.

    Severity

    Low

    Description

    Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution.

Potential Risks

The "Potential Risks" section identifies issues that are not direct security vulnerabilities but could still affect the project’s performance, reliability, or user trust. These risks arise from design choices, architectural decisions, or operational practices that, while not immediately exploitable, may lead to problems under certain conditions. Additionally, potential risks can impact the quality of the audit itself, as they may involve external factors or components beyond the scope of the audit, leading to incomplete assessments or oversight of key areas. This section aims to provide a broader perspective on factors that could affect the project's long-term security, functionality, and the comprehensiveness of the audit findings.

Appendix 2. Scope

The scope of the project includes the following smart contracts from the provided repository:

Scope Details

Repositoryhttps://github.com/opinionsdotfun
Commit7717f7dbc6f6ea08df52781c7e49e5def418bc3a
WhitepaperREADME.md
RequirementsREADME.md
Technical RequirementsREADME.md

Appendix 3. Additional Valuables

Additional Recommendations

The smart contracts in the scope of this audit could benefit from the introduction of automatic emergency actions for critical activities, such as unauthorized operations like ownership changes or proxy upgrades, as well as unexpected fund manipulations, including large withdrawals or minting events. Adding such mechanisms would enable the protocol to react automatically to unusual activity, ensuring that the contract remains secure and functions as intended.

To improve functionality, these emergency actions could be designed to trigger under specific conditions, such as:

  • Detecting changes to ownership or critical permissions.

  • Monitoring large or unexpected transactions and minting events.

  • Pausing operations when irregularities are identified.

These enhancements would provide an added layer of security, making the contract more robust and better equipped to handle unexpected situations while maintaining smooth operations.

Disclaimer