numbat_wasm_module_dns/
lib.rs

1#![no_std]
2
3mod dns_proxy;
4
5numbat_wasm::imports!();
6
7/// The module deals with registering usernames in a DNS contract.
8#[numbat_wasm::module]
9pub trait DnsModule {
10    #[proxy]
11    fn dns_proxy(&self, to: ManagedAddress) -> dns_proxy::Proxy<Self::Api>;
12
13    #[payable("REWA")]
14    #[endpoint(dnsRegister)]
15    fn dns_register(
16        &self,
17        dns_address: ManagedAddress,
18        name: BoxedBytes,
19        #[payment] payment: BigUint,
20    ) -> SCResult<AsyncCall> {
21        only_owner!(self, "only owner can call dnsRegister");
22
23        Ok(self
24            .dns_proxy(dns_address)
25            .register(name, payment)
26            .async_call())
27    }
28}