Apollo Protocol

Smart Contract Audit Report

Audit Summary

Apollo Protocol Audit Report Apollo Protocol is a new ERC-20 token on Metis with an elastic supply that performs automatic liquidity adds.

For this audit, we reviewed the project team's ApolloFactory, Apollo, and Vault contracts at 0xC09d94b59705863174A09CC38506EADcC76C086b on the Metis Mainnet.

Audit Findings

Please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
Date: April 1st, 2022.
Updated: April 4th, 2022 to reflect the changes made in the project team's newly deployed Mainnet address.

Finding #1 - Apollo - Medium (Resolved)

Description: Any user has the ability to deploy a new Apollo contract.
function deploy(ERC20 usdc, IUniswapV2Router02 _router, address presaleAddress, bytes32 _salt) public payable returns (address) {
	apollo = new Apollo{salt: _salt}(usdc, _router, presaleAddress);
Risk/Impact: The address that is stored in state will be modified for the Apollo contract when a new contract is created.
Recommendation: The contract should require that only the team can deploy a new Apollo contract.
Resolution: The team has applied the onlyOwner() modifier to the above function.

Finding #2 - Apollo - Low

Description: There are several instances in the contract where multiplication is performed on the result of a division. Division can lead to integer truncation, therefore dividing and subsequently multiplying can cause results to lose precision and become less accurate.
uint256 gonWhaleTax = (gonAmount / feeDenominator) * whaleTaxFee;
uint256 gonBotTax = (gonAmount / feeDenominator) * botTaxFee;
circuitBreakerTax = (gonAmount / feeDenominator) * circuitBreakerSellTaxFee;
circuitBreakerTax = (gonAmount / feeDenominator) * circuitBreakerBuyTaxFee;
feeAmount = (gonAmount / feeDenominator) * _totalFee;
burnFeeAmount = (gonAmount / feeDenominator) * burnFee;
liquidityFeeAmount = (gonAmount / feeDenominator) * liquidityFee;
Risk/Impact: The above values will be set to zero if the gonAmount is less than the feeDenominator.
Recommendation: These calculations should be modified to perform all multiplication before division.
Resolution: The team has not yet addressed this issue.

Finding #3 - Apollo - Informational (Resolved)

Description: Several functions are declared public, but are never called internally.
Vault.approveFor, Vault.addLiquidity, Apollo.transfer, Apollo.transferFrom, ApolloFactory.deploy
Recommendation: These functions should be declared external for additional gas savings on each call.
Resolution: The team has declared the above functions external.

Contracts Overview

ApolloFactory Contract:
  • The owner can use this contract to generate a new Apollo contract by specifying the USDC address, Router address, Presale address, and Salt value.
Apollo and Vault Contracts:
  • The initial supply of the token is set to 300,000 $APOLLO.
  • Upon deployment, 250,000 tokens will be sent to the team's Treasury wallet, and 50,000 tokens will be sent to the specified Presale address.
  • The maximum allowed supply of $APOLLO is 3 billion [3,000,000,000] tokens.
  • No mint or burn functions are present, though the circulating supply can be reduced by sending tokens to the 0x..dead address.

  • The contract features an Anti-whale mechanism that is triggered on buy and sell transactions if the number of tokens being transferred is greater than the limit number of tokens set by the team. The caller will be taxed at a 49% rate.
  • The contract features an Anti-bot mechanism that is triggered on buy and sell transactions if the cool-down period (determined by the owner) has not passed since the caller's last buy or sell. The caller will be taxed at a 49% rate.
  • The tokens collected from the Anti-whale and Anti-bot mechanisms are sent to the team's Treasury wallet.
  • There is a 4% Liquidity fee, a 2.5% Treasury fee, a 5% Apollo-Insurance Fund Fee, and a 2.5% Burn Fee fee on all transfers where neither the sender nor the recipient is excluded from fees.
  • There is an additional 2% Sell fee added on all sell transactions.
  • If a user owns at least 1 NFT of the NFT address set by the team, total fees will be decreased by 50%.
  • A separate circuitBreaker tax will be charged if the price of the token has dropped (or will drop after the transaction takes place) more than the threshold percentage (determined by the owner) in a 15 minute period. The total fees on sells during this period will be doubled to 32%. The total fees on buys during this period will be halved to 7%.
  • The tokens collected through the circuitBreaker tax are sent to the Apollo-Insurance Fund wallet.
  • Blacklisted contracts are not permitted to transfer tokens.
  • The contract features an auto-rebase mechanism that is triggered on token transfers when the following conditions are met:
    • The auto-rebase mechanism is enabled by the team.
    • Rebasing has been manually started by the team.
    • The token has not reached the maximum supply.
    • The caller is not initiating a buy transaction via the DEX.
    • The contract is not currently swapping tokens, performing a rebase, or performing an automatic liquidity add.
    • 15 minutes have passed since this functionality has previously occurred.
  • During a rebase, 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 to the total supply is dependent on the total supply at the time of rebasing and the time since deployment.
  • The rebase function properly calls sync() on the Pair contract to prevent theft-of-liquidity attacks that have occurred with other rebase tokens.
  • An automatic liquidity add will also occur on token transfers if at least 2 days have passed since the previous automatic liquidity add.
  • A liquidity-add is funded by selling half of the tokens collected as liquidity fees, pairing the received USDC with the token, and adding it as liquidity to the 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 through the Treasury fee and Apollo Insurance-Fund Fee are swapped for USDC and stored in the Vault contract. The received USDC is sent to the team's Treasury wallet and Apollo Insurance-Fund wallet respectively.
  • The Vault contract must grant both the Treasury wallet and Apollo Insurance-Fund wallet a sufficient allowance in order for this functionality to occur successfully.
  • The tokens collected through the Burn fee are sent to the 0x..dead address.
  • Any user can airdrop any number of tokens to any addresses at any time.
  • As the contract is implemented with Solidity v0.8.x, it is safe from any possible overflows/underflows.

  • The owner can enable/disable automatic liquidity adds and the auto-rebase mechanism at any time.
  • The owner can add/remove any contract address from the transfer blacklist at any time. EOAs cannot be blacklisted.
  • The owner can include/exclude accounts from transfer fees at any time.
  • The owner can update the Anti-whale token limit and Anti-bot cool-down period to any values at any time.
  • The owner can set the additional Whale fee, Bot fee, and circuitBreaker fees to any values at any time.
  • The owner can swap all of the $APOLLO in the contract for USDC and send it to the team's Treasury wallet at any time.
  • The owner can update the Treasury wallet, Liquidity wallet, and Apollo-Insurance Fund wallet at any time.
  • The owner can update the NFT contract address at any time.
  • The owner can add/remove addresses as a Firepool address at any time.
  • The owner can set the Firepool address at any time.
  • The owner can set the circuitBreaker threshold to any value at any time.
  • The owner can grant a maximum approval to any address to spend any specified token from the Vault contract.

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 owner can swap all of the $APOLLO in the contract for USDC and send it to the team's Treasury wallet.
  • The owner can set the Anti-whale limit and Anti-bot cool-down time to any values at any time.
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
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

 + [Int] IUniswapV2Router01 
    - [Ext] factory
    - [Ext] WETH
    - [Ext] addLiquidity #
    - [Ext] addLiquidityETH ($)
    - [Ext] removeLiquidity #
    - [Ext] removeLiquidityETH #
    - [Ext] removeLiquidityWithPermit #
    - [Ext] removeLiquidityETHWithPermit #
    - [Ext] swapExactTokensForTokens #
    - [Ext] swapTokensForExactTokens #
    - [Ext] swapExactETHForTokens ($)
    - [Ext] swapTokensForExactETH #
    - [Ext] swapExactTokensForETH #
    - [Ext] swapETHForExactTokens ($)
    - [Ext] quote
    - [Ext] getAmountOut
    - [Ext] getAmountIn
    - [Ext] getAmountsOut
    - [Ext] getAmountsIn

 + [Int] IUniswapV2Router02 (IUniswapV2Router01)
    - [Ext] removeLiquidityETHSupportingFeeOnTransferTokens #
    - [Ext] removeLiquidityETHWithPermitSupportingFeeOnTransferTokens #
    - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
    - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
    - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #

 + [Int] IUniswapV2Pair 
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transfer #
    - [Ext] transferFrom #
    - [Ext] nonces
    - [Ext] permit #
    - [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] IUniswapV2Factory 
    - [Ext] feeTo
    - [Ext] feeToSetter
    - [Ext] getPair
    - [Ext] allPairs
    - [Ext] allPairsLength
    - [Ext] createPair #
    - [Ext] setFeeTo #
    - [Ext] setFeeToSetter #

 +  Ownable 
    - [Pub]  #
    - [Pub] renounceOwnership #
       - modifiers: onlyOwner
    - [Pub] transferOwnership #
       - modifiers: onlyOwner
    - [Int] _transferOwnership #

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

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

 + [Int] IApollo (IERC20, IERC20Metadata)
    - [Ext] getCirculatingSupply

 +  Vault (Ownable)
    - [Pub]  #
    - [Pub] approveFor #
       - modifiers: onlyOwner
    - [Pub] addLiquidity #
    - [Ext]  #

 + [Int] BalanceAble 
    - [Ext] balanceOf

 +  Apollo (IApollo, Ownable)
    - [Pub]  #
    - [Int] rebase #
    - [Pub] transfer #
       - modifiers: validRecipient
    - [Ext] batchTransfer #
    - [Ext] batchTransferSame #
    - [Pub] transferFrom #
       - modifiers: validRecipient
    - [Int] _basicTransfer #
    - [Int] _transferFrom #
    - [Int] takeCircuitBreakerFee #
    - [Int] takeFee #
    - [Pub] addLiquidity #
       - modifiers: swapping
    - [Int] swapBack #
       - modifiers: swapping
    - [Ext] withdrawAllToTreasury #
       - modifiers: swapping,onlyOwner
    - [Pub] shouldRebase
    - [Pub] shouldAddLiquidity
    - [Pub] shouldSwapBack
    - [Pub] shouldCircuitBreaker
    - [Ext] allowance
    - [Ext] decreaseAllowance #
    - [Ext] increaseAllowance #
    - [Ext] approve #
    - [Pub] getCirculatingSupply
    - [Ext] isNotInSwap
    - [Pub] getCircuitBreakerEpoch
    - [Pub] getCurrentPrice
    - [Ext] manualSync #
    - [Pub] getPriceDown
    - [Int] checkCircuitBreakCurrent #
    - [Pub] balanceOf
    - [Ext] approveFor #
       - modifiers: onlyOwner
    - [Ext] approveVault #
       - modifiers: onlyOwner
    - [Int] isContract
    - [Ext] startRebase #
       - modifiers: onlyOwner
    - [Ext] setNftContract #
       - modifiers: onlyOwner
    - [Ext] setAutoRebase #
       - modifiers: onlyOwner
    - [Ext] setAutoAddLiquidity #
       - modifiers: onlyOwner
    - [Ext] getLiquidityBacking
    - [Ext] setFeeReceivers #
       - modifiers: onlyOwner
    - [Ext] setIsFeeExempt #
       - modifiers: onlyOwner
    - [Ext] setIsFirePool #
       - modifiers: onlyOwner
    - [Ext] setBotBlacklist #
       - modifiers: onlyOwner
    - [Ext] setMaxSafeSwapAmount #
       - modifiers: onlyOwner
    - [Ext] setSafeSwapInterval #
       - modifiers: onlyOwner
    - [Ext] setBotTaxFee #
       - modifiers: onlyOwner
    - [Ext] setWhaleTaxFee #
       - modifiers: onlyOwner
    - [Ext] setCircuitBreakerPriceThreshold #
       - modifiers: onlyOwner
    - [Ext] setCircuitBreakerBuyTaxFee #
       - modifiers: onlyOwner
    - [Ext] setCircuitBreakerSellTaxFee #
       - modifiers: onlyOwner
    - [Ext] setFirePool #
       - modifiers: onlyOwner
    - [Ext] chainInfo

 +  ApolloFactory 
    - [Pub] deploy ($)

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 1800+ 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!
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.