Fortecoin

Smart Contract Audit Report

Audit Summary

Fortecoin is building a new ERC-20 token.

For this audit, we reviewed the project team's Stablecoin contract at 0xc9357d8fb84dd3041612dc5b2a2cd914d9405572 and Wallet contract at 0xb1eb5a86ed8c43afeb58e989fe66da2a1c3478dd on the Ethereum Mainnet.

Audit Findings

All findings have been resolved, though some centralized aspects are present.
Date: September 29th, 2023.
Updated: October 3rd, 2023 to reflect the contract's newly deployed Testnet addresses that resolve Finding #1 and to remove the Minter contract from the scope of the audit.
Updated: October 10th, 2023 to reflect the contract's newly deployed mainnet addresses.
Updated: December 18th, 2023 to reflect updates made to the contracts by the project team on their GitHub repository.
Updated: January 23rd, 2024 to reflect the project's newly deployed mainnet addresses.

Finding #1 - Stablecoin - High (Resolved)

Description: Any address granted the Minter role can use the burn() function to burn any account's tokens without an approval.
function burn(address _account, uint256 _amount) public onlyRole(MINTER_ROLE) {
   _burn(_account, _amount);
}
Risk/Impact: The team can burn any user's tokens at any time.
Recommendation: The team should modify the burn() function to enforce that Minter addresses can only burn tokens that they have an approval for.
Resolution: The team has implemented the above recommendation.

Contracts Overview

Stablecoin Contract:
  • The total supply of the token is set to zero upon initialization.
  • The team will specify an Admin address that is granted the Mint role, Burn role, Pause role, and Blacklist role upon initialization.
  • Any address granted the Mint role can mint any number of tokens to any address at any time.
  • Any address granted the Burn role can burn their own tokens to reduce the total supply at any time.
  • Any address granted the Burn role can burn tokens on behalf of any address up to their granted allowance at any time.
  • Any address granted the Pause role can pause/unpause the contract at any time which disables all transfers, mints, and burns from being able to occur.
  • Any address granted the Blacklist role can add/remove any address from the contract's blacklist at any time. Blacklisted accounts are prohibited from participating in transfers.
  • The contract implements the EIP-2612 standard to support permits which allows for approvals to be made via signatures.
  • As the contract is implemented with Solidity v0.8.x, it is protected from overflows/underflows.
  • The contract complies with the ERC-20 token standard.
Wallet Contract:
  • The team will specify the token address used in the contract and an Admin address that is granted each of the contract's specified roles upon initialization.
  • Any address granted the Beneficiary role can specify an address to add as a beneficiary at any time. The beneficiary is assigned a 24-hour transfer limit and a cool-down time before they are enabled to transfer.
  • Any address granted the Beneficiary role can specify an address to remove as a beneficiary at any time.
  • Any address granted the Beneficiary-Limit role can modify the 24-hour transfer limit for a specified beneficiary address at any time.
  • Any address granted the Limit role can set the contract's 24-hour transfer limit to any value at any time.
  • Any address granted the Beneficiary-Limit role can temporarily increase or decrease the 24-hour transfer limit for a specified beneficiary address at any time.
  • Any address granted the Limit role can temporarily increase or decrease the contract's 24-hour transfer limit to any value at any time.
  • Any address granted the Transfer role can specify a number of tokens to transfer from the contract to a beneficiary address.
  • Any address granted the Default Admin role can withdraw any tokens from the contract at any time.
  • Any address granted the Mint role can mint any number of tokens to their own address in the token contract at any time.
  • Any address granted the Burn role can burn any number of tokens from their own address in the token contract at any time.

Audit Results

Vulnerability Category Notes Result
Arbitrary Jump/Storage Write N/A PASS
Centralization of Control
  • Any address granted the Mint role can mint any number of tokens to any address at any time in the Stablecoin contract.
  • The Blacklist role can add any address to the transfer blacklist at any time in the Stablecoin contract.
  • The team can upgrade the contracts at any time.
WARNING
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

Stablecoin Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 +  Initializable 
    - [Int] _checkInitializing
    - [Int] _disableInitializers #
    - [Int] _getInitializedVersion
    - [Int] _isInitializing
    - [Prv] _getInitializableStorage

 +  ContextUpgradeable (Initializable)
    - [Int] __Context_init #
       - modifiers: onlyInitializing
    - [Int] __Context_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _msgSender
    - [Int] _msgData
    - [Int] _contextSuffixLength

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

 + [Int] IERC20Metadata (IERC20)
    - [Ext] name
    - [Ext] symbol
    - [Ext] decimals

 + [Int] IERC20Errors 

 + [Int] IERC721Errors 

 + [Int] IERC1155Errors 

 +  ERC20Upgradeable (Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors)
    - [Prv] _getERC20Storage
    - [Int] __ERC20_init #
       - modifiers: onlyInitializing
    - [Int] __ERC20_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals
    - [Pub] totalSupply
    - [Pub] balanceOf
    - [Pub] transfer #
    - [Pub] allowance
    - [Pub] approve #
    - [Pub] transferFrom #
    - [Int] _transfer #
    - [Int] _update #
    - [Int] _mint #
    - [Int] _burn #
    - [Int] _approve #
    - [Int] _approve #
    - [Int] _spendAllowance #

 +  PausableUpgradeable (Initializable, ContextUpgradeable)
    - [Prv] _getPausableStorage
    - [Int] __Pausable_init #
       - modifiers: onlyInitializing
    - [Int] __Pausable_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] paused
    - [Int] _requireNotPaused
    - [Int] _requirePaused
    - [Int] _pause #
       - modifiers: whenNotPaused
    - [Int] _unpause #
       - modifiers: whenPaused

 +  ERC20PausableUpgradeable (Initializable, ERC20Upgradeable, PausableUpgradeable)
    - [Int] __ERC20Pausable_init #
       - modifiers: onlyInitializing
    - [Int] __ERC20Pausable_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _update #
       - modifiers: whenNotPaused

 + [Int] IERC20Permit 
    - [Ext] permit #
    - [Ext] nonces
    - [Ext] DOMAIN_SEPARATOR

 + [Lib] ECDSA 
    - [Int] tryRecover
    - [Int] recover
    - [Int] tryRecover
    - [Int] recover
    - [Int] tryRecover
    - [Int] recover
    - [Prv] _throwError

 + [Lib] Math 
    - [Int] tryAdd
    - [Int] trySub
    - [Int] tryMul
    - [Int] tryDiv
    - [Int] tryMod
    - [Int] max
    - [Int] min
    - [Int] average
    - [Int] ceilDiv
    - [Int] mulDiv
    - [Int] mulDiv
    - [Int] sqrt
    - [Int] sqrt
    - [Int] log2
    - [Int] log2
    - [Int] log10
    - [Int] log10
    - [Int] log256
    - [Int] log256
    - [Int] unsignedRoundsUp

 + [Lib] SignedMath 
    - [Int] max
    - [Int] min
    - [Int] average
    - [Int] abs

 + [Lib] Strings 
    - [Int] toString
    - [Int] toStringSigned
    - [Int] toHexString
    - [Int] toHexString
    - [Int] toHexString
    - [Int] equal

 + [Lib] MessageHashUtils 
    - [Int] toEthSignedMessageHash
    - [Int] toEthSignedMessageHash
    - [Int] toDataWithIntendedValidatorHash
    - [Int] toTypedDataHash

 + [Int] IERC5267 
    - [Ext] eip712Domain

 +  EIP712Upgradeable (Initializable, IERC5267)
    - [Prv] _getEIP712Storage
    - [Int] __EIP712_init #
       - modifiers: onlyInitializing
    - [Int] __EIP712_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _domainSeparatorV4
    - [Prv] _buildDomainSeparator
    - [Int] _hashTypedDataV4
    - [Pub] eip712Domain
    - [Int] _EIP712Name
    - [Int] _EIP712Version
    - [Int] _EIP712NameHash
    - [Int] _EIP712VersionHash

 +  NoncesUpgradeable (Initializable)
    - [Prv] _getNoncesStorage
    - [Int] __Nonces_init #
       - modifiers: onlyInitializing
    - [Int] __Nonces_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] nonces
    - [Int] _useNonce #
    - [Int] _useCheckedNonce #

 +  ERC20PermitUpgradeable (Initializable, ERC20Upgradeable, IERC20Permit, EIP712Upgradeable, NoncesUpgradeable)
    - [Int] __ERC20Permit_init #
       - modifiers: onlyInitializing
    - [Int] __ERC20Permit_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] permit #
    - [Pub] nonces
    - [Ext] DOMAIN_SEPARATOR

 +  BlacklistableUpgradable (Initializable, ContextUpgradeable)
    - [Prv] _getBlacklistableUpgradableStorage
    - [Int] __Blacklistable_init #
       - modifiers: onlyInitializing
    - [Int] __Blacklistable_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] isBlacklisted
    - [Int] _blacklist #
    - [Int] _unBlacklist #

 +  ERC20BlacklistableUpgradable (Initializable, ERC20Upgradeable, BlacklistableUpgradable)
    - [Int] __ERC20Blacklistable_init #
       - modifiers: onlyInitializing
    - [Int] __ERC20Blacklistable_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _update #
       - modifiers: notBlacklisted,notBlacklisted

 + [Int] IAccessControl 
    - [Ext] hasRole
    - [Ext] getRoleAdmin
    - [Ext] grantRole #
    - [Ext] revokeRole #
    - [Ext] renounceRole #

 + [Int] IERC165 
    - [Ext] supportsInterface

 +  ERC165Upgradeable (Initializable, IERC165)
    - [Int] __ERC165_init #
       - modifiers: onlyInitializing
    - [Int] __ERC165_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] supportsInterface

 +  AccessControlUpgradeable (Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable)
    - [Prv] _getAccessControlStorage
    - [Int] __AccessControl_init #
       - modifiers: onlyInitializing
    - [Int] __AccessControl_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] supportsInterface
    - [Pub] hasRole
    - [Int] _checkRole
    - [Int] _checkRole
    - [Pub] getRoleAdmin
    - [Pub] grantRole #
       - modifiers: onlyRole
    - [Pub] revokeRole #
       - modifiers: onlyRole
    - [Pub] renounceRole #
    - [Int] _setRoleAdmin #
    - [Int] _grantRole #
    - [Int] _revokeRole #

 +  ExtendedAccessControlUpgradeable (AccessControlUpgradeable)
    - [Prv] _getExtendedAccessControlUpgradeableStorage
    - [Int] __ExtendedAccessControl_init #
       - modifiers: initializer
    - [Int] __ExtendedAccessControl_init_unchained #
       - modifiers: initializer
    - [Pub] roles
    - [Int] _addRole #
    - [Int] _grantRoles #
    - [Pub] grantRoles #
       - modifiers: onlyRole
    - [Pub] revokeRoles #
       - modifiers: onlyRole
    - [Pub] transferRoles #
       - modifiers: onlyRole
    - [Pub] transferRoles #
       - modifiers: onlyRole

 +  Stablecoin (Initializable, ContextUpgradeable, ERC20Upgradeable, ERC20PausableUpgradeable, ExtendedAccessControlUpgradeable, ERC20PermitUpgradeable, ERC20BlacklistableUpgradable)
    - [Pub]  #
    - [Pub] initialize #
       - modifiers: initializer
    - [Pub] decimals
    - [Pub] pause #
       - modifiers: onlyRole
    - [Pub] unpause #
       - modifiers: onlyRole
    - [Pub] blacklist #
       - modifiers: onlyRole
    - [Pub] unBlacklist #
       - modifiers: onlyRole
    - [Pub] mint #
       - modifiers: onlyRole
    - [Pub] mint #
       - modifiers: onlyRole
    - [Pub] burn #
       - modifiers: onlyRole
    - [Pub] burn #
       - modifiers: onlyRole
    - [Int] _update #

Wallet Contract

Smart Contract Audit - Inheritance

Smart Contract Audit - Graph


 ($) = payable function
 # = non-constant function
 
 Int = Internal
 Ext = External
 Pub = Public
 
 +  Initializable 
    - [Int] _checkInitializing
    - [Int] _disableInitializers #
    - [Int] _getInitializedVersion
    - [Int] _isInitializing
    - [Prv] _getInitializableStorage

 +  ContextUpgradeable (Initializable)
    - [Int] __Context_init #
       - modifiers: onlyInitializing
    - [Int] __Context_init_unchained #
       - modifiers: onlyInitializing
    - [Int] _msgSender
    - [Int] _msgData
    - [Int] _contextSuffixLength

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

 + [Lib] LinkedListLibrary 
    - [Int] generate #
    - [Int] length
    - [Int] first
    - [Int] next
    - [Int] remove #

 + [Lib] LimiterLibrary 
    - [Int] transfers
    - [Int] temporarilyIncreaseLimit #
    - [Int] temporarilyDecreaseLimit #
    - [Int] remainingLimit
    - [Int] usedLimit
    - [Prv] _filterTransfers #
    - [Prv] _addTransferNode #
    - [Prv] _addUncheckedTransfer #
    - [Int] addTransfer #

 + [Lib] InternalBeneficiaryLibrary 
    - [Int] convert

 + [Lib] BeneficiariesLibrary 
    - [Int] addBeneficiary #
    - [Int] setBeneficiaryLimit #
    - [Int] temporarilyIncreaseBeneficiaryLimit #
    - [Int] temporarilyDecreaseBeneficiaryLimit #
    - [Int] addBeneficiaryTransfer #
    - [Prv] _getBeneficiaryKey
    - [Prv] _getBeneficiary
    - [Int] getBeneficiary
    - [Int] removeBeneficiary #
    - [Int] getBeneficiaries

 + [Int] IAccessControl 
    - [Ext] hasRole
    - [Ext] getRoleAdmin
    - [Ext] grantRole #
    - [Ext] revokeRole #
    - [Ext] renounceRole #

 + [Int] IERC165 
    - [Ext] supportsInterface

 +  ERC165Upgradeable (Initializable, IERC165)
    - [Int] __ERC165_init #
       - modifiers: onlyInitializing
    - [Int] __ERC165_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] supportsInterface

 +  AccessControlUpgradeable (Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable)
    - [Prv] _getAccessControlStorage
    - [Int] __AccessControl_init #
       - modifiers: onlyInitializing
    - [Int] __AccessControl_init_unchained #
       - modifiers: onlyInitializing
    - [Pub] supportsInterface
    - [Pub] hasRole
    - [Int] _checkRole
    - [Int] _checkRole
    - [Pub] getRoleAdmin
    - [Pub] grantRole #
       - modifiers: onlyRole
    - [Pub] revokeRole #
       - modifiers: onlyRole
    - [Pub] renounceRole #
    - [Int] _setRoleAdmin #
    - [Int] _grantRole #
    - [Int] _revokeRole #

 +  ExtendedAccessControlUpgradeable (AccessControlUpgradeable)
    - [Prv] _getExtendedAccessControlUpgradeableStorage
    - [Int] __ExtendedAccessControl_init #
       - modifiers: initializer
    - [Int] __ExtendedAccessControl_init_unchained #
       - modifiers: initializer
    - [Pub] roles
    - [Int] _addRole #
    - [Int] _grantRoles #
    - [Pub] grantRoles #
       - modifiers: onlyRole
    - [Pub] revokeRoles #
       - modifiers: onlyRole
    - [Pub] transferRoles #
       - modifiers: onlyRole
    - [Pub] transferRoles #
       - modifiers: onlyRole

 + [Int] IToken (IERC20)
    - [Ext] mint #
    - [Ext] burn #

 +  Wallet (ExtendedAccessControlUpgradeable)
    - [Pub]  #
    - [Pub] initialize #
       - modifiers: initializer
    - [Pub] addBeneficiary #
       - modifiers: onlyRole
    - [Pub] addBeneficiary #
       - modifiers: onlyRole
    - [Pub] addBeneficiary #
       - modifiers: onlyRole
    - [Pub] getBeneficiaries
    - [Pub] getBeneficiary
    - [Pub] getBeneficiaryEnabledAt
    - [Pub] getBeneficiaryLimit
    - [Pub] getBeneficiaryRemainingLimit
    - [Pub] getBeneficiaryTransfers
    - [Pub] getLimit
    - [Pub] getRemainingLimit
    - [Pub] getTransfers
    - [Pub] removeBeneficiary #
       - modifiers: onlyRole
    - [Pub] setBeneficiaryLimit #
       - modifiers: onlyRole
    - [Pub] setLimit #
       - modifiers: onlyRole
    - [Pub] temporarilyIncreaseBeneficiaryLimit #
       - modifiers: onlyRole
    - [Pub] temporarilyDecreaseBeneficiaryLimit #
       - modifiers: onlyRole
    - [Pub] temporarilyIncreaseLimit #
       - modifiers: onlyRole
    - [Pub] temporarilyDecreaseLimit #
       - modifiers: onlyRole
    - [Pub] transfer #
       - modifiers: onlyRole
    - [Pub] transfer #
       - modifiers: onlyRole
    - [Pub] mint #
       - modifiers: onlyRole
    - [Pub] burn #
       - modifiers: onlyRole

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.