Integrity Coin

Smart Contract Audit Report

Audit Summary

Integrity Coin Audit Report Integrity Coin is a new BEP-20 token that is an automatic liquidity providing protocol that pays holders dividends in BUSD.

For this audit, we reviewed the IntegrityCoin and DividendDistributor contracts provided to us by the project team.

Audit Findings

Informational findings were identified and the team may want to review them. In addition, centralized aspects are present.
Date: June 14th, 2022.

Finding #1 - IntegrityCoin - Informational

Description: Several state variables can never be modified, but are not declared constant.
BUSD, DEAD, WBNB, ZERO, _totalSupply, highTaxMinimumLimit, swapEnabled, swapThresholdEnabled
Recommendation: These state variables should be declared constant for additional gas savings on each reference.

Finding #2 - IntegrityCoin - Informational

Description: In the shouldSwapBack() function, the swapEnabled condition and !swapThresholdEnabled condition are always checked, however these values are set to true and cannot be modified.
function shouldSwapBack() internal view returns (bool) {
	return msg.sender != pancakeV2BNBPair
	&& !inSwap
	&& swapEnabled
	&& (!swapThresholdEnabled || _balances[address(this)] >= swapThreshold);
Recommendation: The swapEnabled condition and !swapThresholdEnabled condition can be removed from the shouldSwapBack() function for additional gas savings on each call, or two setter functions could be added that toggle these boolean variables.

Contracts Overview

  • The total supply of the token is set to 1 quadrillion $TEG [1,000,000,000,000,000].
  • No mint or burn functions are present; though the circulating supply can be reduced by sending tokens to the 0x..dead address if desired.
  • There was no token allocation for our team to analyze as the contract has yet to be deployed to the mainnet.

  • Trading must be unlocked by the team before all buy and sell transactions can take place on the platform. Only addresses that have been exempt by the team can participate in buy and sell transactions when trading is locked. Once trading is unlocked it can never be locked again.
  • The contract enforces a maximum sell amount (set by the team) which imposes a limit to the number of tokens that can be sold via Pancakeswap in a single transaction.
  • There is a Reflection fee, Liquidity Fee, and Buyback 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 transfer is a buy, sell, or peer-to-peer transfer.
  • If the High-Tax functionality is enabled by the team and the number of tokens a user is attempting to sell via Pancakeswap is greater than the High-Tax minimum value, the High-Tax fees (set by the team) will be charged on this sell transaction.
  • The tokens collected from fees are stored in the contract address. The tokens are swapped for BNB for the purpose of funding Pancakeswap liquidity when the following conditions are met:
    • The automatic liquidity add functionality is enabled by the team.
    • The threshold number of tokens (set by the team) in the contract address has been reached.
    • The contract is not currently performing an automatic liquidity add.
    • The caller is not initiating a buy transaction via Pancakeswap.
  • Liquidity-adds are automatically performed by selling the tokens collected as fees, pairing the received BNB with the token, and adding it as liquidity to the BNB pair.
  • The LP tokens received through this process are sent to the Liquidity address set by the team. We recommend that the team lock these newly acquired LP tokens.
  • The tokens collected through the Buyback fee are swapped for BNB and sent to the team's Buyback wallet.
  • The tokens collected from the Reflection Fee are swapped for BNB and sent to the DividendDistributor contract where they are swapped for BUSD and distributed as rewards.
  • If the BUSD balance of the contract reaches the threshold number of tokens (set by the team) and the caller is not initiating a buy transaction via Pancakeswap, the BUSD will be deposited into the DividendDistributor and distributed as rewards.
  • The contract utilizes the SafeMath library to prevent overflows/underflows.
  • The contract complies with the BEP-20 token standard.

  • Once dividends are distributed, they will need to be claimed; claiming happens automatically on each transfer.
  • Dividend rewards can also be claimed manually by kicking off the claim cycle, which will process all eligible token holders.
  • Alternatively, a user can manually claim dividends as an individual at any time.
  • There is a wait-time (set by the team) between claiming dividend rewards.
  • Claimed dividends are sent to the user's wallet address.
Ownership Controls:
  • The owner can assign any addresses to an Authorized role which can be used to maintain control over various role-restricted functions within the ecosystem.
  • Authorized addresses can set total fees for each fee structure up to 60% at any time.
  • Authorized addresses can exclude addresses from transfer fees, dividends, and the High-Tax sell restriction at any time.
  • Authorized addresses can update the threshold number of tokens that triggers automatic liquidity adds to any value at any time.
  • Authorized addresses can set the maximum sell amount to any value greater than 50 billion at any time.
  • Authorized addresses can set the High-Tax minimum sell value to any value greater than 50 billion at any time.
  • Authorized addresses can enable/disable the High-Tax functionality at any time.
  • Authorized addresses can enable/disable fees on peer-to-peer transfers at any time.
  • Authorized addresses can update the minimum threshold of dividends a user must be due in order for their rewards to be distributed on transfers to any value at any time.
  • Authorized addresses can update the wait-time between claiming rewards to any value at any time.
  • Authorized addresses can update the maximum amount of gas used for processing and sending BNB to the Buyback wallet to any values at any time.
  • Authorized addresses can update the threshold amount of BUSD needed to trigger the automatic deposit functionality to any value at any time.
  • Authorized addresses can manually trigger an automatic BUSD deposit to the DividendDistributor contract at any time.
  • Authorized addresses can update the Liquidity address and Buyback address to any addresses at any time.
  • Authorized addresses can lock any of the above functionality from being able to be updated for a specified amount of 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 Liquidity address set by the team.
  • The team can set total fees up to 60%.
Compiler IssuesN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Ether/Token TheftN/APASS
Flash LoansN/APASS
Front RunningThe Automatic Reflection functionality may be susceptible to front-running; The team must monitor and if suspicious activity is detected, should lower the swapThreshold value.PASS
Improper EventsN/APASS
Improper Authorization SchemeN/APASS
Integer Over/UnderflowN/APASS
Logical IssuesN/APASS
Oracle IssuesN/APASS
Outdated Compiler VersionN/APASS
Race ConditionsN/APASS
Signature IssuesN/APASS
Unbounded LoopsN/APASS
Unused CodeN/APASS
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] SafeMath 
    - [Int] add
    - [Int] sub
    - [Int] sub
    - [Int] mul
    - [Int] div
    - [Int] div

 + [Int] IBEP20 
    - [Ext] totalSupply
    - [Ext] decimals
    - [Ext] symbol
    - [Ext] name
    - [Ext] getOwner
    - [Ext] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

 + [Int] IDEXFactory 
    - [Ext] createPair #

 + [Int] IDEXRouter 
    - [Ext] factory
    - [Ext] WETH
    - [Ext] addLiquidity #
    - [Ext] addLiquidityETH ($)
    - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
    - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
    - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #

 +  TEGAuth 
    - [Pub]  #
    - [Pub] authorizeFor #
       - modifiers: authorizedFor
    - [Pub] authorizeForMultiplePermissions #
       - modifiers: authorizedFor
    - [Pub] unauthorizeFor #
       - modifiers: authorizedFor
    - [Pub] unauthorizeForMultiplePermissions #
       - modifiers: authorizedFor
    - [Pub] isOwner
    - [Pub] isAuthorizedFor
    - [Pub] isAuthorizedFor
    - [Pub] transferOwnership #
       - modifiers: onlyOwner
    - [Pub] getPermissionNameToIndex
    - [Pub] getPermissionUnlockTime
    - [Pub] isLocked
    - [Pub] lockPermission #
       - modifiers: authorizedFor
    - [Pub] unlockPermission #

 + [Int] IDividendDistributor 
    - [Ext] setDistributionCriteria #
    - [Ext] setShare #
    - [Ext] deposit ($)
    - [Ext] depositBUSD #
    - [Ext] process #
    - [Ext] claimDividend #

 +  DividendDistributor (IDividendDistributor)
    - [Pub]  #
    - [Ext] setDistributionCriteria #
       - modifiers: onlyToken
    - [Ext] setShare #
       - modifiers: onlyToken
    - [Ext] deposit ($)
       - modifiers: onlyToken
    - [Ext] depositBUSD #
       - modifiers: onlyToken
    - [Ext] process #
       - modifiers: onlyToken
    - [Int] shouldDistribute
    - [Int] distributeDividend #
    - [Ext] claimDividend #
    - [Pub] getShare
    - [Pub] getTotalShares
    - [Pub] getDividendsPerShare
    - [Pub] getUnpaidEarnings
    - [Int] getCumulativeDividends
    - [Int] addShareholder #
    - [Int] removeShareholder #

 +  IntegrityCoin (IBEP20, TEGAuth)
    - [Pub]  #
       - modifiers: TEGAuth
    - [Ext]  ($)
    - [Ext] totalSupply
    - [Ext] decimals
    - [Ext] symbol
    - [Ext] name
    - [Ext] getOwner
    - [Pub] balanceOf
    - [Ext] allowance
    - [Pub] approve #
    - [Ext] approveMax #
    - [Ext] transfer #
    - [Ext] transferFrom #
    - [Int] _transferFrom #
    - [Int] _basicTransfer #
    - [Int] takeFee #
    - [Int] isTrade
    - [Int] checkTradableLock
    - [Int] isTranferMethod
    - [Int] shouldSwapAirdropBUSD
    - [Int] swapAirdropBUSD #
    - [Ext] swapAirdropBUSDManual #
       - modifiers: authorizedFor
    - [Int] shouldSwapBack
    - [Int] swapBack #
       - modifiers: swapping
    - [Int] launched
    - [Int] launch #
    - [Ext] setAirdropBUSDthreshold #
       - modifiers: authorizedFor
    - [Ext] setIsDividendExempt #
       - modifiers: authorizedFor
    - [Ext] setTaxs #
       - modifiers: authorizedFor
    - [Ext] setFeeReceivers #
       - modifiers: authorizedFor
    - [Ext] setSwapBackSettings #
       - modifiers: authorizedFor
    - [Ext] setDistributionCriteria #
       - modifiers: authorizedFor
    - [Ext] setDistributorSettings #
       - modifiers: authorizedFor
    - [Pub] getCirculatingSupply
    - [Ext] claimDividend #
    - [Ext] setIsTradableLockExempt #
       - modifiers: authorizedFor
    - [Ext] setIsHighTaxExempt #
       - modifiers: authorizedFor
    - [Ext] setIsTransferFeeExempt #
       - modifiers: authorizedFor
    - [Ext] setIsTradeFeeExempt #
       - modifiers: authorizedFor
    - [Int] setIsAllExempt #
       - modifiers: authorizedFor
    - [Ext] setTradable #
       - modifiers: authorizedFor
    - [Ext] setHighTaxEnabled #
       - modifiers: authorizedFor
    - [Ext] setTransferFeeEnabled #
       - modifiers: authorizedFor
    - [Ext] setHighTaxMinimum #
       - modifiers: authorizedFor
    - [Ext] setMaxSellAmount #
       - modifiers: authorizedFor
    - [Int] initTaxs #
       - modifiers: authorizedFor
    - [Int] initOwner #
       - modifiers: authorizedFor
    - [Int] getTax

About SourceHat

SourceHat (formerly Solidity Finance - founded in 2020) has quickly grown to have one of the most experienced and well-equipped smart contract auditing teams in the industry. Our team has conducted 1300+ 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 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.