D100 - Smart Contract Audit Report

Summary

D100 D100 is a token that rebases based on the market cap of DeFi. The token will be deployed on the Binance Smart Chain.

We audited D100's contracts provided to us by the team. Once deployed, we will verify the code and add the addresses below.

  • D100Token - 0x9d8aac497a4b8fe697dd63101d793f0c6a6eebb6
  • D100Token Monetary Policy - 0x19c28F537A90B7F9975A69A3c6Ada808AA87D389
  • Oracle - 0x170293407b29Cd82B52b57CD31FCBaF8d4b638f6
  • Market Cap Oracle - 0x055eCED2000Cc2710f9075DC1Ba3D50DD98a84F7
  • Token Price Oracle - 0x224225Ad7da5E1C49EE16C3D37FE63038C076988
  • Audit Findings:
    D100 Token Contract:
  • The initial supply of the token is 2.5 million, sent to the deployer's address upon deployment.
  • The token rebases based upon the market cap of DeFi.
  • The owner can pause and unpause transfers of the token at any time; and can exempt addresses from the pause mechanism. The owner can also 'ban' users, disallowing them from moving their tokens.
  • The owner has the ability to update the Monetary Policy address at any time; as well as some variables used in calculating the rebase.
  • The contract complies with the ERC20 and ERC677 (transferAndCall/token fallback) standards.
  • Utilization of SafeMath to prevent overflows.

  • Monetary Policy Contract:
  • This contract represents the the monetary policy that controls the rebases. Anyone call call the rebase() function to trigger a rebase after the set time period has elapsed.
  • The rebase function properly calls sync() on the Uniswap pair contract(s) to prevent theft-of-liquidity attacks which have occured with other rebase tokens. The owner can add/remove other liquidity pools to this list to sync them after rebases.
  • The owner can pause and unpause rebases at any time.
  • The owner has the ability to update the D100 token addresses and oracle addresses at any time; as well as some variables used in calculating the rebase & incentive payout for the rebase() caller.
  • The owner can also withdraw any tokens sent to the Monetary Policy contract by mistake.
  • Utilization of SafeMath to prevent overflows.

  • Market Cap Oracle Contract:
  • This contract represents the oracle for the market cap used in the rebase calculation.
  • The Oracle implementation uses the Tellor Oracle.
  • These contracts pull external data to provide the platform with market data which is used to calculate the rebases of the token.
  • Users must trust the team's oracle implementation to provide honest pricing.
  • Utilization of SafeMath to prevent overflows.

  • Target Price Oracle Contract:
  • This contract represents the oracle for the current token price used in the rebase calculation.
  • The Oracle implementation uses Uniswap's TWAP (Time-Weighted Average Price) Oracle method, which is secure from manipulation by flash loans.
  • The owner has the ability to update the Monetary Policy address at any time, which is used for calling the function that updates the price.
  • Utilization of SafeMath to prevent overflows.


  • Audit Findings Summary:
  • No issues from outside attackers were identified.
  • Ensure trust in the project team as they have notable power in the ecosystem.
  • Date: February 24th, 2021.
  • Combined Audit Results

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

    Function Graph

    Smart Contract Graph

    Inheritence Chart

    Smart Contract Inheritance

    Functions Overview / Source Code


    Click here to download the source code.

    
     ($) = 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
    
     + [Int] IERC20 
        - [Ext] totalSupply
        - [Ext] balanceOf
        - [Ext] transfer #
        - [Ext] allowance
        - [Ext] approve #
        - [Ext] transferFrom #
    
     + [Lib] SafeMath 
        - [Int] add
        - [Int] sub
        - [Int] sub
        - [Int] mul
        - [Int] div
        - [Int] div
        - [Int] mod
        - [Int] mod
    
     +  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 #
    
     + [Lib] SafeMathInt 
        - [Int] mul
        - [Int] div
        - [Int] sub
        - [Int] add
        - [Int] abs
    
     +  ERC677 
        - [Pub] transfer #
        - [Pub] transferAndCall #
    
     +  ERC677Receiver 
        - [Pub] onTokenTransfer #
    
     +  ERC677Token (ERC677)
        - [Pub] transferAndCall #
        - [Prv] contractFallback #
        - [Prv] isContract
    
     +  D100Token (ERC20, ERC677Token, Ownable)
        - [Pub]  #
        - [Ext] setTransfersPaused #
           - modifiers: onlyOwner
        - [Ext] setTransferPauseExempt #
           - modifiers: onlyOwner
        - [Pub] setRebasesPaused #
           - modifiers: onlyOwner
        - [Ext] setMonetaryPolicy #
           - modifiers: onlyOwner
        - [Ext] rebase #
        - [Pub] totalShares
        - [Ext] sharesOf
        - [Ext] setUserBanStatus #
           - modifiers: onlyOwner
        - [Pub] totalSupply
        - [Pub] balanceOf
        - [Pub] transfer #
           - modifiers: validRecipient
        - [Pub] allowance
        - [Pub] transferFrom #
           - modifiers: validRecipient
        - [Pub] approve #
        - [Pub] increaseAllowance #
        - [Pub] decreaseAllowance #
    							

    Function Graph

    Smart Contract Graph

    Inheritence Chart

    Smart Contract Inheritance

    Functions Overview / Source Code


    Click here to download the source code.

    
     ($) = payable function
     # = non-constant function
     
     Int = Internal
     Ext = External
     Pub = Public
     
     + [Lib] UInt256Lib 
        - [Int] toInt256Safe
    
     +  Context 
        - [Int] _msgSender
        - [Int] _msgData
    
     +  Ownable (Context)
        - [Int]  #
        - [Pub] owner
        - [Pub] renounceOwnership #
           - modifiers: onlyOwner
        - [Pub] transferOwnership #
           - modifiers: onlyOwner
    
     + [Int] IERC20 
        - [Ext] totalSupply
        - [Ext] balanceOf
        - [Ext] transfer #
        - [Ext] allowance
        - [Ext] approve #
        - [Ext] transferFrom #
    
     + [Lib] SafeMath 
        - [Int] add
        - [Int] sub
        - [Int] sub
        - [Int] mul
        - [Int] div
        - [Int] div
        - [Int] mod
        - [Int] mod
    
     +  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 #
    
     + [Lib] SafeMathInt 
        - [Int] mul
        - [Int] div
        - [Int] sub
        - [Int] add
        - [Int] abs
    
     +  ERC677 
        - [Pub] transfer #
        - [Pub] transferAndCall #
    
     +  ERC677Receiver 
        - [Pub] onTokenTransfer #
    
     +  ERC677Token (ERC677)
        - [Pub] transferAndCall #
        - [Prv] contractFallback #
        - [Prv] isContract
    
     +  D100Token (ERC20, ERC677Token, Ownable)
        - [Pub]  #
        - [Ext] setTransfersPaused #
           - modifiers: onlyOwner
        - [Ext] setTransferPauseExempt #
           - modifiers: onlyOwner
        - [Pub] setRebasesPaused #
           - modifiers: onlyOwner
        - [Ext] setMonetaryPolicy #
           - modifiers: onlyOwner
        - [Ext] rebase #
        - [Pub] totalShares
        - [Ext] sharesOf
        - [Ext] setUserBanStatus #
           - modifiers: onlyOwner
        - [Pub] totalSupply
        - [Pub] balanceOf
        - [Pub] transfer #
           - modifiers: validRecipient
        - [Pub] allowance
        - [Pub] transferFrom #
           - modifiers: validRecipient
        - [Pub] approve #
        - [Pub] increaseAllowance #
        - [Pub] decreaseAllowance #
    
     + [Int] IOracle 
        - [Ext] getData
        - [Ext] update #
    
     + [Int] ISync 
        - [Ext] sync #
    
     +  D100TokenMonetaryPolicy (Ownable)
        - [Ext] setD100Token #
           - modifiers: onlyOwner
        - [Ext] rebase #
        - [Pub] calcIncentive
        - [Ext] withdrawTokens #
           - modifiers: onlyOwner
        - [Pub] getNextSupplyDelta
        - [Ext] addUniPair #
           - modifiers: onlyOwner
        - [Ext] removeUniPair #
           - modifiers: onlyOwner
        - [Pub] sync #
        - [Ext] setmktcapOracle #
           - modifiers: onlyOwner
        - [Ext] setTokenPriceOracle #
           - modifiers: onlyOwner
        - [Ext] setIncentiveLimit #
           - modifiers: onlyOwner
        - [Ext] setDeviationThreshold #
           - modifiers: onlyOwner
        - [Ext] setRebaseLag #
           - modifiers: onlyOwner
        - [Ext] setRebaseTimingParameters #
           - modifiers: onlyOwner
        - [Pub]  #
        - [Pub] inRebaseWindow
        - [Prv] computeSupplyDelta
        - [Prv] withinDeviationThreshold
    							

    Function Graph

    Smart Contract Graph

    Inheritence Chart

    Smart Contract Inheritance

    Functions Overview / Source Code


    Click here to download the source code.

    
    
     ($) = payable function
     # = non-constant function
     
     Int = Internal
     Ext = External
     Pub = Public
     
     + [Int] ITellor 
        - [Ext] beginDispute #
        - [Ext] vote #
        - [Ext] tallyVotes #
        - [Ext] proposeFork #
        - [Ext] addTip #
        - [Ext] submitMiningSolution #
        - [Ext] submitMiningSolution #
        - [Ext] proposeOwnership #
        - [Ext] claimOwnership #
        - [Ext] depositStake #
        - [Ext] requestStakingWithdraw #
        - [Ext] withdrawStake #
        - [Ext] approve #
        - [Ext] transfer #
        - [Ext] transferFrom #
        - [Ext] name
        - [Ext] symbol
        - [Ext] decimals
        - [Ext] getNewCurrentVariables
        - [Ext] getTopRequestIDs
        - [Ext] getNewVariablesOnDeck
        - [Ext] updateTellor #
        - [Ext] unlockDisputeFee #
        - [Ext] allowance
        - [Ext] allowedToTrade
        - [Ext] balanceOf
        - [Ext] balanceOfAt
        - [Ext] didMine
        - [Ext] didVote
        - [Ext] getAddressVars
        - [Ext] getAllDisputeVars
        - [Ext] getCurrentVariables
        - [Ext] getDisputeIdByDisputeHash
        - [Ext] getDisputeUintVars
        - [Ext] getLastNewValue
        - [Ext] getLastNewValueById
        - [Ext] getMinedBlockNum
        - [Ext] getMinersByRequestIdAndTimestamp
        - [Ext] getNewValueCountbyRequestId
        - [Ext] getRequestIdByRequestQIndex
        - [Ext] getRequestIdByTimestamp
        - [Ext] getRequestIdByQueryHash
        - [Ext] getRequestQ
        - [Ext] getRequestUintVars
        - [Ext] getRequestVars
        - [Ext] getStakerInfo
        - [Ext] getSubmissionsByTimestamp
        - [Ext] getTimestampbyRequestIDandIndex
        - [Ext] getUintVar
        - [Ext] getVariablesOnDeck
        - [Ext] isInDispute
        - [Ext] retrieveData
        - [Ext] totalSupply
    
     +  UsingTellor 
        - [Pub]  #
        - [Pub] retrieveData
        - [Pub] isInDispute
        - [Pub] getNewValueCountbyRequestId
        - [Pub] getTimestampbyRequestIDandIndex
        - [Pub] getCurrentValue
        - [Pub] getIndexForDataBefore
        - [Pub] getDataBefore
    
     + [Lib] SafeMath 
        - [Int] add
        - [Int] sub
        - [Int] sub
        - [Int] mul
        - [Int] div
        - [Int] div
        - [Int] mod
        - [Int] mod
    
     +  Context 
        - [Int] _msgSender
        - [Int] _msgData
    
     +  Ownable (Context)
        - [Int]  #
        - [Pub] owner
        - [Pub] renounceOwnership #
           - modifiers: onlyOwner
        - [Pub] transferOwnership #
           - modifiers: onlyOwner
    
     +  Oracle (Ownable)
        - [Pub]  #
        - [Pub] name
        - [Pub] symbol
        - [Pub] decimals
        - [Pub] totalSupply
        - [Pub] balanceOf
        - [Ext] faucet #
        - [Pub] transfer #
        - [Pub] allowance
        - [Pub] approve #
        - [Pub] transferFrom #
        - [Pub] increaseAllowance #
        - [Pub] decreaseAllowance #
        - [Int] _transfer #
        - [Int] _mint #
        - [Int] _burn #
        - [Int] _approve #
        - [Ext] submitValue #
           - modifiers: onlyOwner
        - [Ext] disputeValue #
           - modifiers: onlyOwner
        - [Pub] retrieveData
        - [Pub] isInDispute
        - [Pub] getNewValueCountbyRequestId
        - [Pub] getTimestampbyRequestIDandIndex
        - [Ext] addTip #
    
     +  MktCapOracle (UsingTellor)
        - [Pub]  #
           - modifiers: UsingTellor
        - [Ext] readTellorValue
        - [Ext] readTellorValueBefore #
    
    							

    Function Graph

    Smart Contract Graph

    Inheritence Chart

    Smart Contract Inheritance

    Functions Overview / Source Code


    Click here to download the source code.

    
    
     ($) = 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
    
     + [Int] IPancakePair 
        - [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 #
    
     + [Lib] Babylonian 
        - [Int] sqrt
    
     + [Lib] FixedPoint 
        - [Int] encode
        - [Int] encode144
        - [Int] div
        - [Int] mul
        - [Int] fraction
        - [Int] decode
        - [Int] decode144
        - [Int] reciprocal
        - [Int] sqrt
    
     + [Lib] PancakeOracleLibrary 
        - [Int] currentBlockTimestamp
        - [Int] currentCumulativePrices
    
     +  TokenPriceOracle (Ownable)
        - [Pub]  #
        - [Ext] update #
        - [Ext] getData
        - [Pub] setMonetaryPolicy #
           - modifiers: onlyOwner