Introduction
We express our gratitude to the Lovefy Inc team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
Lovefy Inc is a decentralized protocol for peer to peer value transfer connecting Web3, with traditional Social Media and E-Commerce platforms
title | content |
---|---|
Platform | EVM |
Language | Solidity |
Tags | Staking |
Timeline | 30/01/2024 - 16/02/2024 |
Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
---|---|
Repository | https://github.com/gotbitlabs/love-lending→ |
Commit | b679cf2 |
Review Scope
- Commit
- b679cf2
Audit Summary
10/10
100%
9/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 Lovefy Inc |
Audited By | Ivan Bondar |
Approved By | Przemyslaw Swiatowiec |
Website | https://love.io/→ |
Changelog | 01/02/2024 - Preliminary Report |
16/02/2024 - Final Report |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Lovefy Inc
- Audited By
- Ivan Bondar
- Approved By
- Przemyslaw Swiatowiec
- Website
- https://love.io/→
- Changelog
- 01/02/2024 - Preliminary Report
- 16/02/2024 - Final Report
System Overview
Lovefy Inc is a decentralized protocol for peer to peer value transfer connecting Web3, with traditional Social Media and E-Commerce platforms. The Minting Contract designed for staking tokens to earn rewards. It centralizes the process of token staking and reward distribution, offering a transparent and efficient mechanism for managing stakes and calculating rewards.
Files in the Scope: Minting.sol - This contract is the backbone of Lovefy Inc's framework, offering a range of functionalities:
Token Staking and Reward Distribution:
Central to the system, it manages the staking of tokens by users.
Responsible for tracking individual stakes, total staked tokens, and calculating rewards based on stake duration and amount.
Withdrawal and Reward Claiming Mechanisms:
Enables users to withdraw their staked tokens along with the earned rewards.
Supports management of individual stakes and facilitates the claiming of rewards.
Privileged roles
Contract Owner:
Possesses the authority to transfer ownership, and to pause or unpause the contract.
Responsible for updating reward rates and distribution periods, pivotal for the system's reward mechanism.
Executive Summary
Documentation quality
The total Documentation Quality score is 10 out of 10.
Functional requirements are detailed:
Project overview is detailed.
All roles in the system are described.
Use cases described.
For each contract all futures are described.
All interactions are described.
Technical description is robust:
Run instructions are provided.
Technical specification is provided.
NatSpec is sufficient.
Code quality
The total Code Quality score is 9 out of 10.
The development environment is configured.
Solidity Style Guide violations.
Test coverage
Code coverage of the project is 100% (branch coverage).
Deployment and basic user interactions are covered with tests.
Negative cases coverage is present.
Interactions by several users are tested.
Security score
Upon auditing, the code was found to contain 1 critical, 0 high, 1 medium, and 0 low severity issues. All issues were fixed in the remediation part of this audit, 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 9.8. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
Importance of Setting Correct Reward Rates: The contract's functionality relies on the accurate setting of reward rates to cover the designated reward period. If the reward rates are not configured correctly, it may lead to issues related to insufficient rewards, disrupting the expected distribution of rewards to users.
Findings
Code ― | Title | Status | Severity | |
---|---|---|---|---|
F-2024-0713 | Stake and Reward Locking in Staking Contract for Consecutive Reward Periods | fixed | Critical | |
F-2024-0702 | Potential Locking of Unclaimed Rewards in Minting Contract | fixed | Medium | |
F-2024-0718 | Function Parameter "paused" Shadows Function paused() from Pausable Contract | fixed | Observation | |
F-2024-0717 | Redundant periodFinish Check in the Stake Function | fixed | Observation | |
F-2024-0716 | Checks-Effects-Interactions Pattern Violation in stake Function | fixed | Observation | |
F-2024-0715 | Unsafe uint128 casting | fixed | Observation |
Identify vulnerabilities in your smart contracts.
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/gotbitlabs/love-lending→ |
Commit | c62c919b4e89cec629fe1478cec4bb578d903264 |
Whitepaper | NA |
Requirements | NatSpec |
Technical Requirements | NatSpec |
Deployed Address ETH | 0xBb39219BE50f2743353e23Db204997bA421275de |
Deployed Address BSC | 0x2CB5398C6dDa35636324c6050960E8722a7E2Dc1 |
Deployed Address PLS | 0xb7F1198a651e8009052b3eBb59C53dADD9AF8D25 |
Scope Details
- Commit
- c62c919b4e89cec629fe1478cec4bb578d903264
- Whitepaper
- NA
- Requirements
- NatSpec
- Technical Requirements
- NatSpec
- Deployed Address ETH
- 0xBb39219BE50f2743353e23Db204997bA421275de
- Deployed Address BSC
- 0x2CB5398C6dDa35636324c6050960E8722a7E2Dc1
- Deployed Address PLS
- 0xb7F1198a651e8009052b3eBb59C53dADD9AF8D25