1
1
// SPDX-License-Identifier: MIT
2
- pragma solidity 0.8.18 ;
2
+ pragma solidity 0.8.26 ;
3
3
4
4
import { AAccessControlled } from "../access/AAccessControlled.sol " ;
5
5
import { ARegistryWired } from "../registry/ARegistryWired.sol " ;
@@ -11,6 +11,7 @@ import { IZNSSubRegistrar } from "../registrar/IZNSSubRegistrar.sol";
11
11
import { IZNSPricer } from "../types/IZNSPricer.sol " ;
12
12
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol " ;
13
13
import { StringUtils } from "../utils/StringUtils.sol " ;
14
+ import { ZeroAddressPassed, DomainAlreadyExists } from "../utils/CommonErrors.sol " ;
14
15
15
16
16
17
/**
@@ -100,10 +101,8 @@ contract ZNSRootRegistrar is
100
101
// Create hash for given domain name
101
102
bytes32 domainHash = keccak256 (bytes (name));
102
103
103
- require (
104
- ! registry.exists (domainHash),
105
- "ZNSRootRegistrar: Domain already exists "
106
- );
104
+ if (registry.exists (domainHash))
105
+ revert DomainAlreadyExists (domainHash);
107
106
108
107
// Get price for the domain
109
108
uint256 domainPrice = rootPricer.getPrice (0x0 , name, true );
@@ -256,10 +255,8 @@ contract ZNSRootRegistrar is
256
255
external
257
256
override
258
257
{
259
- require (
260
- isOwnerOf (domainHash, msg .sender , OwnerOf.BOTH),
261
- "ZNSRootRegistrar: Not the owner of both Name and Token "
262
- );
258
+ if (! isOwnerOf (domainHash, msg .sender , OwnerOf.BOTH))
259
+ revert NotTheOwnerOf (OwnerOf.BOTH, msg .sender , domainHash);
263
260
264
261
subRegistrar.clearMintlistAndLock (domainHash);
265
262
_coreRevoke (domainHash, msg .sender );
@@ -305,10 +302,9 @@ contract ZNSRootRegistrar is
305
302
external
306
303
override
307
304
{
308
- require (
309
- isOwnerOf (domainHash, msg .sender , OwnerOf.TOKEN),
310
- "ZNSRootRegistrar: Not the owner of the Token "
311
- );
305
+ if (! isOwnerOf (domainHash, msg .sender , OwnerOf.TOKEN))
306
+ revert NotTheOwnerOf (OwnerOf.TOKEN, msg .sender , domainHash);
307
+
312
308
registry.updateDomainOwner (domainHash, msg .sender );
313
309
314
310
emit DomainReclaimed (domainHash, msg .sender );
@@ -330,7 +326,7 @@ contract ZNSRootRegistrar is
330
326
&& candidate == domainToken.ownerOf (uint256 (domainHash));
331
327
}
332
328
333
- revert ( " Wrong enum value for ` ownerOf` " );
329
+ revert InvalidOwnerOfEnumValue ( ownerOf);
334
330
}
335
331
336
332
/**
@@ -348,10 +344,9 @@ contract ZNSRootRegistrar is
348
344
* @param rootPricer_ Address of the IZNSPricer type contract to set as pricer of Root Domains
349
345
*/
350
346
function setRootPricer (address rootPricer_ ) public override onlyAdmin {
351
- require (
352
- rootPricer_ != address (0 ),
353
- "ZNSRootRegistrar: rootPricer_ is 0x0 address "
354
- );
347
+ if (rootPricer_ == address (0 ))
348
+ revert ZeroAddressPassed ();
349
+
355
350
rootPricer = IZNSPricer (rootPricer_);
356
351
357
352
emit RootPricerSet (rootPricer_);
@@ -363,10 +358,9 @@ contract ZNSRootRegistrar is
363
358
* @param treasury_ Address of the `ZNSTreasury` contract
364
359
*/
365
360
function setTreasury (address treasury_ ) public override onlyAdmin {
366
- require (
367
- treasury_ != address (0 ),
368
- "ZNSRootRegistrar: treasury_ is 0x0 address "
369
- );
361
+ if (treasury_ == address (0 ))
362
+ revert ZeroAddressPassed ();
363
+
370
364
treasury = IZNSTreasury (treasury_);
371
365
372
366
emit TreasurySet (treasury_);
@@ -378,10 +372,9 @@ contract ZNSRootRegistrar is
378
372
* @param domainToken_ Address of the `ZNSDomainToken` contract
379
373
*/
380
374
function setDomainToken (address domainToken_ ) public override onlyAdmin {
381
- require (
382
- domainToken_ != address (0 ),
383
- "ZNSRootRegistrar: domainToken_ is 0x0 address "
384
- );
375
+ if (domainToken_ == address (0 ))
376
+ revert ZeroAddressPassed ();
377
+
385
378
domainToken = IZNSDomainToken (domainToken_);
386
379
387
380
emit DomainTokenSet (domainToken_);
@@ -392,7 +385,8 @@ contract ZNSRootRegistrar is
392
385
* @param subRegistrar_ Address of the `ZNSSubRegistrar` contract
393
386
*/
394
387
function setSubRegistrar (address subRegistrar_ ) external override onlyAdmin {
395
- require (subRegistrar_ != address (0 ), "ZNSRootRegistrar: subRegistrar_ is 0x0 address " );
388
+ if (subRegistrar_ == address (0 ))
389
+ revert ZeroAddressPassed ();
396
390
397
391
subRegistrar = IZNSSubRegistrar (subRegistrar_);
398
392
emit SubRegistrarSet (subRegistrar_);
0 commit comments