Skip to content

[v1.5] SubdomainToken contract#136

Closed
MichaelKorchagin wants to merge 8 commits intorc/zchain-native-mainfrom
mike1/cpt-97-subdomaintoken-contract
Closed

[v1.5] SubdomainToken contract#136
MichaelKorchagin wants to merge 8 commits intorc/zchain-native-mainfrom
mike1/cpt-97-subdomaintoken-contract

Conversation

@MichaelKorchagin
Copy link
Collaborator

No description provided.

@openzeppelin-code
Copy link

openzeppelin-code bot commented Apr 29, 2025

[v1.5] SubdomainToken contract

Generated at commit: b3ea2112aa821f40d68013be06b9f13c05709e16

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
1
1
0
4
18
24
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@codecov
Copy link

codecov bot commented Apr 29, 2025

Codecov Report

Attention: Patch coverage is 80.11364% with 35 lines in your changes missing coverage. Please review.

Project coverage is 94.26%. Comparing base (5dd6a86) to head (2cadb36).

❗ There is a different number of reports uploaded between BASE (5dd6a86) and HEAD (2cadb36). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (5dd6a86) HEAD (2cadb36)
3 1
Additional details and impacted files
@@               Coverage Diff               @@
##           development     #136      +/-   ##
===============================================
- Coverage        99.80%   94.26%   -5.55%     
===============================================
  Files               11       13       +2     
  Lines              512      610      +98     
  Branches           127      129       +2     
===============================================
+ Hits               511      575      +64     
- Misses               1       35      +34     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Choose a reason for hiding this comment

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

If files show like this, where the entire file is changed, it is usually because of the line endings for the file changing and it makes it really hard to review what actually changed. Please always use LF not CRLF to be consistent with the repo

_setRegistry(registry_);
}

function register(address to, uint256 tokenId, string memory _tokenURI)
Copy link
Contributor

Choose a reason for hiding this comment

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

To remain consistent with the other functions in contracts we define in the repository, when line breaks are necessary put them within parameter lists instead.

function myFunc(
  address var1,
  address var2,
  uint256 var3
) external {
  ...
}

_setTokenURI(tokenId, _tokenURI);
}

function revoke(uint256 tokenId)
Copy link
Contributor

Choose a reason for hiding this comment

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

for functions without long signatures like this, it isn't necessary to break the signature into multiple lines.

function revoke(uint256 tokenID) external {
  ...
}

}

// TODO: add access control, when it's ready
// TODO: do we check the passed string?
Copy link
Contributor

Choose a reason for hiding this comment

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

No we don't check this on-chain

function revoke(uint256 tokenId)
external
{
_burn(tokenId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Be sure access control is on this function as well, when it is ready to be implemented.

super.transferFrom(from, to, tokenId);

// TODO: make a fucntion or update existing one in the registry
// registry.updateDomainOwner(bytes32(abi.encodePacked(tokenId)), to);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be uncommented?

emit TokenURISet(tokenId, _tokenURI);
}

function transferFrom(
Copy link
Contributor

Choose a reason for hiding this comment

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

also be sure to include AC here when ready


string private baseURI;

event TokenURISet(uint256 indexed tokenId, string tokenURI);
Copy link
Contributor

Choose a reason for hiding this comment

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

Put events in the interface IZNSSubdomainToken

Copy link
Contributor

Choose a reason for hiding this comment

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

After addressing other things I've pointed out, add natspec comments

@Whytecrowe Whytecrowe changed the title SubdomainToken contract [v1.5] SubdomainToken contract May 7, 2025
@Whytecrowe Whytecrowe changed the base branch from development to rc/zchain-native-main May 7, 2025 20:26
EIP712,
ERC721Votes,
ERC2981,
ARegistryWired {
Copy link
Contributor

Choose a reason for hiding this comment

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

why doesn't this just inherit the ZNSDomainToken contract? It seems to have almost the same implementation. is there a reason you chose to make this separate?

@Whytecrowe Whytecrowe closed this May 23, 2025
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.

3 participants