Only Moons Token Locker V1 - Smart Contract Audit Report

Summary

OnlyMoonsTokenLockerV1 Audit Report Only Moons is building a platform that enables users to create and manage their own token lockers.

We reviewed the project team's contracts deployed at 0x016c1D8cf86f60A5382BA5c42D4be960CBd1b868 on the Binance SmartChain Mainnet.

Notes on the Contracts:
  • Anyone can use the TokenLockerManager contract to create a new TokenLocker contract; the user is declared the owner of the new TokenLocker contract.
  • On creation, the user specifies the token address, the amount to lock, and the unlock time.
  • The tokens are immediately transferred to the TokenLocker contract.
  • The owner of the TokenLockerManager can enable or disable the creation of TokenLockers at any time.
  • The owner of the TokenLocker can deposit additional tokens and set a new unlock time at will. The new unlock time must later than the unlock time currently set, and it must be a future time.
  • Once the unlock time has passed, the owner of the TokenLocker can withdraw the locked tokens from the contract.
  • The owner of the TokenLocker can withdraw any ETH or tokens, except for the locked tokens, erroneously sent to the contract.
  • The owner of the TokenLocker contract can transfer the ownership of the TokenLocker contract to any other address at any time.
  • The logic within the deposit and withdrawal functions is properly structured to prevent any re-entrancy attacks.
  • As the contracts are deployed with Solidity v0.8.10, they are safe from any possible overflows/underflows.
  • The team worked with us to optimize these contracts for gas efficiency.

Audit Findings Summary:
  • No security issues from outside attackers were identified.
  • Date: November 24th, 2021.
  • Updated: December 6th, 2021 to include new mainnet deployment address.

External Threat Results

Vulnerability CategoryNotesResult
Arbitrary Storage WriteN/APASS
Arbitrary JumpN/APASS
Centralization of ControlN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Deprecated OpcodesN/APASS
Ether ThiefN/APASS
ExceptionsN/APASS
External CallsN/APASS
Integer Over/UnderflowN/APASS
Multiple SendsN/APASS
SuicideN/APASS
State Change External CallsN/APASS
Unbounded LoopN/APASS
Unchecked RetvalN/APASS
User Supplied AssertionN/APASS
Critical Solidity CompilerN/APASS
Overall Contract Safety PASS

TokenLockerManagerV1 Contract

Smart Contract Graph

Contract Inheritance


 ($) = payable function
 # = non-constant function
 
 + [Int] ITokenLockerManagerV1 
    - [Ext] tokenLockerCount
    - [Ext] creationEnabled
    - [Ext] setCreationEnabled #
    - [Ext] createTokenLocker #
    - [Ext] getTokenLockAddress
    - [Ext] getTokenLockData
    - [Ext] getLpData
    - [Ext] getTokenLockersForAddress
    - [Ext] notifyLockerOwnerChange #

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

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

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

 + [Int] IUniswapV2Factory 
    - [Ext] feeTo
    - [Ext] feeToSetter
    - [Ext] getPair
    - [Ext] allPairs
    - [Ext] allPairsLength
    - [Ext] createPair #
    - [Ext] setFeeTo #
    - [Ext] setFeeToSetter #

 + [Int] IUniswapV2Pair 
    - [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 #

 + [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 #

 + [Lib] Util 
    - [Ext] getTokenData
    - [Ext] isLpToken
    - [Ext] getLpData

 +  TokenLockerV1 (Ownable)
    - [Pub]  #
       - modifiers: Ownable
    - [Prv] _balance
    - [Ext] getIsLpToken
    - [Ext] getLockData
    - [Ext] getLpData
    - [Ext] deposit #
       - modifiers: onlyOwner,transferLocked
    - [Ext] withdraw #
       - modifiers: onlyOwner,transferLocked
    - [Ext] withdrawToken #
       - modifiers: onlyOwner,transferLocked
    - [Ext] withdrawEth #
       - modifiers: onlyOwner,transferLocked
    - [Int] _transferOwnership #
       - modifiers: onlyOwner
    - [Ext]  ($)

 +  TokenLockerManagerV1 (ITokenLockerManagerV1, Ownable)
    - [Pub]  #
       - modifiers: Ownable
    - [Ext] tokenLockerCount
    - [Ext] creationEnabled
    - [Ext] setCreationEnabled #
       - modifiers: onlyOwner
    - [Ext] createTokenLocker #
       - modifiers: allowCreation,lockCreation
    - [Ext] getTokenLockAddress
    - [Ext] getTokenLockData
    - [Ext] getLpData
    - [Ext] getTokenLockersForAddress
    - [Ext] notifyLockerOwnerChange #