Introduction
We express our gratitude to the Angel Block team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
AngelBlock is a non-custodial, protocol based fundraising infrastructure that allows to conduct token based raises in a more transparent, decentralized, and democratized manner.
| title | content |
|---|---|
| Platform | EVM |
| Language | Solidity |
| Tags | Staking |
| Timeline | 03/04/2023 - 18/05/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | https://github.com/angel-block/angelblock-contracts→ |
| Commit | ea726f7 |
Review Scope
- Commit
- ea726f7
Audit Summary
10/10
100%
10/10
10/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 Angel Block |
| Audited By | Hacken |
| Website | https://angelblock.io→ |
| Changelog | 10/04/2023 - Initial Review |
| 18/05/2023 - Second Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Angel Block
- Audited By
- Hacken
- Website
- https://angelblock.io→
- Changelog
- 10/04/2023 - Initial Review
- 18/05/2023 - Second Review
System Overview
AngelBlock is a non-custodial, protocol based fundraising infrastructure that allows to conduct token based raises in a more transparent, decentralized, and democratized manner.
The audit is focused on the Staking part of the system. It consists of following contracts:
AbstractPool – an abstract smart contract which basically describes the pool for accumulating deposited funds.
DepositPool – a pool smart contract inherited AbstractPool, which stores deposited assets and ERC721(NFTs) from staking. Tokens and NFTs are part of the ecosystem and are clearly defined in the smart contract. A smart contract has a keeper who can withdraw funds from the smart contract.
AbstractStaking – an abstract smart contract which basically describes a staking mechanism. It is available to update the state of the contract based on the compounding interest and rewards. It ensures that the compounding process only happens if there are sufficient rewards and an hour has passed since the last compounding action. As a deposit are accepted ERC20 and ERC721(NFTs) tokens.
TholosStaking – a staking smart contract inherited AbstractStaking. It has extended functionality for calculating rewards. Unstaking is only possible after a 10 day period after the unstake request.
NFTDataOperator – a smart contract calculates the ERC20 tokens equivalent for a given amount of WETH tokens based on the current and previous NFT collection floor prices and volumes. It also ensures that the calculated ERC20 per ERC721(NFTs) value is within the allowed local cap range. The contract allows updating the local cap values and is configurable by the owner.
INFTDataOperator – an interface for NFTDataOperator smart contract.
ITholosStaking – an interface for TholosStaking smart contract.
IStaking – an interface describes basic staking functions. TholosStaking smart contract inherits this interface.
IPool – an interface for the deposit pool. Describes ERC20 interactions.
IPool721 – an interface for the deposit pool. Describes ERC721(NFTs) interactions.
Privileged roles
The 'keeper' of the DepositPool smart contract is able to withdraw native ERC20 and ERC721 (NFTs) tokens from the balance of the smart contract.
The ‘owner' of the NFTDataOperator is available to change cap range.
The ‘admin’ of the TholosStaking is available to configure the state of the smart contract.
The ‘manager’ of the TholosStaking is available to set
maxNftRewardCapvalue.The ‘nft operator’ of the TholosStaking is available to set the rate between ERC20 native token and ERC721(NFT).
The ‘upgrader’ of the TholosStaking is available to upgrade the smart contract.
Privileged roles
Provide more documentation and explanation of the project's technical part.
Executive Summary
Documentation quality
The total Documentation quality score is 10 out of 10.
Functional requirements are provided and detailed.
Technical description is sufficient:
NatSpec is provided and sufficient.
Run instructions are provided.
Code quality
The total Code quality score is 10 out of 10.
The development environment is configured.
The code is well organized and follows best practices.
Test coverage
Code coverage of the project is 100% (branch coverage).
Test coverage is sufficient.
Security score
Upon auditing, the code was found to contain 0 critical, 2 high, 1 medium, and 12 low severity issues. Out of these, 8 issues have been addressed and resolved, leading to a Security score of 10 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 10. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
The TholosStaking smart contract uses a queue to handle unstake requests. If the unstake queue size equals ten (10), it is impossible to withdraw assets.
The deposit and withdrawal of ERC721 assets are only supported for the EOA wallets. In case of using Multi-sig or other smart contracts for interaction with staking contracts, it is a user responsibility to check if ERC721 tokens are supported.
The vulnerability in AbstractStaking.sol could manifest when the rewardPool's balance is depleted or its transfer allowance is insufficient, potentially preventing users from withdrawing their funds. Additionally, this system presents a risk of gas inefficiency due to the unnecessary storage updates and token transfers in its design.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-0062 | Invalid Calculations; Requirements Violation | mitigated | High | |
| F-2023-0061 | Denial Of Service | mitigated | High | |
| F-2023-0063 | Requirements Violation | fixed | Medium | |
| F-2023-0075 | Gas Optimization | unfixed | Low | |
| F-2023-0074 | Unchecked Transfer | mitigated | Low | |
| F-2023-0073 | Code Clarity | unfixed | Low | |
| F-2023-0072 | OpenZeppelin Deprecated Function | fixed | Low | |
| F-2023-0071 | Code Consistency | fixed | Low | |
| F-2023-0070 | Gas Optimization | fixed | Low | |
| F-2023-0069 | Redundant Code | fixed | 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/angel-block/angelblock-contracts→ |
| Commit | ea726f7 |
| Whitepaper | Provided→ |
| Requirements | Provided→ |
| Technical Requirements | Provided→ |