multiversx_sc_modules/dns.rs
1use crate::dns_proxy;
2
3multiversx_sc::imports!();
4
5/// Standard smart contract module that deals with registering usernames in a DNS contract.
6///
7/// MultiversX usernames/herotags need to be requested by the beneficiary.
8/// For a contract, this means that they need an endpoint via which to request a username from the DNS.
9///
10#[multiversx_sc::module]
11pub trait DnsModule {
12 #[payable("EGLD")]
13 #[only_owner]
14 #[endpoint(dnsRegister)]
15 fn dns_register(&self, dns_address: ManagedAddress, name: ManagedBuffer) {
16 let payment = self.call_value().egld().clone();
17 self.tx()
18 .to(&dns_address)
19 .typed(dns_proxy::DnsProxy)
20 .register(name)
21 .egld(payment)
22 .async_call_and_exit();
23 }
24}