Rubyscore_Profile

Rubyscore_Profile is an SBT ERC721-based smart contract for claiming and managing user names. Users can claim unique names represented by ERC721 tokens.

OPERATOR_ROLE

bytes32 OPERATOR_ROLE

getIdByName

function getIdByName(string name) external pure returns (uint256)

See {IRubyscore_Profile}

getBaseURI

function getBaseURI() external view returns (string)

See {IRubyscore_Profile}

getBaseExtension

function getBaseExtension() external view returns (string)

See {IRubyscore_Profile}

checkName

function checkName(string name) external view returns (bool, uint256)

See {IRubyscore_Profile}

getPremiumPrice

function getPremiumPrice() external view returns (uint256)

See {IRubyscore_Profile}

getPremiumStatus

function getPremiumStatus(address userAddress) external view returns (bool)

See {IRubyscore_Profile}

getOwnerByName

function getOwnerByName(string name) external view returns (address)

See {IRubyscore_Profile}

getNameByOwner

function getNameByOwner(address userAddress) external view returns (string)

See {IRubyscore_Profile}

getNameById

function getNameById(uint256 id) external view returns (string)

See {IRubyscore_Profile}

getIdByOwner

function getIdByOwner(address userAddress) public view returns (uint256)

See {IRubyscore_Profile}

tokenURI

function tokenURI(uint256 tokenId) public view virtual returns (string)

See {IRubyscore_Profile}

hasName

function hasName(address _user) public view returns (bool)

See {IRubyscore_Profile}

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

See {IRubyscore_Profile}

constructor

constructor(address admin, address operator) public

Constructor to initialize the contract with admin and operator addresses.

Parameters

Name
Type
Description

admin

address

Address of the contract admin.

operator

address

Address of the contract operator.

updateBaseURI

function updateBaseURI(string newBaseURI) external

See {IRubyscore_Profile}

updateBaseExtension

function updateBaseExtension(string newBaseExtension) external

See {IRubyscore_Profile}

updatePremiumPrice

function updatePremiumPrice(uint256 newPremiumPrice) external

See {IRubyscore_Profile}

claimName

function claimName(string name) external payable returns (uint256 tokenId)

See {IRubyscore_Profile}

withdraw

function withdraw() external

See {IRubyscore_Profile}

_transfer

function _transfer(address, address, uint256) internal pure

Internal ERC721 transfer function override to prevent external transfers.

from The address to transfer from. to The address to transfer to. tokenId The ID of the token being transferred.

_convertNameToId

function _convertNameToId(string str) internal pure returns (uint256)

Converts a name string to a unique identifier (ID).

Parameters

Name
Type
Description

str

string

The name to convert to an ID.

Return Values

Name
Type
Description

[0]

uint256

The unique ID corresponding to the given name.

_convertStringToUint256

function _convertStringToUint256(string str) internal pure returns (uint256)

Converts a string to a unique uint256 value.

Parameters

Name
Type
Description

str

string

The string to convert to a uint256.

Return Values

Name
Type
Description

[0]

uint256

The unique uint256 value derived from the given string.

_normalizeName

function _normalizeName(string str) internal pure returns (string, bool)

Normalizes a given name string by converting it to lowercase and validating its length and characters.

Parameters

Name
Type
Description

str

string

The name to normalize.

Return Values

Name
Type
Description

[0]

string

normalizedName The normalized name string in lowercase.

[1]

bool

status True if the normalization was successful, indicating a valid name; otherwise, false.

_checkValidCharacters

function _checkValidCharacters(uint8 bCharacter) internal pure returns (bool)

Checks if a given character is valid within a name.

Parameters

Name
Type
Description

bCharacter

uint8

The character to check.

Return Values

Name
Type
Description

[0]

bool

True if the character is valid; otherwise, false.

strLength

function strLength(string s) internal pure returns (uint256)

Returns the length of a given string

Parameters

Name
Type
Description

s

string

The string to measure the length of

Return Values

Name
Type
Description

[0]

uint256

The length of the input string

Last updated