My DeFi Pet - Audit Report

Summary

My DeFi Pet  Audit Report My DeFi Pet is a new lifestyle game where users own and manage blockchain-based pets.

The My DeFi Pet suite of contracts includes a BEP20 and KRC20 tokens (for Binance Smart Chain and KardiaChain Network, respectively) as well as a unique smart contract designed to mint ERC721-compliant NFTs. We reviewed the contracts at commit 2062471ea5a7e1464a41729c25184e8b00eeed77 and later at commit 0873a31ae212842063480abcf8e53634d4f4efd4 on the project's private GitHub.

    Notes on the contracts:
  • The My DeFi Pet BEP20/KRC20 tokens have a total supply of 100 million. These tokens act as currency for the game.
  • Upon deployment, the supply shall be delivered to the team.
  • No mint functions are present - the token is only minted upon deployment
  • Anyone has the ability to burn their own tokens, which is reflected in the getBurnedAmountTotal() view function.

  • The CryptoPet contract is the main contract supporting the My DeFi Pet game.
  • Each pet is represented by an unique NFT which is minted to its owner upon creation ('birthing') of the pet.
  • Each pet has a set of unique variables ('genes') associated with it.
  • For 100 DPET tokens a user can create ('summon') a new pet.
  • Additionally, users can kick off an auction process every 24 hours where a pet will be created and sold to the highest bidder.
  • Two pets can 'breed' together to create a new pet which inherits the genes from its parents.
  • After breeding, anyone can call the giveBirth() function to mint the pet NFT to its owner.
  • Owners of pets can feed those pets DPET tokens in order to upgrade them.
  • Pet owners can elect to sell off their pets via a public auction build into the contract.
  • As some genes are rarer than others, the variables in each NFT contract can largely influnce the value of the pet.
  • The team has the ability to pause the contract and set some variables used.
  • The presale will be occuring on KickPad, which we previously reviewed here.
  • Utilization of SafeMath across all contracts to prevent overflows.
Audit Findings Summary:
  • No security issues from outside attackers were identified.
  • Date: April 22nd, 2021

External Threats - Audit Results

Vulnerability Category Notes Result
Arbitrary Storage Write N/A PASS
Arbitrary Jump N/A PASS
Delegate Call to Untrusted Contract N/A PASS
Dependence on Predictable Variables N/A PASS
Deprecated Opcodes N/A PASS
Ether Thief N/A PASS
Exceptions N/A PASS
External Calls N/A PASS
Flash Loans N/A PASS
Integer Over/Underflow N/A PASS
Multiple Sends N/A PASS
Oracles N/A PASS
Suicide N/A PASS
State Change External Calls N/A PASS
Unchecked Retval N/A PASS
User Supplied Assertion N/A PASS
Critical Solidity Compiler N/A PASS
Overall Contract Safety   PASS


Function Graph

Smart Contract Graph

Inheritence Chart

Smart Contract Inheritance

Functions Overview



 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public

 + [Lib] SafeMath 
    - [Int] add
    - [Int] sub

 +  Ownable 
    - [Pub]  #
    - [Pub] transferOwnership #
       - modifiers: onlyOwner

 +  KRC721 
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Ext] ownerOf
    - [Ext] approve #
    - [Ext] transfer #
    - [Ext] transferFrom #
    - [Ext] supportsInterface

 + [Int] IGeneScience 
    - [Ext] mixGenes

 +  PetAccessControl (Ownable)
    - [Ext] pause #
       - modifiers: onlyOwner,whenNotPaused
    - [Pub] unpause #
       - modifiers: onlyOwner,whenPaused

 +  PetBase (PetAccessControl)
    - [Int] _transfer #
    - [Int] _createPet #
    - [Ext] setSecondsPerBlock #
       - modifiers: onlyOwner

 +  PetOwnership (PetBase, KRC721)
    - [Ext] supportsInterface
    - [Int] _owns
    - [Int] _approvedFor
    - [Int] _approve #
    - [Pub] balanceOf
    - [Ext] transfer #
       - modifiers: whenNotPaused
    - [Ext] approve #
       - modifiers: whenNotPaused
    - [Ext] transferFrom #
       - modifiers: whenNotPaused
    - [Pub] totalSupply
    - [Ext] ownerOf
    - [Ext] tokensOfOwner

 +  PetBreeding (PetOwnership)
    - [Ext] setGeneScienceAddress #
       - modifiers: onlyOwner
    - [Int] _isReadyToBreed
    - [Int] _isSiringPermitted
    - [Int] _triggerCooldown #
    - [Ext] approveSiring #
       - modifiers: whenNotPaused
    - [Ext] setAutoBirthFee #
       - modifiers: onlyOwner
    - [Prv] _isReadyToGiveBirth
    - [Pub] isReadyToBreed
    - [Pub] isPregnant
    - [Prv] _isValidMatingPair
    - [Int] _canBreedWithViaAuction
    - [Ext] canBreedWith
    - [Int] _breedWith #
    - [Ext] breedWithAuto ($)
       - modifiers: whenNotPaused
    - [Ext] giveBirth #
       - modifiers: whenNotPaused

 +  ClockAuctionBase 
    - [Int] _owns
    - [Int] _escrow #
    - [Int] _transfer #
    - [Int] _addAuction #
    - [Int] _cancelAuction #
    - [Int] _bid #
    - [Int] _removeAuction #
    - [Int] _isOnAuction
    - [Int] _currentPrice
    - [Int] _computeCurrentPrice
    - [Int] _computeCut

 +  Pausable (Ownable)
    - [Pub] pause #
       - modifiers: onlyOwner,whenNotPaused
    - [Pub] unpause #
       - modifiers: onlyOwner,whenPaused

 +  ClockAuction (Pausable, ClockAuctionBase)
    - [Pub]  #
    - [Ext] withdrawBalance #
       - modifiers: onlyOwner
    - [Ext] changeCut #
       - modifiers: onlyOwner
    - [Ext] getBalance
    - [Ext] createAuction #
       - modifiers: whenNotPaused
    - [Ext] bid ($)
       - modifiers: whenNotPaused
    - [Ext] cancelAuction #
    - [Ext] cancelAuctionWhenPaused #
       - modifiers: whenPaused,onlyOwner
    - [Ext] getAuction
    - [Ext] getCurrentPrice

 +  SiringClockAuction (ClockAuction)
    - [Pub]  #
       - modifiers: ClockAuction
    - [Ext] createAuction #
    - [Ext] bid ($)

 +  SaleClockAuction (ClockAuction)
    - [Pub]  #
       - modifiers: ClockAuction
    - [Ext] createAuction #
    - [Ext] bid ($)
    - [Ext] averageGen0SalePrice

 +  PetAuction (PetBreeding)
    - [Ext] setSaleAuctionAddress #
       - modifiers: onlyOwner
    - [Ext] setSiringAuctionAddress #
       - modifiers: onlyOwner
    - [Ext] createSaleAuction #
       - modifiers: whenNotPaused
    - [Ext] createSiringAuction #
       - modifiers: whenNotPaused
    - [Ext] bidOnSiringAuction ($)
       - modifiers: whenNotPaused

 +  PetMinting (PetAuction)
    - [Ext] createPromoPet #
    - [Ext] createGen0Auction #
    - [Int] _computeNextGen0Price

 +  PetCore (PetMinting)
    - [Pub]  #
    - [Ext]  ($)
    - [Ext] getPet
    - [Ext] getBalance
    - [Ext] withdrawBalance #
       - modifiers: onlyOwner

 +  GeneScience (IGeneScience)
    - [Int] _ascend
    - [Prv] _sliceNumber
    - [Int] _get5Bits
    - [Pub] decode
    - [Pub] encode
    - [Pub] expressingTraits
    - [Pub] mixGenes
							


Function Graph

Smart Contract Graph

Inheritence Chart

Smart Contract Inheritance

Functions Overview



 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public

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

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

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

 +  Pausable (Ownable)
    - [Pub] pause #
       - modifiers: onlyOwner,whenNotPaused
    - [Pub] unpause #
       - modifiers: onlyOwner,whenPaused

 +  BEP20 (Context, IBEP20, Pausable)
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
       - modifiers: whenNotPaused
    - [Pub] allowance
    - [Pub] approve #
       - modifiers: whenNotPaused
    - [Pub] transferFrom #
       - modifiers: whenNotPaused
    - [Pub] increaseAllowance #
       - modifiers: whenNotPaused
    - [Pub] decreaseAllowance #
       - modifiers: whenNotPaused
    - [Int] _transfer #
    - [Int] _mint #
    - [Int] _burn #
    - [Int] _approve #
    - [Int] _burnFrom #

 +  BEP20Detailed (IBEP20)
    - [Pub]  #
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals

 +  DPETToken (BEP20Detailed, BEP20)
    - [Pub]  #
       - modifiers: BEP20Detailed
    - [Pub] transfer #
    - [Pub] transferFrom #
    - [Pub] getBurnedAmountTotal
    - [Pub] burn #
    - [Ext]  ($)

							


Function Graph

Smart Contract Graph

Inheritence Chart

Smart Contract Inheritance

Functions Overview



 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public

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

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

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

 +  Pausable (Ownable)
    - [Pub] pause #
       - modifiers: onlyOwner,whenNotPaused
    - [Pub] unpause #
       - modifiers: onlyOwner,whenPaused

 +  KRC20 (Context, IKRC20, Pausable)
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
       - modifiers: whenNotPaused
    - [Pub] allowance
    - [Pub] approve #
       - modifiers: whenNotPaused
    - [Pub] transferFrom #
       - modifiers: whenNotPaused
    - [Pub] increaseAllowance #
       - modifiers: whenNotPaused
    - [Pub] decreaseAllowance #
       - modifiers: whenNotPaused
    - [Int] _transfer #
    - [Int] _mint #
    - [Int] _burn #
    - [Int] _approve #
    - [Int] _burnFrom #

 +  KRC20Detailed (IKRC20)
    - [Pub]  #
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals

 +  DPETToken (KRC20Detailed, KRC20)
    - [Pub]  #
       - modifiers: KRC20Detailed
    - [Pub] transfer #
    - [Pub] transferFrom #
    - [Pub] getBurnedAmountTotal
    - [Pub] burn #
    - [Ext]  ($)