CertiK reviewed Dogita (Dogita - audit) on 21 May 2024: 20 findings, 0 critical; 1 marked fixed, 4 acknowledged, 15 open.
Report hosted on skynet.certik.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 0 | 1 | 1 |
| Medium | 0 | 3 | 0 |
| Low | 15 | 0 | 0 |
In abstract/base contracts, the modifier for initialize functions must not use the `initializer()`. Otherwise, when child contracts use multiple inheritance, it will lead to the initialization function potentially being called multiple times, causing state variables to be incorrectly initialized or the initialization logic to be skipped if the internal state indicates it has already been initialized.
The `process()` function is publicly accessible, yet within its body, there exists a function call to `processAccount()`, which is intended to be invoked solely by the `owner`. Consequently, non-owner accounts encounter failure when attempting to call the `process()` function due to the conflicting code logic described above. ```solidity=2820 function process(uint256 gas) public returns ( uint256, uint256, uint256 ) { .... if (canAutoClaim(lastClaimTimes[account])) { if (processAccount(payable(account), true)) { claims++; } } .... } ``` ```solidity=2874 function processAccount(address payable account, bool automatic) public onlyOwner returns (bool) { ```
The `swapAndLiquify` function converts half of the DOGITA (DOGA) tokens to ETH. The other half of DOGITA tokens and part of the converted ETH are deposited into the LP pool on Uniswap as liquidity. For every `swapAndLiquify` function call, a small amount of ETH leftover in the contract. This is because the price of DOGITA drops after swapping the first half of DOGITA tokens into ETHs, and the other half of DOGITA tokens require less than the converted ETH to be paired with it when adding liquidity. The contract doesn't appear to provide a way to withdraw those ETH, and they will be locked in the contract forever.
When initializing the contract, ensure that the zero address is excluded from receiving dividends. Failing to do so may result in dividends being allocated to burned tokens, causing these dividends to remain unclaimed within the dividend tracker contract.
By default, fees are exempted for the `owner` and `_marketingWalletAddress` addresses. However, there are issues in the current code: 1. When the values of the above two addresses are updated, the old values are not included in the fees. 2. When the values of the above two addresses are updated, the new values are not automatically exempted from fees by default. ```solidity=3035 _isExcludedFromFees[owner()] = true; _isExcludedFromFees[_marketingWalletAddress] = true; _isExcludedFromFees[address(this)] = true; ``` ```solidity=881 function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } ``` ```solidity=3097 function setMarketingWallet(address payable wallet) external onlyOwner { require( wallet != address(0), "BABYTOKEN: The marketing wallet cannot be the value of zero" ); require(!wallet.isContract(), "Marketing wallet cannot be a contract"); _marketingWalletAddress = wallet; } ```
Addresses are not validated before assignment or external calls, potentially allowing the use of zero addresses and leading to unexpected behavior or vulnerabilities. For example, transferring tokens to a zero address can result in a permanent loss of those tokens. ```solidity=3064 payable(serviceFeeReceiver_).transfer(serviceFee_); ``` - `serviceFeeReceiver_` is not zero-checked before being used.
The following codes are designed for excluding a specific address from fee charge accounts collection. However, there is no code logic for including a specific address in fee charge accounts collection again after excluding. ```solidity=3052 // exclude from paying fees or having max transaction amount _isExcludedFromFees[owner()] = true; _isExcludedFromFees[_marketingWalletAddress] = true; _isExcludedFromFees[address(this)] = true; ``` ```solidity=3077 function excludeFromFees(address account) external onlyOwner { require( !_isExcludedFromFees[account], "BABYTOKEN: Account is already excluded" ); _isExcludedFromFees[account] = true; emit ExcludeFromFees(account); } function excludeMultipleAccountsFromFees( address[] calldata accounts ) external onlyOwner { for (uint256 i = 0; i < accounts.length; i++) { _isExcludedFromFees[accounts[i]] = true; } emit ExcludeMultipleAccountsFromFees(accounts); } ```
In the contract `BABYTOKENDividendTracker`, the function `excludeFromDividends()` could only exclude users from dividends. If someone is falsely to be excluded from dividends, there is no way to recover.
A sandwich attack may happen when an attacker observes a transaction swapping tokens or adding liquidity without setting restrictions on slippage or minimum output amount. The attacker can manipulate the exchange rate by frontrunning (executing before the target) a transaction to purchase one of the assets and make profits by backrunning (executing after the target) a transaction to sell the asset. The cited functions are called without setting restrictions on slippage or minimum output amount, so transactions triggering these functions are vulnerable to sandwich attacks, especially when the input amount is large.
The contract is serving as the underlying entity to interact with one or more third party protocols, `Pancake`. The scope of the audit treats third party entities as black boxes and assumes their functional correctness. However, in the real world, third parties can be compromised and this may lead to lost or stolen assets. In addition, upgrades of third parties can possibly create severe impacts, such as increasing fees of third parties, migrating to new LP pools, etc. ```solidity=2944 IUniswapV2Router02 public uniswapV2Router; ``` - The contract `DOGITA (DOGA)` interacts with third party contract with `IUniswapV2Router02` interface via `uniswapV2Router`.
Type casting refers to changing an variable of one data type into another. The code contains an unsafe cast between integer types, which may result in unexpected truncation or sign flipping of the value. ```solidity=2260 int256 b = int256(a); ``` Casted expression `a` has estimated range [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935] but target type `int256` has range [-57896044618658097711785492504343953926634992332820282019728792003956564819968, 57896044618658097711785492504343953926634992332820282019728792003956564819967]. --- ```solidity=2292 return int256(map.indexOf[key]); ``` Casted expression `map.indexOf[key]` has estimated range [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935] but target type `int256` has range [-57896044618658097711785492504343953926634992332820282019728792003956564819968, 57896044618658097711785492504343953926634992332820282019728792003956564819967]. --- ```solidity=2755 int256(processesUntilEndOfArray) ``` Casted expression `processesUntilEndOfArray` has estimated range [0, 115792089237316195423570985008687907853269984665640564039457584007913129639935] but target type `int256` has range [-57896044618658097711785492504343953926634992332820282019728792003956564819968, 57896044618658097711785492504343953926634992332820282019728792003956564819967].
It is not recommended to use Solidity's `transfer()` and `send()` functions for transferring native tokens, since some contracts may not be able to receive the funds. Those functions forward only a fixed amount of gas (2300 specifically) and the receiving contracts may run out of gas before finishing the transfer. Also, EVM instructions' gas costs may increase in the future. Thus, some contracts that can receive now may stop working in the future due to the gas limitation. ```solidity=3064 payable(serviceFeeReceiver_).transfer(serviceFee_); ``` - `BABYTOKEN.constructor` uses `transfer()`.
The following code is intended to charge service fee values in BNB. However, a current issue with the code is that if `msg.value` exceeds `serviceFee_`, the leftover service fee is not refunded to the contract deployer. ```solidity=29999 constructor( string memory name_, string memory symbol_, uint256 totalSupply_, address[4] memory addrs, // reward, router, marketing wallet, dividendTracker uint256[3] memory feeSettings, // rewards, liquidity, marketing uint256 minimumTokenBalanceForDividends_, address serviceFeeReceiver_, uint256 serviceFee_ ) payable ERC20(name_, symbol_) { .... payable(serviceFeeReceiver_).transfer(serviceFee_); } ```
The linked variables assigned in the constructor can be declared as `immutable`. Immutable state variables can be assigned during contract creation but will remain constant throughout the lifetime of a deployed contract. A big advantage of immutable variables is that reading them is significantly cheaper than reading from regular state variables since they will not be stored in storage.
If the `call` at Line 94 is failed and returns false, the if-clause at Line 96~99 will handle the failure situation. Although the `withdrawnDividends[user]` is updated again at Line 97, the `emit` at Line 93 can not be updated. ```solidity=89 function _withdrawDividendOfUser(address payable user) internal returns (uint256) { uint256 _withdrawableDividend = withdrawableDividendOf(user); if (_withdrawableDividend > 0) { withdrawnDividends[user] = withdrawnDividends[user].add(_withdrawableDividend); emit DividendWithdrawn(user, _withdrawableDividend); (bool success,) = user.call{value: _withdrawableDividend, gas: 3000}(""); if(!success) { withdrawnDividends[user] = withdrawnDividends[user].sub(_withdrawableDividend); return 0; } return _withdrawableDividend; } return 0; } ```
| Address | Chain | Source code |
|---|---|---|
| 0x0531…b52f0x05311d9aa0e17d1071986146ced510c85c71b52f | Chain: BNB Chain | Source code: Verified source |
1,045 projects reviewed · 1,376 reports · latest May 2025
See CertiK’s auditsSomething wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.
Tell us