Introduction
We express our gratitude to the Alacrity LSD team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
The Alacrity LSD Protocol audit scope consists of a staking and rewarding protocol that accepts ERC20 and native token staking for stakers, and distributes rewards according to their staked values.
| title | content |
|---|---|
| Platform | EVM |
| Language | Solidity |
| Tags | Staking; ERC20 Token |
| Timeline | 16/06/2023 - 18/08/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/AlacrityProtocolLSD/smartcontracts→ |
| Commit | 204f265d3447faa59cc9586614146e035ccf9ca3 |
Review Scope
- Commit
- 204f265d3447faa59cc9586614146e035ccf9ca3
Audit Summary
9/10
0%
7/10
7/10
The system users should acknowledge all the risks summed up in the risks section of the report
Document Information
This report may contain confidential information about IT systems and the intellectual property of the Customer, as well as information about potential vulnerabilities and methods of their exploitation.
The report can be disclosed publicly after prior consent by another Party. Any subsequent publication of this report shall be without mandatory consent.
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for Alacrity LSD |
| Audited By | Hacken |
| Website | https://linktr.ee/alacritylsd→ |
| Changelog | 23/06/2023 - Initial Review |
| 21/07/2023 - Second Review | |
| 18/08/2023 - Third Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Alacrity LSD
- Audited By
- Hacken
- Changelog
- 23/06/2023 - Initial Review
- 21/07/2023 - Second Review
- 18/08/2023 - Third Review
System Overview
The Alacrity LSD Protocol audit scope consists of a staking and rewarding protocol that accepts ERC20 and native token staking for stakers, and distributes rewards according to their staked values. Both the staking token and reward token can be configured, and different taking pools can be managed by admin addresses.
The core contracts of the system are the following;
StakingPool.sol - The staking contract for a single ERC20 token staking and reward token.
StakingPoolFactory.sol - The contract that handles creation and management of several staking pools, including native token staking.
EthStakingPool.sol - The staking pool contract for the native token.
CurrencyTransferLib.sol - The helper library for transferring native tokens.
RewardsDistributionRecipient.sol - Helper extendable contract to allow calls restricted to rewards distributor.
IVEALSD.sol - Interface for the vote escrow token of Alacrity.
IALSD.sol - Interface for the platforms native token.
IWETH.sol - Interface for native token wrapper.
IStakingPool.sol - Interface for the Staking Pool.
Privileged roles
Owner: Can interact with the StakingPoolFactory.sol and use its privileged functions, such as deploying new pools, withdrawing excess rewards, and adding rewards to pools.
rewardsDistribution: This is the StakingPoolFactory.sol contract. It can trigger privileged functions in the staking pool contracts, such as changing reward rate by notifying reward amount and withdrawing excess rewards.
Executive Summary
Documentation quality
The total Documentation quality score is 7 out of 10.
Functional requirements are provided.
Technical description is provided.
Development environment description is not provided.
NatSpec is not sufficient.
Code quality
The total Code quality score is 7 out of 10.
Solidity style guides are not followed.
Missing zero address checks.
The Development Environment was not configured.
Test coverage
Code coverage of the project is 0% (branch coverage).
Tests were not provided.
Security score
Upon auditing, the code was found to contain 2 critical, 2 high, 3 medium, and 4 low severity issues. Out of these, 8 issues have been addressed and resolved, leading to a Security score of 9 out of 10.
All identified issues are detailed in the “Findings” section of this report.
Summary
The comprehensive audit of the customer's smart contract yields an overall score of 2. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
There are out of scope external calls made in the StakingPoolFactory.sol contracts' addRewards function. The security of the functionality cannot be verified.
Users cannot get their rewards from the system unless the owner adds rewards via StakingPoolFactory contract. The timing and quantity of reward additions are determined by a centralized mechanism.
The ALSD and veALSD contracts are not part of the audit scope, and their security cannot be verified.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-0583 | Data Inconsistency | fixed | Critical | |
| F-2023-0582 | Invalid Calculations | fixed | Critical | |
| F-2023-0585 | Funds Lock | fixed | High | |
| F-2023-0584 | Contradiction In Function Name | fixed | High | |
| F-2023-0588 | Denial of Service | fixed | Medium | |
| F-2023-0587 | Unverifiable Logic | mitigated | Medium | |
| F-2023-0586 | Missing Validation | fixed | Medium | |
| F-2023-0592 | Missing Event Emitting | fixed | Low | |
| F-2023-0591 | Floating Pragma | fixed | Low | |
| F-2023-0590 | Empty Function | unfixed | Low |
Appendix 1. Severity Definitions
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, do not affect security score but can affect code quality score. |
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, do not affect security score but can affect code quality score.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
|---|---|
| Repository | https://github.com/AlacrityProtocolLSD/smartcontracts→ |
| Commit | 204f265d3447faa59cc9586614146e035ccf9ca3 |
| Whitepaper | Provided→ |
| Requirements | Provided→ |
| Technical Requirements | Provided |