Introduction
We express our gratitude to the EarnTV team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
EarnTV is a freemium web3 streaming service in the AVOD (Advertising-supported Video on Demand) and SVOD markets.
| title | content |
|---|---|
| Platform | Polygon |
| Language | Solidity |
| Tags | ERC20 token, Staking, ERC721 token, Subscription |
| Timeline | 05/07/2023 - 24/07/2023 |
| Methodology | https://hackenio.cc/sc_methodology→ |
Review Scope | |
|---|---|
| Repository | http://gitlabrepo.v2softinc.com/bpachai_git/uprime→ |
| Commit | 241611a179e6c73eed2e28b1addac616506a71aa |
Review Scope
- Commit
- 241611a179e6c73eed2e28b1addac616506a71aa
Audit Summary
10/10
98.78%
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 EarnTV |
| Audited By | Hacken |
| Website | https://earntv.io/→ |
| Changelog | 11/07/2023 – Initial Review |
| 24/07/2023 - Second Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for EarnTV
- Audited By
- Hacken
- Website
- https://earntv.io/→
- Changelog
- 11/07/2023 – Initial Review
- 24/07/2023 - Second Review
System Overview
EarnTV is a freemium web3 streaming service in the AVOD (Advertising-supported Video on Demand) and SVOD markets with the following contracts:
RewardToken — Simple ERC-20 token that mints all initial supply to a deployer. Additional minting is not allowed. It has the following attributes: \-Name: RewardEarnTV. \-Symbol: rETV. \-Decimals: 18. \-Total supply: 500m tokens.
ParentEarnTv — The contract is an ERC-20 token implementation with additional administrative and security features. It allows the contract owner and administrators to perform bulk token transfers, burn tokens, pause/unpause the contract, and withdraw any stuck Ether or ERC-20 tokens.
IssueETV — The contract enables the issuance of ETV tokens in bulk. It allows the contract owner to set thresholds for transfers, add or remove issuers, and withdraw stuck ERC-20 tokens or Ether.
GoldETV — The contract is used for minting non-fungible tokens (NFTs) representing subscriptions to a EarnTv service.
SilverETV — The contract is used for minting non-fungible tokens (NFTs) representing subscriptions to a EarnTv service.
BronzeETV — The contract is used for minting non-fungible tokens (NFTs) representing subscriptions to a EarnTv service.
IERC5643.sol — Extension of EIP-721. It proposes an additional interface for NFTs to be used as recurring, expirable subscriptions. The interface includes functions to renew and cancel the subscription.
IERC20Extended — Simple interface for ParentEarnTv.sol
Privileged roles
ParentEarnTv.sol
\-onlyOwner privilege roles:
addAdmins(): Add admins address in the contract.removeAdmins(): Remove admins address from the contract.setIssuerContract(): Set the issuer contract address.updateMaxTransferLimit(): Updates max account transfer limit.updateTimeBetweenSubmissions(): Updates time between submissions.withdrawAll(): Transfer all BNBs/ETHs stored in the contract to the caller.withdrawStuckTokens(): Transfer stuck ERC20 tokens from within the contract.transferOwnership(): Transfers ownership of the contract to a new account.cancelTransferOwnership(): Cancel ownership transfer request.
\-onlyIssuerContractOrOwner privilege roles:
bulkTransfer(): Moves tokensamountfromtokenOwnertorecipients.
\-onlyAdminOrOwner privilege roles:
pause(): Pause the contract.unpause(): Unpause the contract.
IssueETV.sol
\-onlyIssuer privilege roles:
issueBulkETVToken(): Moves tokensamountfromtokenOwnertorecipients.withdrawAll(): Transfer all BNBs/ETHs stored in the contract to the caller.withdrawStuckTokens(): Transfer stuck ERC20 tokens from within the contract.
\-onlyOwner privilege roles:
updateThreshold(): Increase transfer threshold value for the contract.addIssuers(): Add issuers address in the contract.removeIssuers(): Remove issuers address from the contract.transferOwnership():Transfers ownership of the contract to a new account.
GoldETV.sol
\-onlyOwnerOrAdmin privilege roles:
updateBaseURI(): Sets new URI value.safeMintAndRenewSubscription(): Mint GoldETV Subscription NFTs to the recipient addresses.pause(): Pause the contract.unpause(): Unpause the contract.renewSubscription(): Renews a subscription for a given token ID by extending its expiration date.
\-onlyOwner privilege roles:
withdrawContractEth(): Transfer all ETHs fromthis contracttoowner.transferOwnership(): Transfers ownership of the contract to a new account.cancelTransferOwnership(): Cancel ownership transfer request.updateAdmin(): Update the contract admin address.
SilverETV.sol
\-onlyOwnerOrAdmin privilege roles:
updateBaseURI(): Sets new URI value.safeMintAndRenewSubscription(): Mint GoldETV Subscription NFTs to the recipient addresses.pause(): Pause the contract.unpause(): Unpause the contract.renewSubscription(): Renews a subscription for a given token ID by extending its expiration date.
\-onlyOwner privilege roles:
withdrawContractEth(): Transfer all ETHs fromthis contracttoowner.transferOwnership(): Transfers ownership of the contract to a new account.cancelTransferOwnership(): Cancel ownership transfer request.updateAdmin(): Update the contract admin address.
BronzeETV.sol
\-onlyOwnerOrAdmin privilege roles:
updateBaseURI(): Sets new URI value.safeMintAndRenewSubscription(): Mint GoldETV Subscription NFTs to the recipient addresses.pause(): Pause the contract.unpause(): Unpause the contract.renewSubscription(): Renews a subscription for a given token ID by extending its expiration date.
\-onlyOwner privilege roles:
withdrawContractEth(): Transfer all ETHs fromthis contracttoowner.transferOwnership(): Transfers ownership of the contract to a new account.cancelTransferOwnership(): Cancel ownership transfer request.updateAdmin(): Update the contract admin address.
Executive Summary
Documentation quality
The total Documentation quality score is 10 out of 10.
Functional requirements are provided.
Technical description is provided.
Code quality
The total Code quality score is 9 out of 10.
The development environment is configured.
Test coverage
Code coverage of the project is 98.78% (branch coverage).
Deployment and user interactions are covered with tests.
Security score
Upon auditing, the code was found to contain 0 critical, 1 high, 6 medium, and 8 low severity issues. Out of these, 13 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 9.7. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
ERC-5643: Subscription NFTs proposal still under review and it is not recommended to use. https://eips.ethereum.org/EIPS/eip-5643 .
The Reward Token is a dummy ERC20 with no detailed utility.
The protocol is extremely centralized and the owner gets minted the totality of the tokens.
ETV token transfers are blocked if the contract is paused.
The solution for issue M01 depends on tools that are currently outside the scope of the audit.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2023-1200 | Requirement Violation | fixed | High | |
| F-2023-1206 | Missing Validation | fixed | Medium | |
| F-2023-1205 | Funds Lock | fixed | Medium | |
| F-2023-120 | Missing Validation | fixed | Medium | |
| F-2023-120 | Data Consistency | fixed | Medium | |
| F-2023-1202 | Copy of Well-Known Contract | fixed | Medium | |
| F-2023-1201 | Requirement Violation | mitigated | Medium | |
| F-2023-121 | Possible Integer Overflow | fixed | Low | |
| F-2023-121 | Checks-Effects-Interactions Pattern Violation | fixed | Low | |
| F-2023-1212 | Best Practice Violation - Long Numeric Literal | 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 | http://gitlabrepo.v2softinc.com/bpachai_git/uprime→ |
| Commit | 241611a179e6c73eed2e28b1addac616506a71aa |
| Whitepaper | Provided |
| Requirements | Provided |
| Technical Requirements | Provided |
Scope Details
- Commit
- 241611a179e6c73eed2e28b1addac616506a71aa
- Whitepaper
- Provided
- Requirements
- Provided
- Technical Requirements
- Provided