HEAL
Smart Contract Audit Report
Audit Summary
HEAL is creating a new staking contract which allows users to receive shares of deposited rewards.
For this audit, we reviewed HEAL's RewardsDistributor and RewardsTreasurySplitter contracts at commit da3ce5c726c8186a4b9fb91933e3d01be321fb90 on the team's private GitHub repository.
Audit Findings
Please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
Date: March 17th, 2022.
Contracts Overview
RewardsDistributor Contract:
- As the contracts are implemented with Solidity v0.8.x, they are safe from any possible overflows/underflows.
RewardsTreasurySplitter Contract:
- This contract allows users to stake a specified staking token in order to receive a share of deposited rewards in the form of the blockchain's native token.
- When staking, users can also deposit NFTs from a specified collection in order to boost their rewards based on the "NFT boost percentage".
- Users accumulate rewards when they are deposited into this contract.
- A user's portion of deposited rewards is dependent on their share of total staked tokens.
- After a minimum stake time has elapsed, a user can unstake any amount of their tokens.
- Users must input "0" as the unstaking amount in order to have any staked NFTs transferred back to them; this will also withdraw all of their staking tokens.
- A user's wait time to unstake is reset any time they stake additional tokens.
- Users accumulate rewards based on their number of staked tokens when rewards are deposited into this contract.
- When staking or unstaking, users can elect to either claim or forfeit their accumulated rewards.
- Rewards can also be claimed separately through a claim function.
- When claiming rewards, the user can elect to have their reward converted into staking tokens and staked back into the platform.
- As the contract does not follow the Checks-Effects-Interactions pattern in the stake() and unstake() functions, the team should not use ERC-777 tokens as the staking token.
- The team should note that if reward deposits are predictable, users are able to stake right before a reward deposit occurs to receive the rewards from it. Rewards should be deposited in small amounts to encourage users to remain staked in the contract.
- The owner can update the NFT boost percentage at any time.
- The owner can update the maximum NFTs to boost to any amount at any time.
- The owner can update the NFT contract used for reward boosts at any time; this could potentially disallow users from withdrawing their staked NFTs.
- The owner can update the staking token contract at any time; this could potentially disallow users from withdrawing their staked tokens.
- The owner can update the minimum staking time at any time.
- This contract is intended to interact with the RewardsDistributor contract.
- Any time this contract receives the blockchain's native token, a "treasury percentage" is taken and sent to a treasury address; the remaining amount is deposited into the RewardsDistributor contract as rewards.
- The owner can update the treasury percentage to any amount at any time.
- The owner can update the associated RewardsDistributor contract at any time.
- The owner can withdraw any of the blockchain's native token from this contract.
Audit Results
Vulnerability Category | Notes | Result |
---|---|---|
Arbitrary Jump/Storage Write | N/A | PASS |
Centralization of Control |
| WARNING |
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 |
Unbounded Loops | N/A | PASS |
Unused Code | N/A | PASS |
Overall Contract Safety | PASS |
RewardsDistributor Contract
($) = payable function
# = non-constant function
+ Context
- [Int] _msgSender
- [Int] _msgData
+ Ownable (Context)
- [Pub] #
- [Pub] owner
- [Pub] renounceOwnership #
- modifiers: onlyOwner
- [Pub] transferOwnership #
- modifiers: onlyOwner
- [Int] _transferOwnership #
+ [Int] IERC20
- [Ext] totalSupply
- [Ext] balanceOf
- [Ext] transfer #
- [Ext] allowance
- [Ext] approve #
- [Ext] transferFrom #
+ [Int] IERC165
- [Ext] supportsInterface
+ [Int] IERC721 (IERC165)
- [Ext] balanceOf
- [Ext] ownerOf
- [Ext] safeTransferFrom #
- [Ext] transferFrom #
- [Ext] approve #
- [Ext] getApproved
- [Ext] setApprovalForAll #
- [Ext] isApprovedForAll
- [Ext] safeTransferFrom #
+ [Lib] SafeMath
- [Int] tryAdd
- [Int] trySub
- [Int] tryMul
- [Int] tryDiv
- [Int] tryMod
- [Int] add
- [Int] sub
- [Int] mul
- [Int] div
- [Int] mod
- [Int] sub
- [Int] div
- [Int] mod
+ [Int] IUniswapV2Router01
- [Ext] factory
- [Ext] WETH
- [Ext] addLiquidity #
- [Ext] addLiquidityETH ($)
- [Ext] removeLiquidity #
- [Ext] removeLiquidityETH #
- [Ext] removeLiquidityWithPermit #
- [Ext] removeLiquidityETHWithPermit #
- [Ext] swapExactTokensForTokens #
- [Ext] swapTokensForExactTokens #
- [Ext] swapExactETHForTokens ($)
- [Ext] swapTokensForExactETH #
- [Ext] swapExactTokensForETH #
- [Ext] swapETHForExactTokens ($)
- [Ext] quote
- [Ext] getAmountOut
- [Ext] getAmountIn
- [Ext] getAmountsOut
- [Ext] getAmountsIn
+ [Int] IUniswapV2Router02 (IUniswapV2Router01)
- [Ext] removeLiquidityETHSupportingFeeOnTransferTokens #
- [Ext] removeLiquidityETHWithPermitSupportingFeeOnTransferTokens #
- [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
- [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
- [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #
+ [Int] IRewardsDistributor
- [Ext] depositRewards ($)
- [Ext] getShares
- [Ext] getBoostNfts
+ RewardDistributor (IRewardsDistributor, Ownable)
- [Pub] #
- [Ext] stake #
- [Prv] _stake #
- [Ext] unstake #
- [Ext] depositRewards ($)
- [Int] distributeReward #
- [Ext] claimReward #
- [Int] getElevatedSharesWithBooster
- [Pub] getBaseSharesFromBoosted
- [Pub] getBoostPercentage
- [Pub] eligibleForRewardBooster
- [Pub] getUnpaid
- [Int] getCumulativeRewards
- [Ext] getBaseShares
- [Ext] getShares
- [Pub] getBoostNfts
- [Ext] setShareholderToken #
- modifiers: onlyOwner
- [Ext] setMinSecondsBeforeUnstake #
- modifiers: onlyOwner
- [Ext] setNftBoosterToken #
- modifiers: onlyOwner
- [Ext] setNftBoostPercentage #
- modifiers: onlyOwner
- [Ext] setMaxNftsToBoost #
- modifiers: onlyOwner
- [Ext] ($)
RewardsTreasurySplitter Contract
($) = payable function
# = non-constant function
+ Context
- [Int] _msgSender
- [Int] _msgData
+ Ownable (Context)
- [Pub] #
- [Pub] owner
- [Pub] renounceOwnership #
- modifiers: onlyOwner
- [Pub] transferOwnership #
- modifiers: onlyOwner
- [Int] _transferOwnership #
+ [Int] IRewardsDistributor
- [Ext] depositRewards ($)
- [Ext] getShares
- [Ext] getBoostNfts
+ RewardsTreasurySplitter (Ownable)
- [Pub] #
- [Ext] setRewards #
- modifiers: onlyOwner
- [Ext] setRewardsPercent #
- modifiers: onlyOwner
- [Ext] setTreasury #
- modifiers: onlyOwner
- [Ext] setTreasuryPercent #
- modifiers: onlyOwner
- [Ext] withdrawETH #
- modifiers: onlyOwner
- [Ext] ($)
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.