CertiK reviewed BKOKFi (BKOK) on 29 Sep 2024: 10 findings, 0 critical; 3 marked fixed, 7 open.
The original report was removed from its address (seen 16 Oct 2026).
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 | 0 | 2 |
| Medium | 2 | 0 | 0 |
| Low | 5 | 0 | 1 |
The `BKOK` token contract contains a logic flaw in the `_transfer` function's fee calculation logic, which inadvertently restricts ETH withdrawals to only those accounts that are excluded from fees. This issue arises from an incorrect computation of the fee, leading to the fee exceeding the transfer amount and causing the transaction to revert due to underflow. The fee is calculated using the formula `(amount * feeBase) / feeTotal`. ```solidity=170 if (!isExcludeFee(from)) { @> uint256 fee = (amount * feeBase) / feeTotal; super._transfer(from, address(this), fee); amount -= fee; } ``` In the contract, the `feeBase` is equal to 10000, and the `feeTotal` is 1500, so the calculated `fee` equates to `(amount * 10000) / 1500 ≈ 6.6667 * amount`. Subtracting a fee larger than the `amount` leads to an underflow, causing the transaction to revert in the whole transaction.
In the `BKOK` token contract, two types of trading pairs exist: `WBNB-BKOK` and `USDT-BKOK`. Selling operations within either pair can trigger an automatic burning of `BKOK` tokens from the `WBNB-BKOK` pair. The tokens burned are transferred to the contract itself, potentially initiating subsequent swap operations. Notably, these burn and swap activities are confined to the `WBNB-BKOK` pool. Thus, when `BKOK` tokens are sold in the `USDT-BKOK` pool, it impacts the price in the `WBNB-BKOK` pool as well. This strategy appears designed to stabilize the prices across various BKOK pools. ```solidity=115 if (_autoPair[to]) { autoBurnUniswapPair(); if (!swapIng) { swapIng = true; swapTokenForFee(); swapIng = false; } } ``` ```solidity=315 function autoBurnUniswapPair() internal { if (block.timestamp - lastLpBurnTime > lpBurnFrequency) { burnPair(pairETH); lastLpBurnTime = block.timestamp; } } function burnPair(address _pair) internal returns (bool) { uint256 liquidityPairBalance = balanceOf(_pair); uint256 amountToBurn = (liquidityPairBalance * percentForLPBurn) / percentDiv; if (amountToBurn > 0) { super._transfer(_pair, address(this), amountToBurn); IPancakePair(_pair).sync(); emit AutoNukeLP( liquidityPairBalance, amountToBurn, block.timestamp ); return true; } return false; } } ``` However, it's important to note that selling in the `WBNB-BKOK` pool does not affect the `USDT-BKOK` pool's price. We have some concerns for the auto pair burning mechanism: 1. **Arbitrage Trade**: Should the `BKOK` price in the `WBNB-BKOK` pool be substantially lower compared to its price in the `USD-BKOK` pool, an opportunity for arbitrage trading arises. 2. **Potential Loss for Liquidity Providers**: During the process of auto burning and swapping, the reserves of `WBNB-BKOK` could decrease, resulting in a loss for liquidity providers. We would like to confirm whether the design was intentional.
The `withdrawETH` function in the `BKOK` contract uses a specific formula to calculate the amount of withdrawable ETH based on the proportion of the tokens being transferred relative to the total adjusted token supply. This adjusted supply is computed as the total supply minus the tokens held by the dead address and the tokens in both the WBNB-BKOK and USD-BKOK liquidity pairs, adjusted further by adding the amount being transferred. ```solidity=175 uint256 outETH = getWithdrawOut(amount); super._transfer(from, address(0xdead), amount); ``` The logic here is first to calculate the amount of ETH corresponding to the input tokens (`amount`) and then transfer the `amount` of BKOK tokens to a dead address, effectively removing them from circulation. The `getWithdrawOut` function uses the formula: ```solidity (uint256 amountIn * address(this).balance) / (totalSupply() - balanceOf(address(0xdead)) - balanceOf(pairETH) - balanceOf(pairUSDT) + amountIn) ``` Here, `amountIn` is the amount of BKOK tokens that the user wants to withdraw as ETH. The calculation slightly disadvantages the user by providing less ETH than might be expected from a straightforward proportional withdrawal based on the tokens' current position in the supply metrics. This occurs because the formula anticipates the transfer of tokens to the dead address before it actually happens, impacting the amount of ETH received. This looks reasonable from the `getWithdrawOut` function as it may consider divide by zero error. We ant to confirm whether the current implementation is intended.
In the `multiTransfer()` function, multiple amounts are transferred to multiple addresses within a single function call. Therefore, the elements of the `addrs` and `amounts` arrays must correspond one-to-one, and their lengths must match.
We would like to confirm whether these designs align with the intended functionality: - In the `BKOK` contract, it is noted that the contract accumulates transfer fees and periodic auto burning from `BNB-BKOK` pair and converts them into native coins (BNB), which are then deposited into the contract. According to the on-chain configuration, 20% of this ETH is allocated to a marketing address, 30% is designated for burning, and the remaining 50% stays within the contract. It is noted that only accounts that are exempt from fees have the capability to withdraw these BNB. - Based on the on-chain status of the `BKOK` contract, once the owner renounces their permissions, the `addLiquidity` function can no longer be executed. This implies that unless users actively add liquidity, the liquidity of the pair contract will not increase. If most users only trade one type of token within the pair, this could lead to significant price fluctuations for that token, adversely affecting normal transactions.
A sandwich attack can occur when an attacker notices a transaction involving token swaps or liquidity additions that lacks slippage restrictions or minimum output amount settings. The attacker can exploit this by frontrunning the transaction to purchase one of the assets, thereby manipulating the exchange rate, and then backrunning the transaction to sell the asset for a profit. The referenced functions are invoked without setting slippage restrictions or minimum output amounts, making transactions that trigger these functions particularly vulnerable to sandwich attacks, especially when large input amounts are involved.
The low-level `call` function returns the status of the call as first variable in the returned tuple. The status of the `call` is not asserted to be `true`, which would treat the low-level call as a success even when it reverted. ```solidity=44 function _safeTransferETH(address to, uint value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); if (success) {} } ```
| Address | Chain | Source code |
|---|---|---|
| 0x9cc4…3f200x9cc484ded7a7851a03f05a03e8d19eb5f5a73f20 | 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