Skip to content
$1,000,000 in security audit grants are live now, Apply here →

Security review · October 2025

Contract Updates

for Aria

Guardian's review of Contract Updates for Aria, published October 2025. The report records 7 findings across 2 review rounds, including 1 high and 3 medium.

Published
Review window
September 17 to October 1, 2025
Rounds
Main Review, Remediation Review
Language
Solidity
Chains
Story, BNB Chain
Sector
Real-world assets
  • 0 Critical
  • 1 High
  • 3 Medium
  • 1 Low
  • 2 Informational

7 resolved

Scope

Findings 7

Main Review

4 findings · September 17 to 18, 2025
  1. H-01 High Rewards Included In “Total Staked” Rewards Resolved
    Location
    contracts/iprwa/staking/hook/RoyaltiesHook.sol:232
    Round
    Main Review

    Description

    The contract currently calculates total staked based on the contract’s IPRWA balance. When royalties are deposited, they inflate the staking balance, effectively treating rewards as staked funds. This causes overestimation of staking size and dilution of later rewards.

    Recommendation

    Maintain a dedicated totalStaked state variable updated only during stake/unstake actions.

  2. M-01 Medium Distribution Order In Unstake Rewards Resolved
    Location
    contracts/iprwa/staking/IPRWAStaking.sol:177
    Round
    Main Review

    Description

    In the current design, the distribute function is called after the unstake action. This means users receive IPRWA based on the previous snapshot, potentially under-allocating yield since they were contributing until the point of unstake. While this was intended to avoid gaming the system, it still leaves gaps: for example, a user can repeatedly stake as little as 1 wei to trigger distribution first and then immediately unstake, gaining advantage from timing.

    Recommendation

    Update distributions before calculating shares-to-assets conversion in the unstake function. This ensures users are attributed yield for the full duration of their stake and avoids unnecessary edge cases where minimal stakes can influence the distribution order.

  3. M-02 Medium Randomized Distribution Via Probability Rewards Resolved
    Location
    contracts/iprwa/staking/hook/RoyaltiesHook.sol:71
    Round
    Main Review

    Description

    The protocol introduces randomness (interval + delta) to determine whether distributions occur. While the intent is to mitigate MEV at boundaries, this randomness can be bypassed by wrapper contracts that deterministically call stake only when distribution would be skipped.

    Randomness could also result in one set of users not getting attributed to their yield, while one set is.

    It also requires consideration of forceDistribute by admin.

    Hence, the probabilistic design increases complexity without clear security gains.

    Recommendation

    Consider streaming royalties proportionally based on elapsed time since the last distribution. For example, distribute (elapsed / year) * yearlyDistribution. This approach:

    • Eliminates exploitable randomness,
    • Reduces unnecessary complexity,
    • Ensures smooth, continuous distribution,
    • Aligns directly with stake/unstake actions already in place.
  4. L-01 Low Missing Parent Initializers Resolved
    Location
    contracts/iprwa/staking/hook/RoyaltiesHook.sol:53-54
    Round
    Main Review

    Description

    The initialize() function of RoyaltiesHook only calls __ReentrancyGuard_init(), but does not invoke __AccessControl_init() or __UUPSUpgradeable_init().

    Currently, these functions are empty in the OpenZeppelin 0.8.x implementation, so the contract will work as expected. However, skipping them breaks the standard upgradeable-contract initialization pattern and may cause problems if OpenZeppelin adds initialization logic in future versions or if multiple inheritance chains rely on proper linearization.

    Recommendation

    Call all inherited initializer functions inside initialize() to preserve upgrade-safe patterns and maintain forward compatibility:

    __AccessControl_init();
    __ReentrancyGuard_init();
    __UUPSUpgradeable_init();
    
    

Remediation Review

3 findings · October 1, 2025
  1. M-01 Medium Incorrect Consideration of avgAPR Logical Error Resolved
    Round
    Remediation Review

    Description

    The current comment suggests that avgAPR is used to calculate the total amount of royalties to be distributed.

    avgAPR is used to calculate the total amount of royalties to be distributed, whereas
    

    This is incorrect.

    • APR represents the intended annual reward rate (e.g., 10%).
    • avgAPR represents how much has already been rewarded (but not yet claimed), relative to the staked balance.

    For example:

    • Initial stake = 1000 tokens, APR = 10%.
    • Expected yearly rewards = 100 tokens.
    • After one month: 100 ÷ 12 = 8.33 tokens accrued.
    • avgAPR at this point = (8.33 ÷ 1000) × 100% ≈ 0.833%.

    If a user claims rewards, avgAPR must decrease accordingly. Therefore, avgAPR must always be adjusted as:

    avgAPR= (rewards accrued − claimed)/stake ×100%

    Recommendation

    Calculate avgAPR considering above and ensure that avgAPR is consistently adjusted after claims, so it accurately reflects outstanding (unclaimed) rewards.

    Also consider correcting comment in contract to reflect actual nature of avgAPR.

  2. I-01 Informational Direct Donations to Staking Contract Warning Resolved
    Location
    Global
    Round
    Remediation Review

    Description

    Direct donations increase stakedAndRewards but not approxRewards. While normally unattractive (since donors effectively give value to others), this creates a potential exploit during the vault’s initial phase.

    Attack Scenario

    1. A malicious actor deposits 1 wei as the first stake.
    2. They wait for time to pass.
    3. Instead of staking again (which updates lastDistributionTime), they donate directly.
    4. The system incorrectly treats this donation as if it had been staked since the beginning, releasing more rewards than intended.

    If the first few depositors collude, they could inflate rewards early on at minimal cost.

    Recommendation

    On redeployment or when vault doesn't have much deposits, consider making the first substantial deposit to prevent exploitation by early depositors.

  3. I-02 Informational Missing Admin Functions in IRoyaltiesHookAdmin Best Practices Resolved
    Round
    Remediation Review

    Description

    The IRoyaltiesHookAdmin interface currently lacks functions for updating key parameters:

    • APR (the target annual reward rate)
    • avgAPR (the effective reward rate already accrued but not yet claimed)

    Recommendation

    Consider extending IRoyaltiesHookAdmin to include:

    • setAPR(uint256 newAPR)
    • setAvgAPR(uint256 newAvgAPR)

More from Aria

  1. ERC-20 Native and Token

    33 findings 33 findings: 1 medium, 19 low, 13 informational
  2. Token

    2 findings 2 findings: 1 low, 1 informational
  3. IP Real-World Assets

    27 findings4 high 27 findings: 4 high, 6 medium, 14 low, 3 informational

Put your code through the same review.

This review started with a conversation about scope. Tell us what you are building and we will plan yours with you.

Get a quote