Skip to content

Commit

Permalink
Merge pull request #7 from web3-identity/beta5
Browse files Browse the repository at this point in the history
sync with ens newest code
  • Loading branch information
Pana authored Feb 26, 2023
2 parents 6084df8 + 6a665b3 commit 10294b2
Show file tree
Hide file tree
Showing 12 changed files with 370 additions and 693 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CHANGELOG
===

Last ens-contracts sync time: Feb 13, 2023
Last ens-contracts sync time: Feb 23, 2023

## v0.2.3

Expand Down
2 changes: 1 addition & 1 deletion contracts/web3registrar/NameWhitelist.sol
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,6 @@ contract NameWhitelist is Ownable, INameWhitelist {
}

function keccak(string memory str) private pure returns (bytes32) {
return keccak256(abi.encode(str));
return keccak256(bytes(str));
}
}
24 changes: 6 additions & 18 deletions contracts/web3registrar/Web3RegistrarController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.s
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {INameWhitelist} from "./INameWhitelist.sol"; // CNS UPDATE
import {IFiatPriceOracle} from "./IFiatPriceOracle.sol"; // CNS UPDATE
import {ICNameWrapper} from '../wrapper/ICNameWrapper.sol'; // CNS UPDATE

error CommitmentTooNew(bytes32 commitment);
error CommitmentTooOld(bytes32 commitment);
Expand Down Expand Up @@ -51,7 +50,7 @@ contract Web3RegistrarController is
uint256 public minCommitmentAge;
uint256 public maxCommitmentAge;
ReverseRegistrar public reverseRegistrar;
ICNameWrapper public nameWrapper; // CNS UPDATE
INameWrapper public nameWrapper;

mapping(bytes32 => uint256) public commitments;

Expand All @@ -71,8 +70,7 @@ contract Web3RegistrarController is
);

INameWhitelist public nameWhitelist; // CNS UPDATE
uint256 private validLen = 4; // CNS UPDATE
uint256 private label45Quota = 50000; // CNS UPDATE
uint256 private validLen = 5; // CNS UPDATE

// CNS UPDATE
enum LabelStatus {
Expand All @@ -92,7 +90,7 @@ contract Web3RegistrarController is
uint256 _minCommitmentAge,
uint256 _maxCommitmentAge,
ReverseRegistrar _reverseRegistrar,
ICNameWrapper _nameWrapper
INameWrapper _nameWrapper
) {
_setupRole(ADMIN_ROLE, msg.sender);
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
Expand All @@ -105,7 +103,7 @@ contract Web3RegistrarController is
uint256 _minCommitmentAge,
uint256 _maxCommitmentAge,
ReverseRegistrar _reverseRegistrar,
ICNameWrapper _nameWrapper,
INameWrapper _nameWrapper,
address _admin
) public initializer {
_setupRole(ADMIN_ROLE, _admin);
Expand All @@ -119,7 +117,7 @@ contract Web3RegistrarController is
uint256 _minCommitmentAge,
uint256 _maxCommitmentAge,
ReverseRegistrar _reverseRegistrar,
ICNameWrapper _nameWrapper
INameWrapper _nameWrapper
) internal {
if (_maxCommitmentAge <= _minCommitmentAge) {
revert MaxCommitmentAgeTooLow();
Expand All @@ -135,8 +133,7 @@ contract Web3RegistrarController is
maxCommitmentAge = _maxCommitmentAge;
reverseRegistrar = _reverseRegistrar;
nameWrapper = _nameWrapper;
validLen = 4;
label45Quota = 50000;
validLen = 5;
}

function rentPrice(string memory name, uint256 duration)
Expand Down Expand Up @@ -433,9 +430,6 @@ contract Web3RegistrarController is
if (!available(_label)) {
return LabelStatus.Registered;
}
if ((_label.strlen() == 4 || _label.strlen() == 5) && nameWrapper.label45Count() >= label45Quota) {
return LabelStatus.SoldOut;
}
return LabelStatus.Valid;
}

Expand Down Expand Up @@ -497,12 +491,6 @@ contract Web3RegistrarController is
validLen = _len;
}

// CNS UPDATE
function setLabel45Quota(uint256 _quota) public onlyRole(ADMIN_ROLE) {
require(_quota > label45Quota, "invalid quota");
label45Quota = _quota;
}

// CNS UPDATE
function addAdmin(address addr) public onlyRole(ADMIN_ROLE) {
_setupRole(ADMIN_ROLE, addr);
Expand Down
10 changes: 0 additions & 10 deletions contracts/wrapper/ICNameWrapper.sol

This file was deleted.

Loading

0 comments on commit 10294b2

Please sign in to comment.