NEST Protocol

CertiKFiles named in the report

CertiK reviewed NEST Protocol on 15 Jul 2022: 13 findings, 0 critical; 7 marked fixed, 2 acknowledged, 4 open.

No open critical findings
Open the reportOpen NEST Protocol’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings13

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

SeverityOpenAcknowledgedFixed
Critical000
High020
Medium001
Low406
MediumPotential ETH LossFixed

In function `post()`, Miners will transfer tokens to post the price for all of the pairs in the channel, and the amount of paid ETH will record in the local variable `fee`. If the `channel.token0` or `pair.target` is ETH, the value of `fee` will decrease which means the tokens are frozen in this contract. But if more ETH is paid than is needed, the `msg.sender` will lose this part of ETH.

LowDiscussion on Parameter `scale`Fixed

Since the value of `scale` must be 1, `scale` is not needed in the multiplication formula. ```solidity=356 // 1. Check arguments require(scale == 1, "NOM:!scale"); ``` ```solidity=379 // Freeze token0 fee = _freeze(balances, channel.token0, cn * uint(channel.unit) * scale, fee); ``` ```solidity=387 fee = _freeze(balances, pair.target, scale * equivalent, fee); ``` Also, `scale` can be replaced by fixed value 1 when emit event `Post` or call function `_create()` in function `post()`. ```solidity=394 // 6. Create token price sheet emit Post(channelId, cn, msg.sender, pair.sheets.length, scale, equivalent); // Only pairIndex 0 has reward _create(pair.sheets, accountIndex, uint32(scale), uint(config.pledgeNest), cn == 0 ? 1 : 0, equivalent); ``` In section 2.3 of [white paper](https://www.nestprotocol.org/doc/ennestwhitepaper.pdf), the scale looks like it can be any value. Please describe why the value of `scale` must be 1 in the function `post()`.

LowDiscussion on RewardFixed

According to our understanding, for each channel, there is no essential difference between `pair[0]` and the other pairs, but in real logic only `pair[0]` has a reward. Please teach us why only `pair[0]` has a reward and teach us what part of the official documentation is this reward mechanism documented in. ```solidity=396 // Only pairIndex 0 has reward ``` ```solidity=613 // Only pairIndex 0 has reward ```

LowDiscussion on The Condition of `if` BranchFixed

The condition of the `if` statement in line 856 is inconsistent with the comment in line 855. ```solidity=855 // Not the same block (or flag is false), calculate the price and update it if (flag || prev != height) { ```

LowIncorrect CommentsFixed

File : NestBatchMining.sol (function `take()`, line 444) The is no variable named `ethNum` in struct `PriceSheet`. ```solidity=444 // sheet.token0Scales + sheet.token1Scales is always two times to sheet.ethNum uint needNest1k = (takeNum << 2) * uint(sheet.nestNum1k) / (uint(sheet.token0Scales) + uint(sheet.token1Scales)); ```

LowMissing Error MessagesFixed

The **require** can be used to check for conditions and throw an exception if the condition is not met. It is better to provide a string message containing details about the error that will be passed back to the caller.

LowMissing Zero Address ValidationFixed

Addresses should be checked before assignment or external calls to make sure they are not zero addresses. ```solidity=740 payable(to).transfer(value); ``` - `to` is not zero-checked before being used.

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 (3)

  • contracts/NestBatchMining.sol
  • contracts/NestBatchPlatform2.sol
  • contracts/NestBase.sol

Part of NEST Protocol’s security record

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

Security firm

CertiK

1,044 projects reviewed · 1,375 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