Token Fleet
Fractional Ownership

Covered the contracts governing fractional car ownership, rental profit sharing, and eventual sale proceeds.
report id
0442
category
Token & RWA
language
Solidity
final report
April 7, 2025
lines of code
769
Content

Download audit report

1

Executive Summary

This document presents the security review performed by Nethermind Security for the smart contracts of Token Fleet. Token Fleet is a blockchain-powered platform that allows users to invest in cars through fractional ownership.

By owning tokens, users gain access to a diverse fleet of cars, earning a share of the rental profits and eventual sale proceeds. This allows users to tap into the car rental market without the complexities of full ownership.

This security review focuses exclusively on the smart contracts listed in Section 2 (Audited Files). The audited code comprises of 769 lines of code written in the Solidity language, and the audit was performed using (a) manual analysis of the code base and (b) creation of test cases.

Audit assessment
Audit TypeSecurity Review
Response from ClientRegular responses during audit engagement
Final ReportApril 7, 2025
RepositoryToken Fleet
Commit (Audit)c036ac4614
Commit (Final)4d82b7891d
Documentation AssessmentHigh
Test Suite AssessmentHigh
Total findings
5
Fixed
2
Acknowledged
3
Mitigated
0
Unresolved
0

Findings by severity

  • Critical0
  • High1
  • Medium2
  • Low2
  • Informational0
  • Best Practices0

2

Audited Files

#ContractLoCCommentsRatioBlankTotal
1PortfolioRegistry.sol1612414.9%36221
2Deal.sol3529426.7%104550
3InsuranceVault.sol7114.3%210
4Portfolio.sol812429.6%21126
5DealManager.sol1683722.0%43248
Total76918023.4%2061155

4

System Overview

4.1 Admin Flow

Admin flow overview
Fig. 2: Admin flow overview

The Admin Flow is designed for administrators who oversee the creation and management of Deals.

  • • Admins initiate the process by creating a Deal through the createDeal function in the DealManager contract. Each deal has specific parameters, such as a fundraising target, deadlines, fees, and insurance requirements.
  • • Admins can cancel a deal if the fundraising target is not met within the specified deadline by calling cancelDeal.
  • • Once the target is reached, the admin can close the deal using closeDeal, transferring the raised funds to the designated dealer and allocating insurance funds to a vault.
  • • Throughout the deal’s lifecycle, admins can add income generated by the deal using addIncome, which distributes profits to investors after deducting fees. If additional insurance funds are required, admins can withdraw them using getInsurance.
  • • Finally, when all assets associated with the deal are sold, the admin can finalize the Deal using finalizeDeal, ensuring all remaining funds are distributed appropriately.

Admins also have the ability to upgrade contract implementations at any time.

4.2 Users Flow

User flow overview
Fig. 3: User flow overview

The User Flow is tailored for investors who interact with deals through their portfolios.

  • • Users begin by creating a portfolio via the createPortfolio function in the PortfolioRegistry contract. Each portfolio is represented as an ERC721 token, allowing users to manage multiple portfolios if needed.
  • • Users can interact with deals through their portfolios by calling callDeal, which enables them to invoke any function on a deal, such as depositing funds, claiming rewards, or canceling their participation.
  • • All token transfers within the system are restricted to portfolios, ensuring that funds remain within the ecosystem. Users can also specify a rewardReceiver address to receive rewards generated by their interactions with deals.
  • • Additionally, users can directly interact with deals for functions that do not involve token transfers, such as canceling their participation, accruing income, or depositing assets.
  • • Rewards accumulated in a portfolio can be claimed using claimRewards, and these rewards can also be used for future deposits

5

Risk Rating Methodology

The risk rating methodology used by Nethermind Security follows the principles established by the OWASP Foundation. The severity of each finding is determined by two factors: Likelihood and Impact.

Likelihood measures how likely the finding is to be uncovered and exploited by an attacker. This factor will be one of the following values:

  1. High: the issue is trivial to exploit and has no specific conditions that need to be met;
  2. Medium: the issue is moderately complex and may have some conditions that need to be met;
  3. Low: the issue is very complex and requires very specific conditions to be met.

When defining the likelihood of a finding, other factors are also considered. These can include but are not limited to motive, opportunity, exploit accessibility, ease of discovery, and ease of exploit.

Impact is a measure of the damage that may be caused if an attacker exploits the finding. This factor will be one of the following values:

  1. High: the issue can cause significant damage, such as loss of funds or the protocol entering an unrecoverable state;
  2. Medium: the issue can cause moderate damage, such as impacts that only affect a small group of users or only a particular part of the protocol;
  3. Low: the issue can cause little to no damage, such as bugs that are easily recoverable or cause unexpected interactions that cause minor inconveniences.

When defining the impact of a finding, other factors are also considered. These can include but are not limited to data and state integrity, loss of availability, financial loss, and reputation damage. After defining the likelihood and impact of an issue, the severity is determined according to the table below.

Impact / LikelihoodLowMediumHigh
HighMediumHighCritical
MediumLowMediumHigh
LowInfo / Best PracticesLowMedium
UndeterminedUndeterminedUndeterminedUndetermined

To address issues that do not fit a High, Medium or Low severity, Nethermind Security also uses three more finding severities: Informational, Best Practices, and Undetermined.

  1. Informational findings do not pose any risk to the application, but they carry some information that the audit team intends to pass to the client formally;
  2. Best Practice findings are used when some piece of code does not conform with smart contract development best practices;
  3. Undetermined findings are used when we cannot predict the impact or likelihood of the issue.

6

Issues

6.1 Deal::cancel uses totalSupply instead of totalAssets to verify fundraising target

FileFix commitTypeStatus
Deal.sol2d447e0HighFixed

Each deal has two deadlines: (a) a fundraising deadline; and, (b) a closing deadline. Users can cancel a deal if either deadline is not met.

function cancel() external {
DealStorage storage $ = _getDealStorage();
_onlyStatus($, STATUS.RAISING_FUNDS);

if (totalSupply() < $.target) {
if (block.timestamp <= $.fundraisingDeadline) {
revert FundraisingDeadlineNotReached();
}
} else {
if (block.timestamp <= $.dealDeadline) {
revert DealDeadlineNotReached();
}
}
$.status = STATUS.CANCELLED;
emit DealCancelled();
}

The issue arises in how the target is checked. It incorrectly relies on totalSupply instead of totalAssets. Given that the ratio between the asset and the supply token is not 1:1 and instead linear (for example, a malicious user can intentionally fund the Deal contract with the assets directly through a transfer), the usage of totalSupply is incorrect.

Recommendation

Modify the mentioned check to use totalAssets() instead of totalSupply():

function cancel() external {
DealStorage storage $ = _getDealStorage();
_onlyStatus($, STATUS.RAISING_FUNDS);
- if (totalSupply() < $.target) {
+ if (totalAssets() < $.target) {
if (block.timestamp <= $.fundraisingDeadline) {
revert FundraisingDeadlineNotReached();
}
} else {
if (block.timestamp <= $.dealDeadline) {
revert DealDeadlineNotReached();
}
}
$.status = STATUS.CANCELLED;
emit DealCancelled();
}

Resolution

Fixed in commit 2d447e0

6.2 Inconsistent update of lastUpdate

FileFix commitTypeStatus
Deal.sol—MediumFixed

Users who deposit funds into deals are entitled to proportional rewards. They claim these rewards by calling Deal::claim, which updates lastUpdate[user] to ensure the claimed portion is excluded from future claims:

function _claim(DealStorage storage $, address user, address receiver) internal returns (uint256) {
uint256 assets = reward(user);

==> $.lastUpdate[user] = $.totalIncome;

if (assets > 0) {
USDC.safeTransfer(receiver, assets);
}

emit Claimed(user, receiver, assets);
return assets;
}

function reward(address user) public view returns (uint256) {
DealStorage storage $ = _getDealStorage();
uint256 shares = balanceOf(user);
return Math.mulDiv(shares, $.totalIncome - $.lastUpdate[user], totalSupply(), Math.Rounding.Floor);
}

However, a rounding issue can cause the claimable assets to be zero, despite updating lastUpdate[user]. This results in the system marking the user as having claimed their income when they actually received nothing.

Consider the following example:

  • The total assets deposited into the deal are 5M USDC, and the total supply is approximately 3M shares;
  • Bob deposits 1.6K USDC, receiving 1K shares;
  • 2.5K USDC is added to the deal contract as income;
  • Bob calls claim to receive his share of the income. The reward function computes: 1K×2.5K / 3M = 0;
  • Since assets is 0, Bob receives no rewards, but lastUpdate[user] is still updated, preventing him from claiming his rightful share in future distributions;

Recommendation

Update lastUpdate[user] only when the calculated rewards are greater than zero:

function _claim(DealStorage storage $, address user, address receiver) internal returns (uint256) {
uint256 assets = reward(user);
- $.lastUpdate[user] = $.totalIncome;
if (assets > 0) {
+ $.lastUpdate[user] = $.totalIncome;
USDC.safeTransfer(receiver, assets);
}
emit Claimed(user, receiver, assets);
return assets;
}

Resolution

Fixed in commits 4b322a8 and 4d82b78

6.3 Referral tokens can be permanently locked for portfolio owners without referrers

FileFix commitTypeStatus
DealManager.sol—MediumAcknowledged

When raising funds for a deal via Deal::deposit, the DealManager::registerDeposit function is invoked. This function tracks the deposited amount for each deal to account for referral rewards:

function registerDeposit(uint256 assets, address receiver) external {
DealManagerStorage storage $ = _getDealManagerStorage();

PortfolioRegistry registry = PortfolioRegistry($.portfolioRegistry);
address owner = registry.onlyWhitelistedPortfolio(uint256(uint160(receiver)));
==> address referrer = registry.referrer(owner);
$.deals[msg.sender].deposits += assets;
==> $.deals[msg.sender].referralDeposits[referrer] += assets;
}

Later, users can call claimReferralRewards to claim their referral rewards, which are distributed proportionally:

function _referralRewards(DealManagerStorage storage $, address deal, address user)
internal
view
returns (uint256)
{
DealData storage dealData = $.deals[deal];
return Math.mulDiv(
dealData.referralDeposits[user],
dealData.rewards - dealData.lastRewardClaim[user],
dealData.deposits,
Math.Rounding.Floor
);
}

However, some portfolio owners may not have a referrer, causing registry.referrer(owner); to return the zero address. In such cases, referral rewards are permanently locked to the zero address.

Recommendation

Modify registerDeposit to update referralDeposits only when a valid referrer exists:

function registerDeposit(uint256 assets, address receiver) external {
DealManagerStorage storage $ = _getDealManagerStorage();
PortfolioRegistry registry = PortfolioRegistry($.portfolioRegistry);
address owner = registry.onlyWhitelistedPortfolio(uint256(uint160(receiver)));
address referrer = registry.referrer(owner);
$.deals[msg.sender].deposits += assets;
- $.deals[msg.sender].referralDeposits[referrer] += assets;
+ if (referrer != address(0)) $.deals[msg.sender].referralDeposits[referrer] += assets;
}

Resolution

At the moment, all users need to have a referrer when they get whitelisted, but there is no check enforcing that the referrer is not 0x0. However, only the owner or the whitelistSigner can make that mistake, and we treat them as trustworthy.

6.4 Deal::closeDeal does not check dealDealine

FileFix commitTypeStatus
Deal.sol—LowAcknowledged

Each deal has two deadlines: (a) a fundraising deadline and (b) a closing deadline. Users can cancel a deal if either deadline is not met. After successful fundraising, the deal manager calls Deal::closeDeal to transition the deal to the next phase. However, the function does not check whether the dealDeadline has already passed:

function closeDeal(address dealer) external {
DealStorage storage $ = _getDealStorage();
_onlyDealManagerOwner($, _msgSender());
_onlyStatus($, STATUS.RAISING_FUNDS);
_nonZero(dealer);

if (totalAssets() < $.target) {
revert TargetNotMet();
}

uint256 treasuryFee = $.treasuryFee;
uint256 insuranceAmount = $.insurance;
uint256 dealAssets = totalAssets() - insuranceAmount - treasuryFee;

// Start deal
$.status = STATUS.IN_PROGRESS;

USDC.approve(address($.dealManager), treasuryFee);
$.dealManager.processFee(treasuryFee);
USDC.safeTransfer(dealer, dealAssets);
USDC.safeTransfer(address($.insuranceVault), $.insurance);

emit DealClosed(dealer);
}

While the cancelDeal function allows users to cancel an expired deal and we expect them to cancel deals closely after their deadline, the closeDeal function should still validate the dealDeadline to prevent unintended deal progression past the allowed timeframe.

Recommendation

Add a check in closeDeal to check for the deal’s deadline

Resolution

Deadlines are meant as a mechanism for users to recover their assets if there are delays in executions. Given that, if there are delays and no one cancels, we are fine with closing the deal anyway, as it just means users did not want to cancel. Deadline is a safety mechanism for the user, not for the deal breaker for our processes.

6.5 Portfolio contract does not expose approve function for asset transfers to Deal contract

FileFix commitTypeStatus
Portfolio.sol—LowAcknowledged

Users are meant to interact with deal contracts through their portfolios. For instance, portfolios can interact with the Deal contract to deposit the underlying assets. However, the issue is that depositing/minting assets on the Deal contract requires transfer approval of the asset, and the Portfolio contract does not expose an approve function to grant spending allowances to the Deal contract, which leads to transactions reverts. The current implementation of callDeal allows a workaround of this as it performs low-level calls to any address and not necessarily the Deal contract, in which the portfolio owners can leverage this function to interact with the underlying asset to approve for the deal contract.

function _call(address deal, bytes calldata data, address rewardsReceiver) internal returns (bytes memory) {
(bool success, bytes memory result) = address(deal).call(data);
if (!success) {
assembly {
revert(add(0x20, mload(0)), mload(0))
}
}
_claimRewards(rewardsReceiver);
return result;
}

However, this is not the intended behavior of the function.

Recommendation

Consider exposing a function to approve a token to be spent by a deal address

Resolution

It may be a nice-to-have, but a workaround exists using callDeal, and we may stick with this approach.

7

Documentation Evaluation

Software documentation refers to the written or visual information that describes the functionality, architecture, design, and implementation of software. It provides a comprehensive overview of the software system and helps users, developers, and stakeholders understand how the software works, how to use it, and how to maintain it. Software documentation can take different forms, such as user manuals, system manuals, technical specifications, requirements documents, design documents, and code comments. Software documentation is critical in software development, enabling effective communication between developers, testers, users, and other stakeholders. It helps to ensure that everyone involved in the development process has a shared understanding of the software system and its functionality. Moreover, software documentation can improve software maintenance by providing a clear and complete understanding of the software system, making it easier for developers to maintain, modify, and update the software over time. Smart contracts can use various types of software documentation. Some of the most common types include:

  • Technical whitepaper: A technical whitepaper is a comprehensive document describing the smart contract’s design and technical details. It includes information about the purpose of the contract, its architecture, its components, and how they interact with each other;
  • User manual: A user manual is a document that provides information about how to use the smart contract. It includes step-by-step instructions on how to perform various tasks and explains the different features and functionalities of the contract;
  • Code documentation: Code documentation is a document that provides details about the code of the smart contract. It includes information about the functions, variables, and classes used in the code, as well as explanations of how they work;
  • API documentation: API documentation is a document that provides information about the API (Application Programming Interface) of the smart contract. It includes details about the methods, parameters, and responses that can be used to interact with the contract;
  • Testing documentation: Testing documentation is a document that provides information about how the smart contract was tested. It includes details about the test cases that were used, the results of the tests, and any issues that were identified during testing;
  • Audit documentation: Audit documentation includes reports, notes, and other materials related to the security audit of the smart contract. This type of documentation is critical in ensuring that the smart contract is secure and free from vulnerabilities.

These types of documentation are essential for smart contract development and maintenance. They help ensure that the contract is properly designed, implemented, and tested, and they provide a reference for developers who need to modify or maintain the contract in the future.

8

Remarks & Test Suite

The Token Fleet team was actively present in regular calls, effectively addressing concerns and questions raised by the Nethermind Security team. The codebase included natspec and protocol description that were insightful for the Nethermind Security team to understand the codebase.

Test suite
67Tests passed0Failed

The complete test output is in the full report.

As auditors, we recommend that any changes or updates made to the audited codebase undergo a re-audit or security review to address potential vulnerabilities or risks introduced by the modifications. By conducting a re-audit or security review of the modified codebase, you can significantly enhance the overall security of your system and reduce the likelihood of exploitation. However, we do not possess the authority or right to impose obligations or restrictions on our clients regarding codebase updates, modifications, or subsequent audits. Accordingly, the decision to seek a re-audit or security review lies solely with you.

This report is based on the scope of materials and documentation provided by you to Nethermind in order that Nethermind could conduct the security review outlined in 1. Executive Summary and 2. Audited Files. The results set out in this report may not be complete nor inclusive of all vulnerabilities. Nethermind has provided the review and this report on an as-is, where-is, and as-available basis. You agree that your access and/or use, including but not limited to any associated services, products, protocols, platforms, content, and materials, will be at your sole risk. Blockchain technology remains under development and is subject to unknown risks and flaws. The review does not extend to the compiler layer, or any other areas beyond the programming language, or other programming aspects that could present security risks. This report does not indicate the endorsement of any particular project or team, nor guarantee its security. No third party should rely on this report in any way, including for the purpose of making any decisions to buy or sell a product, service or any other asset. To the fullest extent permitted by law, Nethermind disclaims any liability in connection with this report, its content, and any related services and products and your use thereof, including, without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement. Nethermind does not warrant, endorse, guarantee, or assume responsibility for any product or service advertised or offered by a third party through the product, any open source or third-party software, code, libraries, materials, or information linked to, called by, referenced by or accessible through the report, its content, and the related services and products, any hyperlinked websites, any websites or mobile applications appearing on any advertising, and Nethermind will not be a party to or in any way be responsible for monitoring any transaction between you and any third-party providers of products or services. As with the purchase or use of a product or service through any medium or in any environment, you should use your best judgment and exercise caution where appropriate. FOR AVOIDANCE OF DOUBT, THE REPORT, ITS CONTENT, ACCESS, AND/OR USAGE THEREOF, INCLUDING ANY ASSOCIATED SERVICES OR MATERIALS, SHALL NOT BE CONSIDERED OR RELIED UPON AS ANY FORM OF FINANCIAL, INVESTMENT, TAX, LEGAL, REGULATORY, OR OTHER ADVICE.