Closed zerongt9 closed 1 year ago
@zerongt9 You've added new functions and structures to the contract, so it's not eligible for free reaudit.
The audit fee with 50% re-audit discount is 1200 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.
@yuriy77k can you please help to split it in TWO difference audit request to process.
we will pay the new audit request cost for this audit request (Mint Manager v2 and ERC721 v2 Audit request #12) and also like to submit a fix version ( Mint Manager and ERC721 Audit request #8 ) for free reaudit
@zerongt9 Ok. In this case, the audit fee is 2400 USDT.
@yuriy77k here is the payment tx hash https://etherscan.io/tx/0x6f672d9a92ff2f7f501f1a8ae899b20bce1e7e596e4c14538e25ead31467cc86
please help to arrange the audit
@yuriy77k May I know the current status of audit?
@zerongt9 The audit has been completed, please wait for updates from @yuriy77k on final report.
The high severity issue was found in the contract. The report was sent by email.
@yuriy77k we have fixed the issue and please help to arrange the reaudit.
live4well-smartcontractv2-for-audit smart contract security audit report performed by Callisto Security Audit Department
Commit 4101aa7f1ae0f1880caba7f1bfd5f42266173a5d
In total, 0 issues were reported, including:
0 high severity issues.
0 medium severity issues.
0 low severity issues.
In total, 13 notes were reported, including:
3 minor observations.
10 owner privileges.
SectionDetail
and publicMintSection
quotas can exceed MAX_SUPPLY
.The functions initializeSectionInfo()
, changeSectionQuota()
, and changePublicMintQuota()
do not check if the allowed number of tokens to be minted (quota
) in SectionDetail
and publicMintSection
exceeds MAX_SUPPLY
. The function publicMintERC20()
would revert if there is still a quota
availability and the amount of MAX_SUPPLY
tokens are minted.
The owner should take into account MAX_SUPPLY
so that the sum of quotas does not exceed it.
Note The variable quota
is redundant in the SectionDetail
as each whitelisted user is only allowed to mint one token and the user is removed from the whitelist, the owner can control the number of tokens that can be minted by the SectionDetail
by managing the addressWhitelist
.
The ERC721-nftpassV2.sol
and MintManagerV2.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.
safeMint
function allows any user with MINT_ROLE
permissions to mint an unlimited number of NFTs.addMinter
function allows the administrator to grant NFT minter role to any address.setBaseURI
allows the owner to modify the baseURI_
of the NFT tokens.setTokenURI()
allows owner to override the baseURI_
of NFT tokens to custom URI.privateMint
function, allows any address with PRIVATE_MINT
rights, to min any number of NFTs for free, depending on the quota.changeERC20Price
and changePublicMintERC20Price
, allow the administrator to add any ERC20 tokens including poisoned tokens as payment for NFTssetPrivateMintRole
, allows the administrator to give rights to any address to allow private minting.transferERC20Token
function allows the administrator to sign out any tokens from the contract.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.
The function tokenURI()
returns blindboxURI
if the Blind Box is not opened. But all data that are stored in the smart contract can be read from the blockchain. So, if your security model expects that baseURI_
or tokenURIOverride[tokenId]
should stay unknown for users until you openBlindbox
you shouldn't set it before that time.
Recommend to remove erc20Token.safeApprove(address(this), 0);
from constructor.
transferForm
uses more gas than function transfer
, so if needs to transfer from the address(this)
better to use transfer(to, value)
instead of transferFrom(address(this), to, value)
.To reduce gas cost on contract deployment and use the function transferERC20Token()
you should remove from the constructor:
IERC20 erc20Token = IERC20(_erc20AddressList[i]);
erc20Token.safeApprove(address(this), 0);
erc20Token.safeApprove(address(this), 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF);
And replace in the function transferERC20Token()
erc20Contract.safeTransferFrom(address(this), _to, _amount);
with
erc20Contract.safeTransfer(_to, _amount);
Starting from Solidity v0.8.4, there is a convenient and gas-efficient way to explain to users why an operation failed through the use of custom errors. Until now, you could already use strings to give more information about failures (e.g., revert("Insufficient funds.");), but they are rather expensive, especially when it comes to deployment cost, and it is difficult to use dynamic information in them.
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.
The contracts in the code base lack documentation. This hinders reviewers’ understanding of the code’s intention, which is fundamental to correctly assessing 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).
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.
Function setBaseURI()
, setTokenURI()
, and openBlindbox()
in the NFTPass
contract and functions initializeSectionInfo()
, changeSectionPeriod()
, changeSectionQuota()
, changeERC20Price()
, changePublicMintERC20Price()
, changePublicMintQuota()
, addSectionWhitelist()
, and removeSectionWhitelist()
in the MintManager
contract does not emit any events. Events are a way to log and notify external entities (such as user interfaces or other smart contracts) about specific occurrences within a smart contract. They serve as a mechanism for emitting and recording data onto the blockchain, making it transparent and easily accessible.
CREATE (0xf0)
opcode is assigned following this scheme keccak256(rlp([sender, nonce]))
. Therefore you need to use the same address that was originally used at the main chain to deploy the mock contract at a transaction with the nonce
that matches that on the original chain. Example: If you have deployed your main contract with address 0x010101 at your 2021th transaction then you need to increase your nonce of 0x010101 address to 2020 at the chain where your mock contract will be deployed. Then you can deploy your mock contract with your 2021th transaction, and it will receive the same address as your mainnet contract.The audited smart contract can be deployed. No security issues were found during the audit.
Users should pay attention to the contract owner's privileges.
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.
Audit request
Here is two contract related
ERC721_nftPassV2.sol , a standard ERC721 with Royalty, blindbox function and limited supply MintManagerV2.sol , provide a whitelist mint(erc20 payment) method to minting a nftpass NFT, also there are a mint period and quota to limit the number of minting. Also allow switch to a public mint to welcome all user to minting with erc20 payment
Source code
https://github.com/technine-IT/live4well-smartcontractv2-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)
email: zero.ng@technine.io
Platform
polygon