Coinsult

Request your audit at coinsult.net

Advanced Manual
Smart Contract Audit

September 9, 2022

Audit requested by

Phuket Holiday Coin

0x92bf9DBBE6c787975f214c38E41011C384D96fC7

Phuket Holiday Coin / Security Audit

Table of Contents

1. Audit Summary

1.1 Audit scope

1.2 Tokenomics

1.3 Source Code

2. Disclaimer

3. Global Overview

3.1 Informational issues

3.2 Low-risk issues

3.3 Medium-risk issues

3.4 High-risk issues

4. Vulnerabilities Findings

5. Contract Privileges

5.1 Maximum Fee Limit Check

5.2 Contract Pausability Check

5.3 Max Transaction Amount Check

5.4 Exclude From Fees Check

5.5 Ability to Mint Check

5.6 Ability to Blacklist Check

5.7 Owner Privileges Check

6. Notes

6.1 Notes by Coinsult

6.2 Notes by Phuket Holiday Coin

7. Contract Snapshot

8. Website Review

9. Certificate of Proof

Phuket Holiday Coin / Security Audit

Audit Summary

Audit Scope

Project Name

Phuket Holiday Coin

Blockchain

Binance Smart Chain

Smart Contract Language

Solidity

Contract Address

0x92bf9DBBE6c787975f214c38E41011C384D96fC7

Audit Method

Static Analysis, Manual Review

Date of Audit

9 September 2022

This audit report has been prepared by Coinsult’s experts at the request of the client. In this audit, the results of the static analysis and the manual code review will be presented. The purpose of the audit is to see if the functions work as intended, and to identify potential security issues within the smart contract.

The information in this report should be used to understand the risks associated with the smart contract. This report can be used as a guide for the development team on how the contract could possibly be improved by remediating the issues that were identified.

Phuket Holiday Coin / Security Audit

Tokenomics

Rank Address Quantity (Token) Percentage
1 0x529fbdc45005464a6bac1d135e71674f0c881605 4,999,999,997.05202 100.0000%
2 PancakeSwap V2: PHCF-BUSD 1.466586 0.0000%
3 PancakeSwap V2: PHCF 1.46658 0.0000%
4  0x92bf9dbbe6c787975f214c38e41011c384d96fc7 0.0118512 0.0000%
5 Null Address: 0x000…dEaD 0.0029628 0.0000%

Source Code

Coinsult was comissioned by Phuket Holiday Coin to perform an audit based on the following code:
https://bscscan.com/address/0x92bf9DBBE6c787975f214c38E41011C384D96fC7#code

Phuket Holiday Coin / Security Audit

Disclaimer

This audit report has been prepared by Coinsult’s experts at the request of the client. In this audit, the results of the static analysis and the manual code review will be presented. The purpose of the audit is to see if the functions work as intended, and to identify potential security issues within the smart contract.

The information in this report should be used to understand the risks associated with the smart contract. This report can be used as a guide for the development team on how the contract could possibly be improved by remediating the issues that were identified.

Coinsult is not responsible if a project turns out to be a scam, rug-pull or honeypot. We only provide a detailed analysis for your own research.

Coinsult is not responsible for any financial losses. Nothing in this contract audit is financial advice, please do your own research.

The information provided in this audit is for informational purposes only and should not be considered investment advice. Coinsult does not endorse, recommend, support or suggest to invest in any project. 

Coinsult can not be held responsible for when a project turns out to be a rug-pull, honeypot or scam.

Phuket Holiday Coin / Security Audit

Global Overview

Manual Code Review

In this audit report we will highlight the following issues:

Vulnerability Level

Total

Pending

Acknowledged

Resolved

0

0

0

0

5

5

0

0

2

2

0

0

1

1

0

0

Privilege Overview

Coinsult checked the following privileges:

Contract Privilege

Description

Owner can mint?

Owner can blacklist?

Owner can set fees > 25%?

Owner can exclude from fees?

Owner can pause trading?

Owner can set Max TX amount?

More owner priviliges are listed later in the report.

Phuket Holiday Coin / Security Audit

Different Pragma Directives Are Used
				
					- Version used: ['0.6.12', '>=0.4.0', '>=0.5.0', '>=0.6.0=0.6.2', '>=0.6.4']
- >=0.6.0=0.6.0=0.6.4 (#101)
- >=0.6.0=0.4.0 (#360)
- >=0.6.2 (#658)
- >=0.6.2 (#756)
- >=0.5.0 (#802)
- >=0.5.0 (#857)
- 0.6.12 (#877)
				
			

Recommendation

Use one Solidity version.

Phuket Holiday Coin / Security Audit

Avoid relying on block.timestamp

block.timestamp can be manipulated by miners.

				
					        require(now <= expiry, "PHCF::delegateBySig: signature expired");
				
			

Recommendation

Do not use block.timestampnow or blockhash as a source of randomness

Exploit scenario

				
					contract Game {

    uint reward_determining_number;

    function guessing() external{
      reward_determining_number = uint256(block.blockhash(10000)) % 10;
    }
}
				
			

Eve is a miner. Eve calls guessing and re-orders the block containing the transaction. As a result, Eve wins the game.

Phuket Holiday Coin / Security Audit

Too many digits

Literals with many digits are difficult to read and review.

				
					    uint256 public maxSupply = 10000000000 ether;
				
			

Recommendation

Exploit scenario

				
					contract MyContract{
    uint 1_ether = 10000000000000000000; 
}
				
			

While 1_ether looks like 1 ether, it is 10 ether. As a result, it’s likely to be used incorrectly.

Phuket Holiday Coin / Security Audit

Divide before multiply

Solidity integer division might truncate. As a result, performing multiplication before division can sometimes avoid loss of precision.

				
					            uint256 taxAmount = amount.mul(transferTaxRate).div(10000);
            uint256 burnAmount = taxAmount.mul(burnRate).div(100);
				
			

Recommendation

Consider ordering multiplication before division.

Exploit scenario

				
					contract A {
	function f(uint n) public {
        coins = (oldSupply / n) * interest;
    }
}
				
			

If n is greater than oldSupplycoins will be zero. For example, with oldSupply = 5; n = 10, interest = 2, coins will be zero. If (oldSupply * interest / n) was used, coins would have been 1. In general, it’s usually a good idea to re-arrange arithmetic to perform multiplication before division, unless the limit of a smaller type makes this dangerous.

Phuket Holiday Coin / Security Audit

Boolean equality

Detects the comparison to boolean constants.

				
					            swapAndLiquifyEnabled == true
            && _inSwapAndLiquify == false
				
			

Recommendation

Remove the equality to the boolean constant.

Exploit scenario

				
					contract A {
	function f(bool x) public {
		// ...
        if (x == true) { // bad!
           // ...
        }
		// ...
	}
}
				
			

Boolean constants can be used directly and do not need to be compare to true or false.

Owner can mint new tokens

				
					    /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
    function mint(address _to, uint256 _amount) public onlyMinter returns(bool) {
        uint256 totalSupplyAfterMint = totalSupply().add(_amount);
        require(totalSupplyAfterMint < maxSupply, "PHCF::can't mint over max supply");
        _mint(_to, _amount);
        _moveDelegates(address(0), _delegates[_to], _amount);
        return true;
    }
				
			

Recommendation

maxSupply is a variable which can be changed by the operator.
Duplicate mint functions
				
					    function mint(uint256 amount) public onlyOwner returns (bool) {
        _mint(_msgSender(), amount);
        return true;
    }

    /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
    function mint(address _to, uint256 _amount) public onlyMinter returns(bool) {
        uint256 totalSupplyAfterMint = totalSupply().add(_amount);
        require(totalSupplyAfterMint < maxSupply, "PHCF::can't mint over max supply");
        _mint(_to, _amount);
        _moveDelegates(address(0), _delegates[_to], _amount);
        return true;
    }
				
			

Recommendation

Remove the first mint function, it takes up space in the contract.
Tautology in the update max transfer amount function
				
					    function updateMaxTransferAmountRate(uint16 _maxTransferAmountRate) public onlyOperator {
        require(_maxTransferAmountRate <= 10000000, "PHCF::updateMaxTransferAmountRate: Max transfer amount rate must not exceed the maximum rate.");
        emit MaxTransferAmountRateUpdated(msg.sender, maxTransferAmountRate, _maxTransferAmountRate);
        maxTransferAmountRate = _maxTransferAmountRate;
    }

				
			

Recommendation

The UInt16 value type represents unsigned integers with values ranging from 0 to 65535. So the require statement will always be true.

Phuket Holiday Coin / Security Audit

Contract Privileges

Maximum Fee Limit Check

Coinsult tests if the owner of the smart contract can set the transfer, buy or sell fee to 25% or more. It is bad practice to set the fees to 25% or more, because owners can prevent healthy trading or even stop trading when the fees are set too high. 

Type of fee

Description

Transfer fee

Buy fee

Sell fee

Type of fee

Description

Max transfer fee

Max buy fee

Max sell fee

Phuket Holiday Coin / Security Audit

Contract Pausability Check

Coinsult tests if the owner of the smart contract has the ability to pause the contract. If this is the case, users can no longer interact with the smart contract; users can no longer trade the token.

Privilege Check

Description

Can owner pause the contract?

Phuket Holiday Coin / Security Audit

Max Transaction Amount Check

Coinsult tests if the owner of the smart contract can set the maximum amount of a transaction. If the transaction exceeds this limit, the transaction will revert. Owners could prevent normal transactions to take place if they abuse this function.

Privilege Check

Description

Can owner set max tx amount?

Phuket Holiday Coin / Security Audit

Exclude From Fees Check

Coinsult tests if the owner of the smart contract can exclude addresses from paying tax fees. If the owner of the smart contract can exclude from fees, they could set high tax fees and exclude themselves from fees and benefit from 0% trading fees. However, some smart contracts require this function to exclude routers, dex, cex or other contracts / wallets from fees.

Privilege Check

Description

Can owner exclude from fees?

Phuket Holiday Coin / Security Audit

Ability To Mint Check

Coinsult tests if the owner of the smart contract can mint new tokens. If the contract contains a mint function, we refer to the token’s total supply as non-fixed, allowing the token owner to “mint” more tokens whenever they want.

A mint function in the smart contract allows minting tokens at a later stage. A method to disable minting can also be added to stop the minting process irreversibly.

Minting tokens is done by sending a transaction that creates new tokens inside of the token smart contract. With the help of the smart contract function, an unlimited number of tokens can be created without spending additional energy or money.

Privilege Check

Description

Can owner mint?

Phuket Holiday Coin / Security Audit

Ability To Blacklist Check

Coinsult tests if the owner of the smart contract can blacklist accounts from interacting with the smart contract. Blacklisting methods allow the contract owner to enter wallet addresses which are not allowed to interact with the smart contract. 

This method can be abused by token owners to prevent certain / all holders from trading the token. However, blacklists might be good for tokens that want to rule out certain addresses from interacting with a smart contract.

Privilege Check

Description

Can owner blacklist?

Phuket Holiday Coin / Security Audit

Other Owner Privileges Check

Coinsult lists all important contract methods which the owner can interact with.

⚠ Owner can update max supply (infinite mint)

⚠ Owner can change the PCS router

⚠ Owner can exclude from anti-whale

⚠ Owner can add minter addresses

⚠ Contract contains delegateBySig

Phuket Holiday Coin / Security Audit

Notes

Notes by Phuket Holiday Coin

No notes provided by the team.

Notes by Coinsult

✅ No notes provided by Coinsult

Phuket Holiday Coin / Security Audit

Contract Snapshot

This is how the constructor of the contract looked at the time of auditing the smart contract.

				
					contract PhcfToken is BEP20 {
    // Transfer tax rate in basis points. (default 1%)
    uint16 public transferTaxRate = 100;

    // Burn rate % of transfer tax. (default 20% x 1% = 0.2% of total amount).
    uint16 public burnRate = 20;
    // Max transfer tax rate: 10%.
    uint16 public constant MAXIMUM_TRANSFER_TAX_RATE = 1000;
    // Burn address
    address public constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;

    // Max transfer amount rate in basis points. (default is 0.1% of total supply)
    uint16 public maxTransferAmountRate = 10000;
    // Addresses that excluded from antiWhale
    mapping(address => bool) private _excludedFromAntiWhale;
    // Automatic swap and liquify enabled
    bool public swapAndLiquifyEnabled = false;    
    // Min amount to liquify. (default 500 PHCFs)
    uint256 public minAmountToLiquify = 500 ether;
    // The swap router, modifiable. Will be changed to PHC Finance's router when our own AMM release
    IUniswapV2Router02 public phcfRouter;
    // The trading pair
    address public phcfPair;
    // In swap and liquify
    bool private _inSwapAndLiquify;
    // max supply
    uint256 public maxSupply = 10000000000 ether;
    

    // The operator can only update the transfer tax rate
    address private _operator;

    EnumerableSet.AddressSet private _minters;
    EnumerableSet.AddressSet private _blockAddrs;

    // Events
    event OperatorTransferred(address indexed previousOperator, address indexed newOperator);
    event TransferTaxRateUpdated(address indexed operator, uint256 previousRate, uint256 newRate);
    event BurnRateUpdated(address indexed operator, uint256 previousRate, uint256 newRate);
    event MaxTransferAmountRateUpdated(address indexed operator, uint256 previousRate, uint256 newRate);
    event SwapAndLiquifyEnabledUpdated(address indexed operator, bool enabled);
    event MinAmountToLiquifyUpdated(address indexed operator, uint256 previousAmount, uint256 newAmount);
    event PHCFinanceRouterUpdated(address indexed operator, address indexed router, address indexed pair);
    event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity);
    event MaxSupplyUpdated(uint256 maxSupply);
    

    modifier onlyOperator() {
        require(_operator == msg.sender, "operator: caller is not the operator");
        _;
    }
				
			

Phuket Holiday Coin / Security Audit

Website Review

Coinsult checks the website completely manually and looks for visual, technical and textual errors. We also look at the security, speed and accessibility of the website. In short, a complete check to see if the website meets the current standard of the web development industry. 

Type of check

Description

Mobile friendly?

Contains jQuery errors?

Is SSL secured?

Contains spelling errors?

Phuket Holiday Coin / Security Audit

Certificate of Proof

Phuket Holiday Coin

Audited by Coinsult.net

Date: 9 September 2022

Coinsult

coinsult.net

End of report
Smart Contract Audit

Request your smart contract audit / KYC

t.me/coinsult_tg