Platform: Code4rena
Start Date: 23/02/2024
Pot Size: $92,000 USDC
Total HM: 0
Participants: 47
Period: 10 days
Judge: 0xTheC0der
Id: 336
League: ETH
Rank: 12/47
Findings: 2
Award: $716.32
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: CodeWasp
Also found by: 0xdice91, 0xlemon, Aamir, Al-Qa-qa, AlexCzm, BAHOZ, Bauchibred, Breeje, DadeKuma, Fassi_Security, PetarTolev, Shield, SpicyMeatball, Trust, ZanyBonzy, cheatc0d3, gesha17, haxatron, imare, jesjupyter, kutugu, lsaudit, marchev, merlinboii, nnez, osmanozdemir1, peanuts, radev_sw, twicek, visualbits
694.2987 USDC - $694.30
Judge has assessed an item in Issue #321 as 2 risk. The relevant finding follows:
[L-0] Change the V3FacotryOwner.claimFees() to accept the amount - 1 equal to fees from the uniSwap V3 pools
#0 - c4-judge
2024-03-07T23:50:34Z
MarioPoneder marked the issue as duplicate of #34
#1 - c4-judge
2024-03-14T01:39:50Z
MarioPoneder marked the issue as satisfactory
#2 - c4-judge
2024-03-26T22:58:01Z
MarioPoneder marked the issue as grade-b
🌟 Selected for report: roguereggiant
Also found by: 0xepley, Aamir, Al-Qa-qa, LinKenji, MSK, McToady, Myd, SAQ, Sathish9098, ZanyBonzy, aariiif, cudo, emerald7017, fouzantanveer, hassanshakeel13, hunter_w3b, ihtishamsudo, kaveyjoe, peanuts
22.023 USDC - $22.02
The UniStaker contract serves as a pivotal component within the Uniswap V3 ecosystem, facilitating the distribution of rewards to stakers who delegate and stake their UNI tokens. This report offers a detailed analysis of the UniStaker contract and other contracts in scope, encompassing their functionality, architecture, audit methodology, findings, recommendations, and broader implications within the decentralized finance (DeFi) landscape.
Uniswap V3 revolutionizes decentralized finance (DeFi) with its advanced automated market maker (AMM) solution, introducing concentrated liquidity positions and flexible fee structures. Unlike its predecessors, Uniswap V3 empowers liquidity providers with granular control over their capital allocation within specified price ranges, enhancing capital efficiency and reducing impermanent loss. Additionally, the protocol enables governance token holders to set and manage protocol fees, fostering community participation and sustainability.
Within this context, the UniStaker contract plays a crucial role by incentivizing UNI token holders to actively engage in governance and liquidity provision. Through staking and delegation mechanisms, users contribute to the protocol's growth and earn rewards, thereby enhancing decentralization and community ownership. Here is a brief overview about contracts in Scope of this audit.
The UniStaker contract is responsible for managing the distribution of rewards to stakers based on their delegated UNI tokens. By staking UNI tokens and delegating governance voting weight, users actively participate in protocol governance while earning rewards proportional to their staked amount. The contract's modular architecture, built on OpenZeppelin standards, ensures robustness and security.
The UniStaker contract collaborates closely with the UniV3FactoryOwner contract, which serves as the owner of the Uniswap V3 factory. The UniV3FactoryOwner contract enables governance to set and manage protocol fees for Uniswap V3 pools. By seamlessly integrating with UniStaker, the UniV3FactoryOwner contract ensures that rewards generated from protocol fees are trustlessly distributed to stakers who delegate their UNI tokens.
In addition to the UniV3FactoryOwner contract, the UniStaker contract interacts with the DelegationSurrogate contract. This contract facilitates delegation of governance voting weight while holding UNI tokens on behalf of stakers. By delegating voting power to specified addresses, users enhance their governance participation and flexibility within the Uniswap V3 ecosystem.
Interfaces:
Includes both Non-critical (code style, clarity, syntax, versioning, off-chain monitoring (events, etc)) and Low risk (e.g., assets are not at risk: state handling, function incorrect as to spec, issues with comments). Excludes Gas optimizations, which are submitted and judged separately.
Finding Title | Severity | File | GitHub Link |
---|---|---|---|
Change the claimFee() to accept amount-1 | QA-1 | UniStaker.sol | Link |
Mistakes in Natspac | QA-1 | UniStaker.sol | Link |
No need for else statement | QA-1 | UniStaker.sol | Link |
For this audit, a comprehensive approach combining manual analysis and rigorous fuzzing techniques was implemented to ensure thorough scrutiny of the smart contracts. The following methodologies and tools were employed:
Manual Analysis:
Fuzzing Techniques:
700
lines of fuzzing for 100,000
runs.Automated Tools:
Total Time Spent: Approximately 80 hours were dedicated to the audit process, ensuring thoroughness and meticulousness in analysis and testing.
The current codebase entails certain centralization risks due to the presence of functions managing critical aspects such as setting payout amounts, adding new reward notifiers, and configuring fees for Uniswap V3 pools. While these functions provide flexibility and control over protocol parameters, they also introduce potential vulnerabilities if not handled with caution.
One notable concern is the management of the PAYOUT_AMOUNT
, a parameter crucial for reward distribution. It's imperative to ensure that this value is set to reasonable and rounded amounts, such as 25 WETH
, to maintain stability and prevent potential issues. However, if excessively large or irregular values are used, such as 3234342342343243232
, it could lead to significant disruptions in the reward notification process.
For instance, setting excessively high PAYOUT_AMOUNT values could result in a denial-of-service (DoS) scenario during reward notification. The system may struggle to handle the processing load associated with distributing rewards, potentially leading to delays, inefficiencies, or even system failures. Moreover, irregular values may introduce complexities in calculations, affecting the accuracy and reliability of reward distribution mechanisms.
Additionally, the ability to add new reward notifiers and configure fees for Uniswap V3 pools introduces centralization risks related to governance and control. Improper management or manipulation of these parameters could lead to unfair advantage for certain participants, manipulation of reward distribution, or disruption of protocol operations.
To mitigate these centralization risks, it's essential to implement robust governance mechanisms, transparent decision-making processes, and thorough testing protocols. Regular audits, community participation, and adherence to best practices can enhance the resilience and decentralization of the protocol, ensuring its long-term sustainability and security. Continued diligence, community involvement, and adherence to best practices will be paramount in ensuring the stability, integrity, and resilience of the system
In summary, the audit of the UniStaker protocol unveiled a robust and well-structured codebase, demonstrating a high level of solidity and resilience. The protocol's architecture showcases thoughtful design considerations and meticulous attention to detail, contributing to its overall reliability and security.
Throughout the audit process, only a few informational findings were identified, underscoring the protocol's strong security posture and resistance to vulnerabilities. The development team's adherence to best practices and thorough testing methodologies has contributed to the protocol's solidity and robustness.
Moving forward, it is recommended that the development team continues to prioritize ongoing monitoring and maintenance efforts to ensure the protocol remains resilient to emerging threats and challenges. Additionally, proactive engagement with the community and adoption of industry best practices will further strengthen the protocol's position as a trusted and dependable solution within the decentralized finance (DeFi) ecosystem.
The audit team extends its appreciation to the development team for their cooperation and support throughout the audit process.
This audit report is based on the code and documentation available at the time of the audit and is subject to change based on future updates or revisions to the protocol. The findings and recommendations provided in this report are intended for informational purposes only and should not be considered as financial or investment advice.
80 hours
#0 - c4-judge
2024-03-14T18:11:51Z
MarioPoneder marked the issue as grade-b