Skip to content

Commit

Permalink
Changes to namewrapper in response to review
Browse files Browse the repository at this point in the history
  • Loading branch information
Arachnid committed Sep 29, 2021
1 parent d4a43d3 commit 5bd03c8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions contracts/wrapper/NameWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ contract NameWrapper is
address resolver
) public override {
uint256 tokenId = uint256(keccak256(bytes(label)));
address nameOwner = registrar.ownerOf(tokenId);
address registrant = registrar.ownerOf(tokenId);

require(
nameOwner == msg.sender ||
isApprovedForAll(nameOwner, msg.sender) ||
registrar.isApprovedForAll(nameOwner, msg.sender),
registrant == msg.sender ||
isApprovedForAll(registrant, msg.sender) ||
registrar.isApprovedForAll(registrant, msg.sender),
"NameWrapper: Sender is not owner or authorised by the owner or authorised on the .eth registrar"
);

// transfer the token from the user to this contract
registrar.transferFrom(nameOwner, address(this), tokenId);
registrar.transferFrom(registrant, address(this), tokenId);

// transfer the ens record back to the new owner (this contract)
registrar.reclaim(tokenId, address(this));
Expand Down Expand Up @@ -539,13 +539,13 @@ contract NameWrapper is
address resolver
) = abi.decode(data, (string, address, uint96, address));

bytes32 labelhash = bytes32(tokenId);

require(
keccak256(bytes(label)) == bytes32(tokenId),
keccak256(bytes(label)) == labelhash,
"NameWrapper: Token id does match keccak(label) of label provided in data field"
);

bytes32 labelhash = bytes32(tokenId);

// transfer the ens record back to the new owner (this contract)
registrar.reclaim(uint256(labelhash), address(this));

Expand Down

0 comments on commit 5bd03c8

Please sign in to comment.