Plots Merkle Distributor

Smart Contract Audit Report

Plots Merkle Distributor Audit Report

Executive Summary

This report presents the outcomes of our collaborative engagement with the Plots Finance team, focusing on the comprehensive evaluation of the MerkleDistributor and PlotsFinance contracts.

Our team conducted an initial security assessment from November 14th to November 15th, 2024. On November 18th, our team amended this report to reflect updates made to the MerkleDistributor contract.

Plots Finance is developing an ERC-20 token integrated with a Merkle-based vesting platform that enables users to claim vested tokens through a verifiable Merkle proof process. The vesting schedule includes an initial TGE percentage and periodic vesting rounds.


Audit Scope

Name

Source Code

Visualized

MerkleDistributor

20b6702

Inheritance Chart.  Function Graph.

PlotsFinance

Ethereum Mainnet

Inheritance Chart.  Function Graph.

Name

Address/Source Code

Visualized

MerkleDistributor

20b6702

Inheritance Chart.  Function Graph.

PlotsFinance

Ethereum Mainnet

Inheritance Chart.  Function Graph.


Audit Findings

Finding #1

MerkleDistributor & PlotsFinance

High Resolved

Finding #1 - MerkleDistributor & PlotsFinance
High Resolved

Description: The claim() function attempts to call mint() (with a lowercase 'm') in the token contract. However, the token contract instead implements a Mint() function (with an uppercase 'M'), which does not align with the expected mint() function in the IERC20 interface, resulting in an incompatibility.

Risk/Impact: The minting process will revert, causing all claims to fail.

Recommendation: Rename the Mint() function in the PlotsFinance contract to mint().

Resolution: The team has implemented the above recommendation.

Finding #2

MerkleDistributor & PlotsFinance

High Resolved

Finding #2 - MerkleDistributor & PlotsFinance
High Resolved

Description: The claim() function calls Mint() in the PlotsFinance contract within a require statement. However, Mint() does not return a boolean, as required by claim().

Risk/Impact: The minting process will revert, causing all claims to fail.

Recommendation: Modify the Mint() function in the PlotsFinance contract to return true upon successful execution.

Resolution: The team has implemented the above recommendation.

Finding #3

PlotsFinance

Informational Resolved

Finding #3 - PlotsFinance
Informational Resolved

Description: The ZeroAddress state variable is redundantly updated in the Mint() and Burn() functions on each call.

Recommendation: The ZeroAddress state variable should be hard-coded and declared constant for additional gas savings on each call of the Mint() and Burn() functions.

Resolution: The ZeroAddress state variable is no longer updated in the Mint() and Burn() functions.

Finding #4

PlotsFinance

Informational Open

Finding #4 - PlotsFinance
Informational Open

Description: The maxSupply and ZeroAddress state variables cannot be modified but are not declared constant:

Recommendation: The above state variables could be declared constant for additional gas savings on each reference.

Finding #5

PlotsFinance

Informational Open

Finding #5 - PlotsFinance
Informational Open

Description: The decimals and distributor state variables can only be set one time in the constructor but are not declared immutable.

Recommendation: The decimals and distributor state variables could be declared immutable for additional gas savings on each reference.


System Overview

Plots Finance Token Overview

Token Attributes

The total supply of the token is initially set to zero upon deployment. The maximum supply cap is set to 1 billion tokens [1,000,000,000]. An address controlled by the team can permanently set the Distributor address referenced in the contract on time. The Distributor address can mint any number of tokens to any address up to the maximum supply cap at any time. Any user can burn their own tokens to reduce the total supply at any time.

Merkle Distributor Overview

Configuration

The deployer initializes multiple distribution schedules by specifying a list of Merkle roots, cliff periods, TGE percentages, and number of claim rounds for each distribution.

Claiming

Any user can initiate a claim by providing a user's address, their total eligible amount, Merkle proof, and the index of a specific distribution schedule. The contract verifies the proof against the distribution's Merkle root. This verification confirms the user’s inclusion in the distribution schedule and their entitled amount.

The claimable amount is calculated based on the current round in the schedule. Before the cliff time has been reached, the specified TGE percentage of the total eligible amount is available for claiming. In subsequent rounds, additional portions of the remaining balance become accessible at set intervals, with each subsequent round releasing a calculated portion of the unclaimed balance until the full amount is accessible. The user's cumulative claim total is updated, and in the final round, the distribution is marked as fully claimed for that user. Upon successful claims, the claimable amount is minted directly to the user’s address in the form of the Token address set by the owner.

Users may elect to initiate multiple claims in a single transaction.

Set Token

The owner can set the Token address referenced in the contract one time. Ownership is automatically renounced after this address is set.

Vulnerability Analysis

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control N/A PASS
Compiler Issues N/A PASS
Delegate Call to Untrusted Contract N/A PASS
Dependence on Predictable Variables N/A PASS
Ether/Token Theft N/A PASS
Flash Loans N/A PASS
Front Running N/A PASS
Improper Events N/A PASS
Improper Authorization Scheme N/A PASS
Integer Over/Underflow N/A PASS
Logical Issues N/A PASS
Oracle Issues N/A PASS
Outdated Compiler Version N/A PASS
Race Conditions N/A PASS
Reentrancy N/A PASS
Signature Issues N/A PASS
Sybil Attack N/A PASS
Unbounded Loops N/A PASS
Unused Code N/A PASS
Overall Contract Safety   PASS

About SourceHat

SourceHat has quickly grown to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1800+ solidity smart contract audits covering all major project types and protocols, securing a total of over $50 billion U.S. dollars in on-chain value!
Our firm is well-reputed in the community and is trusted as a top smart contract auditing company for the review of solidity code, no matter how complex. Our team of experienced solidity smart contract auditors performs audits for tokens, NFTs, crowdsales, marketplaces, gambling games, financial protocols, and more!

Contact us today to get a free quote for a smart contract audit of your project!

What is a SourceHat Audit?

Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A SourceHat Audit takes this a step further by verifying economic logic to ensure the stability of smart contracts and highlighting privileged functionality to create a report that is easy to understand for developers and community members alike.

How Do I Interpret the Findings?

Each of our Findings will be labeled with a Severity level. We always recommend the team resolve High, Medium, and Low severity findings prior to deploying the code to the mainnet. Here is a breakdown on what each Severity level means for the project:

  • High severity indicates that the issue puts a large number of users' funds at risk and has a high probability of exploitation, or the smart contract contains serious logical issues which can prevent the code from operating as intended.
  • Medium severity issues are those which place at least some users' funds at risk and has a medium to high probability of exploitation.
  • Low severity issues have a relatively minor risk association; these issues have a low probability of occurring or may have a minimal impact.
  • Informational issues pose no immediate risk, but inform the project team of opportunities for gas optimizations and following smart contract security best practices.