CallistoSecurity / Smart-contract-auditing

This is a working repo of @EthereumCommonwealth audits. We performed more than 400 security audits since 2018. Not even a single contract was hacked after our auditors approved the code. Accepting audit requests here.
https://audits.callisto.network/
2 stars 2 forks source link

Mint Manager and ERC721 Audit request #8

Closed zerongt9 closed 1 year ago

zerongt9 commented 1 year ago

Audit request

Here is two contract related

  1. ERC721-nftpass.sol , required a new parameter uint _level for storage the NFT level at smart contract
  2. MintManager.sol , provide a public mint(erc20 payment) and private mint(no payment required) method to minting a nftpass NFT,also there are a mint period and quota to limit the number of minting.

Source code

https://github.com/technine-IT/live4well-smartcontract-for-audit

Payment plan

... Write [x] at the checkbox of the payment plan that suits your needs ...

Disclosure policy

... Do you want us to publish the report as it is or to notify you privately in case of finding critical mistakes? ...

... provide your conditions for publishing the report or leave only standard disclosure policy link ...

Standard disclosure policy.

Contact information (optional)

slack or email : zero.ng@technine.io

Platform

polygon

yuriy77k commented 1 year ago

@zerongt9 The audit fee is 2400 USDT. You may send USDT (ERC20 or BEP20) to: 0x6317c6944bd1cD3932d062cce39d7Fd602119529 (valid for Ethereum and Binance Smart Chain)

The estimated auditing time - is 7 days after payment.

zerongt9 commented 1 year ago

@yuriy77k here is the payment tx hash 0xc40539d299ea0b68a9cbbd001e8d90f4b5fad85846253a2e084eb03f43b8a718

yuriy77k commented 1 year ago

@zerongt9 audit started

zerongt9 commented 1 year ago

@yuriy77k are there any feedback / result?

yuriy77k commented 1 year ago

@zerongt9 The final report will be ready in 2 days.

yuriy77k commented 1 year ago

@zerongt9 We found a medium severity issue in the contract and the report was sent to your email.

zerongt9 commented 1 year ago

we have fixed the issue and pushed to the same repo please help to arrange the re-audit

yuriy77k commented 1 year ago

Live4well ERC721 token and Mint Manager Security Audit Report

1. Summary

Live4well smart contract security audit report performed by Callisto Security Audit Department

This is re-audit of smart contracts that were fixed by developer according our recommendation.

2. In scope

Commit 467a0fcbc46b2cc94d9ae9ce63d6d565f318a2eb

3. Findings

In total, 0 issues were reported, including:

In total, 12 notes were reported, including:

3.1. Owner Privileges

Severity: owner privileges

Description

The ERC721-nftpass.sol and MintManager.sol contract inherits features of the OpenZeppelin AccessControl contract, allowing the administrator to manage administrators. This role can be abandoned, and it will result in blocking access to critical functions of the contract.

Recommendation

Since the owner has unlimited rights to do everything, the ownership must be transferred to a multi-sig contract. And also the addresses to whom the rights PRIVATE_MINT, MINT_ROLE are given must be trusted.

3.2. The ERC-20 tokens price is set manually

Severity: minor observation

Description

The functions initializeNFTLevelInfo() and addNewERC20Price() are used by the owner to set the price of ERC-721 tokens in ERC-20 tokens. For non-stable coins, the value might fluctuate and the prices are required to be updated in case of a change in value. Allowing users to mint the ERC-721 token at an increased or decreased value depending on the price fluctuation.

Code Snippet

Recommendation

Consider using a price oracle to get the current value of the ERC-20 tokens and convert the value to a stablecoin to determine the amount of ERC-20 tokens required to mint an NFT by a user.

3.3. Follow good coding practice

Severity: minor observation

Description

  1. Unlocked Pragma.

Contracts should be deployed using the same compiler version/flags with which they have been tested. Locking the floating pragma, i.e. by not using ^ in pragma solidity ^0.8.4, ensures that contracts do not accidentally get deployed using a compiler version with unfixed bugs.

  1. Missing docstrings.

The contracts in the code base lack documentation. This hinders reviewers’ understanding of the code’s intention, which is fundamental to correctly assess not only security but also correctness. Additionally, docstrings improve readability and ease maintenance. They should explicitly explain the purpose or intention of the functions, the scenarios under which they can fail, the roles allowed to call them, the values returned, and the events emitted.

Consider thoroughly documenting all functions (and their parameters) that are part of the contracts’ public API. Functions implementing sensitive functionality, even if not public, should be documented as well. When writing docstrings, consider following the Ethereum Natural Specification Format (NatSpec).

  1. Missing test suite.

The contract is missing a test suite to validate and verify the behavior of the contract functionalities. Add tests are recommended to ensure that the contract functions and behaves as expected.

4. Security practices

5. Conclusion

The audited smart contract can be deployed. No security issues were found during the audit.

Users should pay attention to unlimited owner's rights.

It is recommended to adhere to the security practices described in pt. 4 of this report to ensure the contract's operability and prevent any issues that are not directly related to the code of this smart contract.

6. Previous audit report

https://github.com/CallistoSecurity/AuditReports/blob/main/Reports/Polygon_Live4wellERC721MintManager_report.md