IWeb3Entry

Git Source

Functions

initialize

Initializes the Web3Entry.

function initialize(
    string calldata name_,
    string calldata symbol_,
    address linklist_,
    address mintNFTImpl_,
    address periphery_,
    address newbieVilla_
) external;

Parameters

NameTypeDescription
name_stringThe name to set for the web3Entry character NFT.
symbol_stringThe symbol to set for the web3Entry character NFT.
linklist_addressThe address of linklist contract to set.
mintNFTImpl_addressThe address of mintNFTImpl contract to set.
periphery_addressThe address of periphery contract to set.
newbieVilla_addressThe address of newbieVilla contract to set.

createCharacter

This method creates a character with the given parameters to the given address.

function createCharacter(DataTypes.CreateCharacterData calldata vars) external returns (uint256 characterId);

Parameters

NameTypeDescription
varsDataTypes.CreateCharacterDataThe CreateCharacterData struct containing the following parameters: to: The address receiving the character.
handle: The handle to set for the character.
uri: The URI to set for the character metadata.
linkModule: The link module to use, can be the zero address.
linkModuleInitData: The link module initialization data, if any.

setHandle

Sets new handle for a given character.

Owner permission only.

function setHandle(uint256 characterId, string calldata newHandle) external;

Parameters

NameTypeDescription
characterIduint256The character id to set new handle for.
newHandlestringNew handle to set.

setSocialToken

Sets a social token for a given character.

Owner permission only.

function setSocialToken(uint256 characterId, address tokenAddress) external;

Parameters

NameTypeDescription
characterIduint256The characterId to set social token for.
tokenAddressaddressToken address to be set.

setCharacterUri

Sets a new URI for a given character.

function setCharacterUri(uint256 characterId, string calldata newUri) external;

Parameters

NameTypeDescription
characterIduint256The characterId to to be set.
newUristringNew URI to be set.

setPrimaryCharacterId

Sets a given character as primary.

Only character owner can call this function.

function setPrimaryCharacterId(uint256 characterId) external;

Parameters

NameTypeDescription
characterIduint256The character id to to be set.

grantOperatorPermissions

Grant an address as an operator and authorize it with custom permissions.

Every bit in permissionBitMap stands for a corresponding method in Web3Entry. more details in OP.sol.

function grantOperatorPermissions(uint256 characterId, address operator, uint256 permissionBitMap) external;

Parameters

NameTypeDescription
characterIduint256ID of your character that you want to authorize.
operatoraddressAddress to grant operator permissions to.
permissionBitMapuint256Bitmap used for finer grained operator permissions controls.

grantOperatorPermissionsWithSig

Grant an address as an operator and authorize it with custom permissions via signature.

Only character owner can call.

Every bit in permissionBitMap stands for a corresponding method in Web3Entry. more details in OP.sol.

function grantOperatorPermissionsWithSig(
    uint256 characterId,
    address operator,
    uint256 permissionBitMap,
    DataTypes.EIP712Signature calldata signature
) external;

Parameters

NameTypeDescription
characterIduint256ID of your character that you want to authorize.
operatoraddressAddress to grant operator permissions to.
permissionBitMapuint256Bitmap used for finer grained operator permissions controls.
signatureDataTypes.EIP712SignatureThe EIP712Signature struct containing the character owner's signature.

grantOperators4Note

Grant operators allowlist and blocklist roles of a note.

function grantOperators4Note(
    uint256 characterId,
    uint256 noteId,
    address[] calldata blocklist,
    address[] calldata allowlist
) external;

Parameters

NameTypeDescription
characterIduint256ID of character that you want to set.
noteIduint256ID of note that you want to set.
blocklistaddress[]blocklist addresses that you want to grant.
allowlistaddress[]allowlist addresses that you want to grant.

setLinklistUri

Sets a new metadataURI for a given link list.

function setLinklistUri(uint256 linkListId, string calldata uri) external;

Parameters

NameTypeDescription
linkListIduint256The linklist id to set for.
uristringThe metadata uri to set.

setLinklistType

Sets a link type for a given linklist.

Emits a {DetachLinklist} event and a {AttachLinklist} event from web3Entry contract..
Emits a {LinkTypeSet} event from linklist contract.
Linklist is the group of all linking objects with the same link type, like "like".
Each character can only have one linklist for each link type.
It will fail if you try to set a link type which is already set for some linklist owned by the same character.

function setLinklistType(uint256 linkListId, bytes32 linkType) external;

Parameters

NameTypeDescription
linkListIduint256The linklist ID to set for.
linkTypebytes32The link type to set.

linkAddress

Links an address with the given parameters.

function linkAddress(DataTypes.linkAddressData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.linkAddressDataThe linkAddressData struct containing the linking parameters:
fromCharacterId: The character ID to sponsor a link action.
ethAddress: The address to be linked.
linkType: The link type, like "like", which is a bytes32 format.
data: The data passed to the link module to use, if any.

unlinkAddress

Unlinks an address with the given parameters.

function unlinkAddress(DataTypes.unlinkAddressData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.unlinkAddressDataThe unlinkAddressData struct containing the unlinking parameters:
fromCharacterId: The character ID to sponsor a unlink action.
ethAddress: The address to be unlinked.
linkType: The link type, like "like", which is a bytes32 format.

linkCharacter

Links a character with the given parameters.

function linkCharacter(DataTypes.linkCharacterData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.linkCharacterDataThe linkCharacterData struct containing the linking parameters:
fromCharacterId: The character ID to sponsor a link action.
toCharacterId: The character ID to be linked.
linkType: The link type, like "follow", which is a bytes32 format.
data: The data passed to the link module to use, if any.

unlinkCharacter

Unlinks a character with the given parameters.

function unlinkCharacter(DataTypes.unlinkCharacterData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.unlinkCharacterDataThe unlinkCharacterData struct containing the unlinking parameters: fromCharacterId: The character ID to sponsor a unlink action.
toCharacterId: The character ID to be unlinked.
linkType: The link type, like "follow", which is a bytes32 format.

createThenLinkCharacter

Create a character and then link it.

function createThenLinkCharacter(DataTypes.createThenLinkCharacterData calldata vars)
    external
    returns (uint256 characterId);

Parameters

NameTypeDescription
varsDataTypes.createThenLinkCharacterDataThe createThenLinkCharacterData struct containing the parameters:
fromCharacterId: The character ID to sponsor a link action.
to: The address to receive the new character nft.
linkType: The link type, like "follow", which is a bytes32 format.

linkNote

Links a note with the given parameters.

function linkNote(DataTypes.linkNoteData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.linkNoteDataThe linkNoteData struct containing the linking parameters:
fromCharacterId: The character ID to sponsor a link action.
toCharacterId: The character ID of note to be linked.
toNoteId: The note ID of note to be linked.
linkType: The link type, like "like", which is a bytes32 format.
data: The data passed to the link module to use, if any.

unlinkNote

UnLinks a note with the given parameters.

function unlinkNote(DataTypes.unlinkNoteData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.unlinkNoteDataThe unlinkNoteData struct containing the unlinking parameters:
fromCharacterId: The character ID to sponsor a unlink action.
toCharacterId: The character ID of note to be unlinked.
toNoteId: The note ID of note to be unlinked.
linkType: The link type, like "like", which is a bytes32 format.

linkERC721

Links an ERC721 with the given parameters.

function linkERC721(DataTypes.linkERC721Data calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.linkERC721DataThe linkERC721Data struct containing the linking parameters:
fromCharacterId: The character ID to sponsor a link action.
tokenAddress: The token address of ERC721 to be linked.
tokenId: The token ID of ERC721 to be linked.
linkType: The link type, like "like", which is a bytes32 format.
data: The data passed to the link module to use, if any.

unlinkERC721

Unlinks an ERC721 with the given parameters.

function unlinkERC721(DataTypes.unlinkERC721Data calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.unlinkERC721DataThe unlinkERC721Data struct containing the unlinking parameters:
fromCharacterId: The character ID to sponsor a unlink action.
tokenAddress: The token address of ERC721 to be unlinked.
tokenId: The token ID of ERC721 to be unlinked.
linkType: The link type, like "like", which is a bytes32 format.

linkAnyUri

Links any uri with the given parameters.

function linkAnyUri(DataTypes.linkAnyUriData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.linkAnyUriDataThe linkAnyUriData struct containing the linking parameters:
fromCharacterId: The character ID to sponsor a link action.
toUri: The uri to be linked.
linkType: The link type, like "like", which is a bytes32 format.
data: The data passed to the link module to use, if any.

unlinkAnyUri

Unlinks any uri with the given parameters.

function unlinkAnyUri(DataTypes.unlinkAnyUriData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.unlinkAnyUriDataThe unlinkAnyUriData struct containing the unlinking parameters:
fromCharacterId: The character ID to sponsor a unlink action.
toUri: The uri to be unlinked.
linkType: The link type, like "like", which is a bytes32 format.

Links a linklist with the given parameters.

function linkLinklist(DataTypes.linkLinklistData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.linkLinklistDataThe linkLinklistData struct containing the linking parameters:
fromCharacterId: The character ID to sponsor a link action.
toLinkListId: The linklist ID to be linked.
linkType: The link type, like "like", which is a bytes32 format.
data: The data passed to the link module to use, if any.

Unlinks a linklist with the given parameters.

function unlinkLinklist(DataTypes.unlinkLinklistData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.unlinkLinklistDataThe unlinkLinklistData struct containing the unlinking parameters:
fromCharacterId: The character ID to sponsor a unlink action.
toLinkListId: The linklist ID to be unlinked.
linkType: The link type, like "like", which is a bytes32 format.

setLinkModule4Character

Sets a link module for a given character.

function setLinkModule4Character(DataTypes.setLinkModule4CharacterData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.setLinkModule4CharacterDataThe setLinkModule4CharacterData struct containing the parameters:
characterId: The character ID to set for.
linkModule: The address of link module contract to set.
linkModuleInitData: The data passed to the link module to use, if any.

setLinkModule4Note

Sets a link module for a given note.

function setLinkModule4Note(DataTypes.setLinkModule4NoteData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.setLinkModule4NoteDataThe setLinkModule4NoteData struct containing the parameters:
characterId: The character ID to set for.
noteId: The note ID to set for.
linkModule: The address of link module contract to set.
linkModuleInitData: The data passed to the link module to use, if any.

mintNote

Mints an nft with the given note.

function mintNote(DataTypes.MintNoteData calldata vars) external returns (uint256 tokenId);

Parameters

NameTypeDescription
varsDataTypes.MintNoteDataThe MintNoteData struct containing the minting parameters:
characterId: The character ID of the note.
noteId: The note ID of the note.
to: The address to receive the minted nft.
data: The data passed to the mint module to use, if any.

setMintModule4Note

Sets a mint module for the given note.

function setMintModule4Note(DataTypes.setMintModule4NoteData calldata vars) external;

Parameters

NameTypeDescription
varsDataTypes.setMintModule4NoteDataThe setMintModule4NoteData struct containing the setting parameters:
characterId: The character ID of the note.
noteId: The note ID of the note.
mintModule: The address of mint module to set.
mintModuleInitData: The data passed to the mint module to init, if any.

postNote

Posts a note with the given parameters.

function postNote(DataTypes.PostNoteData calldata vars) external returns (uint256 noteId);

Parameters

NameTypeDescription
varsDataTypes.PostNoteDataThe postNoteData struct containing the posting parameters:
characterId: The character ID to post to.
contentUri: The uri to set for the new post.
linkModule: The address of link module to set for the new post.
linkModuleInitData: The data passed to the link module to init, if any.
mintModule: The address of mint module to set for the new post.
mintModuleInitData: The data passed to the mint module to init, if any.

setNoteUri

Set URI for a note.

function setNoteUri(uint256 characterId, uint256 noteId, string calldata newUri) external;

Parameters

NameTypeDescription
characterIduint256The character ID of the note owner.
noteIduint256The ID of the note to set.
newUristringThe new URI.

lockNote

Lock a note and put it into a immutable state where no modifications are allowed. Locked notes are usually assumed as final versions.

function lockNote(uint256 characterId, uint256 noteId) external;

Parameters

NameTypeDescription
characterIduint256The character ID of the note owner.
noteIduint256The ID of the note to lock.

deleteNote

Delete a note.

Deleting a note doesn't essentially mean that the txs or contents are being removed due to the immutability of blockchain itself, but the deleted notes will be tagged as deleted after calling deleteNote.

function deleteNote(uint256 characterId, uint256 noteId) external;

Parameters

NameTypeDescription
characterIduint256The character ID of the note owner.
noteIduint256The ID of the note to delete.

postNote4Character

Posts a note for a given character.

function postNote4Character(DataTypes.PostNoteData calldata vars, uint256 toCharacterId)
    external
    returns (uint256 noteId);

Parameters

NameTypeDescription
varsDataTypes.PostNoteDataThe postNoteData struct containing the posting parameters:
characterId: The character ID to post to.
contentUri: The uri to set for the new post.
linkModule: The address of link module to set for the new post.
linkModuleInitData: The data passed to the link module to init, if any.
mintModule: The address of mint module to set for the new post.
mintModuleInitData: The data passed to the mint module to init, if any.
toCharacterIduint256The target character ID.

Returns

NameTypeDescription
noteIduint256The note ID of the new post.

postNote4Address

Posts a note for a given address.

function postNote4Address(DataTypes.PostNoteData calldata vars, address ethAddress) external returns (uint256 noteId);

Parameters

NameTypeDescription
varsDataTypes.PostNoteDataThe postNoteData struct containing the posting parameters:
characterId: The character ID to post to.
contentUri: The uri to set for the new post.
linkModule: The address of link module to set for the new post.
linkModuleInitData: The data passed to the link module to init, if any.
mintModule: The address of mint module to set for the new post.
mintModuleInitData: The data passed to the mint module to init, if any.
ethAddressaddressThe target address.

Returns

NameTypeDescription
noteIduint256The note ID of the new post.

Posts a note for a given linklist.

function postNote4Linklist(DataTypes.PostNoteData calldata vars, uint256 toLinklistId)
    external
    returns (uint256 noteId);

Parameters

NameTypeDescription
varsDataTypes.PostNoteDataThe postNoteData struct containing the posting parameters:
characterId: The character ID to post to.
contentUri: The uri to set for the new post.
linkModule: The address of link module to set for the new post.
linkModuleInitData: The data passed to the link module to init, if any.
mintModule: The address of mint module to set for the new post.
mintModuleInitData: The data passed to the mint module to init, if any.
toLinklistIduint256The target linklist.

Returns

NameTypeDescription
noteIduint256The note ID of the new post.

postNote4Note

Posts a note for a given note.

function postNote4Note(DataTypes.PostNoteData calldata vars, DataTypes.NoteStruct calldata note)
    external
    returns (uint256 noteId);

Parameters

NameTypeDescription
varsDataTypes.PostNoteDataThe postNoteData struct containing the posting parameters:
characterId: The character ID to post to.
contentUri: The uri to set for the new post.
linkModule: The address of link module to set for the new post.
linkModuleInitData: The data passed to the link module to init, if any.
mintModule: The address of mint module to set for the new post.
mintModuleInitData: The data passed to the mint module to init, if any.
noteDataTypes.NoteStructThe target note struct containing the parameters:
characterId: The character ID of target note.
noteId: The note ID of target note.

Returns

NameTypeDescription
noteIduint256The note ID of the new post.

postNote4ERC721

Posts a note for a given ERC721.

function postNote4ERC721(DataTypes.PostNoteData calldata vars, DataTypes.ERC721Struct calldata erc721)
    external
    returns (uint256 noteId);

Parameters

NameTypeDescription
varsDataTypes.PostNoteDataThe postNoteData struct containing the posting parameters:
characterId: The character ID to post to.
contentUri: The uri to set for the new post.
linkModule: The address of link module to set for the new post.
linkModuleInitData: The data passed to the link module to init, if any.
mintModule: The address of mint module to set for the new post.
mintModuleInitData: The data passed to the mint module to init, if any.
erc721DataTypes.ERC721StructThe target ERC721 struct containing the parameters:
tokenAddress: The token address of target ERC721.
erc721TokenId: The token ID of target ERC721.

Returns

NameTypeDescription
noteIduint256The note ID of the new post.

postNote4AnyUri

Posts a note for a given uri.

function postNote4AnyUri(DataTypes.PostNoteData calldata vars, string calldata uri) external returns (uint256 noteId);

Parameters

NameTypeDescription
varsDataTypes.PostNoteDataThe postNoteData struct containing the posting parameters:
characterId: The character ID to post to.
contentUri: The uri to set for the new post.
linkModule: The address of link module to set for the new post.
linkModuleInitData: The data passed to the link module to init, if any.
mintModule: The address of mint module to set for the new post.
mintModuleInitData: The data passed to the mint module to init, if any.
uristringThe target uri(could be an url link).

Returns

NameTypeDescription
noteIduint256The note ID of the new post.

Burns a linklist NFT.

It will burn the linklist NFT and remove the links from a character.

function burnLinklist(uint256 linklistId) external;

Parameters

NameTypeDescription
linklistIduint256The linklist ID to burn.

getOperators

Get operator list of a character. This operator list has only a sole purpose, which is keeping records of keys of operatorsPermissionBitMap. Thus, addresses queried by this function not always have operator permissions. Keep in mind don't use this function to check authorizations!!!

function getOperators(uint256 characterId) external view returns (address[] memory);

Parameters

NameTypeDescription
characterIduint256ID of your character that you want to check.

Returns

NameTypeDescription
<none>address[]All keys of operatorsPermission4NoteBitMap.

getOperatorPermissions

Get permission bitmap of an operator.

function getOperatorPermissions(uint256 characterId, address operator) external view returns (uint256);

Parameters

NameTypeDescription
characterIduint256ID of character that you want to check.
operatoraddressAddress to grant operator permissions to.

Returns

NameTypeDescription
<none>uint256Permission bitmap of this operator.

getOperators4Note

Get operators blocklist and allowlist for a note.

function getOperators4Note(uint256 characterId, uint256 noteId)
    external
    view
    returns (address[] memory blocklist, address[] memory allowlist);

Parameters

NameTypeDescription
characterIduint256ID of character to query.
noteIduint256ID of note to query.

isOperatorAllowedForNote

Query if a operator has permission for a note.

function isOperatorAllowedForNote(uint256 characterId, uint256 noteId, address operator) external view returns (bool);

Parameters

NameTypeDescription
characterIduint256ID of character that you want to query.
noteIduint256ID of note that you want to query.
operatoraddressAddress to query.

Returns

NameTypeDescription
<none>booltrue if Operator has permission for a note, otherwise false.

getPrimaryCharacterId

Returns primary character for a given account.

function getPrimaryCharacterId(address account) external view returns (uint256);

Parameters

NameTypeDescription
accountaddressThe address to query.

Returns

NameTypeDescription
<none>uint256uint256 The primary character ID, which will be 0 if not mapped.

isPrimaryCharacter

Returns whether or not a character is primary character.

function isPrimaryCharacter(uint256 characterId) external view returns (bool);

Parameters

NameTypeDescription
characterIduint256The character ID to query.

Returns

NameTypeDescription
<none>boolbool True if the character is primary, false otherwise.

getCharacter

Returns the full character struct associated with a given character token ID.

function getCharacter(uint256 characterId) external view returns (DataTypes.Character memory);

Parameters

NameTypeDescription
characterIduint256The token ID of the character to query.

Returns

NameTypeDescription
<none>DataTypes.CharacterThe full character struct of given character.

getCharacterByHandle

Returns the full character struct associated with a given character handle.

function getCharacterByHandle(string calldata handle) external view returns (DataTypes.Character memory);

Parameters

NameTypeDescription
handlestringThe handle of the character to query.

Returns

NameTypeDescription
<none>DataTypes.CharacterThe full character struct of given character.

getHandle

Returns the handle of character with a given character.

function getHandle(uint256 characterId) external view returns (string memory);

Parameters

NameTypeDescription
characterIduint256The token ID of the character to query.

Returns

NameTypeDescription
<none>stringThe handle of given character.

getCharacterUri

Returns the uri of character with a given character.

function getCharacterUri(uint256 characterId) external view returns (string memory);

Parameters

NameTypeDescription
characterIduint256The token ID of the character to query.

Returns

NameTypeDescription
<none>stringThe uri of given character.

getNote

Returns the full note struct associated with a given note.

function getNote(uint256 characterId, uint256 noteId) external view returns (DataTypes.Note memory);

Parameters

NameTypeDescription
characterIduint256The token ID of the character to query.
noteIduint256The token ID of the note to query.

Returns

NameTypeDescription
<none>DataTypes.NoteThe full note struct of given note.

getLinklistUri

Returns the uri of linklist with a given linklist.

function getLinklistUri(uint256 tokenId) external view returns (string memory);

Parameters

NameTypeDescription
tokenIduint256The token ID of the linklist to query.

Returns

NameTypeDescription
<none>stringstring The uri of given linklist.

getLinklistId

Returns the token ID of linklist with a given character and linkType.

function getLinklistId(uint256 characterId, bytes32 linkType) external view returns (uint256);

Parameters

NameTypeDescription
characterIduint256The token ID of the character to query.
linkTypebytes32The linkType.

Returns

NameTypeDescription
<none>uint256The token ID of linklist.

getLinklistType

Returns the linkType of linklist with a given linklist.

function getLinklistType(uint256 linkListId) external view returns (bytes32);

Parameters

NameTypeDescription
linkListIduint256The token ID of the linklist to query.

Returns

NameTypeDescription
<none>bytes32bytes32 The linkType of given linklist.

getLinklistContract

Returns the address of linklist contract.

function getLinklistContract() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of linklist contract.

getDomainSeparator

Returns the domain separator for this NFT contract.

function getDomainSeparator() external view returns (bytes32);

Returns

NameTypeDescription
<none>bytes32bytes32 The domain separator.

nonces

Returns the current nonce for owner. This value must be included whenever a signature is generated by grantOperatorPermissionsWithSig. Every successful call to grantOperatorPermissionsWithSig increases owner's nonce by one. This prevents a signature from being used multiple times.

function nonces(address owner) external view returns (uint256);

Parameters

NameTypeDescription
owneraddressThe owner address to query.

Returns

NameTypeDescription
<none>uint256uint256 The current nonce for owner.

getRevision

Returns the revision number of web3Entry contract.

function getRevision() external pure returns (uint256);

Returns

NameTypeDescription
<none>uint256The the revision number of web3Entry contract.