Skip to main content

SoulName

Masa Finance

SoulName NFT

SoulName NFT that points to a Soulbound identity token

SoulName NFT, that inherits from the NFT contract, and points to a Soulbound identity token. It has an extension, and stores all the information about the identity names.

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

NameTypeDescription
_0bytes32undefined

MINTER_ROLE

function MINTER_ROLE() external view returns (bytes32)

Returns

NameTypeDescription
_0bytes32undefined

approve

function approve(address to, uint256 tokenId) external nonpayable

See {IERC721-approve}.

Parameters

NameTypeDescription
toaddressundefined
tokenIduint256undefined

balanceOf

function balanceOf(address owner) external view returns (uint256)

See {IERC721-balanceOf}.

Parameters

NameTypeDescription
owneraddressundefined

Returns

NameTypeDescription
_0uint256undefined

burn

function burn(uint256 tokenId) external nonpayable

Burn a soul name

The caller must be the owner or an approved address of the soul name.

Parameters

NameTypeDescription
tokenIduint256TokenId of the soul name to burn

contractURI

function contractURI() external view returns (string)

Returns

NameTypeDescription
_0stringundefined

exists

function exists(uint256 tokenId) external view returns (bool)

Returns true if the token exists

Returns true if the token has been minted

Parameters

NameTypeDescription
tokenIduint256Token to check

Returns

NameTypeDescription
_0boolTrue if the token exists

extension

function extension() external view returns (string)

Returns

NameTypeDescription
_0stringundefined

getApproved

function getApproved(uint256 tokenId) external view returns (address)

See {IERC721-getApproved}.

Parameters

NameTypeDescription
tokenIduint256undefined

Returns

NameTypeDescription
_0addressundefined

getExtension

function getExtension() external view returns (string)

Returns the extension of the soul name

This function is used to get the extension of the soul name

Returns

NameTypeDescription
_0stringExtension of the soul name

getRoleAdmin

function getRoleAdmin(bytes32 role) external view returns (bytes32)

Returns the admin role that controls role. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.

Parameters

NameTypeDescription
rolebytes32undefined

Returns

NameTypeDescription
_0bytes32undefined

getSoulNames

function getSoulNames(uint256 identityId) external view returns (string[] sbtNames)

Returns all the active soul names of an account

This function queries all the identity names of the specified identity Id

Parameters

NameTypeDescription
identityIduint256TokenId of the identity

Returns

NameTypeDescription
sbtNamesstring[]Array of soul names associated to the identity Id

getSoulNames

function getSoulNames(address owner) external view returns (string[] sbtNames)

Returns all the active soul names of an account

This function queries all the identity names of the specified account

Parameters

NameTypeDescription
owneraddressAddress of the owner of the identities

Returns

NameTypeDescription
sbtNamesstring[]Array of soul names associated to the account

getTokenData

function getTokenData(string name) external view returns (string sbtName, bool linked, uint256 identityId, uint256 tokenId, uint256 expirationDate, bool active)

Returns the information of a soul name

This function queries the information of a soul name

Parameters

NameTypeDescription
namestringName of the soul name

Returns

NameTypeDescription
sbtNamestringSoul name, in upper/lower case and extension
linkedbooltrue if the soul name is linked, false otherwise
identityIduint256Identity id of the soul name
tokenIduint256SoulName id of the soul name
expirationDateuint256Expiration date of the soul name
activebooltrue if the soul name is active, false otherwise

getTokenId

function getTokenId(string name) external view returns (uint256)

Returns the token id of a soul name

This function queries the token id of a soul name

Parameters

NameTypeDescription
namestringName of the soul name

Returns

NameTypeDescription
_0uint256SoulName id of the soul name

grantRole

function grantRole(bytes32 role, address account) external nonpayable

Grants role to account. If account had not been already granted role, emits a {RoleGranted} event. Requirements: - the caller must have role's admin role. May emit a {RoleGranted} event.

Parameters

NameTypeDescription
rolebytes32undefined
accountaddressundefined

hasRole

function hasRole(bytes32 role, address account) external view returns (bool)

Returns true if account has been granted role.

Parameters

NameTypeDescription
rolebytes32undefined
accountaddressundefined

Returns

NameTypeDescription
_0boolundefined

isApprovedForAll

function isApprovedForAll(address owner, address operator) external view returns (bool)

See {IERC721-isApprovedForAll}.

Parameters

NameTypeDescription
owneraddressundefined
operatoraddressundefined

Returns

NameTypeDescription
_0boolundefined

isAvailable

function isAvailable(string name) external view returns (bool available)

Checks if a soul name is available

This function queries if a soul name already exists and is in the available state

Parameters

NameTypeDescription
namestringName of the soul name

Returns

NameTypeDescription
availablebooltrue if the soul name is available, false otherwise

mint

function mint(address to, string name, uint256 yearsPeriod, string _tokenURI) external nonpayable returns (uint256)

Mints a new soul name

The caller can mint more than one name. The soul name must be unique.

Parameters

NameTypeDescription
toaddressAddress of the owner of the new soul name
namestringName of the new soul name
yearsPerioduint256Years of validity of the name
_tokenURIstringURI of the NFT

Returns

NameTypeDescription
_0uint256undefined

name

function name() external view returns (string)

See {IERC721Metadata-name}.

Returns

NameTypeDescription
_0stringundefined

nameData

function nameData(string) external view returns (bool exists, uint256 tokenId)

Parameters

NameTypeDescription
_0stringundefined

Returns

NameTypeDescription
existsboolundefined
tokenIduint256undefined

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription
_0addressundefined

ownerOf

function ownerOf(uint256 tokenId) external view returns (address)

See {IERC721-ownerOf}.

Parameters

NameTypeDescription
tokenIduint256undefined

Returns

NameTypeDescription
_0addressundefined

renewYearsPeriod

function renewYearsPeriod(uint256 tokenId, uint256 yearsPeriod) external nonpayable

Update the expiration date of a soul name

The caller must be the owner or an approved address of the soul name.

Parameters

NameTypeDescription
tokenIduint256TokenId of the soul name
yearsPerioduint256Years of validity of the name

renounceOwnership

function renounceOwnership() external nonpayable

Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.

renounceRole

function renounceRole(bytes32 role, address account) external nonpayable

Revokes role from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role, emits a {RoleRevoked} event. Requirements: - the caller must be account. May emit a {RoleRevoked} event.

Parameters

NameTypeDescription
rolebytes32undefined
accountaddressundefined

revokeRole

function revokeRole(bytes32 role, address account) external nonpayable

Revokes role from account. If account had been granted role, emits a {RoleRevoked} event. Requirements: - the caller must have role's admin role. May emit a {RoleRevoked} event.

Parameters

NameTypeDescription
rolebytes32undefined
accountaddressundefined

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 tokenId) external nonpayable

See {IERC721-safeTransferFrom}.

Parameters

NameTypeDescription
fromaddressundefined
toaddressundefined
tokenIduint256undefined

safeTransferFrom

function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external nonpayable

See {IERC721-safeTransferFrom}.

Parameters

NameTypeDescription
fromaddressundefined
toaddressundefined
tokenIduint256undefined
databytesundefined

setApprovalForAll

function setApprovalForAll(address operator, bool approved) external nonpayable

See {IERC721-setApprovalForAll}.

Parameters

NameTypeDescription
operatoraddressundefined
approvedboolundefined

setContractURI

function setContractURI(string _contractURI) external nonpayable

Sets the URI of the smart contract metadata

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_contractURIstringURI of the smart contract metadata

setExtension

function setExtension(string _extension) external nonpayable

Sets the extension of the soul name

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_extensionstringExtension of the soul name

setSoulboundIdentity

function setSoulboundIdentity(contract ISoulboundIdentity _soulboundIdentity) external nonpayable

Sets the SoulboundIdentity contract address linked to this soul name

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_soulboundIdentitycontract ISoulboundIdentityAddress of the SoulboundIdentity contract

soulboundIdentity

function soulboundIdentity() external view returns (contract ISoulboundIdentity)

Returns

NameTypeDescription
_0contract ISoulboundIdentityundefined

supportsInterface

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

Query if a contract implements an interface

Interface identification is specified in ERC-165.

Parameters

NameTypeDescription
interfaceIdbytes4The interface identifier, as specified in ERC-165

Returns

NameTypeDescription
_0booltrue if the contract implements interfaceId and interfaceId is not 0xffffffff, false otherwise

symbol

function symbol() external view returns (string)

See {IERC721Metadata-symbol}.

Returns

NameTypeDescription
_0stringundefined

tokenByIndex

function tokenByIndex(uint256 index) external view returns (uint256)

See {IERC721Enumerable-tokenByIndex}.

Parameters

NameTypeDescription
indexuint256undefined

Returns

NameTypeDescription
_0uint256undefined

tokenData

function tokenData(uint256) external view returns (string name, uint256 expirationDate)

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
namestringundefined
expirationDateuint256undefined

tokenOfOwnerByIndex

function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)

See {IERC721Enumerable-tokenOfOwnerByIndex}.

Parameters

NameTypeDescription
owneraddressundefined
indexuint256undefined

Returns

NameTypeDescription
_0uint256undefined

tokenURI

function tokenURI(string name) external view returns (string)

A distinct Uniform Resource Identifier (URI) for a given asset.

This function returns the token URI of the soul name specified by the name

Parameters

NameTypeDescription
namestringName of the soul name

Returns

NameTypeDescription
_0stringURI of the soulname associated to a name

tokenURI

function tokenURI(uint256 tokenId) external view returns (string)

A distinct Uniform Resource Identifier (URI) for a given asset.

Throws if _tokenId is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".

Parameters

NameTypeDescription
tokenIduint256NFT to get the URI of

Returns

NameTypeDescription
_0stringURI of the NFT

totalSupply

function totalSupply() external view returns (uint256)

See {IERC721Enumerable-totalSupply}.

Returns

NameTypeDescription
_0uint256undefined

transferFrom

function transferFrom(address from, address to, uint256 tokenId) external nonpayable

See {IERC721-transferFrom}.

Parameters

NameTypeDescription
fromaddressundefined
toaddressundefined
tokenIduint256undefined

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

NameTypeDescription
newOwneraddressundefined

Events

Approval

event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)

Emitted when owner enables approved to manage the tokenId token.

Parameters

NameTypeDescription
owner indexedaddressundefined
approved indexedaddressundefined
tokenId indexeduint256undefined

ApprovalForAll

event ApprovalForAll(address indexed owner, address indexed operator, bool approved)

Emitted when owner enables or disables (approved) operator to manage all of its assets.

Parameters

NameTypeDescription
owner indexedaddressundefined
operator indexedaddressundefined
approvedboolundefined

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription
previousOwner indexedaddressundefined
newOwner indexedaddressundefined

RoleAdminChanged

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Emitted when newAdminRole is set as role's admin role, replacing previousAdminRole DEFAULT_ADMIN_ROLE is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. Available since v3.1.

Parameters

NameTypeDescription
role indexedbytes32undefined
previousAdminRole indexedbytes32undefined
newAdminRole indexedbytes32undefined

RoleGranted

event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)

Emitted when account is granted role. sender is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.

Parameters

NameTypeDescription
role indexedbytes32undefined
account indexedaddressundefined
sender indexedaddressundefined

RoleRevoked

event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)

Emitted when account is revoked role. sender is the account that originated the contract call: - if using revokeRole, it is the admin role bearer - if using renounceRole, it is the role bearer (i.e. account)

Parameters

NameTypeDescription
role indexedbytes32undefined
account indexedaddressundefined
sender indexedaddressundefined

Transfer

event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)

Emitted when tokenId token is transferred from from to to.

Parameters

NameTypeDescription
from indexedaddressundefined
to indexedaddressundefined
tokenId indexeduint256undefined

YearsPeriodRenewed

event YearsPeriodRenewed(uint256 tokenId, uint256 yearsPeriod, uint256 newExpirationDate)

Parameters

NameTypeDescription
tokenIduint256undefined
yearsPerioduint256undefined
newExpirationDateuint256undefined

Errors

AddressDoesNotHaveIdentity

error AddressDoesNotHaveIdentity(address to)

Parameters

NameTypeDescription
toaddressundefined

CallerNotOwner

error CallerNotOwner(address caller)

Parameters

NameTypeDescription
calleraddressundefined

InvalidTokenURI

error InvalidTokenURI(string tokenURI)

Parameters

NameTypeDescription
tokenURIstringundefined

NameAlreadyExists

error NameAlreadyExists(string name)

Parameters

NameTypeDescription
namestringundefined

NameNotFound

error NameNotFound(string name)

Parameters

NameTypeDescription
namestringundefined

NameRegisteredByOtherAccount

error NameRegisteredByOtherAccount(string name, uint256 tokenId)

Parameters

NameTypeDescription
namestringundefined
tokenIduint256undefined

SameValue

error SameValue()

TokenNotFound

error TokenNotFound(uint256 tokenId)

Parameters

NameTypeDescription
tokenIduint256undefined

URIAlreadyExists

error URIAlreadyExists(string tokenURI)

Parameters

NameTypeDescription
tokenURIstringundefined

ZeroAddress

error ZeroAddress()

ZeroLengthName

error ZeroLengthName(string name)

Parameters

NameTypeDescription
namestringundefined

ZeroYearsPeriod

error ZeroYearsPeriod(uint256 yearsPeriod)

Parameters

NameTypeDescription
yearsPerioduint256undefined