PulseBitcoin - Audit

CertiKFiles named in the report

CertiK reviewed PulseBitcoin (PulseBitcoin - Audit) on 18 Oct 2022: 11 findings, 0 critical; 3 marked fixed, 8 open.

No open critical findings
Open the reportOpen PulseBitcoin’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings11

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical000
High200
Medium000
Low603
HighCentralization Related RisksOpen

In the contracts `ASIC.sol` and `ATM.sol`, the role `OWNER` has authority over the following functions: - `mint()`: Mint a certain amount of tokens to a specified account; - `burn()`: Burn a certain amount of tokens from a specified account; Any compromise to the `OWNER` account may allow a hacker to take advantage of this authority and mint/burn a great number of tokens without the consensus of community. In the contract `PulseBitcoin.sol`, `BA_ADDRESS` is serving as the only account to receive all the tokens from users when users call the `atmStart()` function: ```solidity=365 token.transferFrom(msg.sender, BA_ADDRESS, amount); ``` Any compromise to the `BA_ADDRESS` account may allow a hacker to transfer all the assets to the malicious accounts and cause considerable losses to the team and community. According to the `PulseBitcoin` project design logic, `OWNER` refers to the `PulseBitcoin` contract address since `ASIC.sol` and `ATM.sol` will be deployed by the contract `PulseBitcoin.sol`. The team must ensure that all the core contracts are correctly deployed.

HighPrice OracleOpen

The `atmStart()` function starts and determines the points of a new ATM instance based on the TWAP of Uniswap V3. However, there is only one price oracle adopted. Applying more price oracles, like Chainlink, can make this protocol resistant to price manipulation. The pair of `MAXI-USDC` is applied as one of the price pairs. ```solidity _uniswapPools[MAXI_ADDRESS] = address(0xF5595d56ccB6Cb87a463C558cAD04f49Faa61149); ``` Per the on-chain data of the [MAXI-USDC pair](https://info.uniswap.org/#/pools/0xf5595d56ccb6cb87a463c558cad04f49faa61149), its liquidity is terribly low at the time of writing, and it could be manipulated easily.

LowDivide Before MultiplyOpen

Performing integer division before multiplication truncates the low bits, losing the precision of calculation. ```solidity=190 pSatoshisMine = (((((pSatoshisMine - ((totalpSatoshisMined + pSatoshisMine) - currentHalvingThreshold)) * bitoshis) / pSatoshisMine) * miningRate) / DECIMAL_RESOLUTION) + (((bitoshis - (((pSatoshisMine - ((totalpSatoshisMined + pSatoshisMine) - currentHalvingThreshold)) * bitoshis) / pSatoshisMine)) * (miningRate / 2)) / DECIMAL_RESOLUTION); ``` --- ```solidity=196 bitoshisBurn = (((((pSatoshisMine - ((totalpSatoshisMined + pSatoshisMine) - currentHalvingThreshold)) * bitoshis) / pSatoshisMine) * miningFee) / DECIMAL_RESOLUTION) + (((bitoshis - (((pSatoshisMine - ((totalpSatoshisMined + pSatoshisMine) - currentHalvingThreshold)) * bitoshis) / pSatoshisMine)) * (miningFee / 2)) / DECIMAL_RESOLUTION); ``` --- ```solidity=356 atmPoints = (amount * (2**96)) / tokenPrice; ``` ```solidity=373 atmPoints = atmPoints * SCALE_FACTOR; ```

LowFunction Should Be Declared ExternalOpen

The functions which are never called internally within the contract should have external visibility for gas optimization. ```solidity=102 function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { ``` ```solidity=75 function decimals() public view virtual override returns (uint8) { ``` ```solidity=153 function decimals() public view virtual override returns (uint8) { ```

LowIncompatibility with Deflationary TokensOpen

When transferring deflationary ERC20 tokens, the input amount may not be equal to the received amount due to the charged transaction fee. For example, if a user sends 100 deflationary tokens (with a 10% transaction fee), only 90 tokens actually arrived to the contract. However, a failure to discount such fees may allow the same user to withdraw 100 tokens from the contract, which causes the contract to lose 10 tokens in such a transaction. Reference: https://thoreum-finance.medium.com/what-exploit-happened-today-for-gocerberus-and-garuda-also-for-lokum-ybear-piggy-caramelswap-3943ee23a39f ```solidity=112 if (_plsd.transferFrom(msg.sender, DEAD_ADDRESS, amount)) { ``` - Transferring tokens by `amount`. ```solidity=113 totalPlsdTransformed += amount; ``` - The `amount` appears to be used for bookkeeping purposes without compensating the potential transfer fees.

LowThe Edge Case of Mined TokenOpen

The function `calcPayoutAndFee()` calculates the payout and fees for a miner instance. The `if - else` branch only covers the case that the accumulated amount is greater than the `currentHalvingThreshold.` ```solidity=187 if (totalpSatoshisMined + pSatoshisMine > currentHalvingThreshold) { isHalving = true; ``` ```solidity=203 } else { ``` In the function `minerStart()`, `currentHalvingThreshold` will be updated if `isHalving` is true. ```solidity=231 if (isHalving) { uint256 newPreviousHalvingThresold = currentHalvingThreshold; currentHalvingThreshold = currentHalvingThreshold + ((currentHalvingThreshold - previousHalvingThresold) / 2); previousHalvingThresold = newPreviousHalvingThresold; miningRate = miningRate / 2; miningFee = miningFee / 2; ++numOfHalvings; ++atmMultiplier; } ``` However, there is a possibility that `totalpSatoshisMined + pSatoshisMine` is still greater than the updated `currentHalvingThreshold.` The function `minerStart()` will trigger multiple consecutive halving events and constantly halve `miningRate` and `miningFee.`

LowThird Party DependencyOpen

The contracts `PulseBitcoin.sol` and `ASIC.sol` are serving as the underlying entities to interact with one or more third party protocols. The scope of the audit treats third party entities as black boxes and assume 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=524 (int56[] memory tickCumulatives, ) = IUniswapV3Pool(uniswapV3Pool).observe(secondsAgos); ``` - The contract `PulseBitcoin.sol` interacts with a third party contract with `IUniswapV3Pool` interface via `uniswapV3Pool`. ```solidity=26 IPulseDogecoin private _plsd; ``` - The contract `ASIC.sol` interacts with third party contract with `IPulseDogecoin` interface via `_plsd`.

LowVariables That Could Be Declared as ImmutableOpen

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. ```solidity=37 ASIC private _asic; address public asic; ``` ```solidity=41 ATM private _atm; address public atm; ```

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (13)

  • contracts/rarible/royalties/contracts/impl/AbstractRoyalties.sol
  • contracts/rarible/royalties/contracts/IRoyaltiesProvider.sol
  • contracts/lib/FullMath.sol
  • contracts/tokens/ATM.sol
  • contracts/PulseBitcoin.sol
  • contracts/rarible/royalties/contracts/impl/RoyaltiesV2Impl.sol
  • contracts/lib/TickMath.sol
  • contracts/tokens/ASIC.sol
  • contracts/rarible/royalties/contracts/RoyaltiesV2.sol
  • contracts/lib/UniswapMath.sol
  • contracts/rarible/royalties/contracts/LibRoyaltiesV2.sol
  • contracts/interfaces/PulseDogecoin.sol
  • contracts/rarible/royalties/contracts/LibPart.sol

Part of PulseBitcoin’s security record

PulseBitcoin
Audits1 audit by 1 firmLast audit Oct 2022, by CertiK.
Critical findingsNo open critical findingsIn 1 report.
Open PulseBitcoin’s security record

Security firm

CertiK

1,045 projects reviewed · 1,376 reports · latest May 2025

See CertiK’s audits

Something 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