TimePaysMe

Smart Contract Audit Report

Audit Summary

TimePaysMe Audit Report TimePaysMe is a new product which allows users to create their own Time Capsules which can be used to lock various funds.

For this audit, we reviewed the following contracts on the Ethereum Mainnet:

Audit Findings

No findings were identified.
Date: June 28th, 2023.
Updated: July 5th, 2023 to reflect changes from commit 4a9742aa0dce4c2978c4fb309aeec9cbc1b51160 to the Ethereum Mainnet address listed above.

Contracts Overview

  • As the contracts are implemented with Solidity v0.8.0, they are safe from any possible overflows/underflows.
TimeCapsuleFactory Contract:
  • This contract allows users to create their own "Time Capsule".
  • When creating a TimeCapsule, a user can optionally specify a "recovery address hash" which can claim ownership of the TimeCapsule if certain conditions have been met.
  • Only one capsule can be created per user.
  • A new TimeCapsule contract is created using the associated implementation contract, with the creator set as the owner and the FeeSplitter address set as this contract's associated FeeSplitter.
  • A record of the user's TimeCapsule address is stored in this contract, along with its recovery address hash.
  • If a TimeCapsule is recovered by a user that already owns a Capsule, ownership of their previously owned capsule will be lost.
  • The TimeCapsule implementation and FeeSplitter contracts are defined upon deployment and cannot be updated or upgraded.
TimeCapsule Contract:
  • This contract allows its owner to lock various funds for specified periods of time.
  • When locking funds, the owner specifies a token address, lock start time, unlock time, and the lock type.
  • The sum of the lock amount and a 0.1% fee is required to be present in the contract at the time of locking; the fee amount is transferred to the FeeSplitter address and immediately split between the fee recipients.
  • Users can choose between 3 types of locks: Hard Locks, Drip Locks, and Behavioral locks.
  • No funds can be withdrawn from a Hard Lock until the unlock time has been reached.
  • A Drip Lock's funds unlock linearly throughout the lock period.
  • Behavioral Locks last up to one year, but funds can be unlocked and withdrawn at any earlier time if the owner provides the Lock's unhashed password.
  • The 0x0 address is used to lock the blockchain's native currency.
  • The maximum permitted lock time is 55 years.
  • A user can withdraw a Drip or Hard Lock's total funds if at least one hour remains before a Lock's start time.
  • In order to withdraw, the owner must first initiate their withdrawal, specifying the amount to be withdrawn.
  • Once initiated, the owner must wait an additional 7 days before withdrawing the pending funds to their address.
  • Alternatively, the owner can cancel a pending withdrawal.
  • A user cannot initiate another withdrawal from the same lock until the pending withdrawal has been completed or canceled.
  • The TimeCapsule owner can place their TimeCapsule in "panic mode" at any time, which will disable all functionality apart from canceling.
  • Any address with a signature from the TimeCapsule's owner can also change the contract to Panic Mode.
  • If the contract is in panic mode, or at least one year has passed from the contract's latest unlock time, the TimeCapsule's recovery address can claim ownership of the Vault. This will also restore all contract functionality.
  • Panic mode can only be executed once.
  • A TimeCapsule owner can use this contract to update its recovery address hash a single time after creation while the TimeCapsule is not in Panic state.
  • A signature from the recovery address is required in order to update the TimeCapsule's recovery address.
  • A TimeCapsule owner cannot update the recovery address hash if the specified address already owns a TimeCapsule.
FeeSplitter Contract:
  • This contract is used to split its token balances and native currency between three recipients.
  • The three recipients are set upon deployment and cannot be updated.
  • Anyone can initiate a token split at any time, which divides the specified token and transfers a portion to each recipient.
  • Whenever the contract receives the blockchain's native token, it is automatically divided and transferred to each recipient.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control
  • TimeCapsule owners have the permissions described above.
  • PASS
    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 N/A PASS
    Overall Contract Safety   PASS

    TimeCapsule Contract

    Smart Contract Audit - Inheritance

    Smart Contract Audit - Graph

    
       ($) = payable function
       # = non-constant function
       
       Int = Internal
       Ext = External
       Pub = Public
       
       + [Int] IERC20 
    	  - [Ext] totalSupply
    	  - [Ext] balanceOf
    	  - [Ext] transfer #
    	  - [Ext] allowance
    	  - [Ext] approve #
    	  - [Ext] transferFrom #
      
       + [Lib] Strings 
    	  - [Int] toString
      
       +  Initializable 
    	  - [Int] _disableInitializers #
      
       + [Int] ITimeCapsuleFactory 
    	  - [Ext] predictedCapsuleAddress
    	  - [Ext] createTimeCapsule #
    	  - [Ext] createTimeCapsule #
    	  - [Ext] capsuleAddressOf
    	  - [Ext] validateRecoveryAddressHash #
    	  - [Ext] checkRecoveryAddress
    	  - [Ext] isRecoveryHashValidated
    	  - [Ext] getRecoveryRecord
    	  - [Ext] recoverOwnership #
      
       + [Int] IFeeSplitter 
    	  - [Ext] splitERC20 #
      
       +  TimeCapsuleContext (Initializable)
      
       +  TimeCapsule (TimeCapsuleContext)
    	  - [Pub]  #
    	  - [Pub] initialize #
    		 - modifiers: initializer
    	  - [Ext]  ($)
    	  - [Int] _transferNative #
    	  - [Int] _transferToken #
    	  - [Pub] vaultStatus
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] validateRecoveryAddressHash #
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] checkRecoveryAddress
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] isRecoveryHashValidated
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] lockCount
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] lockData
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] availableBalance
    		 - modifiers: _onlyCapsuleOwner
    	  - [Int] _storeNewLock #
    	  - [Int] _createLock #
    	  - [Pub] createLock ($)
    		 - modifiers: _onlyCapsuleOwner,_notPanicState
    	  - [Pub] createHardLock ($)
    		 - modifiers: _onlyCapsuleOwner,_notPanicState
    	  - [Pub] createBehaviorLock ($)
    		 - modifiers: _onlyCapsuleOwner,_notPanicState
    	  - [Pub] checkBehaviorLockCode
    		 - modifiers: _notPanicState
    	  - [Pub] claimBehaviorLock ($)
    		 - modifiers: _onlyCapsuleOwner,_notPanicState
    	  - [Pub] calculateAllowance
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] initiateWithdrawal #
    		 - modifiers: _onlyCapsuleOwner,_notPanicState
    	  - [Pub] cancelWithdrawal #
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] releaseLock #
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] sendWithdrawal #
    		 - modifiers: _onlyCapsuleOwner,_notPanicState
    	  - [Prv] _splitSignature
    	  - [Prv] __recoverSignerAddress
    	  - [Prv] _recoverSignerAddress
    	  - [Prv] _panic #
    	  - [Pub] panic #
    		 - modifiers: _onlyCapsuleOwner
    	  - [Pub] panic #
    	  - [Int] _recoverVault #
    	  - [Pub] recoverExpiredVault #
    	  - [Pub] recoverVault #
      
      

    TimeCapsuleFactory Contract

    Smart Contract Audit - Inheritance

    Smart Contract Audit - Graph

    
       ($) = payable function
       # = non-constant function
       
       Int = Internal
       Ext = External
       Pub = Public
      
       + [Lib] Clones 
       - [Int] clone #
       - [Int] cloneDeterministic #
       - [Int] predictDeterministicAddress
       - [Int] predictDeterministicAddress
      
      + [Lib] Strings 
       - [Int] toString
      
      + [Int] IFeeSplitter 
       - [Ext] splitERC20 #
      
      + [Int] ITimeCapsule 
       - [Ext] initialize #
      
      +  TimeCapsuleFactory 
       - [Pub]  #
       - [Pub] predictedCapsuleAddress
       - [Int] _instantiateTimeCapsule #
       - [Pub] createTimeCapsule #
       - [Pub] createTimeCapsule #
       - [Pub] capsuleAddressOf
       - [Prv] _splitSignature
       - [Prv] _recoverSignerAddress
       - [Int] _setRecoveryAddressHash #
       - [Int] _validateRecoveryAddressHash #
       - [Pub] validateRecoveryAddressHash #
    	  - modifiers: _onlyOwnersCapsule
       - [Pub] checkRecoveryAddress
       - [Pub] isRecoveryHashValidated
    	  - modifiers: _onlyOwnersCapsule
       - [Pub] recoverOwnership #
    	  - modifiers: _onlyOwnersCapsule
      
       
      

    FeeSplitter Contract

    Smart Contract Audit - Inheritance

    Smart Contract Audit - Graph

    
       ($) = payable function
       # = non-constant function
       
       Int = Internal
       Ext = External
       Pub = Public
      
       + [Int] IERC20 
       - [Ext] totalSupply
       - [Ext] balanceOf
       - [Ext] transfer #
       - [Ext] allowance
       - [Ext] approve #
       - [Ext] transferFrom #
      
      +  FeeSplitter 
       - [Pub]  #
       - [Pub] initialize #
       - [Ext]  ($)
       - [Prv] _splitNative #
       - [Pub] splitERC20 #
       
      

    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.