IWIN GAME

Smart Contract Audit Report

Audit Summary

IWIN GAME Audit Report IWIN GAME is a new BEP-20 token on the Binance Smart Chain that is an automatic liquidity providing protocol.

For this audit, we reviewed the project team's IWINGAME contract at 0x3Ac016BF0adC5257F6304466Ac9cabAaf15A9b3E on the Binance Smart Chain Mainnet.

Audit Findings

Low findings were identified and the team should consider resolving these issues. In addition, centralized aspects are present.
Date: September 1st, 2022.
Updated: September 8th, 2022 to reflect the project's newly deployed Mainnet address.

Finding #1 - IWINGAME - Low

Description: In the setFees() function, the first require statement enforces that total fees cannot exceed 30%. The second require statement enforces that total fees cannot exceed 25%, causing the first require statement to be redundant.
function setFees(uint256 _liquidityFee, uint256 _buybackFee, uint256 _reflectionFee, uint256 _marketingFee, uint256 _feeDenominator) external authorized {
...
require(totalFee <= 3000, "Total fee less than 30%");
feeDenominator = _feeDenominator;
require(totalFee < feeDenominator/4);
Risk/Impact: The total fee percentage cap is actually 25% rather than 30%.
Recommendation: The team should modify the setFees() function to fit their intended functionality in regard to setting a cap on the total fee percentage.

Finding #2 - IWINGAME - Informational

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

Finding #3 - IWINGAME - Informational

Description: Although the SafeMath library is utilized, the contract is deployed with Solidity v0.8.16 which has built-in overflow checks.
Recommendation: SafeMath could be safely removed to reduce contract size, deployment costs, and gas costs on all transactions that utilize it.

Contract Overview

  • The total supply of the token is set to 1 billion $IWIN [1,000,000,000].
  • No mint or burn functions exist, though the circulating supply can be decreased by sending tokens to the 0x..dead address.
  • At the time of writing this report, 100% of the total supply belongs to the owner.

  • The contract enforces a maximum transaction amount (determined by the owner) which imposes a limit to the number of tokens that can be transferred during any given transaction.
  • Users will not be able to transfer their total token balance if the total holder value of the contract falls to zero.
  • There is a Reflection fee, Liquidity Fee, Marketing 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 user is buying or selling during the transfer.
  • Fees are increased during a sell to Pancakeswap up to a value proportional to the time left in the buyback multiplier period, if any.
  • 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 (determined by the owner) in the contract address has been reached.
    • The contract is not currently performing an automatic liquidity add or a buyback.
    • 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 Marketing Fee are swapped for BNB and sent to the team's Marketing Wallet.
  • The tokens collected through the Reflection Fee are sent to the Distributor contract. This contract was not included in the scope of this audit so we are unable to provide an assessment with regard to functionality and security.
  • An automatic buyback will be triggered on token transfers when the following conditions are met:
    • The automatic buyback functionality is enabled by the team.
    • The threshold amount of BNB in the contract address has been reached.
    • The contract is not currently performing an automatic liquidity add or a buyback.
    • The caller is not initiating a buy transaction via Pancakeswap.
    • The cool-down number of blocks (determined by the owner) since the previous buyback has passed.
  • An automatic buyback is performed by swapping an amount of BNB (determined by the owner) in the contract for $IWIN and sending it to the 0x..dead address.
  • Automatic buybacks will be disabled when the total amount of BNB used for buybacks reaches the buyback cap (set by the team).
  • The contract utilizes the SafeMath library to prevent overflows/underflows.
  • The contract complies with the BEP-20 token standard.
Ownership Controls:
  • The owner can assign addresses to an Authorized role which can be used to maintain control over various role-restricted functions within the contract.
  • Authorized addresses can set each fee percentage to any values as long as the total fee percentage combined does not exceed 25%.
  • Authorized addresses can set the fee percentage on all buy transactions to any value up to 10%.
  • Authorized addresses can exclude accounts from transfer fees and the maximum transaction amount at any time.
  • Authorized addresses can set the maximum transaction amount to any value greater than 1 million at any time.
  • Authorized addresses can exclude accounts from dividends in the Distributor contract at any time.
  • Authorized addresses can enable/disable automatic liquidity adds 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 enable/disable the automatic buyback mechanism at any time.
  • Authorized addresses can set the automatic buyback cap, BNB threshold value, and block period to any values at any time.
  • Authorized addresses can set the last automatic buyback block to the current block.number at any time.
  • Authorized addresses can manually trigger a buyback at any time.
  • Authorized addresses can update the buyback multiplier at any time.
  • Authorized addresses can update the Liquidity address and Marketing address at any time.
  • Authorized addresses can update the Pancakeswap Pair addresses at any time.
  • Authorized addresses can update the target liquidity and target liquidity denominator to any values at any time.
  • Authorized addresses can update the minimum period and minimum distribution values in the Distributor contract at any time.
  • Authorized addresses can update the maximum amount of gas used for processing to any value up to 750,000 at any time.
  • The owner can update the Pancakeswap Router address at any time.
  • The owner can withdraw all of the BNB from the contract at any time.
  • The owner can update the Distributor contract address at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control
  • The LP tokens generated through automatic liquidity adds are sent to the Liquidity address set by the team.
  • The team currently owns 100% of the total supply.
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 The Buyback and automatic token swapping functionality may both be susceptible to front-running; The team must monitor and if suspicious activity is detected, the team must disable these systems. 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

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] 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] IERC20 
    - [Ext] totalSupply
    - [Ext] decimals
    - [Ext] symbol
    - [Ext] name
    - [Ext] getOwner
    - [Ext] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

 +  Auth 
    - [Pub]  #
    - [Pub] authorize #
       - modifiers: onlyOwner
    - [Pub] unauthorize #
       - modifiers: onlyOwner
    - [Pub] isOwner
    - [Pub] isAuthorized
    - [Pub] transferOwnership #
       - modifiers: onlyOwner

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

 + [Int] IDividendDistributor 
    - [Ext] setDistributionCriteria #
    - [Ext] setShare #
    - [Ext] deposit #
    - [Ext] process #

 + [Int] IDEXFactory 
    - [Ext] createPair #

 +  IWINGAME (IERC20, Auth)
    - [Pub]  #
       - modifiers: Auth
    - [Ext]  ($)
    - [Ext] withdrawMoney #
       - modifiers: onlyOwner
    - [Ext] totalSupply
    - [Ext] decimals
    - [Ext] symbol
    - [Ext] name
    - [Ext] getOwner
    - [Pub] balanceOf
    - [Ext] allowance
    - [Ext] setDividendDistributor #
       - modifiers: onlyOwner
    - [Ext] setWhiteList #
       - modifiers: authorized
    - [Ext] setPair #
       - modifiers: authorized
    - [Ext] setDexRouter #
       - modifiers: onlyOwner
    - [Pub] approve #
    - [Ext] approveMax #
    - [Ext] transfer #
    - [Ext] transferFrom #
    - [Int] _transferFrom #
    - [Int] _basicTransfer #
    - [Int] checkTxLimit
    - [Int] shouldTakeFee
    - [Pub] getTotalFee
    - [Pub] getTotalHolder
    - [Pub] getMultipliedFee
    - [Int] takeFee #
    - [Int] shouldSwapBack
    - [Int] swapBack #
       - modifiers: swapping
    - [Int] shouldAutoBuyback
    - [Ext] triggerTokenBuyback #
       - modifiers: authorized
    - [Ext] clearBuybackMultiplier #
       - modifiers: authorized
    - [Int] triggerAutoBuyback #
    - [Int] buyTokens #
       - modifiers: swapping
    - [Ext] setAutoBuybackSettings #
       - modifiers: authorized
    - [Ext] setBuybackMultiplierSettings #
       - modifiers: authorized
    - [Ext] setTxLimit #
       - modifiers: authorized
    - [Ext] setIsDividendExempt #
       - modifiers: authorized
    - [Ext] setIsFeeExempt #
       - modifiers: authorized
    - [Ext] setIsFeeExemptRecipient #
       - modifiers: authorized
    - [Ext] setIsTxLimitExempt #
       - modifiers: authorized
    - [Ext] setFees #
       - modifiers: authorized
    - [Ext] setBuyFee #
       - modifiers: authorized
    - [Ext] setFeeReceivers #
       - modifiers: authorized
    - [Ext] setSwapBackSettings #
       - modifiers: authorized
    - [Ext] setTargetLiquidity #
       - modifiers: authorized
    - [Ext] setDistributionCriteria #
       - modifiers: authorized
    - [Ext] setDistributorSettings #
       - modifiers: authorized
    - [Pub] getCirculatingSupply
    - [Pub] getLiquidityBacking
    - [Pub] isOverLiquified

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 1300+ solidity smart contract audits covering all major project types and protocols, securing a total of over $10 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 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.