HighPoint Finance

Smart Contract Audit Report

Audit Summary

HighPoint Finance Audit Report HighPoint Finance is a new ERC-20 token with an elastic supply that performs automatic liquidity adds.

For this audit, we reviewed the project team's HighPointFinance contract at commit bb852e048236fe94c5ed85cf90c654bb7b81751c on the team's GitHub repository.

Audit Findings

Please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
Date: March 18th, 2022.
Updated: March 28th, 2022 to reflect the changes made from commit bb852e048236fe94c5ed85cf90c654bb7b81751c to commit 067f1da706f19c0b6fc76a8b35368cf96a589096

Finding #1 - HighPointFinance - Medium (Resolved)

Description: The auto-rebase mechanism calls the sync() function on the Pair contract on all transfers; sync() cannot be called on buys otherwise the transaction will revert.
Risk/Impact: All buy transactions will revert on transfers that trigger the auto-rebase mechanism.
Recommendation: The coreRebase() function should ensure that the sync() function is not called on a buy transaction. This can be remedied by checking the following condition: msg.sender != pair
Resolution: The team has implemented the above recommendation.

Finding #2 - HighPointFinance - Low (Resolved)

Description: Upon deployment, the total buy fee and sell fee denominators do not account for the two Maintenance fees. After updating fees, the total buy fee and sell fee denominators will account for the Maintenance fees.
totalBuyFee = liquidityFee.add(treasuryFee).add(buyFeeRFV);
totalSellFee = totalBuyFee.add(sellFeeTreasuryAdded).add(sellFeeRFVAdded).add(sellLaunchFeeAdded);
Risk/Impact: The calculations within the swapBack() function will be inaccurate upon deployment because the fee denominators will not account for every fee.
Recommendation: The buy fee and sell fee denominators should account for the two Maintenance fees upon deployment.
Resolution: The team has implemented the above recommendation.

Finding #3 - HighPointFinance - Low (Resolved)

Description: The amountToTreasury calculation in the swapback() function does not subtract the amountToMaintenance local variable.
uint256 amountToTreasury = contractTokenBalance
.sub(amountToLiquify)                                        
.sub(amountToRFV);
Risk/Impact: The calculations within the swapBack() function will be inaccurate as the amountToTreasury local variable does not properly take the remaining contract token balance.
Recommendation: amountToMaintenance should also be subtracted from the above calculation.
Resolution: The team has implemented the above recommendation.

Finding #4 - HighPointFinance - Informational (Resolved)

Description: The else block in the _swapAndLiquify() function will never execute as isLiquidityInAvax will always be true.
if (isLiquidityInAvax) {
...
else {
...
}
Recommendation: The else block should either be removed or the team should add functionality that toggles isLiquidityInAvax.
Resolution: The team has removed the above if-statement from the contract.

Finding #5 - HighPointFinance - Informational (Resolved)

Description: The sellFeeLiquidityAdded state variable is not used in the contract.
Recommendation: This state variable should either be removed or utilized in a way that fits the project team's intended functionality.
Resolution: The team has utilized this variable to fit their intended functionality.

Finding #6 - HighPointFinance - Informational (Resolved)

Description: Several functions are declared public, but are never called internally.
updateBlacklist, addMinter, removeMinter, rescueToken
Recommendation: These functions should be declared external for additional gas savings on each call.
Resolution: The team has declared the above functions external.

Finding #7 - HighPointFinance - Informational (Resolved)

Description: Several state variables can never be modified, but are not declared constant.
DEAD, ZERO, feesOnNormalTransfers, isBurnEnabled, isLiquidityInAvax, sellFeeLiquidityAdded, sellLaunchFeeAdded
Recommendation: These state variables should be declared constant for additional gas savings on each call.
Resolution: The team has declared the above state variables constant.

Contract Overview

  • The initial supply of 4 billion $HPT will be minted to the team's Treasury wallet upon deployment.
  • The maximum supply of $HPT is 340,282,366,920,938,463,463,374,607,431,768,211,455 tokens.
  • The contract utilizes a Minter role. The assigned addresses can mint any number of tokens up to the maximum supply to any address at any time.
  • The owner can trigger a manual rebase; this serves as a frictionless token redistribution which automatically adds or removes tokens for all token holders proportionally at the time of each total supply change.
  • The rebase function calls sync() on the JoeSwap Pair contract to prevent theft-of-liquidity attacks that have occurred with other rebase tokens.
  • No burn functions are present though the circulating supply can be decreased by sending tokens to the 0x..dead address.
  • There was no token allocation for our team to analyze as the contract has yet to be deployed to the mainnet.

  • The initial distribution period of the contract must be manually disabled by the owner in order for all trading to take place on the platform. Only the owner and whitelisted users are able to transfer tokens while the initial distribution period is enabled.
  • Once the initial distribution period is disabled, it can never be re-enabled.
  • There is a Liquidity fee, Treasury fee, RFV fee, and Maintenance fee on all transfers where neither the sender nor the recipient is excluded from fees. A separate fee structure can be set by the team to apply different fee percentages depending on whether the user is buying or selling during the transfer.
  • The fees charged during transfers are stored in the contract address. The tokens are swapped for AVAX for the purpose of funding JoeSwap liquidity when the following conditions are met:
    • The automatic liquidity add functionality is enabled by the team.
    • The threshold number of tokens in the contract address (determined by the owner) has been reached.
    • The contract is not currently performing an automatic liquidity add.
    • The caller is not initiating a buying transaction via JoeSwap.
  • If the Liquidity during the swap is greater than the target value set by the team, no liquidity will be added. Otherwise, the Liquidity fee is used for an automatic Liquidity-add.
  • Liquidity-adds are automatically performed by selling the tokens collected as fees, pairing the received AVAX with the token, and adding it as liquidity to the AVAX pair.
  • The LP tokens received through this process are sent to the Liquidity wallet controlled by the team. We recommend that the team lock these newly acquired LP tokens.
  • The tokens collected from the Treasury fee are swapped for AVAX and sent to the team's Treasury wallet.
  • The tokens collected from the RFV fee and Maintenance fee are swapped for the Stable coin address set by the team and sent to the team's RFV wallet and Maintenance wallet respectively.
  • Also during transfers, if the "next rebase" time has passed and auto rebase is enabled, tokens are automatically added to the total supply. The newly added tokens are distributed proportionally amongst holders in a frictionless manner.
  • The number of tokens added is dependent on the current total supply, and the ratio between the "reward yield" and the "reward yield denominator"; this ratio defaults to ~0.0342% of the current total supply.
  • The contract utilizes SafeMath libraries to prevent any overflows/underflows.
Ownership Controls:
  • The owner set total transfer fees to any value, up to 25%, at any time.
  • The owner can exclude accounts from transfer fees.
  • The owner can toggle the auto rebase functionality, update the rebase frequency, and update the next rebase timestamp at any time.
  • The owner can update the reward yield and the reward yield denominator to any values at any time.
  • The owner can enable/disable automatic liquidity adds at any time.
  • The owner can update the threshold number of tokens that triggers an automatic liquidity add to any value at any time.
  • The owner can add/remove accounts from the Minter role at any time.
  • The owner can blacklist accounts from being able to participate in transfers.
  • The owner can update the Pair address to any address at any time.
  • The owner can update the team's Liquidity wallet, Treasury wallet, RFV wallet, and Maintenance wallet to any addresses at any time.
  • The owner can withdraw any AVAX or tokens from the contract at any time.
  • The owner can add/remove accounts from the initial distribution period whitelist.
  • The owner can manually sync the LP Pair contract at any time.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of Control
  • The LP tokens generated through automatic liquidity adds are sent to the team's Liquidity wallet.
  • The Minter role addresses can mint any number of tokens.
  • The owner can manually trigger a positive or negative rebase.
  • The owner can manually add/remove accounts from the transfer blacklist.
  • The owner can withdraw any tokens and AVAX from the contract.
  • WARNING
    Compiler IssuesN/APASS
    Delegate Call to Untrusted ContractN/APASS
    Dependence on Predictable VariablesN/APASS
    Ether/Token TheftN/APASS
    Flash LoansN/APASS
    Front RunningN/APASS
    Improper EventsN/APASS
    Improper Authorization SchemeN/APASS
    Integer Over/UnderflowN/APASS
    Logical IssuesN/APASS
    Oracle IssuesN/APASS
    Outdated Compiler VersionN/APASS
    Race ConditionsN/APASS
    ReentrancyN/APASS
    Signature IssuesN/APASS
    Unbounded LoopsN/APASS
    Unused CodePASS
    Overall Contract Safety PASS

    Inheritance Chart

    Smart Contract Audit - Inheritance

    Function Graph

    Smart Contract Audit - Graph

    Functions Overview

    
     ($) = payable function
     # = non-constant function
     
     Int = Internal
     Ext = External
     Pub = Public
    
     + [Lib] SafeMathInt 
        - [Int] mul
        - [Int] div
        - [Int] sub
        - [Int] add
        - [Int] abs
    
     + [Int] IERC20 
        - [Ext] totalSupply
        - [Ext] balanceOf
        - [Ext] allowance
        - [Ext] transfer #
        - [Ext] approve #
        - [Ext] transferFrom #
    
     + [Lib] SafeMath 
        - [Int] add
        - [Int] sub
        - [Int] sub
        - [Int] mul
        - [Int] div
        - [Int] div
        - [Int] mod
    
     + [Int] InterfaceLP 
        - [Ext] sync #
    
     + [Lib] Roles 
        - [Int] add #
        - [Int] remove #
        - [Int] has
    
     +  MinterRole 
        - [Pub]  #
        - [Pub] isMinter
        - [Pub] renounceMinter #
        - [Int] _addMinter #
        - [Int] _removeMinter #
    
     +  ERC20Detailed (IERC20)
        - [Pub]  #
        - [Pub] name
        - [Pub] symbol
        - [Pub] decimals
    
     + [Int] IJoeFactory 
        - [Ext] feeTo
        - [Ext] feeToSetter
        - [Ext] migrator
        - [Ext] getPair
        - [Ext] allPairs
        - [Ext] allPairsLength
        - [Ext] createPair #
        - [Ext] setFeeTo #
        - [Ext] setFeeToSetter #
        - [Ext] setMigrator #
    
     + [Int] IJoeRouter 
        - [Ext] factory
        - [Ext] WAVAX
        - [Ext] addLiquidity #
        - [Ext] addLiquidityAVAX ($)
        - [Ext] removeLiquidity #
        - [Ext] removeLiquidityAVAX #
        - [Ext] removeLiquidityWithPermit #
        - [Ext] removeLiquidityAVAXWithPermit #
        - [Ext] swapExactTokensForTokens #
        - [Ext] swapTokensForExactTokens #
        - [Ext] swapExactAVAXForTokens ($)
        - [Ext] swapTokensForExactAVAX #
        - [Ext] swapExactTokensForAVAX #
        - [Ext] swapAVAXForExactTokens ($)
        - [Ext] quote
        - [Ext] getAmountOut
        - [Ext] getAmountIn
        - [Ext] getAmountsOut
        - [Ext] getAmountsIn
        - [Ext] removeLiquidityAVAXSupportingFeeOnTransferTokens #
        - [Ext] removeLiquidityAVAXWithPermitSupportingFeeOnTransferTokens #
        - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
        - [Ext] swapExactAVAXForTokensSupportingFeeOnTransferTokens ($)
        - [Ext] swapExactTokensForAVAXSupportingFeeOnTransferTokens #
    
     + [Int] IJoePair 
        - [Ext] name
        - [Ext] symbol
        - [Ext] decimals
        - [Ext] totalSupply
        - [Ext] balanceOf
        - [Ext] allowance
        - [Ext] approve #
        - [Ext] transfer #
        - [Ext] transferFrom #
        - [Ext] DOMAIN_SEPARATOR
        - [Ext] PERMIT_TYPEHASH
        - [Ext] nonces
        - [Ext] permit #
        - [Ext] MINIMUM_LIQUIDITY
        - [Ext] factory
        - [Ext] token0
        - [Ext] token1
        - [Ext] getReserves
        - [Ext] price0CumulativeLast
        - [Ext] price1CumulativeLast
        - [Ext] kLast
        - [Ext] mint #
        - [Ext] burn #
        - [Ext] swap #
        - [Ext] skim #
        - [Ext] sync #
        - [Ext] initialize #
    
     + [Int] IWAVAX 
        - [Ext] deposit ($)
        - [Ext] transfer #
        - [Ext] withdraw #
    
     +  Ownable 
        - [Pub]  #
        - [Pub] owner
        - [Pub] isOwner
        - [Pub] renounceOwnership #
           - modifiers: onlyOwner
        - [Pub] transferOwnership #
           - modifiers: onlyOwner
        - [Int] _transferOwnership #
    
     +  HighPointFinance (ERC20Detailed, Ownable, MinterRole)
        - [Pub]  #
           - modifiers: ERC20Detailed
        - [Pub] updateBlacklist #
           - modifiers: onlyOwner
        - [Ext] setNextRebase #
           - modifiers: onlyOwner
        - [Ext] setRewardYield #
           - modifiers: onlyOwner
        - [Ext] setAutoRebase #
           - modifiers: onlyOwner
        - [Ext] setRebaseFrequency #
           - modifiers: onlyOwner
        - [Pub] shouldRebase
        - [Ext] swipe #
           - modifiers: onlyOwner
        - [Prv] coreRebase #
        - [Prv] updateLaunchPeriodFee #
        - [Prv] _rebase #
        - [Ext] rebase #
           - modifiers: onlyOwner
        - [Ext] totalSupply
        - [Ext] transfer #
           - modifiers: validRecipient,initialDistributionLock
        - [Ext] setLP #
           - modifiers: onlyOwner
        - [Ext] allowance
        - [Ext] balanceOf
        - [Int] _basicTransfer #
        - [Int] _transferFrom #
        - [Ext] transferFrom #
           - modifiers: validRecipient
        - [Int] swapBack #
           - modifiers: swapping
        - [Prv] _swapAndLiquify #
        - [Prv] _addLiquidity #
        - [Prv] _addLiquidityStableCoin #
        - [Prv] _swapTokensForStableCoin #
        - [Prv] _swapTokensForAVAX #
        - [Int] takeFee #
        - [Ext] decreaseAllowance #
           - modifiers: initialDistributionLock
        - [Ext] increaseAllowance #
           - modifiers: initialDistributionLock
        - [Ext] approve #
           - modifiers: initialDistributionLock
        - [Ext] checkFeeExempt
        - [Ext] setInitialDistributionFinished #
           - modifiers: onlyOwner
        - [Ext] enableTransfer #
           - modifiers: onlyOwner
        - [Ext] setFeeExempt #
           - modifiers: onlyOwner
        - [Int] isStillLaunchPhase
        - [Int] shouldTakeFee
        - [Ext] mint #
           - modifiers: onlyMinter
        - [Ext] setSwapBackSettings #
           - modifiers: onlyOwner
        - [Int] shouldSwapBack
        - [Pub] getCirculatingSupply
        - [Ext] setTargetLiquidity #
           - modifiers: onlyOwner
        - [Pub] addMinter #
           - modifiers: onlyOwner
        - [Pub] removeMinter #
           - modifiers: onlyOwner
        - [Ext] isNotInSwap
        - [Ext] checkSwapThreshold
        - [Ext] manualSync #
        - [Ext] setFeeReceivers #
           - modifiers: onlyOwner
        - [Ext] setFees #
           - modifiers: onlyOwner
        - [Int] setSellFee #
        - [Ext] clearStuckBalance #
           - modifiers: onlyOwner
        - [Pub] rescueToken #
           - modifiers: onlyOwner
        - [Prv] transferToAddressETH #
        - [Pub] getLiquidityBacking
        - [Pub] isOverLiquified
        - [Ext]  ($)

    About Solidity Finance

    Solidity Finance was founded in 2020 and quickly grew to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1000+ 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 across 1500 projects!.
    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 Solidity Audit?

    Typically, a smart contract audit is a comprehensive review process designed to discover logical errors, security vulnerabilities, and optimization opportunities within code. A Solidity 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.