简体   繁体   中英

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. 这是我创建的示例子域名。我需要使用智能合约在记录中添加 ETH 地址,而无需手动添加。

    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.

I found a way to add the Eth address to the record for referring the specific subdomain name. I've used the public contract address "0xf6305c19e814d2a75429Fd637d01F7ee0E77d615" along with the ABI file provided for this contract address.

And implemented the method named "setAddr" that was published under the same ABI and the Contract address.

For more reference, Can visit the provided link.

https://rinkeby.etherscan.io/address/0xf6305c19e814d2a75429Fd637d01F7ee0E77d615#code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM