Skip to content

Commit

Permalink
add functions for get identity name from identityId
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcabot committed Aug 17, 2022
1 parent 3d20096 commit c69aa77
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
26 changes: 24 additions & 2 deletions contracts/SoulBoundName.sol
Expand Up @@ -32,6 +32,7 @@ contract SoulBoundName is

mapping(uint256 => string) tokenIdToName; // used to sort through all names (name in lowercase)
mapping(string => SoulBoundNameData) soulBoundNames; // register of all soulbound names (name in lowercase)
mapping(uint256 => string[]) identityIdToNames; // register of all names associated to an identityId

struct SoulBoundNameData {
address owner;
Expand Down Expand Up @@ -113,6 +114,27 @@ contract SoulBoundName is
);
}

function getIdentityName(uint256 identityId)
external
view
override
returns (string memory sbtName)
{
// TODO: return identity name if exists
return "";
}

function getIdentityNames(uint256 identityId)
external
view
override
returns (string[] memory sbtNames)
{
// TODO: return identity names if exists
sbtNames = new string[](0);
return sbtNames;
}

function tokenURI(uint256 tokenId)
public
view
Expand All @@ -130,8 +152,8 @@ contract SoulBoundName is

bytes memory dataURI = abi.encodePacked(
"{",
'"name": "SoulBoundName #',
tokenId.toString(),
'"name": "',
soulBoundNameData.name,
'", ',
'"description": "This is a SoulBoundName',
'", ',
Expand Down
10 changes: 10 additions & 0 deletions contracts/interfaces/ISoulBoundNameResolver.sol
Expand Up @@ -11,4 +11,14 @@ interface ISoulBoundNameResolver {
string memory sbtName,
uint256 identityId
);

function getIdentityName(uint256 identityId)
external
view
returns (string memory sbtName);

function getIdentityNames(uint256 identityId)
external
view
returns (string[] memory sbtNames);
}

0 comments on commit c69aa77

Please sign in to comment.