Skip to content

Commit 38f16b0

Browse files
committed
add NatSpec for some non obvious errors
1 parent cacba86 commit 38f16b0

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

contracts/price/IZNSCurvePricer.sol

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ import { IZNSPricer } from "../types/IZNSPricer.sol";
77

88
interface IZNSCurvePricer is ICurvePriceConfig, IZNSPricer {
99

10+
/**
11+
* @notice Reverted when multiplier passed by the domain owner
12+
* is equal to 0 or more than 10^18, which is too large.
13+
*/
1014
error InvalidMultiplierPassed(uint256 multiplier);
1115

12-
// TODO upd: "ZNSCurvePricer: incorrect value set causes the price spike at maxLength."
16+
/**
17+
* @notice Reverted when `priceConfig` set by the owner does not result in a proper asymptotic curve
18+
* and one of it's incorrect values causes the price spike at maxLength, meaning that the price
19+
* for a domain label shorter than `baseLength` (the one before `minPrice`) becomes higher than `minPrice`.
20+
*/
1321
error InvalidConfigCausingPriceSpikes(
1422
bytes32 configsDomainHash,
1523
uint256 minPrice,

contracts/registrar/IZNSSubRegistrar.sol

+7
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ import { IZNSPricer } from "../types/IZNSPricer.sol";
1010
* @title IZNSSubRegistrar.sol - Interface for the ZNSSubRegistrar contract responsible for registering subdomains.
1111
*/
1212
interface IZNSSubRegistrar is IDistributionConfig {
13+
/**
14+
* @notice Reverted when someone other than parent owner is trying to buy a subdomain under the parent that is locked\
15+
* or when the parent provided does not exist.
16+
*/
1317
error ParentLockedOrDoesntExist(bytes32 parentHash);
1418

19+
/**
20+
* @notice Reverted when the buyer of subdomain is not approved by the parent in it's mintlist.
21+
*/
1522
error SenderNotApprovedForPurchase(bytes32 parentHash, address sender);
1623

1724
/**

contracts/types/IZNSPricer.sol

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ pragma solidity 0.8.26;
77
* @notice Base interface required to be inherited by all Pricing contracts to work with zNS
88
*/
99
interface IZNSPricer {
10-
// TODO upd: add natspec for all new errors !
10+
/**
11+
* @notice Reverted when someone is trying to buy a subdomain under a parent that is not set up for distribution.
12+
* Specifically it's prices for subdomains.
13+
*/
1114
error ParentPriceConfigNotSet(bytes32 parentHash);
1215

16+
/**
17+
* @notice Reverted when domain owner is trying to set it's stake fee percentage higher than 100% (uint256 "10,000").
18+
*/
1319
error FeePercentageValueTooLarge(uint256 feePercentage, uint256 maximum);
1420

1521
/**

contracts/upgrade-test-mocks/distribution/ZNSSubRegistrarMock.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { StringUtils } from "../../utils/StringUtils.sol";
1515
import { PaymentConfig } from "../../treasury/IZNSTreasury.sol";
1616
import { NotAuthorizedForDomain, ZeroAddressPassed, DomainAlreadyExists } from "../../utils/CommonErrors.sol";
1717

18-
// TODO upd: convert all these errors as well !!
18+
1919
enum AccessType {
2020
LOCKED,
2121
OPEN,

contracts/utils/StringUtils.sol

+2-7
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,11 @@ library StringUtils {
5151
if (length == 0 || length >= MAX_INT)
5252
revert DomainLabelTooLongOrNonexistent(s);
5353

54-
for (uint256 i; i < length;) {
54+
for (uint256 i; i < length; ++i) {
5555
bytes1 b = nameBytes[i];
5656
// Valid strings are lower case a-z, 0-9, or a hyphen
5757
if (!((b > 0x60 && b < 0x7B) || (b > 0x2F && b < 0x3A) || b == 0x2D))
5858
revert DomainLabelContainsInvalidCharacters(s);
59-
60-
// TODO upd: remove all unchecked blocks everywhere !
61-
unchecked {
62-
++i;
63-
}
6459
}
6560
}
66-
}
61+
}

0 commit comments

Comments
 (0)