Introduction
We thank PHPT for allowing us to conduct a Smart Contract Security Assessment. This document outlines our methodology, limitations, and results of the security assessment.
The Philippines Peso Token (PHPT) is a revolutionary stablecoin project with a singular mission: to simplify digital Philippine Peso transactions, empowering Filipinos globally to seamlessly engage in the world of cryptocurrencies.
title | content |
---|---|
Platform | EVM |
Language | Solidity |
Tags | ERC20, Exchange, Upgradable |
Timeline | 19/12/2023 - 12/01/2024 |
Methodology | https://hackenio.cc/sc_methodology→ |
Last Review Scope | |
---|---|
Repository | https://github.com/PHPT-COM/PHPToken/tree/476400faa7e15a2823cdf0ce569ad4052946104e→ |
Commit | 476400faa7e15a2823cdf0ce569ad4052946104e |
Last Review Scope
- Commit
- 476400faa7e15a2823cdf0ce569ad4052946104e
Last Review Scope | |
---|---|
Repository | https://github.com/PHPT-COM/PHPToken/tree/v2→ |
Commit | 7569bc818936dc89069e1076183fd29009540e8e |
Repository 2 | https://github.com/PHPT-COM/phpt-swap/tree/main→ |
Commit 2 | 49219ee3b0f497cf7602132ffeb6ffe96add9e28 |
Last Review Scope
- Commit
- 7569bc818936dc89069e1076183fd29009540e8e
- Repository 2
- https://github.com/PHPT-COM/phpt-swap/tree/main→
- Commit 2
- 49219ee3b0f497cf7602132ffeb6ffe96add9e28
Audit Summary
10/10
80%
10/10
10/10
The system users should acknowledge all the risks summed up in the risks section of the report
Document Information
This report may contain confidential information about IT systems and the intellectual property of the Customer, as well as information about potential vulnerabilities and methods of their exploitation.
The report can be disclosed publicly after prior consent by another Party. Any subsequent publication of this report shall be without mandatory consent.
Document | |
---|---|
Name | Smart Contract Code Review and Security Analysis Report for PHPT |
Audited By | Turgay Arda Usman, Kornel Światłowski |
Approved By | Przemyslaw Swiatowiec |
Website | https://phpt.com/→ |
Changelog | 12/01/2024 - Second Review |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for PHPT
- Audited By
- Turgay Arda Usman, Kornel Światłowski
- Approved By
- Przemyslaw Swiatowiec
- Website
- https://phpt.com/→
- Changelog
- 12/01/2024 - Second Review
System Overview
PHPT (Philippines Peso Token)is a stablecoin modeled after the proven stability of Tether (USDT) and crafted as a BEP-20 token on the Binance Smart Chain Network. It has the following contracts:
PHPT — an ERC-20 token with the blacklist functionality.
Blacklist — Blacklisting functionality.
ExchangeV4 — The contract that allows one to exchange PHTP and USDT.
Privileged roles
The owner of the contract can modify the exchange rates and ratios between USDT and PHPT.
The watcher can modify the exchange rates between USDT and PHPT.
The owner can pause or unpause the contracts.
The Blacklist admin can modify an account's blacklist status.
Executive Summary
Documentation quality
The total Documentation Quality score is 10 out of 10.
Functional requirements are provided .
Technical description is provided.
Code quality
The total Code Quality score is 10 out of 10.
The code follows best practices and style guides
The development environment is configured.
Test coverage
Code coverage of the project is 89.58% (branch coverage) for the swap repository and 0.0% (branch coverage) for the token repository.
Deployment and basic user interactions are covered with tests.
Negative test case coverage is missed.
Interactions by several users are not tested thoroughly.
The token repository lacks tests
Security score
Upon auditing, the code was found to contain 0 critical, 0 high, 2 medium, and 1 low severity issues, leading to a security score of 10 out of 10.
All identified issues are detailed in the “Findings” section of this report.
Summary
The comprehensive audit of the customer's smart contract yields an overall score of 9.3. This score reflects the combined evaluation of documentation, code quality, test coverage, and security aspects of the project.
Risks
The owner can withdraw USDT or PHPT from the Exchange.sol
contract at any time.
The USDT token has 6 decimals and the PHPT has 18 decimals. This decimal difference is being handled in the related ratio and coefficient owner-controlled state variables by converting them to Wei. However, it is a possibility that the contract owner can set wrong values which can cause decimal-related precision problems.
The relative price between USDT and PHPT is being controlled in a centralized manner by the owner.
Findings
Code ― | Title | Status | Severity | |
---|---|---|---|---|
F-2023-0251 | Owner can Frontrun the User Exchange Transaction | fixed | Medium | |
F-2023-0211 | Rates and Coefficients Setters Could be Frontrunned | fixed | Medium | |
F-2023-0203 | Missing Checks for Zero Address | fixed | Low | |
F-2024-0396 | Testing features | fixed | Observation | |
F-2023-0209 | Out-of-Gas Error Due to Excessive Loop Iterations | fixed | Observation | |
F-2023-0208 | Events Emitted Inside Loops | fixed | Observation | |
F-2023-0206 | Missing Events | fixed | Observation | |
F-2023-0201 | Redundant Imports | fixed | Observation | |
F-2023-0200 | Public Functions That Should Be External | fixed | Observation | |
F-2023-0199 | Floating Pragma | fixed | Observation |
Identify vulnerabilities in your smart contracts.
Appendix 1. Severity Definitions
When auditing smart contracts, Hacken is using a risk-based approach that considers Likelihood, Impact, Exploitability and Complexity metrics to evaluate findings and score severities.
Reference on how risk scoring is done is available through the repository in our Github organization:
Severity | Description |
---|---|
Critical | Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation. |
High | High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation. |
Medium | Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category. |
Low | Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score. |
Severity
- Critical
Description
- Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.
Severity
- High
Description
- High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.
Severity
- Medium
Description
- Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.
Severity
- Low
Description
- Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution, do not affect security score but can affect code quality score.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
---|---|
Repository | https://github.com/PHPT-COM/PHPToken/tree/476400faa7e15a2823cdf0ce569ad4052946104e→ |
Commit | 476400faa7e15a2823cdf0ce569ad4052946104e |
Repository | https://github.com/PHPT-COM/phpt-swap→ |
Commit | fa9d86b5f72a67ecad0b35914f1ccac06ade21607774ec061348ff22c7fdc761 |
Whitepaper | https://phpt.com/assets/PHPT%20Whitepaper-REWFlWEA.pdf→ |
Requirements | Not provided |
Technical Requirements | Not provided |
Scope Details
- Commit
- 476400faa7e15a2823cdf0ce569ad4052946104e
- Repository
- https://github.com/PHPT-COM/phpt-swap→
- Commit
- fa9d86b5f72a67ecad0b35914f1ccac06ade21607774ec061348ff22c7fdc761
- Requirements
- Not provided
- Technical Requirements
- Not provided
Contracts in Scope
contracts/PhptokenV2.sol
contracts/common/Blacklist.sol
phpt-swap-contracts-main/contracts/ExchangeV4.sol