'How to implement smart contract to add eth address record to refer the specific ENS subdomain name in solidity

I have wrote the smart contract for creating ENS subdomain name. I need to pass the reference ETH address record for that created subdomain name.This is the sample subdomain name that I was created. I need to add the ETH address inside the records using the smart contract without add manually.

    pragma solidity >=0.8.4;

import "./ENS.sol";

contract EnsSubdomain {
    ENS public immutable ens;
    bytes32 public immutable rootNode;

    constructor(ENS ensAddr, bytes32 node) {
        ens = ensAddr;
        rootNode = node;
    }

    function createSubdomain(
        bytes32 label,
        address owner,
        address resolver,
        uint64 ttl
    ) public {
        ens.setSubnodeRecord(rootNode, label, owner, resolver, ttl);
    }
}

Hereby I have attached the codebase that I have implemented in solidity to create the subdomain name.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source