Rebase Finance

Smart Contract Audit Report

Audit Summary

Rebase Finance Audit Report Rebase Finance is a new BEP-20 token with an elastic supply that performs automatic liquidity adds.

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

Audit Findings

Please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
Date: April 28th, 2022.

Finding #1 - Rebase - High (Resolved)

Description: The LP pair manualSync() function is not called when a rebase occurs.
Risk/Impact: Malicious users will be able to call the skim() function to steal excess tokens from the liquidity pool after rebases occur.
Recommendation: The team should include a call to the manualSync() function within the coreRebase() function to ensure that the LP pool is synced during each rebase.
Resolution: The team has implemented the above recommendation.

Finding #2 - Rebase - Informational

Description:The updateMaxTransaction() and updateSwapThreshold() functions are called twice on all manual rebases.
function manualRebase()
...
	updateMaxTransaction();
	updateSwapThreshold();
	coreRebase(supplyDelta);
...
function coreRebase(
...
	updateMaxTransaction();
	updateSwapThreshold();
Recommendation: These two function calls can be removed from the manualRebase() function.

Finding #3 - Rebase - Informational (Resolved)

Description: The totalFee state variable can never be modified, but is not declared constant.
Recommendation: This state variable could be declared constant for additional gas savings on each reference.
Resolution: The team has decalred the totalFee state variable constant.

Contract Overview

  • The initial supply is set to 1 billion $REBASE [1,000,000,000].
  • The maximum supply of is 340,282,366,920,938,463,463,374,607,431,768,211,455 tokens.
  • No mint or burn function are present in the contract; 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 sell amount and a maximum buy amount (both determined by the owner) that imposes a limit to the number of tokens that can be transferred via Pancakeswap in a single transaction.
  • There is a 5% Liquidity fee, 5% Treasury fee, 5% RFV fee, and 5% Burn fee on all transfers via Pancakeswap where neither the sender nor the recipient is excluded from fees.
  • The contract initially charges an extra 15% Launch fee on all sell transactions via Pancakeswap. This fee is decreased by 3% every 48 rebases.
  • When the Tax bracket functionality is enabled by the team, fees are increased by up to an additional 30% on sells for users that hold over the limit number of tokens in proportion to the current number of $REBASE.
  • The fees charged during transfers 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 in the contract address (determined by the owner) 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 wallet controlled by the team. We recommend that the team lock these newly acquired LP tokens.
  • The tokens collected from the Treasury fee and RFV fee are swapped for BNB and sent to the team's Treasury wallet and RFV wallet respectively.
  • The tokens collected from the Burn fee are sent to the 0x..dead address.
  • Also during transfers, if the "next-rebase" time has passed and auto rebase is enabled, 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 is dependent on the current total supply, and the ratio between the "reward yield" and the "reward yield denominator"; this ratio is ~0.046% of the current total supply.
  • The rebase function calls sync() on the Pancakeswap Pair contract to prevent theft-of-liquidity attacks that have occurred with other rebase tokens.
  • The contract utilizes SafeMath libraries to prevent any overflows/underflows.
Ownership Controls:
  • The owner can exclude accounts from transfer fees at any time.
  • The owner can enable/disable automatic liquidity adds at any time.
  • The owner can enable/disable the auto-rebase mechanism at any time.
  • The owner can manually trigger a manual rebase at any time if the next-rebase time has passed.
  • The owner can set the next-rebase time to any value at any time.
  • The owner can withdraw any BNB or tokens from the contract at any time.
  • The owner can set the additional Launch fee to 0 at any time.
  • The owner can enable/disable the Tax bracket functionality at any time.
  • The owner can enable/disable charging fees on peer-to-peer transfers at any time.
  • The owner can update the team's Liquidity wallet, Treasury wallet, and RFV wallet to any addresses at any time.
  • The owner can add/remove addresses as an Automated Market Maker Pair address at any time.
  • The owner can update the Pancakeswap Router address at any 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 team's Liquidity wallet.
  • The owner can withdraw $REBASE from the contract at any time.
WARNING
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
ReentrancyN/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

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

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

 + [Lib] Math 
    - [Int] max
    - [Int] min
    - [Int] average

 + [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] balanceOf
    - [Ext] transfer #
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transferFrom #

 +  ERC20 (Context, IERC20)
    - [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] _mint #
    - [Int] _burn #
    - [Int] _approve #
    - [Int] _setupDecimals #
    - [Int] _beforeTokenTransfer #

 + [Int] IRebaseFactory 
    - [Ext] feeTo
    - [Ext] feeToSetter
    - [Ext] getPair
    - [Ext] allPairs
    - [Ext] allPairsLength
    - [Ext] createPair #
    - [Ext] setFeeTo #
    - [Ext] setFeeToSetter #
    - [Ext] INIT_CODE_PAIR_HASH
    - [Ext] getBeneficiary
    - [Ext] setBeneficiary #

 + [Int] IRebasePair 
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals
    - [Ext] totalSupply
    - [Ext] balanceOf
    - [Ext] allowance
    - [Ext] approve #
    - [Ext] transfer #
    - [Ext] transferFrom #
    - [Ext] DOMAIN_SEPARATOR
    - [Ext] PERMIT_TYPEHASH
    - [Ext] nonces
    - [Ext] permit #
    - [Ext] MINIMUM_LIQUIDITY
    - [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 #
    - [Ext] beneficiary
    - [Ext] setBeneficiary #

 + [Int] IRebaseRouter01 
    - [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] IRebaseRouter02 (IRebaseRouter01)
    - [Ext] removeLiquidityETHSupportingFeeOnTransferTokens #
    - [Ext] removeLiquidityETHWithPermitSupportingFeeOnTransferTokens #
    - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
    - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
    - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #

 +  Rebase (ERC20, Ownable)
    - [Pub]  #
       - modifiers: ERC20
    - [Ext]  ($)
    - [Pub] totalSupply
    - [Pub] allowance
    - [Pub] balanceOf
    - [Pub] markerPairAddress
    - [Int] shouldRebase
    - [Int] shouldTakeFee
    - [Int] shouldSwapBack
    - [Ext] getGonBalances
    - [Pub] getCirculatingSupply
    - [Pub] getTokensInLPCirculation
    - [Pub] getCurrentTaxBracket
    - [Ext] manualSync #
    - [Pub] transfer #
    - [Int] basicTransfer #
    - [Int] _transferFrom #
    - [Pub] transferFrom #
    - [Int] swapAndLiquify #
    - [Int] addLiquidity #
    - [Int] swapTokensForEth #
    - [Int] swapBack #
       - modifiers: swapping
    - [Int] takeFee #
    - [Pub] decreaseAllowance #
    - [Pub] increaseAllowance #
    - [Pub] approve #
    - [Int] rebase #
    - [Int] coreRebase #
    - [Ext] manualRebase #
       - modifiers: onlyOwner
    - [Int] calculateAmount
    - [Int] updateSwapThreshold #
    - [Int] updateMaxTransaction #
    - [Int] updateLaunchPeriodFee #
    - [Pub] setAutomatedMarketMakerPair #
       - modifiers: onlyOwner
    - [Ext] setFeeExempt #
       - modifiers: onlyOwner
    - [Ext] setSwapBackEnabled #
       - modifiers: onlyOwner
    - [Ext] setFeeReceivers #
       - modifiers: onlyOwner
    - [Ext] clearStuckBalance #
       - modifiers: onlyOwner
    - [Ext] rescueToken #
       - modifiers: onlyOwner
    - [Ext] setAutoRebase #
       - modifiers: onlyOwner
    - [Ext] disableLaunchFee #
       - modifiers: onlyOwner
    - [Ext] setTaxBracketEnabled #
       - modifiers: onlyOwner
    - [Ext] setNextRebase #
       - modifiers: onlyOwner
    - [Ext] setTransferFeeEnabled #
       - modifiers: onlyOwner
    - [Ext] setRouter #
       - modifiers: onlyOwner
    - [Ext] setPair #
       - modifiers: onlyOwner

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.