Skip to main content

Getter Functions

Implementation Note

Getter functions are view functions that do not modify state. They do NOT use Core.sol's signature verification system. References to "EVVM" in function names (e.g., getCoreAddress) refer to the Core.sol contract address.

This section documents the view functions available in the Name Service contract that allow querying system state, user information, pricing details, and administrative data. These functions are read-only and do not modify the blockchain state.


Identity Verification Functions​

verifyIfIdentityExists​

Function Type: public view
Function Signature: verifyIfIdentityExists(string memory _identity) returns (bool)

Checks if an identity exists in the system, handling both pre-registrations and actual username registrations.

Parameters​

ParameterTypeDescription
_identitystringThe identity/username to check

Returns​

TypeDescription
booltrue if the identity exists and is valid

strictVerifyIfIdentityExist​

Function Type: public view
Function Signature: strictVerifyIfIdentityExist(string memory _username) returns (bool)

Strictly verifies if an identity exists and reverts if not found. This is a more strict version that reverts instead of returning false.

Parameters​

ParameterTypeDescription
_usernamestringThe username to verify

Returns​

TypeDescription
booltrue if username exists (reverts if not found)

isUsernameAvailable​

Function Type: public view
Function Signature: isUsernameAvailable(string memory _username) returns (bool)

Checks if a username is available for registration. A username is available if it was never registered or has been expired for 60+ days.

Parameters​

ParameterTypeDescription
_usernamestringThe username to check availability for

Returns​

TypeDescription
booltrue if username is available for registration

Identity Information Functions​

getOwnerOfIdentity​

Function Type: public view
Function Signature: getOwnerOfIdentity(string memory _username) returns (address)

Returns the owner address of a registered identity.

Parameters​

ParameterTypeDescription
_usernamestringThe username to query

Returns​

TypeDescription
addressAddress of the username owner

verifyStrictAndGetOwnerOfIdentity​

Function Type: public view
Function Signature: verifyStrictAndGetOwnerOfIdentity(string memory _username) returns (address)

Combines strict verification with owner lookup in one call. Reverts if username doesn't exist.

Parameters​

ParameterTypeDescription
_usernamestringThe username to verify and get owner

Returns​

TypeDescription
addressOwner address (reverts if username not found)

getIdentityBasicMetadata​

Function Type: public view
Function Signature: getIdentityBasicMetadata(string memory _username) returns (address, uint256)

Returns essential metadata for quick identity verification including owner and expiration date.

Parameters​

ParameterTypeDescription
_usernamestringThe username to get basic info for

Returns​

TypeDescription
(address, uint256)Owner address and expiration timestamp

getExpireDateOfIdentity​

Function Type: public view
Function Signature: getExpireDateOfIdentity(string memory _identity) returns (uint256)

Returns the timestamp when the username registration expires.

Parameters​

ParameterTypeDescription
_identitystringThe username to check expiration for

Returns​

TypeDescription
uint256Expiration timestamp in seconds since Unix epoch

Custom Metadata Functions​

getAmountOfCustomMetadata​

Function Type: public view
Function Signature: getAmountOfCustomMetadata(string memory _username) returns (uint256)

Returns the count of metadata slots currently used by a username.

Parameters​

ParameterTypeDescription
_usernamestringThe username to count metadata

Returns​

TypeDescription
uint256Number of custom metadata entries

getFullCustomMetadataOfIdentity​

Function Type: public view
Function Signature: getFullCustomMetadataOfIdentity(string memory _username) returns (string[] memory)

Retrieves all custom metadata entries for a username as an array.

Parameters​

ParameterTypeDescription
_usernamestringThe username to get metadata

Returns​

TypeDescription
string[] memoryArray of all custom metadata strings

getSingleCustomMetadataOfIdentity​

Function Type: public view
Function Signature: getSingleCustomMetadataOfIdentity(string memory _username, uint256 _key) returns (string memory)

Retrieves a specific custom metadata entry by index.

Parameters​

ParameterTypeDescription
_usernamestringThe username to get metadata from
_keyuint256The index of the metadata entry

Returns​

TypeDescription
string memoryThe metadata string at the specified index

getCustomMetadataMaxSlotsOfIdentity​

Function Type: public view
Function Signature: getCustomMetadataMaxSlotsOfIdentity(string memory _username) returns (uint256)

Returns the total capacity for custom metadata entries.

Parameters​

ParameterTypeDescription
_usernamestringThe username to check metadata capacity

Returns​

TypeDescription
uint256Maximum number of metadata slots

Marketplace Functions​

getOffersOfUsername​

Function Type: public view
Function Signature: getOffersOfUsername(string memory _username) returns (OfferMetadata[] memory)

Returns all offers made for a specific username, including both active and expired offers.

Parameters​

ParameterTypeDescription
_usernamestringThe username to get offers for

Returns​

TypeDescription
OfferMetadata[] memoryArray of all offer metadata structures

getSingleOfferOfUsername​

Function Type: public view
Function Signature: getSingleOfferOfUsername(string memory _username, uint256 _offerID) returns (OfferMetadata memory)

Retrieves detailed information about a particular offer.

Parameters​

ParameterTypeDescription
_usernamestringThe username to get offer from
_offerIDuint256The ID/index of specific offer

Returns​

TypeDescription
OfferMetadata memoryThe complete offer metadata structure

getLengthOfOffersUsername​

Function Type: public view
Function Signature: getLengthOfOffersUsername(string memory _username) returns (uint256)

Counts the total number of offers made for a username.

Parameters​

ParameterTypeDescription
_usernamestringThe username to count offers

Returns​

TypeDescription
uint256Total number of offers that have been made

Pricing Functions​

getPriceOfRegistration​

Function Type: public view
Function Signature: getPriceOfRegistration(string memory username) returns (uint256)

Returns the price to register a specific username. Price is fully dynamic based on existing offers and timing:

  • No Offers: Price is 100x current EVVM reward amount (standard rate)
  • Has Offers: Price is calculated using seePriceToRenew function logic (market-based pricing)
    • Uses the same complex pricing algorithm as username renewal
    • Factors in active offers, market demand, and timing
    • Results in higher prices for in-demand usernames

Parameters​

ParameterTypeDescription
usernamestringThe username to get registration price for

Returns​

TypeDescription
uint256Current registration price in Principal Tokens

seePriceToRenew​

Function Type: public view
Function Signature: seePriceToRenew(string memory _identity) returns (uint256)

Calculates the cost to renew a username registration. Pricing varies based on timing and market demand:

  • Active username with no offers: 500 * 10^18 (500 PT)
  • Active username with offers: Highest active offer amount (capped at 500,000 * reward)
  • Expired username: 500,000 * core.getRewardAmount()

Parameters​

ParameterTypeDescription
_identitystringThe username to calculate renewal price for

Returns​

TypeDescription
uint256Cost in Principal Tokens to renew the username

getPriceToAddCustomMetadata​

Function Type: public view
Function Signature: getPriceToAddCustomMetadata() returns (uint256)

Returns the current price to add custom metadata to a username. Price is dynamic based on current EVVM reward amount (10x reward).

Returns​

TypeDescription
uint256Cost in Principal Tokens (10x current reward)

getPriceToRemoveCustomMetadata​

Function Type: public view** **Function Signature**: getPriceToRemoveCustomMetadata() returns (uint256)`

Returns the current price to remove a single custom metadata entry.

Returns​

TypeDescription
uint256Cost in Principal Tokens (10x current reward)

getPriceToFlushCustomMetadata​

Function Type: public view
Function Signature: getPriceToFlushCustomMetadata(string memory _identity) returns (uint256)

Returns the cost to remove all custom metadata entries from a username. Cost scales with the number of metadata entries.

Parameters​

ParameterTypeDescription
_identitystringThe username to calculate cost for

Returns​

TypeDescription
uint256Total cost (10x reward amount per metadata entry)

getPriceToFlushUsername​

Function Type: public view
Function Signature: getPriceToFlushUsername(string memory _identity) returns (uint256)

Returns the cost to completely remove a username and all its data. Includes cost for metadata removal plus base deletion fee.

Parameters​

ParameterTypeDescription
_identitystringThe username to calculate cost for

Returns​

TypeDescription
uint256Total cost (metadata flush cost + 1x reward amount)

Administrative Getter Functions​

getAdmin​

Function Type: public view
Function Signature: getAdmin() returns (address)

Returns the current admin address with administrative privileges.

Returns​

TypeDescription
addressThe current admin address

getAdminFullDetails​

Function Type: public view
Function Signature: getAdminFullDetails() returns (address, address, uint256)

Returns complete admin information including pending proposals.

Returns​

TypeDescription
(address, address, uint256)Current admin, proposed admin, acceptance time

getProposedWithdrawAmountFullDetails​

Function Type: public view
Function Signature: getProposedWithdrawAmountFullDetails() returns (uint256, uint256)

Returns information about pending token withdrawal proposals.

Returns​

TypeDescription
(uint256, uint256)Proposed withdrawal amount and acceptance deadline

getCoreAddress​

Function Type: public view
Function Signature: getCoreAddress() returns (address)

Returns the address of the Core contract used for payment processing.

Returns​

TypeDescription
addressThe current Core contract address

getCoreAddressFullDetails​

Function Type: public view
Function Signature: getCoreAddressFullDetails() returns (address, address, uint256)

Returns complete Core address information including pending proposals.

Returns​

TypeDescription
(address, address, uint256)Current Core address, proposed address, acceptance time

Utility Functions​

hashUsername​

Function Type: public pure
Function Signature: hashUsername(string memory _username, uint256 _randomNumber) returns (bytes32)

Creates a hash of username and random number for pre-registration using the commit-reveal scheme to prevent front-running attacks.

Parameters​

ParameterTypeDescription
_usernamestringThe username to hash
_randomNumberuint256Random number to add entropy

Returns​

TypeDescription
bytes32Hash of the username and random number

Data Validation Functions​

These functions validate input data formats according to system rules and standards.

Username Validation​

Function: isValidUsername(string memory username) (internal pure)

Validates username format according to system rules:

  • Must be at least 4 characters
  • Must start with a letter
  • Can only contain letters and digits

Email Validation​

Function: isValidEmail(string memory _email) (internal pure)

Validates email address format:

  • Checks for proper structure: prefix(3+ chars) + @ + domain(3+ chars) + . + TLD(2+ chars)
  • Ensures valid characters in each section
  • Returns true for valid format

Phone Number Validation​

Function: isValidPhoneNumberNumber(string memory _phoneNumber) (internal pure)

Validates phone number format:

  • Must be 6-19 digits only (note: code uses inverted logic checking < 20 && > 5 to reject invalid lengths)
  • No special characters or letters allowed
  • Returns true for valid format
Internal Functions

The validation functions are marked as internal and are used by other contract functions for input validation. They are not directly callable from external contracts or users.