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

Modify transfer in DomainToken #119

Open
wants to merge 20 commits into
base: zns-zchain-final
Choose a base branch
from

Conversation

JamesEarle
Copy link
Collaborator

@JamesEarle JamesEarle commented Sep 23, 2024

Modify the original transferFrom method to also include updating the registry with the owner update as well, effectively tying the split ownership together in all standard transfers such as sales on OpenSea

Introduce a new non-standard transfer transferTokenFrom that behaves similarly to the original transferFrom where only the token is transferred.

Copy link

openzeppelin-code bot commented Sep 23, 2024

WIP: Modify transfer in DomainToken

Generated at commit: d6f3763b0377b4d405bb94e49c166e1e3de7f3c2

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
1
1
0
2
18
22
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@@ -34,6 +34,8 @@ contract ZNSAccessController is AccessControl, ZNSRoles, IZNSAccessController {
_setRoleAdmin(GOVERNOR_ROLE, GOVERNOR_ROLE);
// all of the admins control registrar
_setRoleAdmin(REGISTRAR_ROLE, ADMIN_ROLE);
// all of the admins control domain token
_setRoleAdmin(DOMAIN_TOKEN_ROLE, ADMIN_ROLE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm.... this will require us to upgrade every single contract in ZNS for this change to work? is it possible to do this in a less invasive way?

/**
* @notice This role is here specifically for the ZNSDomainToken.sol contract
*/
bytes32 public constant DOMAIN_TOKEN_ROLE = keccak256("DOMAIN_TOKEN_ROLE");
Copy link
Collaborator

Choose a reason for hiding this comment

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

can't we just use Registrar role for this? this way we don't need to upgrade all contracts just for this string...
thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

actually... we may have to upgrade all contracts anyway since they all have custom errors now...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's sort of a decision on the "proper" way this should be. It would definitely be the same effect to just assign the DomainToken contract the REGISTRAR_ROLE but it isn't a registrar, so it felt improper. If we have to upgrade regardless it might make sense to leave it. Let me know what you think

@@ -55,11 +58,15 @@ interface IZNSDomainToken is IERC2981, IERC721 {

function setDefaultRoyalty(address receiver, uint96 royaltyFraction) external;

function transferTokenFrom(address from, address to, uint256 tokenId) external;
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe make a more clear name?...
idk... "changeTokenOwner()` or something... "transferTokenFrom" is kind of a good name, but may be a bit confusing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I felt making it as close to the regular transferFrom was best, so transferTokenFrom made sense because it was transferring just the token, but maybe setTokenOwner or updateTokenOwner to match verbiage from the registry would be better

address from,
address to,
uint256 tokenId
) public override(ERC721Upgradeable, IERC721) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

hm... what about all other transfer methods? there used to be 3 at least. those will not do what we want.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Messaged you about this, but yes because the other two public safeTransferFrom both route through this function it's fine to just override this one.

Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.82%. Comparing base (1b7cf47) to head (ddcdb97).

Additional details and impacted files
@@                Coverage Diff                @@
##           zns-zchain-final     #119   +/-   ##
=================================================
  Coverage             99.81%   99.82%           
=================================================
  Files                    12       12           
  Lines                   547      560   +13     
  Branches                122      123    +1     
=================================================
+ Hits                    546      559   +13     
  Misses                    1        1           

@JamesEarle JamesEarle changed the title WIP: Modify transfer in DomainToken Modify transfer in DomainToken Sep 30, 2024
Copy link
Collaborator

@Whytecrowe Whytecrowe left a comment

Choose a reason for hiding this comment

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

looks good! just need to make sure all possible ERC721 transfer methods are covered here

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