# (EVM) Proxy Doma Record API

User-facing facet for the Proxy DOMA record contract on tokenization chains.

*This facet handles user interactions including tokenization requests, ownership claims, cross-chain bridging, and domain record management. It validates vouchers, manages fees, and integrates with EIP-712 for signature verification. Supports both ownership tokens and capability tokens with appropriate access controls.*

{% file src="<https://3605822629-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fte9OGCgBObOj1vn0919Q%2Fuploads%2Fb5t1MM2zlcCnthYG436X%2FProxyDomaRecordUserFacet.json?alt=media&token=7aa39677-4ccd-465c-9d0c-c10c80775776>" %}
ABI
{% endfile %}

## Structs

#### TokenizationVoucher

Tokenization voucher, obtained from a Registrar.

**Parameters**

| Name | Type | Description |
| ---- | ---- | ----------- |

```solidity
struct TokenizationVoucher {
  struct IDomaRecord.NameInfo[] names;
  uint256 nonce;
  uint256 expiresAt;
  address ownerAddress;
}
```

#### ProofOfContactsVoucher

Proof of Contacts voucher, obtained from a Registrar or Doma-provided storage.

**Parameters**

| Name | Type | Description |
| ---- | ---- | ----------- |

```solidity
struct ProofOfContactsVoucher {
  uint256 registrantHandle;
  enum IDomaRecord.ProofOfContactsSource proofSource;
  uint256 nonce;
  uint256 expiresAt;
}
```

## Errors

### InsufficientCapabilities

```solidity
error InsufficientCapabilities(uint256 tokenId, uint256 requiredCapability)
```

Thrown when a token lacks the required capabilities for an operation.

#### Parameters

| Name               | Type    | Description                              |
| ------------------ | ------- | ---------------------------------------- |
| tokenId            | uint256 | The ID of the token being checked        |
| requiredCapability | uint256 | The capability bitmask that was required |

#### NameAlreadyTokenized

```solidity
error NameAlreadyTokenized(string sld, string tld)
```

Thrown when attempting to tokenize a name that is already tokenized.

**Parameters**

| Name | Type   | Description                         |
| ---- | ------ | ----------------------------------- |
| sld  | string | The second-level domain of the name |
| tld  | string | The top-level domain of the name    |

#### InvalidRegistrar

```solidity
error InvalidRegistrar(uint256 ianaId, uint256 expectedIanaId)
```

Thrown when a registrar ID doesn't match the expected registrar for an operation.

**Parameters**

| Name           | Type    | Description                    |
| -------------- | ------- | ------------------------------ |
| ianaId         | uint256 | The provided registrar IANA ID |
| expectedIanaId | uint256 | The expected registrar IANA ID |

#### NotImplemented

```solidity
error NotImplemented()
```

Thrown when attempting to use functionality not yet implemented for synthetic tokens.

#### UnsupportedTargetChain

```solidity
error UnsupportedTargetChain(string chainId)
```

Thrown when attempting to bridge to an unsupported target chain.

**Parameters**

| Name    | Type   | Description                               |
| ------- | ------ | ----------------------------------------- |
| chainId | string | The unsupported chain ID in CAIP-2 format |

#### TransferLocked

```solidity
error TransferLocked(uint256 tokenId)
```

Thrown when attempting to transfer a token that is locked for transfers.

**Parameters**

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| tokenId | uint256 | The ID of the locked token |

#### NameTokenHasExpired

```solidity
error NameTokenHasExpired(uint256 tokenId, uint256 expiresAt)
```

Thrown when attempting to operate on an expired name token.

**Parameters**

| Name      | Type    | Description                           |
| --------- | ------- | ------------------------------------- |
| tokenId   | uint256 | The ID of the expired token           |
| expiresAt | uint256 | The expiration timestamp of the token |

#### InvalidSigner

```solidity
error InvalidSigner(address signer)
```

Thrown when a voucher signature is invalid or from an unauthorized signer.

**Parameters**

| Name   | Type    | Description                                       |
| ------ | ------- | ------------------------------------------------- |
| signer | address | The address that was recovered from the signature |

#### VoucherExpired

```solidity
error VoucherExpired(uint256 expiresAt, uint256 currentTime)
```

Thrown when a voucher has expired and cannot be used.

**Parameters**

| Name        | Type    | Description                             |
| ----------- | ------- | --------------------------------------- |
| expiresAt   | uint256 | The expiration timestamp of the voucher |
| currentTime | uint256 | The current block timestamp             |

#### PriceFeedStalePrice

```solidity
error PriceFeedStalePrice(uint80 roundId, uint256 updatedAt)
```

Thrown when the price feed data is stale and cannot be trusted.

**Parameters**

| Name      | Type    | Description                                   |
| --------- | ------- | --------------------------------------------- |
| roundId   | uint80  | The round ID from the price feed              |
| updatedAt | uint256 | The timestamp when the price was last updated |

#### InvalidPrice

```solidity
error InvalidPrice(int256 price)
```

Thrown when the price feed returns an invalid price value.

**Parameters**

| Name  | Type   | Description                      |
| ----- | ------ | -------------------------------- |
| price | int256 | The invalid price value returned |

#### TransferFailed

```solidity
error TransferFailed()
```

Thrown when a native currency transfer fails.

#### InvalidFee

```solidity
error InvalidFee(uint256 expectedFee, uint256 providedFee)
```

Thrown when the provided fee doesn't match the expected fee for an operation.

**Parameters**

| Name        | Type    | Description                      |
| ----------- | ------- | -------------------------------- |
| expectedFee | uint256 | The expected fee amount in wei   |
| providedFee | uint256 | The fee amount actually provided |

#### FeeNotRequired

```solidity
error FeeNotRequired(bytes32 operation, uint256 nameCount)
```

Thrown when a fee is provided for an operation that doesn't require payment.

**Parameters**

| Name      | Type    | Description                         |
| --------- | ------- | ----------------------------------- |
| operation | bytes32 | The operation identifier            |
| nameCount | uint256 | The number of names being processed |

#### NonceAlreadyUsed

```solidity
error NonceAlreadyUsed(uint256 nonce)
```

Thrown when attempting to reuse a nonce that has already been consumed.

**Parameters**

| Name  | Type    | Description                     |
| ----- | ------- | ------------------------------- |
| nonce | uint256 | The nonce that was already used |

#### FeeCollected

```solidity
event FeeCollected(uint256 feeWei, uint256 feeUsdCents, string correlationId)
```

Emitted when a fee is collected for an operation.

**Parameters**

| Name          | Type    | Description                                   |
| ------------- | ------- | --------------------------------------------- |
| feeWei        | uint256 | The fee amount collected in wei               |
| feeUsdCents   | uint256 | The equivalent fee amount in USD cents        |
| correlationId | string  | The correlation ID for tracking the operation |

## Methods

#### requestTokenization

```solidity
function requestTokenization(struct ProxyDomaRecordUserFacet.TokenizationVoucher voucher, bytes signature) external payable
```

Request tokenization of domain names using a signed voucher from a registrar.

*Validates the voucher signature, collects fees, and initiates cross-chain tokenization. The voucher must be signed by an authorized registrar and not expired. Names are validated for proper format and checked for existing tokenization on this chain.*

**Parameters**

| Name      | Type                                                | Description                                                         |
| --------- | --------------------------------------------------- | ------------------------------------------------------------------- |
| voucher   | struct ProxyDomaRecordUserFacet.TokenizationVoucher | The tokenization voucher containing names and authorization details |
| signature | bytes                                               | The registrar's signature over the voucher data                     |

#### claimOwnership

```solidity
function claimOwnership(uint256 tokenId, bool isSynthetic, struct ProxyDomaRecordUserFacet.ProofOfContactsVoucher proofOfContactsVoucher, bytes signature) external payable
```

Claim ownership of a domain name using proof of contacts voucher.

*Allows token owners to establish claim over their domain by providing signed proof from either the registrar or DOMA system. Validates voucher signature, collects fees, and initiates cross-chain ownership claim process.*

**Parameters**

| Name                   | Type                                                   | Description                                              |
| ---------------------- | ------------------------------------------------------ | -------------------------------------------------------- |
| tokenId                | uint256                                                | The ID of the ownership token being claimed              |
| isSynthetic            | bool                                                   | Whether the token is synthetic (currently not supported) |
| proofOfContactsVoucher | struct ProxyDomaRecordUserFacet.ProofOfContactsVoucher | The voucher containing proof of contact information      |
| signature              | bytes                                                  | The signature over the voucher (from registrar or DOMA)  |

#### bridge

```solidity
function bridge(uint256 tokenId, bool isSynthetic, string targetChainId, string targetOwnerAddress) external payable
```

Bridge a domain token to another supported chain.

*Burns the token on this chain and initiates minting on the target chain. Validates target chain support, transfer lock status, and token expiration. Collects fees and relays the bridge request to the DOMA chain.*

**Parameters**

| Name               | Type    | Description                                              |
| ------------------ | ------- | -------------------------------------------------------- |
| tokenId            | uint256 | The ID of the ownership token to bridge                  |
| isSynthetic        | bool    | Whether the token is synthetic (currently not supported) |
| targetChainId      | string  | The CAIP-2 chain ID of the destination chain             |
| targetOwnerAddress | string  | The owner address on the target chain                    |

#### requestDetokenization

```solidity
function requestDetokenization(uint256 tokenId, bool isSynthetic) external
```

Request detokenization of a domain name by the owner.

*Initiates the detokenization process on the DOMA chain, which will remove the domain from the protocol and return it to traditional DNS management. Only the token owner can request detokenization.*

**Parameters**

| Name        | Type    | Description                                              |
| ----------- | ------- | -------------------------------------------------------- |
| tokenId     | uint256 | The ID of the ownership token to detokenize              |
| isSynthetic | bool    | Whether the token is synthetic (currently not supported) |

#### setNameservers

```solidity
function setNameservers(uint256 tokenId, string[] nameservers, bool isSynthetic) external payable
```

Update nameservers for a domain.

*Requires CAPABILITY\_REGISTRY\_RECORDS\_MANAGEMENT. Relays change to Doma Chain.*

**Parameters**

| Name        | Type      | Description                                     |
| ----------- | --------- | ----------------------------------------------- |
| tokenId     | uint256   | The ownership token ID.                         |
| nameservers | string\[] | List of nameserver hostnames.                   |
| isSynthetic | bool      | Must be false (synthetic tokens not supported). |

#### setDSKeys

```solidity
function setDSKeys(uint256 tokenId, struct IDomaRecord.DSKey[] dsKeys, bool isSynthetic) external payable
```

Update DNSSEC DS keys for a domain.

*Requires CAPABILITY\_REGISTRY\_RECORDS\_MANAGEMENT. Relays change to Doma Chain.*

**Parameters**

| Name        | Type                        | Description                                     |
| ----------- | --------------------------- | ----------------------------------------------- |
| tokenId     | uint256                     | The ownership token ID.                         |
| dsKeys      | struct IDomaRecord.DSKey\[] | Array of DS key records.                        |
| isSynthetic | bool                        | Must be false (synthetic tokens not supported). |

#### setDNSRRSet

```solidity
function setDNSRRSet(uint256 tokenId, string host, string recordType, uint32 ttl, string[] records, bool isSynthetic) external payable
```

Set DNS resource record set for a domain.

*Requires CAPABILITY\_DNS\_RECORDS\_MANAGEMENT. Relays change to Doma Chain.*

**Parameters**

| Name        | Type      | Description                                            |
| ----------- | --------- | ------------------------------------------------------ |
| tokenId     | uint256   | The ownership token ID.                                |
| host        | string    | The hostname (e.g., "www" or "@" for apex).            |
| recordType  | string    | DNS record type (e.g., "A", "AAAA", "CNAME").          |
| ttl         | uint32    | Time-to-live in seconds.                               |
| records     | string\[] | Array of record values. Empty array deletes the RRSet. |
| isSynthetic | bool      | Must be false (synthetic tokens not supported).        |

#### feesUSDCents

```solidity
function feesUSDCents(bytes32 operation) public view returns (uint256)
```

Get the fee in USD cents for a specific operation.

**Parameters**

| Name      | Type    | Description                       |
| --------- | ------- | --------------------------------- |
| operation | bytes32 | The operation identifier to query |

**Return Values**

| Name | Type    | Description                 |
| ---- | ------- | --------------------------- |
| \[0] | uint256 | The fee amount in USD cents |

#### isTargetChainSupported

```solidity
function isTargetChainSupported(string targetChainId) public view returns (bool)
```

Check if a target chain is supported for bridging operations.

**Parameters**

| Name          | Type   | Description                          |
| ------------- | ------ | ------------------------------------ |
| targetChainId | string | The CAIP-2 chain identifier to check |

**Return Values**

| Name | Type | Description                           |
| ---- | ---- | ------------------------------------- |
| \[0] | bool | Whether the target chain is supported |

#### getNativePrice

```solidity
function getNativePrice(uint256 feeUSDCents) public view returns (uint256 nativeFee)
```

Convert a USD cent amount to the equivalent native token amount.

*Uses Chainlink price feed to get current exchange rate. Validates price feed data.*

**Parameters**

| Name        | Type    | Description                 |
| ----------- | ------- | --------------------------- |
| feeUSDCents | uint256 | The fee amount in USD cents |

**Return Values**

| Name      | Type    | Description                            |
| --------- | ------- | -------------------------------------- |
| nativeFee | uint256 | The equivalent fee in native token wei |

#### getOperationFeeInNative

```solidity
function getOperationFeeInNative(bytes32 operation) public view returns (uint256)
```

Get the fee in native tokens for a specific operation.

*Combines USD cent fee lookup with current price conversion.*

**Parameters**

| Name      | Type    | Description                       |
| --------- | ------- | --------------------------------- |
| operation | bytes32 | The operation identifier to query |

**Return Values**

| Name | Type    | Description                                                    |
| ---- | ------- | -------------------------------------------------------------- |
| \[0] | uint256 | The fee amount in native token wei (0 if operation has no fee) |

#### version

```solidity
function version() external pure returns (string)
```

Get the contract version.

**Return Values**

| Name | Type   | Description                         |
| ---- | ------ | ----------------------------------- |
| \[0] | string | The version string of this contract |

#### REQUEST\_TOKENIZATION\_OPERATION

```solidity
function REQUEST_TOKENIZATION_OPERATION() external pure returns (bytes32)
```

Get the REQUEST\_TOKENIZATION\_OPERATION constant

**Return Values**

| Name | Type    | Description                                 |
| ---- | ------- | ------------------------------------------- |
| \[0] | bytes32 | The operation hash for request tokenization |

#### CLAIM\_OWNERSHIP\_OPERATION

```solidity
function CLAIM_OWNERSHIP_OPERATION() external pure returns (bytes32)
```

Get the CLAIM\_OWNERSHIP\_OPERATION constant

**Return Values**

| Name | Type    | Description                            |
| ---- | ------- | -------------------------------------- |
| \[0] | bytes32 | The operation hash for claim ownership |

#### BRIDGE\_OPERATION

```solidity
function BRIDGE_OPERATION() external pure returns (bytes32)
```

Get the BRIDGE\_OPERATION constant

**Return Values**

| Name | Type    | Description                   |
| ---- | ------- | ----------------------------- |
| \[0] | bytes32 | The operation hash for bridge |

#### SET\_NAMESERVERS\_OPERATION

```solidity
function SET_NAMESERVERS_OPERATION() external pure returns (bytes32)
```

Get the SET\_NAMESERVERS\_OPERATION constant

**Return Values**

| Name | Type    | Description                            |
| ---- | ------- | -------------------------------------- |
| \[0] | bytes32 | The operation hash for set nameservers |

#### SET\_DS\_KEYS\_OPERATION

```solidity
function SET_DS_KEYS_OPERATION() external pure returns (bytes32)
```

Get the SET\_DS\_KEYS\_OPERATION constant

**Return Values**

| Name | Type    | Description                        |
| ---- | ------- | ---------------------------------- |
| \[0] | bytes32 | The operation hash for set DS keys |

#### SET\_DNS\_RRSET\_OPERATION

```solidity
function SET_DNS_RRSET_OPERATION() external pure returns (bytes32)
```

Get the SET\_DNS\_RRSET\_OPERATION constant

**Return Values**

| Name | Type    | Description                          |
| ---- | ------- | ------------------------------------ |
| \[0] | bytes32 | The operation hash for set DNS RRSet |
