Centric Swap Smart Contract Audit

# 1. Introduction
iosiro was commissioned by the Centric Foundation to conduct a smart contract audit on the Centric Swap (previously Centric Cash) smart contract. The audit was performed on 16 April 2020.  

#### Update
A review was performed on 26 May 2021 of changes made to the contracts to allow for deployment on Binance Smart Chain (BSC).

This report is organized into the following sections.

* **[Section 2 - Executive Summary:](#section-2)** A high-level description of the findings of the audit.
* **[Section 3 - Audit Details:](#section-3)** A description of the scope and methodology of the audit.
* **[Section 4 - Design Specification:](#section-4)** An outline of the intended functionality of the smart contracts.
* **[Section 5 - Detailed Findings:](#section-5)** Detailed descriptions of the findings of the audit.

The information in this report should be used to better understand the risk exposure of the smart contracts, and as a guide to improving the security posture of the smart contracts by remediating issues identified. The results of this audit are only a reflection of the source code reviewed at the time of the audit and of the source code that was determined to be in-scope.

The purpose of this audit was to achieve the following.

* Identify potential security flaws.
* Ensure that the smart contracts functioned according to the documentation provided.  

Assessing the economics, game theory, or underlying business model of the platform were beyond the scope of this audit. Therefore, determining the viability of the deflationary currency or the effectiveness of the stabilizing mechanisms to hold the 1 USD peg were explicitly beyond the scope of the audit.    

Due to the unregulated nature and ease of transfer of cryptocurrencies, operations that store or interact with these assets are considered very high risk with regards to cyber attacks. As such, the highest level of security should be observed when interacting with these assets. This requires a forward-thinking approach, which takes into account the new and experimental nature of blockchain technologies. Strategies that should be used to encourage secure code development include:

* Security should be integrated into the development lifecycle and the level of perceived security should not be limited to a single code audit.
* Defensive programming should be employed to account for unforeseen circumstances.
* Current best practices should be followed where possible.  

<a name="section-2"></a>
# 2. Executive Summary

This report presents the findings of an audit performed by iosiro on the Centric Swap smart contracts. The scope of the audit was limited to only the basic BEP20 functionality.

It should be noted that the Centric Rise contract, which was entirely responsible for controlling the supply (i.e. minting and burning Centric Swap), was audited separately. The audit of the Centric Rise system performed by iosiro is publicly available [here](www.iosiro.com/audits/centric-protocol-smart-contract-audit
).

The Centric Foundation provided the [Centric Whitepaper](https://www.joincentric.com/docs/Centric_Whitepaper.pdf) (MD5=a8b3c2e33ef3e36bcc1667cbdd0190a5) as a reference for the audit.

No issues were open at the conclusion of the audit.

At a high level, the security posture of the smart contracts could be further strengthened by:

* Performing additional audits at regular intervals, as security best practices, tools, and knowledge change over time. Additional audits over the course of the project's lifespan ensure the longevity of the codebase.
* Extending Centric's existing bug bounty program to encourage the responsible disclosure of security vulnerabilities in the smart contracts.

#### Tron to BSC Migration

A further review was performed on 26 May 2021 on updates made to the smart contracts to allow for deployment on BSC. No further issues were identified during the review.  

<a name="section-3"></a>
# 3. Audit Details
## 3.1 Scope
The source code considered in-scope for the assessment is described below. Code from all other files is considered to be out-of-scope. Out-of-scope code that interacts with in-scope code is assumed to function as intended and introduce no functional or security vulnerabilities for the purposes of this audit.

### 3.1.1 Centric Smart Contracts
**Project Name:** contracts<br/>
**Commits:** [22a38fb](https://github.com/Centric-Org/contracts/tree/22a38fbebf82517f57d0b2004137a091ba7c53cd/contracts)<br/>
**Files:**  Cash.sol, SafeMath.sol, RoundMath.sol, TRC20.sol, helpers/Administrable.sol, helpers/Claimable.sol

### 3.1.2 Centric Smart Contracts BSC Migration
**Project Name:** contracts<br/>
**Commits:** [aae4b3e](https://github.com/Centric-Org/contracts/pull/8/commits/aae4b3e30f808bae89826589b2598d3d6157629e)<br/>
**Files:**  Administrable.sol, CentricSwap.sol, Claimable.sol, SafeMath.sol, RoundMath.sol, BEP20.sol

## 3.2  Methodology

A variety of techniques were used while conducting the audit. These techniques are briefly described below.

### 3.2.1 Code Review

The source code was manually inspected to identify potential security flaws. Code review is a useful approach for detecting security flaws, discrepancies between the specification and implementation, design improvements, and high risk areas of the system.

### 3.2.2 Dynamic Analysis

The contracts were compiled, deployed, and tested in a Ganache test environment, both manually and through the Truffle test suite provided. Manual analysis was used to confirm that the code operated at a functional level, and to verify the exploitability of any potential security issues identified.

### 3.2.3 Automated Analysis

Tools were used to automatically detect the presence of several types of security vulnerabilities, including reentrancy, timestamp dependency bugs, and transaction-ordering dependency bugs. The static analysis results were manually analyzed to remove false-positive results. True positive results would be indicated in this report. Static analysis tools that may have been used included Slither, Securify, as well as MythX. Tools such as the Remix IDE, compilation output, and linters could also have been used to identify potential areas of concern.

## 3.3  Risk Ratings

Each issue identified during the audit has been assigned a risk rating. The rating is determined based on the criteria outlined below.

* **High Risk** - The issue could result in a loss of funds for the contract owner or system users.
* **Medium Risk** - The issue resulted in the code specification being implemented incorrectly.
* **Low Risk** - A best practice or design issue that could affect the security of the contract.
* **Informational** - A lapse in best practice or a suboptimal design pattern that has a minimal risk of affecting the security of the contract.
* **Closed** - The issue was identified during the audit and has since been addressed to a satisfactory level to remove the risk that it posed.

<a name="section-4"></a>
# 4. Design Specification
The following section outlines the intended functionality of the system at a high level. The specification is based on the implementation in the codebase and any perceived points of conflict should be highlighted with the auditing team to determine the source of the discrepancy.

## 4.1 Centric Swap

Centric Swap is a cryptocurrency intended to be traded on exchanges at market rates.

#### BEP20 Token

It should be represented by a BEP20-compliant token with the following values.

Field        | Value
------------ | -------------
Name         | Centric Swap
Symbol       | CNS
Decimals     | 8

#### Minting

It should only be possible for the Centric Rise contract to mint Centric Swap tokens. The Centric Rise contract should be able to freely mint an arbitrary amount of Centric Swap tokens to an address.

#### Burning

It should only be possible for the Centric Rise contract to burn Centric Swap tokens. The Centric Rise contract should be able to burn an arbitrary amount of Centric Swap tokens from any address. When burning Centric Swap tokens, the amount should be removed from the total supply.

#### Centric Rise Contract

It should be possible for only the Centric Swap contract owner to set the address of the Centric Rise contract. It should not be possible to change the address once set.

<a name="section-5"></a>
# 5. Detailed Findings
The following section details the findings of the audit.

## 5.1 High Risk

No high risk issues were present at the conclusion of the review.

## 5.2 Medium Risk

No medium risk issues were present at the conclusion of the review.

## 5.3 Low Risk

No low risk issues were present at the conclusion of the review.

## 5.4 Informational

No informational risk issues were present at the conclusion of the review.

Secure your system.
Request a service
Start Now