Skip to content
Business logic Audit finding Beginner

Event Parameter Typo, referer in Staked Event vs referrer in StakeParams Struct

The Staked event in the staking interface spells its parameter 'referer' while the StakeParams struct spells the same concept 'referrer'. Off-chain consumers that generate bindings or subgraph schemas from the ABI may silently fail to read the referral address, so referral tracking and rewards could be lost.

godwinudo Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

68995 sc insight event parameter typo referer in staked event vs referrer in stakeparams struct

Submitted on Mar 12th 2026 at 09:30:12 UTC by @godwinudo for Audit Comp | Folks Finance: Staking Contracts

Description

Brief/Intro

The Staked event in IStakingV1.sol uses the parameter name referer (single r), while the StakeParams struct uses referrer (double r). This naming inconsistency is baked into the contract's ABI and cannot be corrected post-deployment, causing permanent confusion for off-chain integrations.

Vulnerability Details

The IStakingV1.sol interface defines the StakeParams struct with the field name referrer:

Solidity
struct StakeParams {
    uint64 maxStakingDurationSeconds;
    uint64 maxUnlockDurationSeconds;
    uint32 minAprBps;
    address referrer;       // <-- double 'r'
}

However, the Staked event in the same interface uses the spelling referer:

Solidity
event Staked(
    address indexed user,
    uint8 indexed periodIndex,
    address indexed referer,   // <-- single 'r'
    uint8 stakeIndex,
    uint256 amount
);

The event is emitted in _stake() in Staking.sol, passing the struct field into the event parameter:

Solidity
emit Staked(msg.sender, periodIndex, params.referrer, stakeIndex, amount);

The code compiles and functions correctly because event parameter names are metadata, and the EVM only cares about the types and indexing for topic hashing. The event signature hash is computed from the types (address, uint8, address, uint8, uint256), not the parameter names. So no on-chain behavior is affected.

However, the parameter name referer becomes part of the contract's ABI JSON output. Every tool that generates typed bindings from the ABI inherits this inconsistency. A subgraph developer defining their schema sees referer in the event ABI but referrer in the struct ABI and documentation.

Since the event signature is encoded in the deployed bytecode, this cannot be fixed without redeploying the contract.

Impact Details

Off-chain systems that parse the contract's ABI subgraphs, analytics dashboards, frontend applications, and SDK wrappers will encounter different spellings for the same conceptual field depending on whether they read it from the StakeParams struct or the Staked event.

Proof of Concept

{% stepper %} {% step %}

Step 1

The Staking contract is deployed. The Staked event is now part of the on-chain ABI with the parameter name referer (single r). {% endstep %}

{% step %}

Step 2

A developer reads the StakeParams struct in IStakingV1.sol and sees the field is called referrer (double r). They build their staking UI using this spelling throughout their codebase. {% endstep %}

{% step %}

Step 3

After a user stakes, the frontend listens for the Staked event to confirm the transaction and display details.

The decoded event args use the ABI parameter name referer, not referrer. The variable referrerAddress is undefined. The frontend silently fails to display or track the referral. {% endstep %}

{% step %}

Step 4

A subgraph developer building an indexer for the protocol defines their schema based on the struct documentation:

The actual event parameter is event.params.referer. The subgraph either fails to compile or silently stores null referrer addresses. {% endstep %}

{% step %}

Step 5

The protocol's referral reward system queries the subgraph for all stakes with a given referrer address. Because the referrer was stored as null due to the spelling mismatch, no referral rewards are attributed. Referrers who brought users to the protocol receive nothing. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by godwinudo. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

A typo in the event parameter name ('referer') diverges from the struct field name ('referrer'), and event parameter names are frozen into the ABI once deployed.

Impact

Off-chain systems such as subgraphs, dashboards, frontends and SDKs may see different spellings for the same field and could silently fail to record or reward referrals; on-chain behaviour is unaffected.

What the attacker needed

Deployed staking contract; off-chain consumer reading the ABI

The fix

The event parameter should be renamed to 'referrer' to match the struct, which requires redeploying the contract since the ABI is fixed at deployment.

How it was found

  1. The staking contract is deployed with the Staked event exposing the parameter name 'referer'.
  2. A developer reads the StakeParams struct, sees 'referrer', and builds their UI using that spelling.
  3. After a user stakes, the frontend decodes the Staked event and looks for 'referrer', which is undefined, so the referral is not displayed or tracked.
  4. A subgraph developer defines a schema from the struct documentation and the indexer either fails to compile or stores null referrer addresses.
  5. The referral reward system queries the subgraph and finds no attributed referrers, so referrers receive nothing.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract can announce things that happen by emitting an 'event', and other software listens for these events to update dashboards or databases. The name of a field inside an event is only a label for humans and tools; the blockchain itself does not care about spelling. Here the label in the event is spelled slightly differently from the label in a related data structure, so tools that read the labels can look for the wrong name and quietly get nothing.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by godwinudo

View all

14 more disclosed reports, best first.

More from Folks Finance: Staking Contracts

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.