Smart Contract Security Audit Dcip
Smart Contract Security Audit Dcip
Smart Contract Security Audit Dcip
security audit
DCIP
v.1.2
No part of this publication, in whole or in part, may be reproduced, copied, transferred or any other right reserved to its copyright a CTDSec,
including photocopying and all other copying, any transfer or transmission using any network or other means of communication, in any form or
by any means such as any information storage, transmission or retrieval system, without prior written permission.
Table of Contents
1.0 Introduction 3
1.2 Disclaimer 3
2.0 Coverage 4
During June of 2021, DCIP engaged CTDSec to audit smart contracts that they created. The engagement
was technical in nature and focused on identifying security flaws in the design and implementation of
the contracts. DCIP provided CTDSec with access to their code repository and whitepaper.
1.2 Disclaimer
It should be noted that this audit is not an endorsement of the reliability or effectiveness of
the contract, rather limited to an assessment of the logic and implementation. In order to
ensure a secure contract that’s able to withstand the network’s fast-paced and
rapidly changing environment, we at CTDSec recommend that DCIP team put in place a
bug bounty program to encourage further and active analysis of the smart contract.
For this audit, we performed research, investigation, and review of the DCIP contract followed by issue
reporting, along with mitigation and remediation instructions outlined in this report. The following
Source:
● DCIP.sol [SHA256] -
46a587b7885be9403efbd9280fc1b7715e9245ae4f43893df629239213b55b2a
● Presale.sol [SHA256] -
e867f74f5f93989c87cd1c18245c0701f9e166e74655105c9a2c2c392a26c99e
● Voting.sol [SHA256] -
b5f7af6fa4cde92e64e647bb585b953ccfa855ac42ce750850170174a275f562
In order to check for the security of the contract, we tested several attacks in order to make sure
that the contract is secure and follows best practices.
DCIP Contract:
The function _burnTokenFromWallet() subtracts rBurn from _rOwned only if the account is not excluded.
The function _burnTokenFromWallet() does not decrease allowance of account for the owner.
b5b5744fe577311be3a5fd74cc7cdbefb547ac04a25a693a6971da1c10ff68a9
https://github.com/DCIP-Finance/smart-contracts/blob/main/contracts/DCIP.sol
The owner can burn an unlimited number of tokens from any account.
Recommendation: Check allowance for owner or write about that possibility in your white paper.
b5b5744fe577311be3a5fd74cc7cdbefb547ac04a25a693a6971da1c10ff68a9
https://github.com/DCIP-Finance/smart-contracts/blob/main/contracts/DCIP.sol
The contract burns tokens by sending them to _tOwned[_burnAddress] and excludes that address from
reward. _burnAddress can be included to reward.
Recommendation: The contract logic is written for distributing tokens to these addresses correctly only if
they are excluded.
The function includeInReward() should check and disallow including of these addresses. Or you can
rewrite the distribution logic.
b5b5744fe577311be3a5fd74cc7cdbefb547ac04a25a693a6971da1c10ff68a9
https://github.com/DCIP-Finance/smart-contracts/blob/main/contracts/DCIP.sol
Presale contract
Recommendation:
That kind of functions do not receive eth/bnb and should not be payable
DCIP contract:
The function includeInReward() uses the loop to find and remove addresses from the _excluded list.
Function will be aborted with OUT_OF_GAS exception if there will be a long excluded addresses list.
The function _getCurrentSupply also uses the loop for evaluating total supply. It also could be aborted
with OUT_OF_GAS exception if there will be a long excluded addresses list.
Recommendation:
DCIP contract:
Recommendation: Create two types of constant variables. First type will be used when the current
block.timestamp is less than (_holderToTimestamp[_msgSender()] + 24 hours), second for the rest.
Presale contract:
2. Contract’s decimals
According to logic in getCalculatedAmount() function token that used in presale should have the same
decimal as BNB.
The variable presale is unused. The variable Expired in VotingState structure is unused.
Voting contract:
The function vote() calculates voter weight by dividing voter balance to total supply of the myToken.
Total supply of the myToken should always be greater than or equal to the balance of a certain address.
There is only one case when voter weight value equals to 1 - voter has all tokens of myToken contract.
5. Access error
Owner can burn an unlimited number of tokens from any account. FIXED.
Owner can change excluded from fee and excluded from reward lists.
Owner can change the max transaction amount by passing percent of total supply.
Voting:
Presale:
Owner can withdraw any tokens from the contract address to himself. FIXED.
Owner can withdraw BNB from the contract to himself even if presale in active status. FIXED.
1. white list;
2. presale address;
b5b5744fe577311be3a5fd74cc7cdbefb547ac04a25a693a6971da1c10ff68a9