The handle/sub-handle gets burned and are issued a new token ID when another user mints an expired handle/sub-handle using the mintHandle or mintSubhandle function. It's crucial for owners to renew before the expiration date to prevent reclamation through the mint function.
When a parent handle gets reclaimed by another user, the previous parent handle owner loses any upcoming revenue share from sub-handle owners, which is then transferred to the new owner of the handle.
Burn Handle:
/** * Function to burn an expired handle. * @param tokenId The token ID associated with the handle. */functionburnHandle(uint256 tokenId) internal {// Get the handle name with suffix and the corresponding handle.stringmemory handleWithSuffix = handleNames[tokenId]; Handle storage handle = handles[handleWithSuffix];// Check if the handle is registered.require(handle.tokenId !=0,"Handle not registered");// Check if the handle is expired.require(handle.expirationTimestamp <= block.timestamp,"Handle is not expired");address owner =ownerOf(tokenId); // Get the owner of the token.// Mark the token as burned burnedTokenIds[tokenId] =true;// Burn the token_burn(tokenId);emitHandleBurned(owner, handleWithSuffix, tokenId); }
Burn Sub-Handle:
/** * Function to burn an expired subhandle. * @param subhandleAndParent The combined name of the subhandle and its parent handle. */functionburnSubhandle(stringmemory subhandleAndParent) internal {// Split the combined handle name into subhandle name and parent handle name. (string memory subhandleName, string memory parentHandleName) = StringUtil.splitCombinedHandleName(subhandleAndParent);
// Construct the parent handle name with suffix.stringmemory parentHandleWithSuffix =string(abi.encodePacked(parentHandleName,".",string(HANDLE_SUFFIX)));// Get the subhandle from the parent handle's subhandles mapping. Subhandle storage subhandle = handles[parentHandleWithSuffix].subhandles[subhandleName];// Check if the subhandle is registered.require(subhandle.tokenId !=0,"Subhandle not registered");// Check if the subhandle is expired.require(subhandle.expirationTimestamp <= block.timestamp,"Subhandle is not expired");// Mark the token as burned burnedTokenIds[subhandle.tokenId] =true;// Burn the token_burn(subhandle.tokenId);// Construct the subhandle name with suffix.stringmemory subhandleWithSuffix =string(abi.encodePacked(subhandleName,".", parentHandleWithSuffix));emitSubhandleBurned(msg.sender, subhandleWithSuffix, subhandle.tokenId); }