Skip to content
$1,000,000 in security audit grants are live now, Apply here →

Security review · August 2022

Protocol Review

for Infinity Lotto

After a line by line manual analysis and automated review, Guardian has concluded that:

Published
Language
Solidity
Chains
BNB Chain
Sector
Tokens
  • 0 Critical
  • 0 High
  • 1 Medium
  • 11 Low
  • 0 Informational

1 resolved · 11 acknowledged

Scope

Overview

After a line by line manual analysis and automated review, Guardian has concluded that:

  • Infinity Lotto’s smart contracts have a LOW RISK SEVERITY
  • Infinity Lotto’s smart contracts have an ACTIVE OWNERSHIP
  • Important owner privileges – authorize, unauthorize, transferOwnership, addStakingContract, removeBadStakingContract, setAutomatedMarketMakerPair, updateClaimWait, setMaxWalletPercent_base1000, tradingStatus, cooldownEnabled, enable_blacklist, manage_blacklist, setSellMultiplier, multiAirdrop, multiAirdrop_fixed, addTeamDivWallet, removeTeamDivWallet, setIsFeeExempt, setGoldenModeTaxByIs0, setIsTimelockExempt, setIsTxLimitExempt, setIsMaxWalletExempt, setContractFees, setFeeContract, setSwapBackSettings, setDistributorSettings, withdrawlToken, updateRouter
  • Infinity Lotto’s smart contract owner has multiple “write” privileges. Centralization risk correlated to the active ownership is MEDIUM

Findings 12

  1. LOT-1 Medium Centralization Risk Centralization / Privilege Resolved
    Location
    InfinityLotto.sol

    Description

    Privileged addresses have authority over many functions that may be used to negatively disrupt the project. Some important privileges include:

    • owner can blacklist an address preventing it from swapping ILOTTO tokens. Additionally, the token pair or exchange router could be blacklisted, which would cease trading.
    • owner can set isMaxWalletExempt to false for the pair contract, thus halting all trading.
    • owner can label an address a teamDivWallet which would instantaneously create more XiLotto dividend tokens and would dilute the future dividends of other holders. Furthermore, this allows the team to to dump on the market without any cooldown.
    • owner can toggle tradingStatus to false which would prevent users from transferring funds and cease trading on all exchanges.
    • owner can updateClaimWait to an arbitrarily long period, potentially preventing XiLotto holders from ever claiming their dividends.
    • Any authorized address can update the router to a potentially malicious contract that causes a denial-of-service via reverting, or siphons funds upon execution of swapBack rather than distributing these funds as dividends.
    • owner can set the cooldownTimerInterval to an arbitrarily long length of time, making it so that addresses are potentially only able to buy ILotto2 once. Additionally, owner can combine an extremely long cooldownTimerInterval with adding the exchange’s router as an automatedMarketMakerPair, this way any address can potentially only buy/sell one time.

    Recommendation

    Currently the owner address is not a multi-sig. Ensure that the privileged addresses are multi-sig and/or introduce timelock for improved community oversight. Optionally introduce require statements to limit the scope of the exploits that can be carried out by the privileged addresses.

    Resolution

    Infinity Lotto Team: **

    • Contract Ownership is transferred a multi sig wallet
  2. LOT-2 Low Multiplication On Result Of Division Precision Acknowledged
    Location
    InfinityLotto.sol: 1885

    Description

    In the function takeFee: uint256 feeAmount = amount.div(feeDenominator * 100).mul(totalFee).mul(multiplier) performs multiplication on the result of division, which leads to a loss in precision.

    For example: 100.div(100 * 100).mul(10).mul(100) = 0 but 100.mul(10).mul(100).div(100 * 100) = 10

    Recommendation

    Change to uint256 feeAmount = (amount * totalFee * multiplier) / (feeDenominator * 100).

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  3. LOT-3 Low Constant Modifiers Mutability Acknowledged
    Location
    InfinityLotto.sol

    Description

    Contract variables such as MAX_INT, RWRD, DEAD, ZERO, _totalSupply, feeDenominator can be declared constant.

    Recommendation

    Declare the variables constant.

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  4. LOT-4 Low Immutable Modifiers Mutability Acknowledged
    Location
    InfinityLotto.sol

    Description

    The WBNB and distributor variables are never modified after they are set in the constructor, and should therefore be declared immutable.

    Recommendation

    Declare the variables immutable.

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  5. LOT-5 Low SafeMath Operations Best Practices Acknowledged
    Location
    InfinityLotto.sol

    Description

    There is no need for add, sub, mul, and div in Solidity version ^0.8.0 as there are already implicit overflow and underflow checks.

    Recommendation

    Use language provided operators +, -, *, / to save on gas.

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  6. LOT-6 Low Superfluous Mapping Optimization Acknowledged
    Location
    InfinityLotto.sol: 1500

    Description

    In the XiLotto contract, the tokenHoldersMap is declared as an IterableMapping, but it is only ever used to access the values of the keys. Therefore the use of IterableMapping is gas inefficient and it can be replaced as a list.

    Recommendation

    Replace the tokenHoldersMap with a list of tokenHolders.

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  7. LOT-7 Low Internal Functions Best Practices Acknowledged
    Location
    InfinityLotto.sol

    Description

    Internal functions should be denoted with a preceding _: checkTxLimit, shouldTakeFee, takeFee, shouldSwapBack, swapBack, swapAndSendToDiv.

    Recommendation

    Rename these functions to _checkTxLimit, _shouldTakeFee, _takeFee, _shouldSwapBack, _swapBack, _swapAndSendToDiv.

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  8. LOT-8 Low External Modifiers Best Practices Acknowledged
    Location
    InfinityLotto.sol

    Description

    Many public functions can be declared external: tradingStatus, cooldownEnabled, enable_blacklist, manage_blacklist, getCirculatingSupply, addTeamDivWallet, setAutomatedMarketMakerPair.

    Recommendation

    Declare these functions external as they are never called internally.

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  9. LOT-9 Low Lack of CamelCase Best Practices Acknowledged
    Location
    InfinityLotto.sol: 1979, 1983

    Description

    Function names should adhere to camelCase: enable_blacklist, manage_blacklist.

    Recommendation

    Introduce camelCase instead of snake_case.

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  10. LOT-10 Low Typo Typos Acknowledged
    Location
    InfinityLotto.sol: 2078

    Description

    withdrawlToken should be withdrawalToken.

    Recommendation

    Fix spelling for cleaner code.

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  11. LOT-11 Low Residual MaxWalletExemption Logical Error Acknowledged
    Location
    InfinityLotto.sol: 1743

    Description

    When removeBadStakingContract is called, isMaxWalletExempt is not reset to false.

    Recommendation

    If this is not intended, perform isMaxWalletExempt[badStakingContract] = false; or delete isMaxWalletExempt[badStakingContract].

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.
  12. LOT-12 Low Boolean Redundancy Optimization Acknowledged
    Location
    InfinityLotto.sol: 2093

    Description

    In updateRouter the final if statement condition is automatedMarketMakerPairs[pair] != true, but this is redundant since the mapping values are booleans themselves.

    Recommendation

    Replace the if statement condition with a more gas efficient !automatedMarketMakerPairs[pair].

    Resolution

    Infinity Lotto Team: **

    • Acknowledged, but not changed as this doesn’t significantly affect the token and would require a contract migration.

Put your code through the same review.

This review started with a conversation about scope. Tell us what you are building and we will plan yours with you.

Get a quote