Pragma

Smart Contract Audit Report

Audit Summary

Pragma Audit Report Pragma is a new ERC-20 token with an elastic supply that performs automatic liquidity adds.

For this audit, we reviewed the Pragma contract provided to us by the project team.

Audit Findings

Please ensure trust in the team prior to investing as they have substantial control in the ecosystem.
Date: March 29th, 2022.
Updated: April 3rd, 2022 to support changes made by the project team.

Finding #1 - Pragma - Informational (Resolved)

Description: Several state variables can never be modified, but are not declared constant.
gonSwapThreshold, targetLiquidity, targetLiquidityDenominator, totalFee
Recommendation: These state variables should be declared constant for additional gas savings on each call.
Resolution: The team has declared the above state variables constant.

Finding #2 - Pragma - Informational (Resolved)

Description: The updateBlacklist function is declared public, but is never called internally.
Recommendation: This function should be declared external for additional gas savings on each call.
Resolution: The team has declared the above function external.

Contract Overview

  • The initial supply of the token is set to 4.6 billion [4,600,000,000] $PRAGMA.
  • The maximum allowed supply of $PRAGMA is 340,282,366,920,938,463,463,374,607,431,768,211,455 tokens.
  • No mint or burn functions are present, though the circulating supply can be reduced by sending tokens to the 0x..dead address.
  • There was no token allocation for our team to analyze as the contract has yet to be deployed to the mainnet.

  • The initial distribution period of the contract must be manually disabled by the owner in order for all trading to take place on the platform. Only users that are excluded can transfer tokens while the initial distribution period is enabled.
  • There is a Liquidity fee, Treasury fee, and RFV fee on all transfers via SpookySwap where neither the sender nor the recipient is excluded from fees.
  • There is an additional Sell fee added on all sell transactions via SpookySwap.
  • Blacklisted users are not permitted to transfer tokens.
  • The contract features an auto-rebase mechanism that is triggered on token transfers when the following conditions are met:
    • The auto-rebase mechanism is enabled by the team.
    • The token has not reached the maximum supply.
    • The caller is not initiating a buy transaction via SpookySwap.
    • The contract is not currently swapping tokens, performing a rebase, or performing an automatic liquidity add.
    • 15 minutes have passed since this functionality has previously occurred.
    • The initial distribution period has been disabled by the team.
  • During a rebase, tokens are automatically added to the total supply. The newly added tokens are distributed proportionally amongst holders in a frictionless manner.
  • The number of tokens added to the total supply is dependent on the total supply at the time of rebasing and the rebase rate (determined by the owner).
  • The rebase function properly calls sync() on the SpookySwap Pair contract to prevent theft-of-liquidity attacks that have occurred with other rebase tokens.
  • An automatic liquidity add will also occur on token transfers if the threshold number of tokens in the contract address has been reached.
  • If the liquidity during a liquidity-add is greater than the target value, no liquidity will be added. Otherwise, the Liquidity fee is used for a liquidity-add.
  • A liquidity-add is funded by selling half of the tokens collected as liquidity fees, pairing the received FTM with the token, and adding it as liquidity to the FTM pair.
  • The LP tokens received through this process are sent to the Liquidity wallet controlled by the team. We recommend that the team lock these newly acquired LP tokens.
  • The tokens collected through the Treasury fee and RFV Fee are swapped for FTM and sent to the team's Treasury wallet and RFV respectively.
  • The contract utilizes the SafeMath library to prevent any overflows/underflows.

  • The owner can enable the auto-rebase mechanism at any time. Once enabled, it can never be disabled.
  • The owner can decrease the rebase rate at any time.
  • The owner can add/remove any address from the transfer blacklist at any time.
  • The owner can include/exclude accounts from transfer fees at any time.
  • The contract utilizes a Discounter role. The assigned addresses can specify accounts that will receive a fee discount on sell transactions for a specified period of time.
  • The owner can add/remove addresses from the Discounter role at any time.

Audit Results

Vulnerability CategoryNotesResult
Arbitrary Jump/Storage WriteN/APASS
Centralization of Control
  • The LP tokens generated through automatic liquidity adds are sent to the team's Liquidity wallet.
  • The owner can blacklist accounts from token transfers.
WARNING
Compiler IssuesN/APASS
Delegate Call to Untrusted ContractN/APASS
Dependence on Predictable VariablesN/APASS
Ether/Token TheftN/APASS
Flash LoansN/APASS
Front RunningN/APASS
Improper EventsN/APASS
Improper Authorization SchemeN/APASS
Integer Over/UnderflowN/APASS
Logical IssuesN/APASS
Oracle IssuesN/APASS
Outdated Compiler VersionN/APASS
Race ConditionsN/APASS
ReentrancyN/APASS
Signature IssuesN/APASS
Unbounded LoopsN/APASS
Unused CodeN/APASS
Overall Contract Safety PASS

Inheritance Chart

Smart Contract Audit - Inheritance

Function Graph

Smart Contract Audit - Graph

Functions Overview


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

 + [Lib] Roles 
    - [Int] add #
    - [Int] remove #
    - [Int] has

 + [Lib] SafeMath 
    - [Int] add
    - [Int] sub
    - [Int] sub
    - [Int] mul
    - [Int] div
    - [Int] div
    - [Int] mod

 +  DiscounterRole 
    - [Pub]  #
    - [Pub] isDiscounter
    - [Pub] renounceDiscounter #
    - [Int] _addDiscounter #
    - [Int] _removeDiscounter #

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

 + [Int] ILiquidityProvider 
    - [Ext] sync #

 + [Int] IDEXRouter 
    - [Ext] factory #
    - [Ext] WETH #
    - [Ext] addLiquidity #
    - [Ext] addLiquidityETH ($)
    - [Ext] swapExactTokensForTokensSupportingFeeOnTransferTokens #
    - [Ext] swapExactETHForTokensSupportingFeeOnTransferTokens ($)
    - [Ext] swapExactTokensForETHSupportingFeeOnTransferTokens #

 + [Int] IDEXFactory 
    - [Ext] createPair #

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

 +  ERC20Detailed (IERC20)
    - [Pub]  #
    - [Pub] name
    - [Pub] symbol
    - [Pub] decimals

 +  Pragma (ERC20Detailed, Ownable, DiscounterRole)
    - [Pub]  #
       - modifiers: ERC20Detailed
    - [Pub] updateBlacklist #
       - modifiers: onlyOwner
    - [Int] rebase #
    - [Ext] totalSupply
    - [Ext] transfer #
       - modifiers: allowTreasuryWallet,validRecipient,initialDistributionLock
    - [Ext] allowance
    - [Ext] balanceOf
    - [Int] _basicTransfer #
    - [Int] _transferFrom #
    - [Ext] transferFrom #
       - modifiers: validRecipient
    - [Int] swapBack #
       - modifiers: swapping
    - [Int] takeFee #
    - [Ext] decreaseAllowance #
       - modifiers: initialDistributionLock
    - [Ext] increaseAllowance #
       - modifiers: initialDistributionLock
    - [Ext] approve #
       - modifiers: initialDistributionLock
    - [Ext] checkFeeExempt
    - [Ext] setInitialDistributionFinished #
       - modifiers: onlyOwner
    - [Ext] startRebases #
       - modifiers: onlyOwner
    - [Ext] enableTransfer #
       - modifiers: onlyOwner
    - [Ext] setFeeExempt #
       - modifiers: onlyOwner
    - [Ext] decreaseRebaseRate #
       - modifiers: onlyOwner
    - [Ext] addDiscounter #
       - modifiers: onlyOwner
    - [Ext] removeDiscounter #
       - modifiers: onlyOwner
    - [Ext] setDiscount #
       - modifiers: onlyDiscounter
    - [Int] shouldTakeFee
    - [Int] shouldRebase
    - [Int] shouldSwapBack
    - [Pub] getCirculatingSupply
    - [Ext] checkSwapThreshold
    - [Ext] manualSync #
    - [Pub] getLiquidityBacking
    - [Pub] isOverLiquified
    - [Ext]  ($)

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.