Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eth registrar #7

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft

Eth registrar #7

wants to merge 19 commits into from

Conversation

jefflau
Copy link
Member

@jefflau jefflau commented Oct 1, 2024

Eth registrar on the premise that the commit + registrations happen on L2.

  • Commitments (with event)
  • Registrations
  • Renewals (no grace period)
  • Withdrawing funds to owner

Todo:

  • Add Grace period
  • Fix tests for Exponential Price Curve (not using ens registry)

@jefflau jefflau requested a review from Arachnid October 1, 2024 05:29

uint256 public immutable MIN_COMMIT_AGE;
uint256 public immutable MAX_COMMIT_AGE;
uint256 public constant MIN_REGISTRATION_DURATION = 28 days;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we have an owner, maybe we want to make this configurable?

uint256 public immutable MIN_COMMIT_AGE;
uint256 public immutable MAX_COMMIT_AGE;
uint256 public constant MIN_REGISTRATION_DURATION = 28 days;
mapping(bytes32 => uint256) public commitments;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solidity supports naming mapping keys and values now, which would add clarity here.

Suggested change
mapping(bytes32 => uint256) public commitments;
mapping(bytes32 hash => uint256 inception) public commitments;

uint256 public immutable MAX_COMMIT_AGE;
uint256 public constant MIN_REGISTRATION_DURATION = 28 days;
mapping(bytes32 => uint256) public commitments;
bytes32 public constant ETH_LABELHASH = keccak256(abi.encodePacked("eth"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can save some bytecode by making this a module level constant (and therefore not a public variable).

uint256 public constant MIN_REGISTRATION_DURATION = 28 days;
mapping(bytes32 => uint256) public commitments;
bytes32 public constant ETH_LABELHASH = keccak256(abi.encodePacked("eth"));
ETHRegistry public registry;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be immutable, right?


event NameRegistered(
string label,
bytes32 labelHash,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

uint64 expires = currentExpiry + duration;

// Check if the provided value is sufficient
IPriceOracle.Price memory price = rentPrice(label, duration);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this just swallow any extra?

@@ -0,0 +1,237 @@
// import { loadFixture } from '@nomicfoundation/hardhat-toolbox-viem/network-helpers.js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be commented out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants