Smart Contract Security Audit For TokenDeal

Score:
9.9 /10
Ecosystem:
Type:
NFT Platform
Background Image

Overview

TokenDeal is a protocol for NFT sales. The contract represents the main sale phases: funds collection during purchase, purchased NFT mint after the sale, and collected funds withdrawal.

Services: Smart Contracts Audit
Technologies: Ethereum Solidity

Task

Blaize’s task was to find and describe security issues in the smart contracts of the platform.

We needed to check the TokenDeal protocol with the following parameters:

  • Whether contracts are secure on both sides of the bridge;
  • Whether the implemented functionality corresponds to the documentation;
  • Whether contracts meet best practices in efficient use of gas and code readability.
  • Whether the bridge flow is safe for users.

We have scanned both sets of smart contracts for commonly known and more specific vulnerabilities:

  • Unsafe types conversion and unsafe math;
  • Timestamp Dependence;
  • Reentrancy (for Solidity part);
  • Correct roles distribution and access control flow;
  • Gas Limit and Loops;
  • Transaction-Ordering Dependence;
  • DoS attacks with (Gas Limit, unexpected reverts, storage abuse, etc.);
  • Byte array vulnerabilities;
  • Style guide violation;
  • ERC20 standard correspondence and correct tokens usage;
  • Uninitialized state/storage/ local variables;

Also, the TokenDeal protocol was checked against less common vulnerabilities from the internal Blaize.Security knowledge base.

Sale Flow Overview

TokenDeal NFT Sale Flow

Sale Flow Overview Image

The audited set of contracts represents the protocol for the NFT sale. It handles funds collection, NFT minting, and distribution of funds between the manager and the owner.

Here are the main parts of TokenDeal NFT sale flow:

1. Funds collection

2. NFT mint

3. Funds withdrawal

4. Global refund

The auditor’s team checked the contract against common vulnerabilities and its own security checklist, checked the funds flow, user operations, correct roles assignment, and the overall business logic (in search of loopholes, backdoors, and potential disruptions of the contract workflow).

Also, the team performed several testing rounds against the whole NFT sale process.

Smart Contract Security Audit

Blaize.Security has an established security audit procedure. It includes the following steps:

Comprehensive Security Audit

  • Manual code review;
  • Static analysis by automated tools;
  • Business logic review and decomposition of the system;
  • Unit test coverage check;
  • Extensive integration testing;
  • Fuzzy and exploratory testing;
  • Providing a detailed report of detected issues;
  • Verification of fixes;
  • Final audit report preparation & publishing.

Automated Tools Analysis

  • The auditors scanned the contract with several publicly available automated analysis tools with the manual verification of all the issues detected with these tools.

Manual Code Review

  • The Blaize.Security team made a manual analysis of smart contracts for any security vulnerabilities. We checked smart contract logic and compared it with the one described in the documentation.

Security Analysis Report

  • Finally, we have provided to the TokenDeal team the smart contracts security analysis report. Besides, the report contains the confirmation of fixes and necessary explanations from the TokenDeal team.

Audit Result

The audit found no critical issues. But the team has prepared a description and recommendation for the row of low-risk issues, including best practices violations, accuracy loss, and several questions connected to the business logic of the protocol. There were several unclear edgecases for the refund operations, NFT minting, and lock time for the contract. Though, the TokenDeal team resolved or verified all the issues.

Also, the Blaize Security team needs to notice that the contract depends on 3rd party contract – the actual NFT which will be sold. For now, the NFT contract is not written; therefore, there is no way to check the whole process of future NFT minting. Nevertheless, the TokenDeal team prepared the interface for the future NFT, compatible with the sale logic.

Audit Result Image

Contracts are well documented with Natspec comments and have good gas optimization. Despite current recommendations for additional checks for the lock change and token address during the minting, the overall security is high enough to comply with the security standard. Therefore, according to the above-listed rules, the overall security of the smart-contracts system of TokenDeal protocol can be evaluated as Highly Secure, 9.9 out of 10!

Score:
9.9 /10
Rate Background

Get in Touch

Your blockchain dreams deserve top-tier security. Let's secure them together with our team of certified blockchain security professionals.
Get consulting on WEB3 security from top-tier security researchers and auditors. Contact us, and let's fortify your decentralized future.