Aimedis

Smart Contract Audit Report

Audit Summary

Aimedis Audit Report Aimedis is a new ERC-20 token on Polygon that is an automatic liquidity providing protocol.

For this audit, we reviewed the project team's Aimedis contract at 0x33b6d77c607ea499ab5db7e2201c5a516a78a5db on the Polygon Mainnet.

Audit Findings

Informational findings were identified and the team may want to review them. In addition, centralized aspects are present.
Date: March 9th, 2023.

Finding #1 - Aimedis - Informational

Description: In the _transfer() function, the second if-statement will always be true because if either the "from" address or the "to" address is excluded from fees, the function would have already executed a return statement.
function _transfer(address from, address to, uint256 amount) internal override {
...
if(_isExcludedFromFees[from] || _isExcludedFromFees[to] || swapping){
   super._transfer(from, to, amount);
   return;
}
...

if(!_isExcludedFromFees[from] && !_isExcludedFromFees[to]){
...   
}
Recommendation: The team could remove the second if-statement above from the _transfer() function for additional gas savings on each transfer.

Finding #2 - Aimedis - Informational

Description: The limitsInEffect and maxBuyAmount state variables are not used in the contract.
Recommendation: The team should either remove these state variables to reduce contract size and deployment costs or utilize them in a way that fits their intended functionality.

Contract Overview

  • The total supply of the token is currently 588 million $AIMX [588,000,000].
  • No mint functions are accessible beyond deployment.
  • Any user can burn their own tokens to reduce the total supply.
  • At the time of writing this report, there are 6,624 total token holders. The token allocation is as follows:
  • The above contracts are not within the scope of this audit.

  • Trading must be enabled by the owner in order for all transfers to take place on the platform. Only accounts that have been excluded from fees can participate in transfers when trading is disabled. Once trading is enabled, it cannot be disabled.
  • Blacklisted accounts are prohibited from participating in transfers.
  • The contract enforces a maximum sell amount (determined by the owner) which imposes a limit to the number of tokens that can be sold via an approved DEX in a single transaction.
  • Users are prohibited from selling tokens within 2 blocks of their last buy transaction.
  • There is a Liquidity fee, Operations fee, and Dev fee on all buys and sells via an approved DEX 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 or sell.
  • The tokens collected through fees are stored in the contract address. The tokens collected through the Operations fee and Dev fee are swapped for the stablecoin address set by the team and sent to the team's Operations wallet and Dev wallet when the following conditions are met:
    • The threshold number of tokens (determined by the owner) in the contract address has been reached.
    • The contract is not currently swapping tokens.
    • The caller is not initiating a buy transaction via an approved DEX.
    • Neither the sender nor the recipient is excluded from fees.
  • The tokens collected through the Liquidity fee are sent from the contract to the Pair address.
  • The owner can airdrop any number of tokens to up to 400 addresses per transaction at any time.
  • When the lossless functionality is enabled, the Lossless contract address is called to execute logic before all transfers and allowance processes. The Lossless contract is not within the scope of this audit, so we are unable to provide an assessment of the contract with regards to security.
  • The Lossless contract can transfer any user's full token balance to the Lossless contract address at any time.
  • The Recovery Admin can propose to disable the lossless functionality, which begins the time lock period at any time. The lossless functionality can be disabled by the Recovery Admin address once the lock time has elapsed.
  • The Recovery Admin address can be transferred to a new address using a key hash; once the current Recovery Admin address proposes the new candidate address, the candidate address must provide the key hash to accept the role.
  • As the contract is deployed with Solidity v0.8.17, it is protected from overflows/underflows.
  • The contract complies with the ERC-20 token standard.
Ownership Controls:
  • The owner can set total sell fees up to 20% and total buy fees up to 15%
  • The owner can add/remove addresses from the transfer blacklist at any time.
  • The owner can exclude and include accounts from transfer fees at any time.
  • The owner can set the maximum sell amount to any value greater than 0.0083% of the total supply.
  • The owner can include and exclude accounts from the maximum sell restriction at any time.
  • The owner can update the threshold number of tokens needed to trigger the automatic token swapping functionality to any value between 0.001% and 0.01% of the total supply at any time.
  • The owner can withdraw any ETH from the contract at any time.
  • The owner can withdraw any tokens from the contract when trading is disabled.
  • The owner can withdraw any tokens besides Aimedis from the contract after trading is enabled.
  • The owner can manually trigger the automatic token swapping functionality at any time.
  • The owner can set the team's Dev wallet and Operations wallet to any addresses at any time.
  • The owner can add/remove any address as an Automated Market Maker Pair at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control
  • The Lossless contract can transfer out any user's full token balance at any time.
  • The owner can add any account to the transfer blacklist at any time.
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
Sybil Attack N/A PASS
Unbounded Loops N/A PASS
Unused Code The limitsInEffect and maxBuyAmount state variables are not used in the contract. PASS
Overall Contract Safety   WARNING

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

 +  Context 
    - [Int] _msgSender
    - [Int] _msgData

 + [Int] IERC20 
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

 + [Int] IERC20Metadata (IERC20)
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals

 +  ERC20 (Context, IERC20, IERC20Metadata)
    - [Pub]  #
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
    - [Pub] allowance
    - [Pub] approve #
    - [Pub] transferFrom #
    - [Pub] increaseAllowance #
    - [Pub] decreaseAllowance #
    - [Int] _transfer #
    - [Int] _createInitialSupply #
    - [Int] _approve #

 + [Lib] Address 
    - [Int] isContract
    - [Int] sendValue #
    - [Int] functionCall #
    - [Int] functionCall #
    - [Int] functionCallWithValue #
    - [Int] functionCallWithValue #
    - [Int] functionStaticCall
    - [Int] functionStaticCall
    - [Int] functionDelegateCall #
    - [Int] functionDelegateCall #
    - [Int] verifyCallResultFromTarget
    - [Int] verifyCallResult
    - [Prv] _revert

 + [Lib] SafeERC20 
    - [Int] safeTransfer #
    - [Prv] _callOptionalReturn #

 + [Int] ILosslessController 
    - [Ext] beforeTransfer #
    - [Ext] beforeTransferFrom #
    - [Ext] beforeApprove #
    - [Ext] beforeIncreaseAllowance #
    - [Ext] beforeDecreaseAllowance #
    - [Ext] afterApprove #
    - [Ext] afterTransfer #
    - [Ext] afterTransferFrom #
    - [Ext] afterIncreaseAllowance #
    - [Ext] afterDecreaseAllowance #

 +  LERC20 (Context, IERC20)
    - [Pub]  #
    - [Ext] getAdmin
    - [Ext] transferOutBlacklistedFunds #
    - [Pub] setLosslessAdmin #
       - modifiers: onlyRecoveryAdmin
    - [Pub] transferRecoveryAdminOwnership #
       - modifiers: onlyRecoveryAdmin
    - [Ext] acceptRecoveryAdminOwnership #
    - [Pub] proposeLosslessTurnOff #
       - modifiers: onlyRecoveryAdmin
    - [Pub] executeLosslessTurnOff #
       - modifiers: onlyRecoveryAdmin
    - [Pub] executeLosslessTurnOn #
       - modifiers: onlyRecoveryAdmin
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
       - modifiers: lssTransfer
    - [Pub] allowance
    - [Pub] approve #
       - modifiers: lssAprove
    - [Pub] transferFrom #
       - modifiers: lssTransferFrom
    - [Pub] increaseAllowance #
       - modifiers: lssIncreaseAllowance
    - [Pub] decreaseAllowance #
       - modifiers: lssDecreaseAllowance
    - [Int] _transfer #
    - [Int] _mint #
    - [Int] _burn #
    - [Int] _approve #

 +  Ownable (Context)
    - [Pub]  #
    - [Pub] owner
    - [Ext] renounceOwnership #
       - modifiers: onlyOwner
    - [Pub] transferOwnership #
       - modifiers: onlyOwner

 +  TokenHandler (Ownable)
    - [Ext] sendTokenToOwner #
       - modifiers: onlyOwner

 + [Int] ILpPair 
    - [Ext] sync #

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

 + [Int] IDexFactory 
    - [Ext] createPair #

 +  Aimedis (LERC20, Ownable)
    - [Pub]  #
       - modifiers: LERC20
    - [Ext]  ($)
    - [Ext] enableTrading #
       - modifiers: onlyOwner
    - [Ext] massManageRestrictedWallets #
       - modifiers: onlyOwner
    - [Ext] updateMaxSellAmount #
       - modifiers: onlyOwner
    - [Ext] updateSwapTokensAtAmount #
       - modifiers: onlyOwner
    - [Prv] _excludeFromMaxTransaction #
    - [Ext] airdropToWallets #
       - modifiers: onlyOwner
    - [Ext] excludeFromMaxTransaction #
       - modifiers: onlyOwner
    - [Ext] setAutomatedMarketMakerPair #
       - modifiers: onlyOwner
    - [Prv] _setAutomatedMarketMakerPair #
    - [Ext] updateBuyFees #
       - modifiers: onlyOwner
    - [Ext] updateSellFees #
       - modifiers: onlyOwner
    - [Pub] excludeFromFees #
       - modifiers: onlyOwner
    - [Int] _transfer #
    - [Prv] swapTokensForEth #
    - [Ext] getCurrentBlock
    - [Ext] getCurrentTimestamp
    - [Prv] swapTokensForSTABLECOIN #
    - [Prv] swapBack #
    - [Ext] transferForeignToken #
       - modifiers: onlyOwner
    - [Ext] withdrawStuckETH #
       - modifiers: onlyOwner
    - [Ext] setOperationsAddress #
       - modifiers: onlyOwner
    - [Ext] setDevAddress #
       - modifiers: onlyOwner
    - [Ext] forceSwapBack #
       - modifiers: onlyOwner
    - [Ext] burnTokens #

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 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.