Contract Address Details

0x1860b85e7315d5E4f2a23dd62D0F7D6A6e34d7aF

Contract Name
Web3Entry
Creator
0xe01c8d–e085f7 at 0x56bf68–99728d
Balance
0 CSB
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
85845568
Contract name:
Web3Entry




Optimization enabled
true
Compiler version
v0.8.10+commit.fc410830




Optimization runs
200
Verified at
2022-08-08T08:02:04.862466Z

contracts/Web3Entry.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "./base/NFTBase.sol";
import "./interfaces/IWeb3Entry.sol";
import "./interfaces/ILinklist.sol";
import "./interfaces/ILinkModule4Note.sol";
import "./interfaces/IResolver.sol";
import "./storage/Web3EntryStorage.sol";
import "./storage/Web3EntryExtendStorage.sol";
import "./libraries/DataTypes.sol";
import "./libraries/Constants.sol";
import "./libraries/Events.sol";
import "./libraries/CharacterLogic.sol";
import "./libraries/PostLogic.sol";
import "./libraries/LinkModuleLogic.sol";
import "./libraries/LinkLogic.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

contract Web3Entry is IWeb3Entry, NFTBase, Web3EntryStorage, Initializable, Web3EntryExtendStorage {
    using Strings for uint256;
    using EnumerableSet for EnumerableSet.Bytes32Set;

    uint256 internal constant REVISION = 4;

    function initialize(
        string calldata _name,
        string calldata _symbol,
        address _linklistContract,
        address _mintNFTImpl,
        address _periphery,
        address _resolver
    ) external initializer {
        super._initialize(_name, _symbol);
        _linklist = _linklistContract;
        MINT_NFT_IMPL = _mintNFTImpl;
        periphery = _periphery;
        resolver = _resolver;

        emit Events.Web3EntryInitialized(block.timestamp);
    }

    function canCreate(string memory handle, address account) public view returns (bool) {
        return true;
    }

    function createProfile(DataTypes.CreateCharacterData calldata vars) external {
        _createCharacter(vars);
    }

    function setProfileUri(uint256 profileId, string calldata newUri) external {
        _setCharacterUri(profileId, newUri);
    }

    function _setCharacterUri(uint256 profileId, string memory newUri) internal {
        _validateCallerIsCharacterOwnerOrOperator(profileId);

        _characterById[profileId].uri = newUri;

        emit Events.SetCharacterUri(profileId, newUri);
    }

    /**
     * This method creates a character with the given parameters to the given address.
     *
     * @param vars The 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.
     */
    function createCharacter(DataTypes.CreateCharacterData calldata vars) external {
        _createCharacter(vars);
    }

    function _createCharacter(DataTypes.CreateCharacterData memory vars) internal {
        _characterCounter = _characterCounter + 1;

        // mint character nft
        _mint(vars.to, _characterCounter);

        CharacterLogic.createCharacter(
            vars,
            true,
            _characterCounter,
            _characterIdByHandleHash,
            _characterById
        );

        // set primary character
        if (_primaryCharacterByAddress[vars.to] == 0) {
            _primaryCharacterByAddress[vars.to] = _characterCounter;
        }
    }

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

        CharacterLogic.setHandle(characterId, newHandle, _characterIdByHandleHash, _characterById);
    }

    function setSocialToken(uint256 characterId, address tokenAddress) external {
        _validateCallerIsCharacterOwner(characterId);

        CharacterLogic.setSocialToken(characterId, tokenAddress, _characterById);
    }

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

    function setPrimaryCharacterId(uint256 characterId) external {
        _validateCallerIsCharacterOwner(characterId);

        uint256 oldCharacterId = _primaryCharacterByAddress[msg.sender];
        _primaryCharacterByAddress[msg.sender] = characterId;

        emit Events.SetPrimaryCharacterId(msg.sender, characterId, oldCharacterId);
    }

    function setOperator(uint256 characterId, address operator) external {
        _validateCallerIsCharacterOwner(characterId);
        _setOperator(characterId, operator);
    }

    function setLinklistUri(uint256 linklistId, string calldata uri) external {
        _validateCallerIsLinklistOwner(linklistId);

        ILinklist(_linklist).setUri(linklistId, uri);
    }

    function linkCharacter(DataTypes.linkCharacterData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);
        _validateCharacterExists(vars.toCharacterId);

        LinkLogic.linkCharacter(
            vars.fromCharacterId,
            vars.toCharacterId,
            vars.linkType,
            vars.data,
            IERC721Enumerable(this).ownerOf(vars.fromCharacterId),
            _linklist,
            _characterById[vars.toCharacterId].linkModule,
            _attachedLinklists
        );
    }

    function unlinkCharacter(DataTypes.unlinkCharacterData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);

        LinkLogic.unlinkCharacter(
            vars,
            IERC721Enumerable(this).ownerOf(vars.fromCharacterId),
            _linklist,
            _attachedLinklists[vars.fromCharacterId][vars.linkType]
        );
    }

    function createThenLinkCharacter(DataTypes.createThenLinkCharacterData calldata vars) external {
        _createThenLinkCharacter(vars.fromCharacterId, vars.to, vars.linkType, "0x");
    }

    function _createThenLinkCharacter(
        uint256 fromCharacterId,
        address to,
        bytes32 linkType,
        bytes memory data
    ) internal {
        _validateCallerIsCharacterOwner(fromCharacterId);
        require(
            _primaryCharacterByAddress[to] == 0,
            "Target address already has primary character."
        );

        uint256 characterId = ++_characterCounter;
        // mint character nft
        _mint(to, characterId);

        CharacterLogic.createCharacter(
            DataTypes.CreateCharacterData({
                to: to,
                handle: Strings.toHexString(uint160(to), 20),
                uri: "",
                linkModule: address(0),
                linkModuleInitData: ""
            }),
            false,
            characterId,
            _characterIdByHandleHash,
            _characterById
        );

        // set primary character
        _primaryCharacterByAddress[to] = characterId;

        // link character
        LinkLogic.linkCharacter(
            fromCharacterId,
            characterId,
            linkType,
            data,
            IERC721Enumerable(this).ownerOf(fromCharacterId),
            _linklist,
            address(0),
            _attachedLinklists
        );
    }

    function linkNote(DataTypes.linkNoteData calldata vars) external {
        _validateCallerIsCharacterOwnerOrOperator(vars.fromCharacterId);
        _validateNoteExists(vars.toCharacterId, vars.toNoteId);

        LinkLogic.linkNote(
            vars,
            IERC721Enumerable(this).ownerOf(vars.fromCharacterId),
            _linklist,
            _noteByIdByCharacter,
            _attachedLinklists
        );
    }

    function unlinkNote(DataTypes.unlinkNoteData calldata vars) external {
        _validateCallerIsCharacterOwnerOrOperator(vars.fromCharacterId);

        LinkLogic.unlinkNote(vars, _linklist, _attachedLinklists);
    }

    function linkERC721(DataTypes.linkERC721Data calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);
        _validateERC721Exists(vars.tokenAddress, vars.tokenId);

        LinkLogic.linkERC721(
            vars,
            IERC721Enumerable(this).ownerOf(vars.fromCharacterId),
            _linklist,
            _attachedLinklists
        );
    }

    function unlinkERC721(DataTypes.unlinkERC721Data calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);

        LinkLogic.unlinkERC721(
            vars,
            _linklist,
            _attachedLinklists[vars.fromCharacterId][vars.linkType]
        );
    }

    function linkAddress(DataTypes.linkAddressData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);

        LinkLogic.linkAddress(
            vars,
            IERC721Enumerable(this).ownerOf(vars.fromCharacterId),
            _linklist,
            _attachedLinklists
        );
    }

    function unlinkAddress(DataTypes.unlinkAddressData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);

        LinkLogic.unlinkAddress(
            vars,
            _linklist,
            _attachedLinklists[vars.fromCharacterId][vars.linkType]
        );
    }

    function linkAnyUri(DataTypes.linkAnyUriData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);

        LinkLogic.linkAnyUri(
            vars,
            IERC721Enumerable(this).ownerOf(vars.fromCharacterId),
            _linklist,
            _attachedLinklists
        );
    }

    function unlinkAnyUri(DataTypes.unlinkAnyUriData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);

        LinkLogic.unlinkAnyUri(
            vars,
            _linklist,
            _attachedLinklists[vars.fromCharacterId][vars.linkType]
        );
    }

    /*
    function linkCharacterLink(
        uint256 fromCharacterId,
        DataTypes.CharacterLinkStruct calldata linkData,
        bytes32 linkType
    ) external {
        _validateCallerIsCharacterOwner(fromCharacterId);

        LinkLogic.linkCharacterLink(
            fromCharacterId,
            linkData,
            msg.sender,
            linkType,
            _linklist,
            _attachedLinklists
        );
    }

    function unlinkCharacterLink(
        uint256 fromCharacterId,
        DataTypes.CharacterLinkStruct calldata linkData,
        bytes32 linkType
    ) external {
        _validateCallerIsCharacterOwner(fromCharacterId);

        LinkLogic.unlinkCharacterLink(
            fromCharacterId,
            linkData,
            linkType,
            _linklist,
            _attachedLinklists[linkData.fromCharacterId][linkData.linkType]
        );
    }
    */

    function linkLinklist(DataTypes.linkLinklistData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);

        LinkLogic.linkLinklist(
            vars,
            IERC721Enumerable(this).ownerOf(vars.fromCharacterId),
            _linklist,
            _attachedLinklists
        );
    }

    function unlinkLinklist(DataTypes.unlinkLinklistData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.fromCharacterId);

        LinkLogic.unlinkLinklist(
            vars,
            _linklist,
            _attachedLinklists[vars.fromCharacterId][vars.linkType]
        );
    }

    // set link module for his character
    function setLinkModule4Character(DataTypes.setLinkModule4CharacterData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.characterId);

        CharacterLogic.setCharacterLinkModule(
            vars.characterId,
            vars.linkModule,
            vars.linkModuleInitData,
            _characterById[vars.characterId]
        );
    }

    function setLinkModule4Note(DataTypes.setLinkModule4NoteData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.characterId);
        _validateNoteExists(vars.characterId, vars.noteId);

        LinkModuleLogic.setLinkModule4Note(
            vars.characterId,
            vars.noteId,
            vars.linkModule,
            vars.linkModuleInitData,
            _noteByIdByCharacter
        );
    }

    function setLinkModule4Linklist(DataTypes.setLinkModule4LinklistData calldata vars) external {
        _validateCallerIsLinklistOwner(vars.linklistId);

        LinkModuleLogic.setLinkModule4Linklist(
            vars.linklistId,
            vars.linkModule,
            vars.linkModuleInitData,
            _linkModules4Linklist
        );
    }

    function setLinkModule4ERC721(DataTypes.setLinkModule4ERC721Data calldata vars) external {
        require(msg.sender == ERC721(vars.tokenAddress).ownerOf(vars.tokenId), "NotERC721Owner");

        LinkModuleLogic.setLinkModule4ERC721(
            vars.tokenAddress,
            vars.tokenId,
            vars.linkModule,
            vars.linkModuleInitData,
            _linkModules4ERC721
        );
    }

    function setLinkModule4Address(DataTypes.setLinkModule4AddressData calldata vars) external {
        LinkModuleLogic.setLinkModule4Address(
            vars.account,
            vars.linkModule,
            vars.linkModuleInitData,
            _linkModules4Address
        );
    }

    function mintNote(DataTypes.MintNoteData calldata vars) external returns (uint256) {
        _validateNoteExists(vars.characterId, vars.noteId);

        return
            PostLogic.mintNote(
                vars.characterId,
                vars.noteId,
                vars.to,
                vars.mintModuleData,
                MINT_NFT_IMPL,
                _characterById,
                _noteByIdByCharacter
            );
    }

    function setMintModule4Note(DataTypes.setMintModule4NoteData calldata vars) external {
        _validateCallerIsCharacterOwner(vars.characterId);
        _validateNoteExists(vars.characterId, vars.noteId);

        LinkModuleLogic.setMintModule4Note(
            vars.characterId,
            vars.noteId,
            vars.mintModule,
            vars.mintModuleInitData,
            _noteByIdByCharacter
        );
    }

    function postNote(DataTypes.PostNoteData calldata vars) external returns (uint256) {
        _validateCallerIsCharacterOwnerOrOperator(vars.characterId);

        uint256 noteId = ++_characterById[vars.characterId].noteCount;

        PostLogic.postNoteWithLink(vars, noteId, 0, 0, "", _noteByIdByCharacter);
        return noteId;
    }

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

        PostLogic.setNoteUri(characterId, noteId, newUri, _noteByIdByCharacter);
    }

    function lockNote(uint256 characterId, uint256 noteId) external {
        _validateCallerIsCharacterOwnerOrOperator(characterId);
        _validateNoteExists(characterId, noteId);

        _noteByIdByCharacter[characterId][noteId].locked = true;

        emit Events.LockNote(characterId, noteId);
    }

    function deleteNote(uint256 characterId, uint256 noteId) external {
        _validateCallerIsCharacterOwnerOrOperator(characterId);
        _validateNoteExists(characterId, noteId);

        _noteByIdByCharacter[characterId][noteId].deleted = true;

        emit Events.DeleteNote(characterId, noteId);
    }

    function postNote4Character(DataTypes.PostNoteData calldata postNoteData, uint256 toCharacterId)
        external
        returns (uint256)
    {
        _validateCallerIsCharacterOwnerOrOperator(postNoteData.characterId);

        bytes32 linkItemType = Constants.NoteLinkTypeCharacter;
        bytes32 linkKey = bytes32(toCharacterId);
        uint256 noteId = ++_characterById[postNoteData.characterId].noteCount;

        PostLogic.postNoteWithLink(
            postNoteData,
            noteId,
            linkItemType,
            linkKey,
            abi.encodePacked(toCharacterId),
            _noteByIdByCharacter
        );

        return noteId;
    }

    function postNote4Address(DataTypes.PostNoteData calldata noteData, address ethAddress)
        external
        returns (uint256)
    {
        _validateCallerIsCharacterOwnerOrOperator(noteData.characterId);

        bytes32 linkItemType = Constants.NoteLinkTypeAddress;
        bytes32 linkKey = bytes32(uint256(uint160(ethAddress)));
        uint256 noteId = ++_characterById[noteData.characterId].noteCount;

        PostLogic.postNoteWithLink(
            noteData,
            noteId,
            linkItemType,
            linkKey,
            abi.encodePacked(ethAddress),
            _noteByIdByCharacter
        );

        return noteId;
    }

    function postNote4Linklist(DataTypes.PostNoteData calldata noteData, uint256 toLinklistId)
        external
        returns (uint256)
    {
        _validateCallerIsCharacterOwnerOrOperator(noteData.characterId);

        bytes32 linkItemType = Constants.NoteLinkTypeLinklist;
        bytes32 linkKey = bytes32(toLinklistId);
        uint256 noteId = ++_characterById[noteData.characterId].noteCount;

        PostLogic.postNoteWithLink(
            noteData,
            noteId,
            linkItemType,
            linkKey,
            abi.encodePacked(toLinklistId),
            _noteByIdByCharacter
        );

        return noteId;
    }

    function postNote4Note(
        DataTypes.PostNoteData calldata postNoteData,
        DataTypes.NoteStruct calldata note
    ) external returns (uint256) {
        _validateCallerIsCharacterOwnerOrOperator(postNoteData.characterId);

        bytes32 linkItemType = Constants.NoteLinkTypeNote;
        bytes32 linkKey = ILinklist(_linklist).addLinkingNote(0, note.characterId, note.noteId);
        uint256 noteId = ++_characterById[postNoteData.characterId].noteCount;

        PostLogic.postNoteWithLink(
            postNoteData,
            noteId,
            linkItemType,
            linkKey,
            abi.encodePacked(note.characterId, note.noteId),
            _noteByIdByCharacter
        );

        return noteId;
    }

    function postNote4ERC721(
        DataTypes.PostNoteData calldata postNoteData,
        DataTypes.ERC721Struct calldata erc721
    ) external returns (uint256) {
        _validateCallerIsCharacterOwnerOrOperator(postNoteData.characterId);
        _validateERC721Exists(erc721.tokenAddress, erc721.erc721TokenId);

        bytes32 linkItemType = Constants.NoteLinkTypeERC721;
        bytes32 linkKey = ILinklist(_linklist).addLinkingERC721(
            0,
            erc721.tokenAddress,
            erc721.erc721TokenId
        );
        uint256 noteId = ++_characterById[postNoteData.characterId].noteCount;

        PostLogic.postNoteWithLink(
            postNoteData,
            noteId,
            linkItemType,
            linkKey,
            abi.encodePacked(erc721.tokenAddress, erc721.erc721TokenId),
            _noteByIdByCharacter
        );

        return noteId;
    }

    function postNote4AnyUri(DataTypes.PostNoteData calldata postNoteData, string calldata uri)
        external
        returns (uint256)
    {
        _validateCallerIsCharacterOwnerOrOperator(postNoteData.characterId);

        bytes32 linkItemType = Constants.NoteLinkTypeAnyUri;
        bytes32 linkKey = ILinklist(_linklist).addLinkingAnyUri(0, uri);
        uint256 noteId = ++_characterById[postNoteData.characterId].noteCount;

        PostLogic.postNoteWithLink(
            postNoteData,
            noteId,
            linkItemType,
            linkKey,
            abi.encodePacked(uri),
            _noteByIdByCharacter
        );

        return noteId;
    }

    function burn(uint256 tokenId) public override {
        // clear handle
        bytes32 handleHash = keccak256(bytes(_characterById[tokenId].handle));
        _characterIdByHandleHash[handleHash] = 0;

        // clear character
        delete _characterById[tokenId];

        // burn token
        super.burn(tokenId);
    }

    function getPrimaryCharacterId(address account) external view returns (uint256) {
        return _primaryCharacterByAddress[account];
    }

    function isPrimaryCharacter(uint256 characterId) external view returns (bool) {
        address account = ownerOf(characterId);
        return characterId == _primaryCharacterByAddress[account];
    }

    function getCharacter(uint256 characterId) external view returns (DataTypes.Character memory) {
        return _characterById[characterId];
    }

    function getCharacterByHandle(string calldata handle)
        external
        view
        returns (DataTypes.Character memory)
    {
        bytes32 handleHash = keccak256(bytes(handle));
        uint256 characterId = _characterIdByHandleHash[handleHash];
        return _characterById[characterId];
    }

    function getHandle(uint256 characterId) external view returns (string memory) {
        return _characterById[characterId].handle;
    }

    function getCharacterUri(uint256 characterId) external view returns (string memory) {
        return tokenURI(characterId);
    }

    function getOperator(uint256 characterId) external view returns (address) {
        return _operatorByCharacter[characterId];
    }

    function getNote(uint256 characterId, uint256 noteId)
        external
        view
        returns (DataTypes.Note memory)
    {
        return _noteByIdByCharacter[characterId][noteId];
    }

    function getLinkModule4Address(address account) external view returns (address) {
        return _linkModules4Address[account];
    }

    function getLinkModule4Linklist(uint256 tokenId) external view returns (address) {
        return _linkModules4Linklist[tokenId];
    }

    function getLinkModule4ERC721(address tokenAddress, uint256 tokenId)
        external
        view
        returns (address)
    {
        return _linkModules4ERC721[tokenAddress][tokenId];
    }

    function tokenURI(uint256 characterId) public view override returns (string memory) {
        return _characterById[characterId].uri;
    }

    function getLinklistUri(uint256 tokenId) external view returns (string memory) {
        return ILinklist(_linklist).Uri(tokenId);
    }

    function getLinklistId(uint256 characterId, bytes32 linkType) external view returns (uint256) {
        return _attachedLinklists[characterId][linkType];
    }

    function getLinklistType(uint256 linkListId) external view returns (bytes32) {
        return ILinklist(_linklist).getLinkType(linkListId);
    }

    function getLinklistContract() external view returns (address) {
        return _linklist;
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override {
        if (_operatorByCharacter[tokenId] != address(0)) {
            _setOperator(tokenId, address(0));
        }

        if (_primaryCharacterByAddress[from] != 0) {
            _primaryCharacterByAddress[from] = 0;
        }

        super._beforeTokenTransfer(from, to, tokenId);
    }

    function _setOperator(uint256 characterId, address operator) internal {
        _operatorByCharacter[characterId] = operator;
        emit Events.SetOperator(characterId, operator, block.timestamp);
    }

    function _validateCallerIsCharacterOwnerOrOperator(uint256 characterId) internal view {
        address owner = ownerOf(characterId);
        require(
            msg.sender == owner ||
                msg.sender == _operatorByCharacter[characterId] ||
                (tx.origin == owner && msg.sender == periphery),
            "NotCharacterOwner"
        );
    }

    function _validateCallerIsCharacterOwner(uint256 characterId) internal view {
        address owner = ownerOf(characterId);
        require(
            msg.sender == owner || (tx.origin == owner && msg.sender == periphery),
            "NotCharacterOwner"
        );
    }

    function _validateCallerIsLinklistOwner(uint256 tokenId) internal view {
        require(msg.sender == IERC721(_linklist).ownerOf(tokenId), "NotLinkListOwner");
    }

    function _validateCharacterExists(uint256 characterId) internal view {
        require(_exists(characterId), "CharacterNotExists");
    }

    function _validateERC721Exists(address tokenAddress, uint256 tokenId) internal view {
        require(address(0) != IERC721(tokenAddress).ownerOf(tokenId), "REC721NotExists");
    }

    function _validateNoteExists(uint256 characterId, uint256 noteId) internal view {
        require(!_noteByIdByCharacter[characterId][noteId].deleted, "NoteIsDeleted");
        require(noteId <= _characterById[characterId].noteCount, "NoteNotExists");
    }

    function setMintNFTImpl() external {
        MINT_NFT_IMPL = 0x87EFEb45f2dc12f77C4AD46769dab4678EF84045;
    }

    function getRevision() external pure returns (uint256) {
        return REVISION;
    }
}
        

@openzeppelin/contracts/utils/Strings.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}
          

contracts/interfaces/ILinkModule4Linklist.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

interface ILinkModule4Linklist {
    function initializeLinkModule(uint256 tokenId, bytes calldata data)
        external
        returns (bytes memory);

    function processLink(
        address account,
        uint256 tokenId,
        bytes calldata data
    ) external;
}
          

@openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
          

contracts/interfaces/ILinkModule4Address.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

interface ILinkModule4Address {
    function initializeLinkModule(address account, bytes calldata data)
        external
        returns (bytes memory);

    function processLink(
        address account,
        uint256 noteId,
        bytes calldata data
    ) external;
}
          

contracts/interfaces/IMintNFT.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

interface IMintNFT {
    function initialize(
        uint256 characterId,
        uint256 noteId,
        address web3Entry,
        string calldata name,
        string calldata symbol
    ) external;

    function mint(address to) external returns (uint256);

    function getSourcePublicationPointer() external view returns (uint256, uint256);
}
          

@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}
          

contracts/interfaces/ILinklist.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "../libraries/DataTypes.sol";

interface ILinklist {
    function mint(
        uint256 characterId,
        bytes32 linkType,
        uint256 tokenId
    ) external;

    function setUri(uint256 tokenId, string memory uri) external;

    /////////////////////////////////
    // linking Character
    /////////////////////////////////
    function addLinkingCharacterId(uint256 tokenId, uint256 toCharacterId) external;

    function removeLinkingCharacterId(uint256 tokenId, uint256 toCharacterId) external;

    function getLinkingCharacterIds(uint256 tokenId) external view returns (uint256[] memory);

    function getLinkingCharacterListLength(uint256 tokenId) external view returns (uint256);

    /////////////////////////////////
    // linking Note
    /////////////////////////////////
    function addLinkingNote(
        uint256 tokenId,
        uint256 toCharacterId,
        uint256 toNoteId
    ) external returns (bytes32);

    function removeLinkingNote(
        uint256 tokenId,
        uint256 toCharacterId,
        uint256 toNoteId
    ) external;

    function getLinkingNotes(uint256 tokenId)
        external
        view
        returns (DataTypes.NoteStruct[] memory results);

    function getLinkingNote(bytes32 linkKey) external view returns (DataTypes.NoteStruct memory);

    function getLinkingNoteListLength(uint256 tokenId) external view returns (uint256);

    function addLinkingCharacterLink(
        uint256 tokenId,
        DataTypes.CharacterLinkStruct calldata linkData
    ) external;

    function removeLinkingCharacterLink(
        uint256 tokenId,
        DataTypes.CharacterLinkStruct calldata linkData
    ) external;

    function getLinkingCharacterLinks(uint256 tokenId)
        external
        view
        returns (DataTypes.CharacterLinkStruct[] memory results);

    function getLinkingCharacterLink(bytes32 linkKey)
        external
        view
        returns (DataTypes.CharacterLinkStruct memory);

    function getLinkingCharacterLinkListLength(uint256 tokenId) external view returns (uint256);

    /////////////////////////////////
    // linking ERC721
    /////////////////////////////////
    function addLinkingERC721(
        uint256 tokenId,
        address tokenAddress,
        uint256 erc721TokenId
    ) external returns (bytes32);

    function removeLinkingERC721(
        uint256 tokenId,
        address tokenAddress,
        uint256 erc721TokenId
    ) external;

    function getLinkingERC721s(uint256 tokenId)
        external
        view
        returns (DataTypes.ERC721Struct[] memory results);

    function getLinkingERC721(bytes32 linkKey)
        external
        view
        returns (DataTypes.ERC721Struct memory);

    function getLinkingERC721ListLength(uint256 tokenId) external view returns (uint256);

    /////////////////////////////////
    // linking Address
    /////////////////////////////////
    function addLinkingAddress(uint256 tokenId, address ethAddress) external;

    function removeLinkingAddress(uint256 tokenId, address ethAddress) external;

    function getLinkingAddresses(uint256 tokenId) external view returns (address[] memory);

    function getLinkingAddressListLength(uint256 tokenId) external view returns (uint256);

    /////////////////////////////////
    // linking Any
    /////////////////////////////////
    function addLinkingAnyUri(uint256 tokenId, string memory toUri) external returns (bytes32);

    function removeLinkingAnyUri(uint256 tokenId, string memory toUri) external;

    function getLinkingAnyUris(uint256 tokenId) external view returns (string[] memory results);

    function getLinkingAnyUri(bytes32 linkKey) external view returns (string memory);

    function getLinkingAnyListLength(uint256 tokenId) external view returns (uint256);

    /////////////////////////////////
    // linking Linklist
    /////////////////////////////////
    function addLinkingLinklistId(uint256 tokenId, uint256 linklistId) external;

    function removeLinkingLinklistId(uint256 tokenId, uint256 linklistId) external;

    function getLinkingLinklistIds(uint256 tokenId) external view returns (uint256[] memory);

    function getLinkingLinklistLength(uint256 tokenId) external view returns (uint256);

    function getCurrentTakeOver(uint256 tokenId) external view returns (uint256);

    function getLinkType(uint256 tokenId) external view returns (bytes32);

    function Uri(uint256 tokenId) external view returns (string memory);
}
          

contracts/libraries/PostLogic.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "./DataTypes.sol";
import "./Events.sol";
import "../interfaces/ILinkModule4Note.sol";
import "../interfaces/IMintModule4Note.sol";
import "../interfaces/IMintNFT.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

library PostLogic {
    using Strings for uint256;

    function postNoteWithLink(
        DataTypes.PostNoteData calldata vars,
        uint256 noteId,
        bytes32 linkItemType,
        bytes32 linkKey,
        bytes calldata data,
        mapping(uint256 => mapping(uint256 => DataTypes.Note)) storage _noteByIdByCharacter
    ) external {
        uint256 characterId = vars.characterId;
        // save note
        if (linkItemType != bytes32(0)) {
            _noteByIdByCharacter[characterId][noteId].linkItemType = linkItemType;
            _noteByIdByCharacter[characterId][noteId].linkKey = linkKey;
        }
        _noteByIdByCharacter[characterId][noteId].contentUri = vars.contentUri;
        _noteByIdByCharacter[characterId][noteId].linkModule = vars.linkModule;
        _noteByIdByCharacter[characterId][noteId].mintModule = vars.mintModule;

        // init link module
        if (vars.linkModule != address(0)) {
            bytes memory linkModuleReturnData = ILinkModule4Note(vars.linkModule)
                .initializeLinkModule(characterId, noteId, vars.linkModuleInitData);

            emit Events.SetLinkModule4Note(
                characterId,
                noteId,
                vars.linkModule,
                linkModuleReturnData,
                block.timestamp
            );
        }

        // init mint module
        if (vars.mintModule != address(0)) {
            bytes memory mintModuleReturnData = IMintModule4Note(vars.mintModule)
                .initializeMintModule(characterId, noteId, vars.mintModuleInitData);

            emit Events.SetMintModule4Note(
                characterId,
                noteId,
                vars.mintModule,
                mintModuleReturnData,
                block.timestamp
            );
        }

        emit Events.PostNote(characterId, noteId, linkKey, linkItemType, data);
    }

    function mintNote(
        uint256 characterId,
        uint256 noteId,
        address to,
        bytes calldata mintModuleData,
        address mintNFTImpl,
        mapping(uint256 => DataTypes.Character) storage _characterById,
        mapping(uint256 => mapping(uint256 => DataTypes.Note)) storage _noteByIdByCharacter
    ) external returns (uint256 tokenId) {
        address mintNFT = _noteByIdByCharacter[characterId][noteId].mintNFT;
        if (mintNFT == address(0)) {
            mintNFT = _deployMintNFT(
                characterId,
                noteId,
                _characterById[characterId].handle,
                mintNFTImpl
            );
            _noteByIdByCharacter[characterId][noteId].mintNFT = mintNFT;
        }

        // mint nft
        tokenId = IMintNFT(mintNFT).mint(to);

        address mintModule = _noteByIdByCharacter[characterId][noteId].mintModule;
        if (mintModule != address(0)) {
            IMintModule4Note(mintModule).processMint(to, characterId, noteId, mintModuleData);
        }

        emit Events.MintNote(to, characterId, noteId, mintNFT, tokenId);
    }

    function setNoteUri(
        uint256 characterId,
        uint256 noteId,
        string calldata newUri,
        mapping(uint256 => mapping(uint256 => DataTypes.Note)) storage _noteByIdByCharacter
    ) external {
        require(!_noteByIdByCharacter[characterId][noteId].locked, "NoteLocked");

        _noteByIdByCharacter[characterId][noteId].contentUri = newUri;

        emit Events.SetNoteUri(characterId, noteId, newUri);
    }

    function _deployMintNFT(
        uint256 characterId,
        uint256 noteId,
        string memory handle,
        address mintNFTImpl
    ) internal returns (address) {
        address mintNFT = Clones.clone(mintNFTImpl);

        bytes4 firstBytes = bytes4(bytes(handle));

        string memory NFTName = string(
            abi.encodePacked(handle, "-Note-", characterId.toString(), "-", noteId.toString())
        );
        string memory NFTSymbol = string(
            abi.encodePacked(firstBytes, "-Note-", characterId.toString(), "-", noteId.toString())
        );

        IMintNFT(mintNFT).initialize(characterId, noteId, address(this), NFTName, NFTSymbol);
        return mintNFT;
    }
}
          

@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}
          

@openzeppelin/contracts/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/Address.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !Address.isContract(address(this));
    }
}
          

@openzeppelin/contracts/token/ERC721/IERC721.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}
          

@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}
          

@openzeppelin/contracts/utils/introspection/IERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
          

contracts/base/ERC721Enumerable.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "./ERC721.sol";

abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(IERC165, ERC721)
        returns (bool)
    {
        return
            interfaceId == type(IERC721Enumerable).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index)
        public
        view
        virtual
        override
        returns (uint256)
    {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(
            index < ERC721Enumerable.totalSupply(),
            "ERC721Enumerable: global index out of bounds"
        );
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId;
            // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex;
            // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId;
        // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex;
        // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}
          

contracts/libraries/LinkLogic.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "./Events.sol";
import "./DataTypes.sol";
import "../interfaces/ILinklist.sol";
import "../interfaces/ILinkModule4Character.sol";
import "../interfaces/ILinkModule4Note.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

library LinkLogic {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    function linkCharacter(
        uint256 fromCharacterId,
        uint256 toCharacterId,
        bytes32 linkType,
        bytes memory data,
        address linker,
        address linklist,
        address linkModule,
        mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists
    ) external {
        uint256 linklistId = _mintLinklist(
            fromCharacterId,
            linkType,
            linker,
            linklist,
            _attachedLinklists
        );

        // add to link list
        ILinklist(linklist).addLinkingCharacterId(linklistId, toCharacterId);

        // process link module
        if (linkModule != address(0)) {
            try
                ILinkModule4Character(linkModule).processLink(linker, toCharacterId, data)
            {} catch {}
        }

        emit Events.LinkCharacter(linker, fromCharacterId, toCharacterId, linkType, linklistId);
    }

    function unlinkCharacter(
        DataTypes.unlinkCharacterData calldata vars,
        address linker,
        address linklist,
        uint256 linklistId
    ) external {
        // remove from link list
        ILinklist(linklist).removeLinkingCharacterId(linklistId, vars.toCharacterId);

        emit Events.UnlinkCharacter(
            linker,
            vars.fromCharacterId,
            vars.toCharacterId,
            vars.linkType
        );
    }

    function linkNote(
        DataTypes.linkNoteData calldata vars,
        address linker,
        address linklist,
        mapping(uint256 => mapping(uint256 => DataTypes.Note)) storage _noteByIdByCharacter,
        mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists
    ) external {
        uint256 linklistId = _mintLinklist(
            vars.fromCharacterId,
            vars.linkType,
            linker,
            linklist,
            _attachedLinklists
        );

        // add to link list
        ILinklist(linklist).addLinkingNote(linklistId, vars.toCharacterId, vars.toNoteId);

        // process link
        address linkModule = _noteByIdByCharacter[vars.toCharacterId][vars.toNoteId].linkModule;
        if (linkModule != address(0)) {
            try
                ILinkModule4Note(linkModule).processLink(
                    linker,
                    vars.toCharacterId,
                    vars.toNoteId,
                    vars.data
                )
            {} catch {}
        }

        emit Events.LinkNote(
            vars.fromCharacterId,
            vars.toCharacterId,
            vars.toNoteId,
            vars.linkType,
            linklistId
        );
    }

    function unlinkNote(
        DataTypes.unlinkNoteData calldata vars,
        address linklist,
        mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists
    ) external {
        // do note check note
        // _validateNoteExists(vars.toCharacterId, vars.toNoteId);

        uint256 linklistId = _attachedLinklists[vars.fromCharacterId][vars.linkType];

        // remove from link list
        ILinklist(linklist).removeLinkingNote(linklistId, vars.toCharacterId, vars.toNoteId);

        emit Events.UnlinkNote(
            vars.fromCharacterId,
            vars.toCharacterId,
            vars.toNoteId,
            vars.linkType,
            linklistId
        );
    }

    function linkCharacterLink(
        uint256 fromCharacterId,
        DataTypes.CharacterLinkStruct calldata linkData,
        address linker,
        bytes32 linkType,
        address linklist,
        mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists
    ) external {
        uint256 linklistId = _mintLinklist(
            fromCharacterId,
            linkType,
            linker,
            linklist,
            _attachedLinklists
        );

        // add to link list
        ILinklist(linklist).addLinkingCharacterLink(linklistId, linkData);

        // event
        emit Events.LinkCharacterLink(
            fromCharacterId,
            linkType,
            linkData.fromCharacterId,
            linkData.toCharacterId,
            linkData.linkType
        );
    }

    function unlinkCharacterLink(
        uint256 fromCharacterId,
        DataTypes.CharacterLinkStruct calldata linkData,
        bytes32 linkType,
        address linklist,
        uint256 linklistId
    ) external {
        // remove from link list
        ILinklist(linklist).removeLinkingCharacterLink(linklistId, linkData);

        // event
        emit Events.UnlinkCharacterLink(
            fromCharacterId,
            linkType,
            linkData.fromCharacterId,
            linkData.toCharacterId,
            linkData.linkType
        );
    }

    function linkLinklist(
        DataTypes.linkLinklistData calldata vars,
        address linker,
        address linklist,
        mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists
    ) external {
        uint256 linklistId = _mintLinklist(
            vars.fromCharacterId,
            vars.linkType,
            linker,
            linklist,
            _attachedLinklists
        );

        // add to link list
        ILinklist(linklist).addLinkingLinklistId(linklistId, vars.toLinkListId);

        emit Events.LinkLinklist(
            vars.fromCharacterId,
            vars.toLinkListId,
            vars.linkType,
            linklistId
        );
    }

    function unlinkLinklist(
        DataTypes.unlinkLinklistData calldata vars,
        address linklist,
        uint256 linklistId
    ) external {
        // add to link list
        ILinklist(linklist).removeLinkingLinklistId(linklistId, vars.toLinkListId);

        emit Events.UnlinkLinklist(
            vars.fromCharacterId,
            vars.toLinkListId,
            vars.linkType,
            linklistId
        );
    }

    function linkERC721(
        DataTypes.linkERC721Data calldata vars,
        address linker,
        address linklist,
        mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists
    ) external {
        uint256 linklistId = _mintLinklist(
            vars.fromCharacterId,
            vars.linkType,
            linker,
            linklist,
            _attachedLinklists
        );

        // add to link list
        ILinklist(linklist).addLinkingERC721(linklistId, vars.tokenAddress, vars.tokenId);

        emit Events.LinkERC721(
            vars.fromCharacterId,
            vars.tokenAddress,
            vars.tokenId,
            vars.linkType,
            linklistId
        );
    }

    function unlinkERC721(
        DataTypes.unlinkERC721Data calldata vars,
        address linklist,
        uint256 linklistId
    ) external {
        // remove from link list
        ILinklist(linklist).removeLinkingERC721(linklistId, vars.tokenAddress, vars.tokenId);

        emit Events.UnlinkERC721(
            vars.fromCharacterId,
            vars.tokenAddress,
            vars.tokenId,
            vars.linkType,
            linklistId
        );
    }

    function linkAddress(
        DataTypes.linkAddressData calldata vars,
        address linker,
        address linklist,
        mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists
    ) external {
        uint256 linklistId = _mintLinklist(
            vars.fromCharacterId,
            vars.linkType,
            linker,
            linklist,
            _attachedLinklists
        );

        // add to link list
        ILinklist(linklist).addLinkingAddress(linklistId, vars.ethAddress);

        emit Events.LinkAddress(vars.fromCharacterId, vars.ethAddress, vars.linkType, linklistId);
    }

    function unlinkAddress(
        DataTypes.unlinkAddressData calldata vars,
        address linklist,
        uint256 linklistId
    ) external {
        // remove from link list
        ILinklist(linklist).removeLinkingAddress(linklistId, vars.ethAddress);

        emit Events.UnlinkAddress(vars.fromCharacterId, vars.ethAddress, vars.linkType);
    }

    function linkAnyUri(
        DataTypes.linkAnyUriData calldata vars,
        address linker,
        address linklist,
        mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists
    ) external {
        uint256 linklistId = _mintLinklist(
            vars.fromCharacterId,
            vars.linkType,
            linker,
            linklist,
            _attachedLinklists
        );

        // add to link list
        ILinklist(linklist).addLinkingAnyUri(linklistId, vars.toUri);

        emit Events.LinkAnyUri(vars.fromCharacterId, vars.toUri, vars.linkType, linklistId);
    }

    function unlinkAnyUri(
        DataTypes.unlinkAnyUriData calldata vars,
        address linklist,
        uint256 linklistId
    ) external {
        // remove from link list
        ILinklist(linklist).removeLinkingAnyUri(linklistId, vars.toUri);

        emit Events.UnlinkAnyUri(vars.fromCharacterId, vars.toUri, vars.linkType);
    }

    function _mintLinklist(
        uint256 fromCharacterId,
        bytes32 linkType,
        address to,
        address linklist,
        mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists
    ) internal returns (uint256 linklistId) {
        linklistId = _attachedLinklists[fromCharacterId][linkType];
        if (linklistId == 0) {
            linklistId = IERC721Enumerable(linklist).totalSupply() + 1;
            // mint linkList nft
            ILinklist(linklist).mint(fromCharacterId, linkType, linklistId);

            // attach linkList
            _attachedLinklists[fromCharacterId][linkType] = linklistId;
            emit Events.AttachLinklist(linklistId, fromCharacterId, linkType);
        }
    }
}
          

contracts/interfaces/IWeb3Entry.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "../libraries/DataTypes.sol";

interface IWeb3Entry {
    function initialize(
        string calldata _name,
        string calldata _symbol,
        address _linklistContract,
        address _mintNFTImpl,
        address _periphery,
        address resolver
    ) external;

    function createCharacter(DataTypes.CreateCharacterData calldata vars) external;

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

    function setSocialToken(uint256 characterId, address tokenAddress) external;

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

    function setPrimaryCharacterId(uint256 characterId) external;

    function setOperator(uint256 characterId, address operator) external;

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

    function linkAddress(DataTypes.linkAddressData calldata vars) external;

    function unlinkAddress(DataTypes.unlinkAddressData calldata vars) external;

    function linkCharacter(DataTypes.linkCharacterData calldata vars) external;

    function unlinkCharacter(DataTypes.unlinkCharacterData calldata vars) external;

    function createThenLinkCharacter(DataTypes.createThenLinkCharacterData calldata vars) external;

    function linkNote(DataTypes.linkNoteData calldata vars) external;

    function unlinkNote(DataTypes.unlinkNoteData calldata vars) external;

    function linkERC721(DataTypes.linkERC721Data calldata vars) external;

    function unlinkERC721(DataTypes.unlinkERC721Data calldata vars) external;

    function linkAnyUri(DataTypes.linkAnyUriData calldata vars) external;

    function unlinkAnyUri(DataTypes.unlinkAnyUriData calldata vars) external;

    /*
    function linkCharacterLink(
        uint256 fromCharacterId,
        DataTypes.CharacterLinkStruct calldata linkData,
        bytes32 linkType
    ) external;

    function unlinkCharacterLink(
        uint256 fromCharacterId,
        DataTypes.CharacterLinkStruct calldata linkData,
        bytes32 linkType
    ) external;
    */

    function linkLinklist(DataTypes.linkLinklistData calldata vars) external;

    function unlinkLinklist(DataTypes.unlinkLinklistData calldata vars) external;

    function setLinkModule4Character(DataTypes.setLinkModule4CharacterData calldata vars) external;

    function setLinkModule4Note(DataTypes.setLinkModule4NoteData calldata vars) external;

    function setLinkModule4Linklist(DataTypes.setLinkModule4LinklistData calldata vars) external;

    function setLinkModule4ERC721(DataTypes.setLinkModule4ERC721Data calldata vars) external;

    function setLinkModule4Address(DataTypes.setLinkModule4AddressData calldata vars) external;

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

    function setMintModule4Note(DataTypes.setMintModule4NoteData calldata vars) external;

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

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

    function lockNote(uint256 characterId, uint256 noteId) external;

    function deleteNote(uint256 characterId, uint256 noteId) external;

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

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

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

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

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

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

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

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

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

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

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

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

    function getOperator(uint256 characterId) external view returns (address);

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

    function getLinkModule4Address(address account) external view returns (address);

    function getLinkModule4Linklist(uint256 tokenId) external view returns (address);

    function getLinkModule4ERC721(address tokenAddress, uint256 tokenId)
        external
        view
        returns (address);

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

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

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

    function getLinklistContract() external view returns (address);

    function getRevision() external pure returns (uint256);
}
          

contracts/interfaces/ILinkModule4Character.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

interface ILinkModule4Character {
    function initializeLinkModule(uint256 characterId, bytes calldata data)
        external
        returns (bytes memory);

    function processLink(
        address caller,
        uint256 characterId,
        bytes calldata data
    ) external;
}
          

contracts/libraries/Events.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

library Events {
    event BaseInitialized(string name, string symbol, uint256 timestamp);

    event Web3EntryInitialized(uint256 timestamp);

    event LinklistNFTInitialized(uint256 timestamp);

    event MintNFTInitialized(uint256 characterId, uint256 noteId, uint256 timestamp);

    event CharacterCreated(
        uint256 indexed characterId,
        address indexed creator,
        address indexed to,
        string handle,
        uint256 timestamp
    );

    event SetPrimaryCharacterId(
        address indexed account,
        uint256 indexed characterId,
        uint256 indexed oldCharacterId
    );

    event SetHandle(address indexed account, uint256 indexed characterId, string newHandle);

    event SetSocialToken(
        address indexed account,
        uint256 indexed characterId,
        address indexed tokenAddress
    );

    event SetOperator(uint256 indexed characterId, address indexed operator, uint256 timestamp);

    event SetCharacterUri(uint256 indexed characterId, string newUri);

    event PostNote(
        uint256 indexed characterId,
        uint256 indexed noteId,
        bytes32 indexed linkKey,
        bytes32 linkItemType,
        bytes data
    );

    event SetNoteUri(uint256 indexed characterId, uint256 noteId, string newUri);

    event DeleteNote(uint256 indexed characterId, uint256 noteId);

    event LockNote(uint256 indexed characterId, uint256 noteId);

    event LinkCharacter(
        address indexed account,
        uint256 indexed fromCharacterId,
        uint256 indexed toCharacterId,
        bytes32 linkType,
        uint256 linklistId
    );

    event UnlinkCharacter(
        address indexed account,
        uint256 indexed fromCharacterId,
        uint256 indexed toCharacterId,
        bytes32 linkType
    );

    event LinkNote(
        uint256 indexed fromCharacterId,
        uint256 indexed toCharacterId,
        uint256 indexed toNoteId,
        bytes32 linkType,
        uint256 linklistId
    );

    event UnlinkNote(
        uint256 indexed fromCharacterId,
        uint256 indexed toCharacterId,
        uint256 indexed toNoteId,
        bytes32 linkType,
        uint256 linklistId
    );

    event LinkERC721(
        uint256 indexed fromCharacterId,
        address indexed tokenAddress,
        uint256 indexed toNoteId,
        bytes32 linkType,
        uint256 linklistId
    );

    event LinkAddress(
        uint256 indexed fromCharacterId,
        address indexed ethAddress,
        bytes32 linkType,
        uint256 linklistId
    );

    event UnlinkAddress(
        uint256 indexed fromCharacterId,
        address indexed ethAddress,
        bytes32 linkType
    );

    event LinkAnyUri(
        uint256 indexed fromCharacterId,
        string toUri,
        bytes32 linkType,
        uint256 linklistId
    );

    event UnlinkAnyUri(uint256 indexed fromCharacterId, string toUri, bytes32 linkType);

    event LinkCharacterLink(
        uint256 indexed fromCharacterId,
        bytes32 indexed linkType,
        uint256 clFromCharacterId,
        uint256 clToCharacterId,
        bytes32 clLinkType
    );

    event UnlinkCharacterLink(
        uint256 indexed fromCharacterId,
        bytes32 indexed linkType,
        uint256 clFromCharactereId,
        uint256 clToCharacterId,
        bytes32 clLinkType
    );

    event UnlinkERC721(
        uint256 indexed fromCharacterId,
        address indexed tokenAddress,
        uint256 indexed toNoteId,
        bytes32 linkType,
        uint256 linklistId
    );

    event LinkLinklist(
        uint256 indexed fromCharacterId,
        uint256 indexed toLinklistId,
        bytes32 linkType,
        uint256 indexed linklistId
    );

    event UnlinkLinklist(
        uint256 indexed fromCharacterId,
        uint256 indexed toLinklistId,
        bytes32 linkType,
        uint256 indexed linklistId
    );

    event MintNote(
        address indexed to,
        uint256 indexed characterId,
        uint256 indexed noteId,
        address tokenAddress,
        uint256 tokenId
    );

    event SetLinkModule4Character(
        uint256 indexed characterId,
        address indexed linkModule,
        bytes returnData,
        uint256 timestamp
    );

    event SetLinkModule4Note(
        uint256 indexed characterId,
        uint256 indexed noteId,
        address indexed linkModule,
        bytes returnData,
        uint256 timestamp
    );

    event SetLinkModule4Address(
        address indexed account,
        address indexed linkModule,
        bytes returnData,
        uint256 timestamp
    );

    event SetLinkModule4ERC721(
        address indexed tokenAddress,
        uint256 indexed tokenId,
        address indexed linkModule,
        bytes returnData,
        uint256 timestamp
    );

    event SetLinkModule4Linklist(
        uint256 indexed linklistId,
        address indexed linkModule,
        bytes returnData,
        uint256 timestamp
    );

    event SetMintModule4Note(
        uint256 indexed characterId,
        uint256 indexed noteId,
        address indexed mintModule,
        bytes returnData,
        uint256 timestamp
    );

    event AttachLinklist(
        uint256 indexed linklistId,
        uint256 indexed characterId,
        bytes32 indexed linkType
    );

    event DetachLinklist(
        uint256 indexed linklistId,
        uint256 indexed characterId,
        bytes32 indexed linkType
    );
}
          

contracts/interfaces/IMintModule4Note.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

interface IMintModule4Note {
    function initializeMintModule(
        uint256 characterId,
        uint256 noteId,
        bytes calldata data
    ) external returns (bytes memory);

    function processMint(
        address to,
        uint256 characterId,
        uint256 noteId,
        bytes calldata data
    ) external;
}
          

contracts/interfaces/ILinkModule4Note.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

interface ILinkModule4Note {
    function initializeLinkModule(
        uint256 characterId,
        uint256 noteId,
        bytes calldata data
    ) external returns (bytes memory);

    function processLink(
        address caller,
        uint256 characterId,
        uint256 noteId,
        bytes calldata data
    ) external;
}
          

contracts/libraries/CharacterLogic.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "./DataTypes.sol";
import "./Events.sol";
import "./Constants.sol";
import "../interfaces/ILinkModule4Character.sol";
import "../interfaces/ILinklist.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

library CharacterLogic {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    function createCharacter(
        DataTypes.CreateCharacterData calldata vars,
        bool validateHandle,
        uint256 characterId,
        mapping(bytes32 => uint256) storage _characterIdByHandleHash,
        mapping(uint256 => DataTypes.Character) storage _characterById
    ) external {
        if (validateHandle) {
            _validateHandle(vars.handle);
        }

        bytes32 handleHash = keccak256(bytes(vars.handle));
        require(_characterIdByHandleHash[handleHash] == 0, "HandleExists");

        _characterIdByHandleHash[handleHash] = characterId;

        _characterById[characterId].characterId = characterId;
        _characterById[characterId].handle = vars.handle;
        _characterById[characterId].uri = vars.uri;

        // init link module
        if (vars.linkModule != address(0)) {
            _characterById[characterId].linkModule = vars.linkModule;

            ILinkModule4Character(vars.linkModule).initializeLinkModule(
                characterId,
                vars.linkModuleInitData
            );
        }

        emit Events.CharacterCreated(
            characterId,
            msg.sender,
            vars.to,
            vars.handle,
            block.timestamp
        );
    }

    function setSocialToken(
        uint256 characterId,
        address tokenAddress,
        mapping(uint256 => DataTypes.Character) storage _characterById
    ) external {
        require(_characterById[characterId].socialToken == address(0), "SocialTokenExists");

        _characterById[characterId].socialToken = tokenAddress;

        emit Events.SetSocialToken(msg.sender, characterId, tokenAddress);
    }

    function setCharacterLinkModule(
        uint256 characterId,
        address linkModule,
        bytes calldata linkModuleInitData,
        DataTypes.Character storage _character
    ) external {
        _character.linkModule = linkModule;

        bytes memory returnData;
        if (linkModule != address(0)) {
            returnData = ILinkModule4Character(linkModule).initializeLinkModule(
                characterId,
                linkModuleInitData
            );
        }
        emit Events.SetLinkModule4Character(characterId, linkModule, returnData, block.timestamp);
    }

    function setHandle(
        uint256 characterId,
        string calldata newHandle,
        mapping(bytes32 => uint256) storage _characterIdByHandleHash,
        mapping(uint256 => DataTypes.Character) storage _characterById
    ) external {
        _validateHandle(newHandle);

        // set new handle
        bytes32 handleHash = keccak256(bytes(newHandle));
        require(_characterIdByHandleHash[handleHash] == 0, "HandleExists");

        // remove old handle
        string memory oldHandle = _characterById[characterId].handle;
        bytes32 oldHandleHash = keccak256(bytes(oldHandle));
        delete _characterIdByHandleHash[oldHandleHash];

        _characterIdByHandleHash[handleHash] = characterId;

        _characterById[characterId].handle = newHandle;

        emit Events.SetHandle(msg.sender, characterId, newHandle);
    }

    function _validateHandle(string calldata handle) private pure {
        bytes memory byteHandle = bytes(handle);
        require(
            byteHandle.length >= Constants.MIN_HANDLE_LENGTH &&
                byteHandle.length <= Constants.MAX_HANDLE_LENGTH,
            "HandleLengthInvalid"
        );

        uint256 byteHandleLength = byteHandle.length;
        for (uint256 i = 0; i < byteHandleLength; ++i) {
            require(
                (byteHandle[i] <= "9" && byteHandle[i] >= "0") ||
                    (byteHandle[i] <= "z" && byteHandle[i] >= "a") ||
                    byteHandle[i] == "-" ||
                    byteHandle[i] == "_",
                "HandleContainsInvalidCharacters"
            );
        }
    }
}
          

contracts/libraries/DataTypes.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

library DataTypes {
    struct MigrateData {
        address account;
        string handle;
        string uri;
        address[] toAddresses;
        bytes32 linkType;
    }

    struct CreateCharacterData {
        address to;
        string handle;
        string uri;
        address linkModule;
        bytes linkModuleInitData;
    }

    struct createThenLinkCharacterData {
        uint256 fromCharacterId;
        address to;
        bytes32 linkType;
    }

    struct linkNoteData {
        uint256 fromCharacterId;
        uint256 toCharacterId;
        uint256 toNoteId;
        bytes32 linkType;
        bytes data;
    }

    struct unlinkNoteData {
        uint256 fromCharacterId;
        uint256 toCharacterId;
        uint256 toNoteId;
        bytes32 linkType;
    }

    struct linkCharacterData {
        uint256 fromCharacterId;
        uint256 toCharacterId;
        bytes32 linkType;
        bytes data;
    }

    struct unlinkCharacterData {
        uint256 fromCharacterId;
        uint256 toCharacterId;
        bytes32 linkType;
    }

    struct linkERC721Data {
        uint256 fromCharacterId;
        address tokenAddress;
        uint256 tokenId;
        bytes32 linkType;
        bytes data;
    }

    struct unlinkERC721Data {
        uint256 fromCharacterId;
        address tokenAddress;
        uint256 tokenId;
        bytes32 linkType;
    }

    struct linkAddressData {
        uint256 fromCharacterId;
        address ethAddress;
        bytes32 linkType;
        bytes data;
    }

    struct unlinkAddressData {
        uint256 fromCharacterId;
        address ethAddress;
        bytes32 linkType;
    }

    struct linkAnyUriData {
        uint256 fromCharacterId;
        string toUri;
        bytes32 linkType;
        bytes data;
    }

    struct unlinkAnyUriData {
        uint256 fromCharacterId;
        string toUri;
        bytes32 linkType;
    }

    struct linkLinklistData {
        uint256 fromCharacterId;
        uint256 toLinkListId;
        bytes32 linkType;
        bytes data;
    }

    struct unlinkLinklistData {
        uint256 fromCharacterId;
        uint256 toLinkListId;
        bytes32 linkType;
    }

    struct setLinkModule4CharacterData {
        uint256 characterId;
        address linkModule;
        bytes linkModuleInitData;
    }

    struct setLinkModule4NoteData {
        uint256 characterId;
        uint256 noteId;
        address linkModule;
        bytes linkModuleInitData;
    }

    struct setLinkModule4LinklistData {
        uint256 linklistId;
        address linkModule;
        bytes linkModuleInitData;
    }

    struct setLinkModule4ERC721Data {
        address tokenAddress;
        uint256 tokenId;
        address linkModule;
        bytes linkModuleInitData;
    }

    struct setLinkModule4AddressData {
        address account;
        address linkModule;
        bytes linkModuleInitData;
    }

    struct setMintModule4NoteData {
        uint256 characterId;
        uint256 noteId;
        address mintModule;
        bytes mintModuleInitData;
    }

    struct linkCharactersInBatchData {
        uint256 fromCharacterId;
        uint256[] toCharacterIds;
        bytes[] data;
        address[] toAddresses;
        bytes32 linkType;
    }

    struct LinkData {
        uint256 linklistId;
        uint256 linkItemType;
        uint256 linkingCharacterId;
        address linkingAddress;
        uint256 linkingLinklistId;
        bytes32 linkKey;
    }

    struct PostNoteData {
        uint256 characterId;
        string contentUri;
        address linkModule;
        bytes linkModuleInitData;
        address mintModule;
        bytes mintModuleInitData;
        bool locked;
    }

    struct MintNoteData {
        uint256 characterId;
        uint256 noteId;
        address to;
        bytes mintModuleData;
    }

    // character struct
    struct Character {
        uint256 characterId;
        string handle;
        string uri;
        uint256 noteCount;
        address socialToken;
        address linkModule;
    }

    // note struct
    struct Note {
        bytes32 linkItemType; // type of note with link
        bytes32 linkKey; // if linkKey is not empty, it is a note with link
        string contentUri;
        address linkModule;
        address mintModule;
        address mintNFT;
        bool deleted;
        bool locked;
    }

    struct CharacterLinkStruct {
        uint256 fromCharacterId;
        uint256 toCharacterId;
        bytes32 linkType;
    }

    struct NoteStruct {
        uint256 characterId;
        uint256 noteId;
    }

    struct ERC721Struct {
        address tokenAddress;
        uint256 erc721TokenId;
    }
}
          

@openzeppelin/contracts/utils/Address.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

contracts/libraries/LinkModuleLogic.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "./Events.sol";
import "./DataTypes.sol";
import "../interfaces/IMintModule4Note.sol";
import "../interfaces/ILinkModule4Note.sol";
import "../interfaces/ILinkModule4ERC721.sol";
import "../interfaces/ILinkModule4Linklist.sol";
import "../interfaces/ILinkModule4Address.sol";

library LinkModuleLogic {
    function setLinkModule4Note(
        uint256 characterId,
        uint256 noteId,
        address linkModule,
        bytes calldata linkModuleInitData,
        mapping(uint256 => mapping(uint256 => DataTypes.Note)) storage _noteByIdByCharacter
    ) external {
        require(!_noteByIdByCharacter[characterId][noteId].locked, "NoteLocked");

        if (linkModule != address(0)) {
            _noteByIdByCharacter[characterId][noteId].linkModule = linkModule;

            bytes memory returnData = ILinkModule4Note(linkModule).initializeLinkModule(
                characterId,
                noteId,
                linkModuleInitData
            );

            emit Events.SetLinkModule4Note(
                characterId,
                noteId,
                linkModule,
                returnData,
                block.timestamp
            );
        }
    }

    function setLinkModule4Address(
        address account,
        address linkModule,
        bytes calldata linkModuleInitData,
        mapping(address => address) storage _linkModules4Address
    ) external {
        require(msg.sender == account, "NotAddressOwner");

        if (linkModule != address(0)) {
            _linkModules4Address[account] = linkModule;
            bytes memory linkModuleReturnData = ILinkModule4Address(linkModule)
                .initializeLinkModule(account, linkModuleInitData);

            emit Events.SetLinkModule4Address(
                account,
                linkModule,
                linkModuleReturnData,
                block.timestamp
            );
        }
    }

    function setMintModule4Note(
        uint256 characterId,
        uint256 noteId,
        address mintModule,
        bytes calldata mintModuleInitData,
        mapping(uint256 => mapping(uint256 => DataTypes.Note)) storage _noteByIdByCharacter
    ) external {
        require(!_noteByIdByCharacter[characterId][noteId].locked, "NoteLocked");

        if (mintModule != address(0)) {
            _noteByIdByCharacter[characterId][noteId].mintModule = mintModule;

            bytes memory returnData = IMintModule4Note(mintModule).initializeMintModule(
                characterId,
                noteId,
                mintModuleInitData
            );

            emit Events.SetMintModule4Note(
                characterId,
                noteId,
                mintModule,
                returnData,
                block.timestamp
            );
        }
    }

    function setLinkModule4Linklist(
        uint256 linklistId,
        address linkModule,
        bytes calldata linkModuleInitData,
        mapping(uint256 => address) storage _linkModules4Linklist
    ) external {
        if (linkModule != address(0)) {
            _linkModules4Linklist[linklistId] = linkModule;
            bytes memory linkModuleReturnData = ILinkModule4Linklist(linkModule)
                .initializeLinkModule(linklistId, linkModuleInitData);

            emit Events.SetLinkModule4Linklist(
                linklistId,
                linkModule,
                linkModuleReturnData,
                block.timestamp
            );
        }
    }

    function setLinkModule4ERC721(
        address tokenAddress,
        uint256 tokenId,
        address linkModule,
        bytes calldata linkModuleInitData,
        mapping(address => mapping(uint256 => address)) storage _linkModules4ERC721
    ) external {
        if (linkModule != address(0)) {
            _linkModules4ERC721[tokenAddress][tokenId] = linkModule;
            bytes memory linkModuleReturnData = ILinkModule4ERC721(linkModule).initializeLinkModule(
                tokenAddress,
                tokenId,
                linkModuleInitData
            );

            emit Events.SetLinkModule4ERC721(
                tokenAddress,
                tokenId,
                linkModule,
                linkModuleReturnData,
                block.timestamp
            );
        }
    }
}
          

contracts/base/NFTBase.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "./ERC721Enumerable.sol";
import "../libraries/Events.sol";

abstract contract NFTBase is ERC721Enumerable {
    function _initialize(string calldata name, string calldata symbol) internal {
        ERC721.__ERC721_Init(name, symbol);

        emit Events.BaseInitialized(name, symbol, block.timestamp);
    }

    function burn(uint256 tokenId) public virtual {
        require(_isApprovedOrOwner(msg.sender, tokenId), "NFTBase: NotOwnerOrApproved");
        _burn(tokenId);
    }
}
          

@openzeppelin/contracts/utils/structs/EnumerableSet.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}
          

contracts/interfaces/ILinkModule4ERC721.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

interface ILinkModule4ERC721 {
    function initializeLinkModule(
        address tokenAddress,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes memory);

    function processLink(
        address account,
        address tokenAddress,
        uint256 tokenId,
        bytes calldata data
    ) external;
}
          

contracts/base/ERC721.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    function __ERC721_Init(string calldata name_, string calldata symbol_) internal {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165, IERC165)
        returns (bool)
    {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return
            bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        override
        returns (bool)
    {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721: transfer caller is not owner nor approved"
        );

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721: transfer caller is not owner nor approved"
        );
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(
            _checkOnERC721Received(from, to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId)
        internal
        view
        virtual
        returns (bool)
    {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner ||
            getApproved(tokenId) == spender ||
            isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (
                bytes4 retval
            ) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}
          

contracts/interfaces/IResolver.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

interface IResolver {
    function addENSRecords(string[] calldata labels, address[] calldata owners) external;

    function addRNSRecords(string[] calldata labels, address[] calldata owners) external;

    function deleteENSRecords(string[] calldata labels) external;

    function deleteRNSRecords(string[] calldata labels) external;

    function getENSRecord(string calldata label) external view returns (address);

    function getRNSRecord(string calldata label) external view returns (address);

    function getTotalENSCount() external view returns (uint256);

    function getTotalRNSCount() external view returns (uint256);
}
          

contracts/storage/Web3EntryExtendStorage.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

contract Web3EntryExtendStorage {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    address internal periphery; // slot 21
    mapping(uint256 => address) internal _operatorByCharacter;
    address public resolver;
    mapping(uint256 => EnumerableSet.Bytes32Set) internal _linkTypesByCharacter; // obsoleted
}
          

contracts/storage/Web3EntryStorage.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "../libraries/DataTypes.sol";

contract Web3EntryStorage {
    // characterId => Character
    mapping(uint256 => DataTypes.Character) internal _characterById;
    // handleHash => characterId
    mapping(bytes32 => uint256) internal _characterIdByHandleHash;
    // address => characterId
    mapping(address => uint256) internal _primaryCharacterByAddress;

    // characterId =>  (linkType => linklistId)
    mapping(uint256 => mapping(bytes32 => uint256)) internal _attachedLinklists;

    // characterId => noteId => Note
    mapping(uint256 => mapping(uint256 => DataTypes.Note)) internal _noteByIdByCharacter; // slot 14

    /////////////////////////////////
    // link modules
    /////////////////////////////////

    // tokenId => linkModule4Linklist
    mapping(uint256 => address) internal _linkModules4Linklist;

    // tokenAddress => tokenId => linkModule4ERC721
    mapping(address => mapping(uint256 => address)) internal _linkModules4ERC721;

    // address => linkModule4Address
    mapping(address => address) internal _linkModules4Address;

    uint256 internal _characterCounter;
    // LinkList NFT token contract
    address internal _linklist;
    address internal MINT_NFT_IMPL;
}
          

@openzeppelin/contracts/proxy/Clones.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol)

pragma solidity ^0.8.0;

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 *
 * _Available since v3.4._
 */
library Clones {
    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create(0, ptr, 0x37)
        }
        require(instance != address(0), "ERC1167: create failed");
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
            instance := create2(0, ptr, 0x37, salt)
        }
        require(instance != address(0), "ERC1167: create2 failed");
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
            mstore(add(ptr, 0x14), shl(0x60, implementation))
            mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)
            mstore(add(ptr, 0x38), shl(0x60, deployer))
            mstore(add(ptr, 0x4c), salt)
            mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))
            predicted := keccak256(add(ptr, 0x37), 0x55)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(address implementation, bytes32 salt)
        internal
        view
        returns (address predicted)
    {
        return predictDeterministicAddress(implementation, salt, address(this));
    }
}
          

@openzeppelin/contracts/utils/introspection/ERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
          

contracts/libraries/Constants.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

library Constants {
    uint8 internal constant MAX_HANDLE_LENGTH = 31;
    uint8 internal constant MIN_HANDLE_LENGTH = 3;

    // note link item type
    // "Character"
    bytes32 constant NoteLinkTypeCharacter =
        0x4368617261637465720000000000000000000000000000000000000000000000;
    // "Address"
    bytes32 constant NoteLinkTypeAddress =
        0x4164647265737300000000000000000000000000000000000000000000000000;
    // "Linklist"
    bytes32 constant NoteLinkTypeLinklist =
        0x4c696e6b6c697374000000000000000000000000000000000000000000000000;
    // "Note"
    bytes32 constant NoteLinkTypeNote =
        0x4e6f746500000000000000000000000000000000000000000000000000000000;
    // "ERC721"
    bytes32 constant NoteLinkTypeERC721 =
        0x4552433732310000000000000000000000000000000000000000000000000000;
    // "AnyUri"
    bytes32 constant NoteLinkTypeAnyUri =
        0x416e795572690000000000000000000000000000000000000000000000000000;
}
          

Contract ABI

[{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"approved","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approve","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"canCreate","inputs":[{"type":"string","name":"handle","internalType":"string"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createCharacter","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.CreateCharacterData","components":[{"type":"address","name":"to","internalType":"address"},{"type":"string","name":"handle","internalType":"string"},{"type":"string","name":"uri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createProfile","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.CreateCharacterData","components":[{"type":"address","name":"to","internalType":"address"},{"type":"string","name":"handle","internalType":"string"},{"type":"string","name":"uri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createThenLinkCharacter","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.createThenLinkCharacterData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deleteNote","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getApproved","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct DataTypes.Character","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"handle","internalType":"string"},{"type":"string","name":"uri","internalType":"string"},{"type":"uint256","name":"noteCount","internalType":"uint256"},{"type":"address","name":"socialToken","internalType":"address"},{"type":"address","name":"linkModule","internalType":"address"}]}],"name":"getCharacter","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct DataTypes.Character","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"handle","internalType":"string"},{"type":"string","name":"uri","internalType":"string"},{"type":"uint256","name":"noteCount","internalType":"uint256"},{"type":"address","name":"socialToken","internalType":"address"},{"type":"address","name":"linkModule","internalType":"address"}]}],"name":"getCharacterByHandle","inputs":[{"type":"string","name":"handle","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getCharacterUri","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getHandle","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getLinkModule4Address","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getLinkModule4ERC721","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getLinkModule4Linklist","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getLinklistContract","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLinklistId","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getLinklistType","inputs":[{"type":"uint256","name":"linkListId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getLinklistUri","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct DataTypes.Note","components":[{"type":"bytes32","name":"linkItemType","internalType":"bytes32"},{"type":"bytes32","name":"linkKey","internalType":"bytes32"},{"type":"string","name":"contentUri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"address","name":"mintModule","internalType":"address"},{"type":"address","name":"mintNFT","internalType":"address"},{"type":"bool","name":"deleted","internalType":"bool"},{"type":"bool","name":"locked","internalType":"bool"}]}],"name":"getNote","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getOperator","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPrimaryCharacterId","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRevision","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"string","name":"_name","internalType":"string"},{"type":"string","name":"_symbol","internalType":"string"},{"type":"address","name":"_linklistContract","internalType":"address"},{"type":"address","name":"_mintNFTImpl","internalType":"address"},{"type":"address","name":"_periphery","internalType":"address"},{"type":"address","name":"_resolver","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isPrimaryCharacter","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"linkAddress","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.linkAddressData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"address","name":"ethAddress","internalType":"address"},{"type":"bytes32","name":"linkType","internalType":"bytes32"},{"type":"bytes","name":"data","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"linkAnyUri","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.linkAnyUriData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"string","name":"toUri","internalType":"string"},{"type":"bytes32","name":"linkType","internalType":"bytes32"},{"type":"bytes","name":"data","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"linkCharacter","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.linkCharacterData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"uint256","name":"toCharacterId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"},{"type":"bytes","name":"data","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"linkERC721","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.linkERC721Data","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"},{"type":"bytes","name":"data","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"linkLinklist","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.linkLinklistData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"uint256","name":"toLinkListId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"},{"type":"bytes","name":"data","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"linkNote","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.linkNoteData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"uint256","name":"toCharacterId","internalType":"uint256"},{"type":"uint256","name":"toNoteId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"},{"type":"bytes","name":"data","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lockNote","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"mintNote","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.MintNoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"},{"type":"bytes","name":"mintModuleData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"postNote","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.PostNoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"contentUri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"},{"type":"address","name":"mintModule","internalType":"address"},{"type":"bytes","name":"mintModuleInitData","internalType":"bytes"},{"type":"bool","name":"locked","internalType":"bool"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"postNote4Address","inputs":[{"type":"tuple","name":"noteData","internalType":"struct DataTypes.PostNoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"contentUri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"},{"type":"address","name":"mintModule","internalType":"address"},{"type":"bytes","name":"mintModuleInitData","internalType":"bytes"},{"type":"bool","name":"locked","internalType":"bool"}]},{"type":"address","name":"ethAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"postNote4AnyUri","inputs":[{"type":"tuple","name":"postNoteData","internalType":"struct DataTypes.PostNoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"contentUri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"},{"type":"address","name":"mintModule","internalType":"address"},{"type":"bytes","name":"mintModuleInitData","internalType":"bytes"},{"type":"bool","name":"locked","internalType":"bool"}]},{"type":"string","name":"uri","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"postNote4Character","inputs":[{"type":"tuple","name":"postNoteData","internalType":"struct DataTypes.PostNoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"contentUri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"},{"type":"address","name":"mintModule","internalType":"address"},{"type":"bytes","name":"mintModuleInitData","internalType":"bytes"},{"type":"bool","name":"locked","internalType":"bool"}]},{"type":"uint256","name":"toCharacterId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"postNote4ERC721","inputs":[{"type":"tuple","name":"postNoteData","internalType":"struct DataTypes.PostNoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"contentUri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"},{"type":"address","name":"mintModule","internalType":"address"},{"type":"bytes","name":"mintModuleInitData","internalType":"bytes"},{"type":"bool","name":"locked","internalType":"bool"}]},{"type":"tuple","name":"erc721","internalType":"struct DataTypes.ERC721Struct","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"erc721TokenId","internalType":"uint256"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"postNote4Linklist","inputs":[{"type":"tuple","name":"noteData","internalType":"struct DataTypes.PostNoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"contentUri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"},{"type":"address","name":"mintModule","internalType":"address"},{"type":"bytes","name":"mintModuleInitData","internalType":"bytes"},{"type":"bool","name":"locked","internalType":"bool"}]},{"type":"uint256","name":"toLinklistId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"postNote4Note","inputs":[{"type":"tuple","name":"postNoteData","internalType":"struct DataTypes.PostNoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"contentUri","internalType":"string"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"},{"type":"address","name":"mintModule","internalType":"address"},{"type":"bytes","name":"mintModuleInitData","internalType":"bytes"},{"type":"bool","name":"locked","internalType":"bool"}]},{"type":"tuple","name":"note","internalType":"struct DataTypes.NoteStruct","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"resolver","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setCharacterUri","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"newUri","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setHandle","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"string","name":"newHandle","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLinkModule4Address","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.setLinkModule4AddressData","components":[{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLinkModule4Character","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.setLinkModule4CharacterData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLinkModule4ERC721","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.setLinkModule4ERC721Data","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLinkModule4Linklist","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.setLinkModule4LinklistData","components":[{"type":"uint256","name":"linklistId","internalType":"uint256"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLinkModule4Note","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.setLinkModule4NoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"},{"type":"address","name":"linkModule","internalType":"address"},{"type":"bytes","name":"linkModuleInitData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLinklistUri","inputs":[{"type":"uint256","name":"linklistId","internalType":"uint256"},{"type":"string","name":"uri","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMintModule4Note","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.setMintModule4NoteData","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"},{"type":"address","name":"mintModule","internalType":"address"},{"type":"bytes","name":"mintModuleInitData","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMintNFTImpl","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNoteUri","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"},{"type":"string","name":"newUri","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setOperator","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPrimaryCharacterId","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setProfileUri","inputs":[{"type":"uint256","name":"profileId","internalType":"uint256"},{"type":"string","name":"newUri","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSocialToken","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenByIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenOfOwnerByIndex","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlinkAddress","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.unlinkAddressData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"address","name":"ethAddress","internalType":"address"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlinkAnyUri","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.unlinkAnyUriData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"string","name":"toUri","internalType":"string"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlinkCharacter","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.unlinkCharacterData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"uint256","name":"toCharacterId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlinkERC721","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.unlinkERC721Data","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlinkLinklist","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.unlinkLinklistData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"uint256","name":"toLinkListId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unlinkNote","inputs":[{"type":"tuple","name":"vars","internalType":"struct DataTypes.unlinkNoteData","components":[{"type":"uint256","name":"fromCharacterId","internalType":"uint256"},{"type":"uint256","name":"toCharacterId","internalType":"uint256"},{"type":"uint256","name":"toNoteId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50615a4880620000216000396000f3fe608060405234801561001057600080fd5b50600436106104545760003560e01c8063867884e611610241578063c87b56dd1161013b578063e56f2fe4116100c3578063f2ad807511610087578063f2ad807514610a6d578063f316bacd14610a80578063f6479d7714610a93578063fd2d866f14610aa6578063fe9299fb14610ab957600080fd5b8063e56f2fe4146109e5578063e7a1c1c0146109f8578063e985e9c514610a0b578063ec81d19414610a47578063ef0828ab14610a5a57600080fd5b8063d70e10c61161010a578063d70e10c614610961578063dabb05311461098c578063db491e801461099f578063db8c198d146109bf578063dca27135146109d257600080fd5b8063c87b56dd14610928578063cb8e757e1461093b578063cd69fe61146108f1578063d23b320b1461094e57600080fd5b80639a50248d116101c9578063b88d4fde1161018d578063b88d4fde146108cb578063b9d32845146108de578063bd5f69cb146108f1578063c053f6b814610904578063c2a6fe3b1461091557600080fd5b80639a50248d1461085f578063a22cb4651461087f578063a6e6178d14610892578063a7ccb4bf146108a5578063af90b112146108b857600080fd5b806393f057e51161021057806393f057e51461080b57806395d89b411461081e57806395d9fa7d146108265780639864c307146108395780639a4dec181461084c57600080fd5b8063867884e6146107bf5780638734bbfc146107d25780638b4ca06a146107e557806392f7070b146107f857600080fd5b806331b9d08c116103525780634f6ccce7116102da57806369492c971161029e57806369492c971461077057806370a082311461078357806374f345cf146107965780637c392b51146106fe5780637daca6d0146107a957600080fd5b80634f6ccce7146107115780635a936d10146107245780635fb8818314610737578063628b644a1461074a5780636352211e1461075d57600080fd5b806340ad34d81161032157806340ad34d8146106b257806342842e0e146106c557806342966c68146106d857806344b82a24146106eb57806347f94de7146106fe57600080fd5b806331b9d08c1461064d578063327b2a031461067957806333f06ee61461068c578063388f50831461069f57600080fd5b80631316529d116103e05780632209d145116103a45780632209d145146105b557806323b872dd146105eb57806329c301c2146105fe5780632abc6bf6146106115780632f745c591461063a57600080fd5b80631316529d1461054b578063144a3e831461055c57806316b74c2a1461056f57806318160ddd1461059a578063188b04b3146105a257600080fd5b8063081812fc11610427578063081812fc146104ea57806308cb68ff146104fd578063095ea7b3146105125780630c4dd5f2146105255780630ff982441461053857600080fd5b806301ffc9a71461045957806304f3bcec1461048157806305f63c8a146104ac57806306fdde03146104d5575b600080fd5b61046c61046736600461447f565b610ae2565b60405190151581526020015b60405180910390f35b601754610494906001600160a01b031681565b6040516001600160a01b039091168152602001610478565b6104946104ba36600461449c565b6000908152601660205260409020546001600160a01b031690565b6104dd610b0d565b604051610478919061450d565b6104946104f836600461449c565b610b9f565b61051061050b366004614538565b610c39565b005b610510610520366004614591565b610cd2565b610510610533366004614538565b610de8565b6105106105463660046145bd565b610e4d565b60045b604051908152602001610478565b6104dd61056a36600461449c565b610f4c565b610510601480546001600160a01b0319167387efeb45f2dc12f77c4ad46769dab4678ef84045179055565b60085461054e565b6105106105b03660046145eb565b610f57565b6104946105c3366004614591565b6001600160a01b03918216600090815260106020908152604080832093835292905220541690565b6105106105f936600461461f565b611054565b61054e61060c366004614672565b611085565b61054e61061f3660046146a6565b6001600160a01b03166000908152600c602052604090205490565b61054e610648366004614591565b611131565b61049461065b3660046146a6565b6001600160a01b039081166000908152601160205260409020541690565b61054e6106873660046146d5565b6111c7565b61051061069a36600461476b565b61138a565b6105106106ad3660046145eb565b6113fe565b6105106106c03660046147b6565b6114b8565b6105106106d336600461461f565b611532565b6105106106e636600461449c565b61154d565b61054e6106f93660046147d2565b6115ea565b61051061070c36600461476b565b611660565b61054e61071f36600461449c565b6116a0565b6105106107323660046145bd565b611733565b6105106107453660046145eb565b6117c3565b610510610758366004614816565b61187d565b61049461076b36600461449c565b611909565b61051061077e3660046145eb565b611980565b61054e6107913660046146a6565b611ab8565b6105106107a4366004614868565b611b3f565b61046c6107b7366004614975565b600192915050565b6105106107cd3660046147b6565b611bb7565b61046c6107e036600461449c565b611c27565b61054e6107f336600461449c565b611c55565b61054e6108063660046149c6565b611cc1565b6105106108193660046145bd565b611d55565b6104dd611dc4565b6105106108343660046149fb565b611dd3565b6105106108473660046145eb565b611e59565b61054e61085a3660046146d5565b611f13565b61087261086d366004614a20565b61201b565b6040516104789190614a61565b61051061088d366004614aed565b6121ca565b6105106108a036600461476b565b6121d5565b61054e6108b33660046145eb565b61224b565b61054e6108c63660046147d2565b6122ef565b6105106108d9366004614b19565b61232d565b6105106108ec366004614b96565b612365565b6105106108ff366004614b96565b612434565b6013546001600160a01b0316610494565b610510610923366004614868565b612448565b6104dd61093636600461449c565b6124b8565b610510610949366004614b96565b61255d565b61051061095c3660046145eb565b612634565b61054e61096f366004614868565b6000918252600d6020908152604080842092845291905290205490565b61087261099a36600461449c565b6126ae565b6109b26109ad366004614868565b612835565b6040516104789190614bca565b6105106109cd3660046145eb565b612996565b6104dd6109e036600461449c565b6129e0565b6105106109f3366004614c60565b612a52565b610510610a063660046149fb565b612baf565b61046c610a19366004614d1a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6104dd610a5536600461449c565b612bc2565b610510610a68366004614538565b612be2565b610510610a7b36600461449c565b612c51565b61054e610a8e366004614d48565b612ca0565b610510610aa13660046145bd565b612dfc565b610510610ab4366004614538565b612e36565b610494610ac736600461449c565b6000908152600f60205260409020546001600160a01b031690565b60006001600160e01b0319821663780e9d6360e01b1480610b075750610b0782612eaf565b92915050565b606060008054610b1c90614da3565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4890614da3565b8015610b955780601f10610b6a57610100808354040283529160200191610b95565b820191906000526020600020905b815481529060010190602001808311610b7857829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610c1d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b73cdec76a825bb8be252c56612593fe69e243500d163dfc34f25610c6060208401846146a6565b610c7060408501602086016146a6565b610c7d6040860186614dd8565b60116040518663ffffffff1660e01b8152600401610c9f959493929190614e47565b60006040518083038186803b158015610cb757600080fd5b505af4158015610ccb573d6000803e3d6000fd5b5050505050565b6000610cdd82611909565b9050806001600160a01b0316836001600160a01b03161415610d4b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c14565b336001600160a01b0382161480610d675750610d678133610a19565b610dd95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610c14565b610de38383612eff565b505050565b610df28135612f6d565b73cdec76a825bb8be252c56612593fe69e243500d1636252159e8235610e1e60408501602086016146a6565b610e2b6040860186614dd8565b600f6040518663ffffffff1660e01b8152600401610c9f959493929190614e86565b610e57813561302d565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f39782990633019fadd9083903090636352211e90602401602060405180830381865afa158015610eb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed59190614eb1565b60135485356000908152600d60209081526040808320818a0135845282529182902054825160e088901b6001600160e01b031916815286356004820152918601356024830152949091013560448201526001600160a01b0392831660648201529116608482015260a481019190915260c401610c9f565b6060610b07826124b8565b610f61813561302d565b610f6e81602001356130ae565b7320a25de3f09a7e2ba9992c426d0b64a22f39782963957f8a98823560208401356040850135610fa16060870187614dd8565b6040516331a9108f60e11b8152883560048201523090636352211e90602401602060405180830381865afa158015610fdd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110019190614eb1565b6013546020808b01356000908152600a9091526040908190206005015490516001600160e01b031960e08b901b168152610c9f989796959493926001600160a01b03908116921690600d90600401614ece565b61105e3382613107565b61107a5760405162461bcd60e51b8152600401610c1490614f28565b610de38383836131fe565b600061109182356133a5565b81356000908152600a60205260408120600301805482906110b190614f8f565b91829055506040516342a34a5360e01b815290915073672dc6510e7f7fba3c0b0f35d84c749910296f9f906342a34a53906110fa90869085906000908190600e906004016150b4565b60006040518083038186803b15801561111257600080fd5b505af4158015611126573d6000803e3d6000fd5b509295945050505050565b600061113c83611ab8565b821061119e5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c14565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b60006111d383356133a5565b6111ed6111e360208401846146a6565b8360200135613446565b6013546545524337323160d01b906000906001600160a01b0316632ea24efc8261121a60208801886146a6565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152602087013560448201526064016020604051808303816000875af1158015611270573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129491906150f9565b85356000908152600a602052604081206003018054929350909182906112b990614f8f565b9182905550905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53878386866112eb60208c018c6146a6565b8b6020013560405160200161131e92919060609290921b6bffffffffffffffffffffffff19168252601482015260340190565b604051602081830303815290604052600e6040518763ffffffff1660e01b815260040161135096959493929190615112565b60006040518083038186803b15801561136857600080fd5b505af415801561137c573d6000803e3d6000fd5b509298975050505050505050565b61139383612f6d565b601354604051633c17845760e11b81526001600160a01b039091169063782f08ae906113c79086908690869060040161515d565b600060405180830381600087803b1580156113e157600080fd5b505af11580156113f5573d6000803e3d6000fd5b50505050505050565b611408813561302d565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f39782990631e3981939083903090636352211e90602401602060405180830381865afa158015611462573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114869190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600d90600401615180565b6114c281356133a5565b60135460408051635cebf08d60e11b81528335600482015260208401356024820152908301356044820152606083013560648201526001600160a01b039091166084820152600d60a48201527320a25de3f09a7e2ba9992c426d0b64a22f3978299063b9d7e11a9060c401610c9f565b610de38383836040518060200160405280600081525061232d565b6000818152600a6020526040808220905161156b91600101906151f7565b60408051918290039091206000818152600b6020908152838220829055858252600a9052918220828155909250906115a660018301826142da565b6115b46002830160006142da565b50600060038201556004810180546001600160a01b03199081169091556005909101805490911690556115e6826134f6565b5050565b60006115f683356133a5565b82356000908152600a60205260408120600301805467131a5b9adb1a5cdd60c21b9285929091829061162790614f8f565b919050819055905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53878386868a60405160200161131e91815260200190565b610de38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061355592505050565b60006116ab60085490565b821061170e5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610c14565b6008828154811061172157611721615293565b90600052602060002001549050919050565b61173d813561302d565b60135481356000818152600d60209081526040808320818701358085529083529281902054905163d862986560e01b8152600481019490945290850135602484015260448301919091526001600160a01b03909216606482015260848101919091527320a25de3f09a7e2ba9992c426d0b64a22f3978299063d86298659060a401610c9f565b6117cd813561302d565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f397829906331ba880f9083903090636352211e90602401602060405180830381865afa158015611827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184b9190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600d906004016152a9565b6118868461302d565b61189084846135b4565b6040516001626802bf60e01b0319815273672dc6510e7f7fba3c0b0f35d84c749910296f9f9063ff97fd41906118d3908790879087908790600e90600401615330565b60006040518083038186803b1580156118eb57600080fd5b505af41580156118ff573d6000803e3d6000fd5b5050505050505050565b6000818152600260205260408120546001600160a01b031680610b075760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c14565b61198d60208201826146a6565b6040516331a9108f60e11b8152602083013560048201526001600160a01b039190911690636352211e90602401602060405180830381865afa1580156119d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fb9190614eb1565b6001600160a01b0316336001600160a01b031614611a4c5760405162461bcd60e51b815260206004820152600e60248201526d2737ba22a9219b9918a7bbb732b960911b6044820152606401610c14565b73cdec76a825bb8be252c56612593fe69e243500d163384afeb3611a7360208401846146a6565b6020840135611a8860608601604087016146a6565b611a956060870187614dd8565b60106040518763ffffffff1660e01b8152600401610c9f96959493929190615350565b60006001600160a01b038216611b235760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c14565b506001600160a01b031660009081526003602052604090205490565b611b48826133a5565b611b5282826135b4565b6000828152600e60209081526040808320848452825291829020600501805460ff60a81b1916600160a81b179055905182815283917f036469f3e73c83520cdefa197d7a9c854c2f8bc0164b82e9f2bd4aa7e150fd3091015b60405180910390a25050565b611bc1813561302d565b60135481356000908152600d6020908152604080832060608601358452909152908190205490516317e9a8b160e31b81527320a25de3f09a7e2ba9992c426d0b64a22f3978299263bf4d458892610c9f9286926001600160a01b03169190600401615397565b600080611c3383611909565b6001600160a01b03166000908152600c60205260409020549290921492915050565b60135460405162fba02760e01b8152600481018390526000916001600160a01b03169062fba02790602401602060405180830381865afa158015611c9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0791906150f9565b6000611ccd83356133a5565b82356000908152600a602052604081206003018054664164647265737360c81b926001600160a01b0386169290918290611d0690614f8f565b919050819055905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53878386868a60405160200161131e919060609190911b6bffffffffffffffffffffffff1916815260140190565b611d5f813561302d565b60135481356000908152600d6020908152604080832081860135845290915290819020549051633d7f9b3d60e11b81527320a25de3f09a7e2ba9992c426d0b64a22f39782992637aff367a92610c9f9286926001600160a01b031691906004016153e9565b606060018054610b1c90614da3565b611ddc8261302d565b6040516384b44a2f60e01b8152600481018390526001600160a01b0382166024820152600a604482015273d0ef7a6aad947bccbb43d60411e0bf0dd7e23138906384b44a2f9060640160006040518083038186803b158015611e3d57600080fd5b505af4158015611e51573d6000803e3d6000fd5b505050505050565b611e63813561302d565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f397829906372c61ab09083903090636352211e90602401602060405180830381865afa158015611ebd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee19190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600d90600401615431565b6000611f1f83356133a5565b601354604051635cb46be760e01b81526000600482018190528435602483015260208501356044830152634e6f746560e01b9290916001600160a01b0390911690635cb46be7906064016020604051808303816000875af1158015611f88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fac91906150f9565b85356000908152600a60205260408120600301805492935090918290611fd190614f8f565b919050819055905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53878386868a600001358b6020013560405160200161131e929190918252602082015260400190565b612023614314565b6000838360405161203592919061549a565b604080519182900382206000818152600b602090815283822054808352600a82529184902060c086019094528354855260018401805493965091949392908401919061208090614da3565b80601f01602080910402602001604051908101604052809291908181526020018280546120ac90614da3565b80156120f95780601f106120ce576101008083540402835291602001916120f9565b820191906000526020600020905b8154815290600101906020018083116120dc57829003601f168201915b5050505050815260200160028201805461211290614da3565b80601f016020809104026020016040519081016040528092919081815260200182805461213e90614da3565b801561218b5780601f106121605761010080835404028352916020019161218b565b820191906000526020600020905b81548152906001019060200180831161216e57829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b03908116604083015260059092015490911660609091015295945050505050565b6115e6338383613669565b6121de8361302d565b60405163130f361d60e01b815273d0ef7a6aad947bccbb43d60411e0bf0dd7e231389063130f361d9061221f90869086908690600b90600a906004016154aa565b60006040518083038186803b15801561223757600080fd5b505af41580156113f5573d6000803e3d6000fd5b600061225c823560208401356135b4565b73672dc6510e7f7fba3c0b0f35d84c749910296f9f635be694158335602085013561228d60608701604088016146a6565b61229a6060880188614dd8565b6014546040516001600160e01b031960e089901b1681526122d29695949392916001600160a01b031690600a90600e906004016154d8565b602060405180830381865af4158015611c9d573d6000803e3d6000fd5b60006122fb83356133a5565b82356000908152600a6020526040812060030180546821b430b930b1ba32b960b91b9285929091829061162790614f8f565b6123373383613107565b6123535760405162461bcd60e51b8152600401610c1490614f28565b61235f84848484613738565b50505050565b61236f81356133a5565b612381816020013582604001356135b4565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f3978299063018212d19083903090636352211e90602401602060405180830381865afa1580156123db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ff9190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600e90600d90600401615526565b612445612440826155a5565b61376b565b50565b612451826133a5565b61245b82826135b4565b6000828152600e60209081526040808320848452825291829020600501805460ff60a01b1916600160a01b179055905182815283917f4f1db9708b537c1d26a7af4b235fd079bf2342d92a276e27eb6c8717e8bbcf939101611bab565b6000818152600a602052604090206002018054606091906124d890614da3565b80601f016020809104026020016040519081016040528092919081815260200182805461250490614da3565b80156125515780601f1061252657610100808354040283529160200191612551565b820191906000526020600020905b81548152906001019060200180831161253457829003601f168201915b50505050509050919050565b612567813561302d565b61258461257a60408301602084016146a6565b8260400135613446565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f3978299063e7a15c419083903090636352211e90602401602060405180830381865afa1580156125de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126029190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600d90600401615658565b61263e813561302d565b61264d813560208301356135b4565b73cdec76a825bb8be252c56612593fe69e243500d16320828a028235602084013561267e60608601604087016146a6565b61268b6060870187614dd8565b600e6040518763ffffffff1660e01b8152600401610c9f969594939291906156bd565b6126b6614314565b600a60008381526020019081526020016000206040518060c0016040529081600082015481526020016001820180546126ee90614da3565b80601f016020809104026020016040519081016040528092919081815260200182805461271a90614da3565b80156127675780601f1061273c57610100808354040283529160200191612767565b820191906000526020600020905b81548152906001019060200180831161274a57829003601f168201915b5050505050815260200160028201805461278090614da3565b80601f01602080910402602001604051908101604052809291908181526020018280546127ac90614da3565b80156127f95780601f106127ce576101008083540402835291602001916127f9565b820191906000526020600020905b8154815290600101906020018083116127dc57829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b03908116604083015260059092015490911660609091015292915050565b60408051610100808201835260008083526020808401829052606084860181905284018290526080840182905260a0840182905260c0840182905260e08401829052868252600e815284822086835281529084902084519283018552805483526001810154918301919091526002810180549394929391928401916128b990614da3565b80601f01602080910402602001604051908101604052809291908181526020018280546128e590614da3565b80156129325780601f1061290757610100808354040283529160200191612932565b820191906000526020600020905b81548152906001019060200180831161291557829003601f168201915b505050918352505060038201546001600160a01b039081166020830152600483015481166040830152600590920154918216606082015260ff600160a01b8304811615156080830152600160a81b909204909116151560a090910152905092915050565b6129a0813561302d565b6129af813560208301356135b4565b73cdec76a825bb8be252c56612593fe69e243500d1631f2ffb698235602084013561267e60608601604087016146a6565b601354604051632b05429560e21b8152600481018390526060916001600160a01b03169063ac150a5490602401600060405180830381865afa158015612a2a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b0791908101906156eb565b601454600160a81b900460ff16612a7657601454600160a01b900460ff1615612a7a565b303b155b612add5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c14565b601454600160a81b900460ff16158015612b07576014805461ffff60a01b191661010160a01b1790555b612b138989898961383e565b601380546001600160a01b03199081166001600160a01b0388811691909117909255601480548216878416179055601580548216868416179055601780549091169184169190911790556040514281527f400175a56dd3710794078f7b9dbe8296ac94c5a248dfd51bb22ed4ab9eaa9fbf9060200160405180910390a18015612ba4576014805460ff60a81b191690555b505050505050505050565b612bb88261302d565b6115e6828261388f565b6000818152600a602052604090206001018054606091906124d890614da3565b612bec813561302d565b60135481356000908152600d602090815260408083208186013584529091529081902054905163bf5c00c160e01b81527320a25de3f09a7e2ba9992c426d0b64a22f3978299263bf5c00c192610c9f9286926001600160a01b03169190600401615758565b612c5a8161302d565b336000818152600c602052604080822080549085905590519092839285927fce95332e6082aebeb8058a7b56d1a109f67d6550552ed04d36aca4a6acd4d7de9190a45050565b6000612cac84356133a5565b601354604051633610bf0960e11b815265416e7955726960d01b916000916001600160a01b0390911690636c217e1290612cee9084908990899060040161515d565b6020604051808303816000875af1158015612d0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3191906150f9565b86356000908152600a60205260408120600301805492935090918290612d5690614f8f565b919050819055905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53888386868b8b604051602001612d8f92919061549a565b604051602081830303815290604052600e6040518763ffffffff1660e01b8152600401612dc196959493929190615112565b60006040518083038186803b158015612dd957600080fd5b505af4158015612ded573d6000803e3d6000fd5b50929998505050505050505050565b6124458135612e1160408401602085016146a6565b836040013560405180604001604052806002815260200161060f60f31b8152506138f3565b612e40813561302d565b73d0ef7a6aad947bccbb43d60411e0bf0dd7e23138631dc831338235612e6c60408501602086016146a6565b612e796040860186614dd8565b86356000908152600a60205260409081902090516001600160e01b031960e088901b168152610c9f959493929190600401614e86565b60006001600160e01b031982166380ac58cd60e01b1480612ee057506001600160e01b03198216635b5e139f60e01b145b80610b0757506301ffc9a760e01b6001600160e01b0319831614610b07565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612f3482611909565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6013546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e90602401602060405180830381865afa158015612fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fda9190614eb1565b6001600160a01b0316336001600160a01b0316146124455760405162461bcd60e51b815260206004820152601060248201526f2737ba2634b735a634b9ba27bbb732b960811b6044820152606401610c14565b600061303882611909565b9050336001600160a01b038216148061306e5750326001600160a01b03821614801561306e57506015546001600160a01b031633145b6115e65760405162461bcd60e51b81526020600482015260116024820152702737ba21b430b930b1ba32b927bbb732b960791b6044820152606401610c14565b6000818152600260205260409020546001600160a01b03166124455760405162461bcd60e51b81526020600482015260126024820152714368617261637465724e6f7445786973747360701b6044820152606401610c14565b6000818152600260205260408120546001600160a01b03166131805760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c14565b600061318b83611909565b9050806001600160a01b0316846001600160a01b031614806131c65750836001600160a01b03166131bb84610b9f565b6001600160a01b0316145b806131f657506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661321182611909565b6001600160a01b0316146132755760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610c14565b6001600160a01b0382166132d75760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c14565b6132e2838383613b79565b6132ed600082612eff565b6001600160a01b03831660009081526003602052604081208054600192906133169084906157b0565b90915550506001600160a01b03821660009081526003602052604081208054600192906133449084906157c7565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006133b082611909565b9050336001600160a01b03821614806133df57506000828152601660205260409020546001600160a01b031633145b8061306e5750326001600160a01b03821614801561306e57506015546001600160a01b031633146115e65760405162461bcd60e51b81526020600482015260116024820152702737ba21b430b930b1ba32b927bbb732b960791b6044820152606401610c14565b6040516331a9108f60e11b8152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa15801561348b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134af9190614eb1565b6001600160a01b03166115e65760405162461bcd60e51b815260206004820152600f60248201526e5245433732314e6f7445786973747360881b6044820152606401610c14565b6135003382613107565b61354c5760405162461bcd60e51b815260206004820152601b60248201527f4e4654426173653a204e6f744f776e65724f72417070726f76656400000000006044820152606401610c14565b61244581613be4565b61355e826133a5565b6000828152600a6020908152604090912082516135839260029092019184019061435c565b50817f17d7c9f69270ba135480ef16837f38b9d37d3ab291cbd3ba03982290c663199782604051611bab919061450d565b6000828152600e60209081526040808320848452909152902060050154600160a01b900460ff16156136185760405162461bcd60e51b815260206004820152600d60248201526c139bdd19525cd1195b195d1959609a1b6044820152606401610c14565b6000828152600a60205260409020600301548111156115e65760405162461bcd60e51b815260206004820152600d60248201526c4e6f74654e6f7445786973747360981b6044820152606401610c14565b816001600160a01b0316836001600160a01b031614156136cb5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c14565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6137438484846131fe565b61374f84848484613c8b565b61235f5760405162461bcd60e51b8152600401610c14906157df565b6012546137799060016157c7565b6012819055815161378991613d89565b601254604051632902741560e01b815273d0ef7a6aad947bccbb43d60411e0bf0dd7e23138916329027415916137cd91859160019190600b90600a90600401615831565b60006040518083038186803b1580156137e557600080fd5b505af41580156137f9573d6000803e3d6000fd5b505082516001600160a01b03166000908152600c60205260409020541515915061244590505760125490516001600160a01b03166000908152600c6020526040902055565b61384a84848484613ed7565b7f414cd0b34676984f09a5f76ce9718d4062e50283abe0e7e274a9a5b4e0c99c3084848484426040516138819594939291906158da565b60405180910390a150505050565b60008281526016602090815260409182902080546001600160a01b0319166001600160a01b038516908117909155915142815284917f691b92a93c526c4f5a357e56a33c33f6250f94e19e6c49be805800615c414931910160405180910390a35050565b6138fc8461302d565b6001600160a01b0383166000908152600c6020526040902054156139785760405162461bcd60e51b815260206004820152602d60248201527f546172676574206164647265737320616c726561647920686173207072696d6160448201526c393c9031b430b930b1ba32b91760991b6064820152608401610c14565b600060126000815461398990614f8f565b9182905550905061399a8482613d89565b73d0ef7a6aad947bccbb43d60411e0bf0dd7e2313863290274156040518060a00160405280876001600160a01b031681526020016139e2886001600160a01b03166014613ef0565b815260200160405180602001604052806000815250815260200160006001600160a01b0316815260200160405180602001604052806000815250815250600084600b600a6040518663ffffffff1660e01b8152600401613a46959493929190615831565b60006040518083038186803b158015613a5e57600080fd5b505af4158015613a72573d6000803e3d6000fd5b505050506001600160a01b0384166000908152600c602052604090819020829055516331a9108f60e11b8152600481018690527320a25de3f09a7e2ba9992c426d0b64a22f3978299063957f8a989087908490879087903090636352211e90602401602060405180830381865afa158015613af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b159190614eb1565b6013546040516001600160e01b031960e089901b168152613b4d9695949392916001600160a01b031690600090600d90600401615914565b60006040518083038186803b158015613b6557600080fd5b505af4158015612ba4573d6000803e3d6000fd5b6000818152601660205260409020546001600160a01b031615613ba157613ba181600061388f565b6001600160a01b0383166000908152600c602052604090205415613bd9576001600160a01b0383166000908152600c60205260408120555b610de3838383614092565b6000613bef82611909565b9050613bfd81600084613b79565b613c08600083612eff565b6001600160a01b0381166000908152600360205260408120805460019290613c319084906157b0565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006001600160a01b0384163b15613d7e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613ccf90339089908890889060040161596c565b6020604051808303816000875af1925050508015613d0a575060408051601f3d908101601f19168201909252613d07918101906159a9565b60015b613d64573d808015613d38576040519150601f19603f3d011682016040523d82523d6000602084013e613d3d565b606091505b508051613d5c5760405162461bcd60e51b8152600401610c14906157df565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506131f6565b506001949350505050565b6001600160a01b038216613ddf5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c14565b6000818152600260205260409020546001600160a01b031615613e445760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c14565b613e5060008383613b79565b6001600160a01b0382166000908152600360205260408120805460019290613e799084906157c7565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b613ee3600085856143e0565b50610ccb600183836143e0565b60606000613eff8360026159c6565b613f0a9060026157c7565b6001600160401b03811115613f2157613f2161488a565b6040519080825280601f01601f191660200182016040528015613f4b576020820181803683370190505b509050600360fc1b81600081518110613f6657613f66615293565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613f9557613f95615293565b60200101906001600160f81b031916908160001a9053506000613fb98460026159c6565b613fc49060016157c7565b90505b600181111561403c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613ff857613ff8615293565b1a60f81b82828151811061400e5761400e615293565b60200101906001600160f81b031916908160001a90535060049490941c93614035816159e5565b9050613fc7565b50831561408b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c14565b9392505050565b6001600160a01b0383166140ed576140e881600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b614110565b816001600160a01b0316836001600160a01b03161461411057614110838261414a565b6001600160a01b03821661412757610de3816141e7565b826001600160a01b0316826001600160a01b031614610de357610de38282614296565b6000600161415784611ab8565b61416191906157b0565b6000838152600760205260409020549091508082146141b4576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906141f9906001906157b0565b6000838152600960205260408120546008805493945090928490811061422157614221615293565b90600052602060002001549050806008838154811061424257614242615293565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061427a5761427a6159fc565b6001900381819060005260206000200160009055905550505050565b60006142a183611ab8565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b5080546142e690614da3565b6000825580601f106142f6575050565b601f0160209004906000526020600020908101906124459190614454565b6040518060c001604052806000815260200160608152602001606081526020016000815260200160006001600160a01b0316815260200160006001600160a01b031681525090565b82805461436890614da3565b90600052602060002090601f01602090048101928261438a57600085556143d0565b82601f106143a357805160ff19168380011785556143d0565b828001600101855582156143d0579182015b828111156143d05782518255916020019190600101906143b5565b506143dc929150614454565b5090565b8280546143ec90614da3565b90600052602060002090601f01602090048101928261440e57600085556143d0565b82601f106144275782800160ff198235161785556143d0565b828001600101855582156143d0579182015b828111156143d0578235825591602001919060010190614439565b5b808211156143dc5760008155600101614455565b6001600160e01b03198116811461244557600080fd5b60006020828403121561449157600080fd5b813561408b81614469565b6000602082840312156144ae57600080fd5b5035919050565b60005b838110156144d05781810151838201526020016144b8565b8381111561235f5750506000910152565b600081518084526144f98160208601602086016144b5565b601f01601f19169290920160200192915050565b60208152600061408b60208301846144e1565b60006060828403121561453257600080fd5b50919050565b60006020828403121561454a57600080fd5b81356001600160401b0381111561456057600080fd5b6131f684828501614520565b6001600160a01b038116811461244557600080fd5b803561458c8161456c565b919050565b600080604083850312156145a457600080fd5b82356145af8161456c565b946020939093013593505050565b6000606082840312156145cf57600080fd5b61408b8383614520565b60006080828403121561453257600080fd5b6000602082840312156145fd57600080fd5b81356001600160401b0381111561461357600080fd5b6131f6848285016145d9565b60008060006060848603121561463457600080fd5b833561463f8161456c565b9250602084013561464f8161456c565b929592945050506040919091013590565b600060e0828403121561453257600080fd5b60006020828403121561468457600080fd5b81356001600160401b0381111561469a57600080fd5b6131f684828501614660565b6000602082840312156146b857600080fd5b813561408b8161456c565b60006040828403121561453257600080fd5b600080606083850312156146e857600080fd5b82356001600160401b038111156146fe57600080fd5b61470a85828601614660565b92505061471a84602085016146c3565b90509250929050565b60008083601f84011261473557600080fd5b5081356001600160401b0381111561474c57600080fd5b60208301915083602082850101111561476457600080fd5b9250929050565b60008060006040848603121561478057600080fd5b8335925060208401356001600160401b0381111561479d57600080fd5b6147a986828701614723565b9497909650939450505050565b6000608082840312156147c857600080fd5b61408b83836145d9565b600080604083850312156147e557600080fd5b82356001600160401b038111156147fb57600080fd5b61480785828601614660565b95602094909401359450505050565b6000806000806060858703121561482c57600080fd5b843593506020850135925060408501356001600160401b0381111561485057600080fd5b61485c87828801614723565b95989497509550505050565b6000806040838503121561487b57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b03811182821017156148c2576148c261488a565b60405290565b604051601f8201601f191681016001600160401b03811182821017156148f0576148f061488a565b604052919050565b60006001600160401b038211156149115761491161488a565b50601f01601f191660200190565b600082601f83011261493057600080fd5b813561494361493e826148f8565b6148c8565b81815284602083860101111561495857600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561498857600080fd5b82356001600160401b0381111561499e57600080fd5b6149aa8582860161491f565b92505060208301356149bb8161456c565b809150509250929050565b600080604083850312156149d957600080fd5b82356001600160401b038111156149ef57600080fd5b6149aa85828601614660565b60008060408385031215614a0e57600080fd5b8235915060208301356149bb8161456c565b60008060208385031215614a3357600080fd5b82356001600160401b03811115614a4957600080fd5b614a5585828601614723565b90969095509350505050565b60208152815160208201526000602083015160c06040840152614a8760e08401826144e1565b90506040840151601f19848303016060850152614aa482826144e1565b91505060608401516080840152608084015160018060a01b0380821660a08601528060a08701511660c086015250508091505092915050565b8035801515811461458c57600080fd5b60008060408385031215614b0057600080fd5b8235614b0b8161456c565b915061471a60208401614add565b60008060008060808587031215614b2f57600080fd5b8435614b3a8161456c565b93506020850135614b4a8161456c565b92506040850135915060608501356001600160401b03811115614b6c57600080fd5b614b788782880161491f565b91505092959194509250565b600060a0828403121561453257600080fd5b600060208284031215614ba857600080fd5b81356001600160401b03811115614bbe57600080fd5b6131f684828501614b84565b60208152815160208201526020820151604082015260006040830151610100806060850152614bfd6101208501836144e1565b9150606085015160018060a01b0380821660808701528060808801511660a0870152505060a0850151614c3b60c08601826001600160a01b03169052565b5060c085015180151560e08601525060e0850151801515858301525090949350505050565b60008060008060008060008060c0898b031215614c7c57600080fd5b88356001600160401b0380821115614c9357600080fd5b614c9f8c838d01614723565b909a50985060208b0135915080821115614cb857600080fd5b50614cc58b828c01614723565b9097509550506040890135614cd98161456c565b93506060890135614ce98161456c565b92506080890135614cf98161456c565b915060a0890135614d098161456c565b809150509295985092959890939650565b60008060408385031215614d2d57600080fd5b8235614d388161456c565b915060208301356149bb8161456c565b600080600060408486031215614d5d57600080fd5b83356001600160401b0380821115614d7457600080fd5b614d8087838801614660565b94506020860135915080821115614d9657600080fd5b506147a986828701614723565b600181811c90821680614db757607f821691505b6020821081141561453257634e487b7160e01b600052602260045260246000fd5b6000808335601e19843603018112614def57600080fd5b8301803591506001600160401b03821115614e0957600080fd5b60200191503681900382131561476457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03868116825285166020820152608060408201819052600090614e749083018587614e1e565b90508260608301529695505050505050565b8581526001600160a01b0385166020820152608060408201819052600090614e749083018587614e1e565b600060208284031215614ec357600080fd5b815161408b8161456c565b60006101008b83528a6020840152896040840152806060840152614ef5818401898b614e1e565b6001600160a01b03978816608085015295871660a084015250509190931660c082015260e0019190915295945050505050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000600019821415614fa357614fa3614f79565b5060010190565b6000808335601e19843603018112614fc157600080fd5b83016020810192503590506001600160401b03811115614fe057600080fd5b80360383131561476457600080fd5b8035825260006150026020830183614faa565b60e0602086015261501760e086018284614e1e565b91505060408301356150288161456c565b6001600160a01b0381811660408701526150456060860186614faa565b9250868403606088015261505a848483614e1e565b9350506080850135915061506d8261456c565b16608085015261508060a0840184614faa565b85830360a0870152615093838284614e1e565b925050506150a360c08401614add565b151560c08501528091505092915050565b60c0815260006150c760c0830188614fef565b602083810197909752604083019590955250606081019290925281830360808301526000835260a09091015201919050565b60006020828403121561510b57600080fd5b5051919050565b60c08152600061512560c0830189614fef565b876020840152866040840152856060840152828103608084015261514981866144e1565b9150508260a0830152979650505050505050565b838152604060208201526000615177604083018486614e1e565b95945050505050565b60808152843560808201526000602086013561519b8161456c565b6001600160a01b0381811660a0850152604088013560c08501526151c26060890189614faa565b9250608060e08601526151da61010086018483614e1e565b978216602086015250949094166040830152506060015250919050565b600080835481600182811c91508083168061521357607f831692505b602080841082141561523357634e487b7160e01b86526022600452602486fd5b818015615247576001811461525857615285565b60ff19861689528489019650615285565b60008a81526020902060005b8681101561527d5781548b820152908501908301615264565b505084890196505b509498975050505050505050565b634e487b7160e01b600052603260045260246000fd5b608081528435608082015260006152c36020870187614faa565b608060a08501526152d961010085018284614e1e565b915050604087013560c08401526152f36060880188614faa565b848303607f190160e086015261530a838284614e1e565b6001600160a01b0398891660208701529690971660408501525050506060015292915050565b858152846020820152608060408201526000614e74608083018587614e1e565b6001600160a01b038781168252602082018790528516604082015260a0606082018190526000906153849083018587614e1e565b9050826080830152979650505050505050565b8335815260c0810160208501356153ad8161456c565b6001600160a01b039081166020840152604086810135908401526060958601359583019590955292909316608084015260a09092019190915290565b8335815260a0810160208501356153ff8161456c565b6001600160a01b0390811660208401526040958601359583019590955292909316606084015260809092019190915290565b6080815284356080820152602085013560a0820152604085013560c0820152600061545f6060870187614faa565b608060e085015261547561010085018284614e1e565b6001600160a01b03978816602086015295909616604084015250506060015292915050565b8183823760009101908152919050565b8581526080602082015260006154c4608083018688614e1e565b604083019490945250606001529392505050565b888152876020820152600060018060a01b03808916604084015260e0606084015261550760e08401888a614e1e565b951660808301525060a081019290925260c09091015295945050505050565b60a08152853560a0820152602086013560c0820152604086013560e08201526060860135610100820152600061555f6080880188614faa565b60a061012085015261557661014085018284614e1e565b6001600160a01b0398891660208601529690971660408401525050606081019290925260809091015292915050565b600060a082360312156155b757600080fd5b6155bf6148a0565b6155c883614581565b815260208301356001600160401b03808211156155e457600080fd5b6155f03683870161491f565b6020840152604085013591508082111561560957600080fd5b6156153683870161491f565b604084015261562660608601614581565b6060840152608085013591508082111561563f57600080fd5b5061564c3682860161491f565b60808301525092915050565b6080815284356080820152600060208601356156738161456c565b6001600160a01b0381811660a0850152604088013560c0850152606088013560e08501526156a46080890189614faa565b925060a06101008601526151da61012086018483614e1e565b86815285602082015260018060a01b038516604082015260a06060820152600061538460a083018587614e1e565b6000602082840312156156fd57600080fd5b81516001600160401b0381111561571357600080fd5b8201601f8101841361572457600080fd5b805161573261493e826148f8565b81815285602083850101111561574757600080fd5b6151778260208301602086016144b5565b606081528335606082015260006157726020860186614faa565b6060608085015261578760c085018284614e1e565b60409788013560a08601526001600160a01b039690961660208501525050509092019190915290565b6000828210156157c2576157c2614f79565b500390565b600082198211156157da576157da614f79565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60a08152600060018060a01b038088511660a0840152602088015160a060c08501526158616101408501826144e1565b90506040890151609f19808684030160e087015261587f83836144e1565b92508360608c01511661010087015260808b01519350808684030161012087015250506158ac81836144e1565b925050506158be602083018715159052565b8460408301528360608301528260808301529695505050505050565b6060815260006158ee606083018789614e1e565b8281036020840152615901818688614e1e565b9150508260408301529695505050505050565b60006101008a835289602084015288604084015280606084015261593a818401896144e1565b6001600160a01b03978816608085015295871660a084015250509190931660c082015260e00191909152949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061599f908301846144e1565b9695505050505050565b6000602082840312156159bb57600080fd5b815161408b81614469565b60008160001904831182151516156159e0576159e0614f79565b500290565b6000816159f4576159f4614f79565b506000190190565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220588949675c5ae9fe8d5d328ab4796d4056d51cfbf14a4718e654ec6e65fd604464736f6c634300080a0033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106104545760003560e01c8063867884e611610241578063c87b56dd1161013b578063e56f2fe4116100c3578063f2ad807511610087578063f2ad807514610a6d578063f316bacd14610a80578063f6479d7714610a93578063fd2d866f14610aa6578063fe9299fb14610ab957600080fd5b8063e56f2fe4146109e5578063e7a1c1c0146109f8578063e985e9c514610a0b578063ec81d19414610a47578063ef0828ab14610a5a57600080fd5b8063d70e10c61161010a578063d70e10c614610961578063dabb05311461098c578063db491e801461099f578063db8c198d146109bf578063dca27135146109d257600080fd5b8063c87b56dd14610928578063cb8e757e1461093b578063cd69fe61146108f1578063d23b320b1461094e57600080fd5b80639a50248d116101c9578063b88d4fde1161018d578063b88d4fde146108cb578063b9d32845146108de578063bd5f69cb146108f1578063c053f6b814610904578063c2a6fe3b1461091557600080fd5b80639a50248d1461085f578063a22cb4651461087f578063a6e6178d14610892578063a7ccb4bf146108a5578063af90b112146108b857600080fd5b806393f057e51161021057806393f057e51461080b57806395d89b411461081e57806395d9fa7d146108265780639864c307146108395780639a4dec181461084c57600080fd5b8063867884e6146107bf5780638734bbfc146107d25780638b4ca06a146107e557806392f7070b146107f857600080fd5b806331b9d08c116103525780634f6ccce7116102da57806369492c971161029e57806369492c971461077057806370a082311461078357806374f345cf146107965780637c392b51146106fe5780637daca6d0146107a957600080fd5b80634f6ccce7146107115780635a936d10146107245780635fb8818314610737578063628b644a1461074a5780636352211e1461075d57600080fd5b806340ad34d81161032157806340ad34d8146106b257806342842e0e146106c557806342966c68146106d857806344b82a24146106eb57806347f94de7146106fe57600080fd5b806331b9d08c1461064d578063327b2a031461067957806333f06ee61461068c578063388f50831461069f57600080fd5b80631316529d116103e05780632209d145116103a45780632209d145146105b557806323b872dd146105eb57806329c301c2146105fe5780632abc6bf6146106115780632f745c591461063a57600080fd5b80631316529d1461054b578063144a3e831461055c57806316b74c2a1461056f57806318160ddd1461059a578063188b04b3146105a257600080fd5b8063081812fc11610427578063081812fc146104ea57806308cb68ff146104fd578063095ea7b3146105125780630c4dd5f2146105255780630ff982441461053857600080fd5b806301ffc9a71461045957806304f3bcec1461048157806305f63c8a146104ac57806306fdde03146104d5575b600080fd5b61046c61046736600461447f565b610ae2565b60405190151581526020015b60405180910390f35b601754610494906001600160a01b031681565b6040516001600160a01b039091168152602001610478565b6104946104ba36600461449c565b6000908152601660205260409020546001600160a01b031690565b6104dd610b0d565b604051610478919061450d565b6104946104f836600461449c565b610b9f565b61051061050b366004614538565b610c39565b005b610510610520366004614591565b610cd2565b610510610533366004614538565b610de8565b6105106105463660046145bd565b610e4d565b60045b604051908152602001610478565b6104dd61056a36600461449c565b610f4c565b610510601480546001600160a01b0319167387efeb45f2dc12f77c4ad46769dab4678ef84045179055565b60085461054e565b6105106105b03660046145eb565b610f57565b6104946105c3366004614591565b6001600160a01b03918216600090815260106020908152604080832093835292905220541690565b6105106105f936600461461f565b611054565b61054e61060c366004614672565b611085565b61054e61061f3660046146a6565b6001600160a01b03166000908152600c602052604090205490565b61054e610648366004614591565b611131565b61049461065b3660046146a6565b6001600160a01b039081166000908152601160205260409020541690565b61054e6106873660046146d5565b6111c7565b61051061069a36600461476b565b61138a565b6105106106ad3660046145eb565b6113fe565b6105106106c03660046147b6565b6114b8565b6105106106d336600461461f565b611532565b6105106106e636600461449c565b61154d565b61054e6106f93660046147d2565b6115ea565b61051061070c36600461476b565b611660565b61054e61071f36600461449c565b6116a0565b6105106107323660046145bd565b611733565b6105106107453660046145eb565b6117c3565b610510610758366004614816565b61187d565b61049461076b36600461449c565b611909565b61051061077e3660046145eb565b611980565b61054e6107913660046146a6565b611ab8565b6105106107a4366004614868565b611b3f565b61046c6107b7366004614975565b600192915050565b6105106107cd3660046147b6565b611bb7565b61046c6107e036600461449c565b611c27565b61054e6107f336600461449c565b611c55565b61054e6108063660046149c6565b611cc1565b6105106108193660046145bd565b611d55565b6104dd611dc4565b6105106108343660046149fb565b611dd3565b6105106108473660046145eb565b611e59565b61054e61085a3660046146d5565b611f13565b61087261086d366004614a20565b61201b565b6040516104789190614a61565b61051061088d366004614aed565b6121ca565b6105106108a036600461476b565b6121d5565b61054e6108b33660046145eb565b61224b565b61054e6108c63660046147d2565b6122ef565b6105106108d9366004614b19565b61232d565b6105106108ec366004614b96565b612365565b6105106108ff366004614b96565b612434565b6013546001600160a01b0316610494565b610510610923366004614868565b612448565b6104dd61093636600461449c565b6124b8565b610510610949366004614b96565b61255d565b61051061095c3660046145eb565b612634565b61054e61096f366004614868565b6000918252600d6020908152604080842092845291905290205490565b61087261099a36600461449c565b6126ae565b6109b26109ad366004614868565b612835565b6040516104789190614bca565b6105106109cd3660046145eb565b612996565b6104dd6109e036600461449c565b6129e0565b6105106109f3366004614c60565b612a52565b610510610a063660046149fb565b612baf565b61046c610a19366004614d1a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6104dd610a5536600461449c565b612bc2565b610510610a68366004614538565b612be2565b610510610a7b36600461449c565b612c51565b61054e610a8e366004614d48565b612ca0565b610510610aa13660046145bd565b612dfc565b610510610ab4366004614538565b612e36565b610494610ac736600461449c565b6000908152600f60205260409020546001600160a01b031690565b60006001600160e01b0319821663780e9d6360e01b1480610b075750610b0782612eaf565b92915050565b606060008054610b1c90614da3565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4890614da3565b8015610b955780601f10610b6a57610100808354040283529160200191610b95565b820191906000526020600020905b815481529060010190602001808311610b7857829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610c1d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b73cdec76a825bb8be252c56612593fe69e243500d163dfc34f25610c6060208401846146a6565b610c7060408501602086016146a6565b610c7d6040860186614dd8565b60116040518663ffffffff1660e01b8152600401610c9f959493929190614e47565b60006040518083038186803b158015610cb757600080fd5b505af4158015610ccb573d6000803e3d6000fd5b5050505050565b6000610cdd82611909565b9050806001600160a01b0316836001600160a01b03161415610d4b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c14565b336001600160a01b0382161480610d675750610d678133610a19565b610dd95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610c14565b610de38383612eff565b505050565b610df28135612f6d565b73cdec76a825bb8be252c56612593fe69e243500d1636252159e8235610e1e60408501602086016146a6565b610e2b6040860186614dd8565b600f6040518663ffffffff1660e01b8152600401610c9f959493929190614e86565b610e57813561302d565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f39782990633019fadd9083903090636352211e90602401602060405180830381865afa158015610eb1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed59190614eb1565b60135485356000908152600d60209081526040808320818a0135845282529182902054825160e088901b6001600160e01b031916815286356004820152918601356024830152949091013560448201526001600160a01b0392831660648201529116608482015260a481019190915260c401610c9f565b6060610b07826124b8565b610f61813561302d565b610f6e81602001356130ae565b7320a25de3f09a7e2ba9992c426d0b64a22f39782963957f8a98823560208401356040850135610fa16060870187614dd8565b6040516331a9108f60e11b8152883560048201523090636352211e90602401602060405180830381865afa158015610fdd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110019190614eb1565b6013546020808b01356000908152600a9091526040908190206005015490516001600160e01b031960e08b901b168152610c9f989796959493926001600160a01b03908116921690600d90600401614ece565b61105e3382613107565b61107a5760405162461bcd60e51b8152600401610c1490614f28565b610de38383836131fe565b600061109182356133a5565b81356000908152600a60205260408120600301805482906110b190614f8f565b91829055506040516342a34a5360e01b815290915073672dc6510e7f7fba3c0b0f35d84c749910296f9f906342a34a53906110fa90869085906000908190600e906004016150b4565b60006040518083038186803b15801561111257600080fd5b505af4158015611126573d6000803e3d6000fd5b509295945050505050565b600061113c83611ab8565b821061119e5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c14565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b60006111d383356133a5565b6111ed6111e360208401846146a6565b8360200135613446565b6013546545524337323160d01b906000906001600160a01b0316632ea24efc8261121a60208801886146a6565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152602087013560448201526064016020604051808303816000875af1158015611270573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129491906150f9565b85356000908152600a602052604081206003018054929350909182906112b990614f8f565b9182905550905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53878386866112eb60208c018c6146a6565b8b6020013560405160200161131e92919060609290921b6bffffffffffffffffffffffff19168252601482015260340190565b604051602081830303815290604052600e6040518763ffffffff1660e01b815260040161135096959493929190615112565b60006040518083038186803b15801561136857600080fd5b505af415801561137c573d6000803e3d6000fd5b509298975050505050505050565b61139383612f6d565b601354604051633c17845760e11b81526001600160a01b039091169063782f08ae906113c79086908690869060040161515d565b600060405180830381600087803b1580156113e157600080fd5b505af11580156113f5573d6000803e3d6000fd5b50505050505050565b611408813561302d565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f39782990631e3981939083903090636352211e90602401602060405180830381865afa158015611462573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114869190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600d90600401615180565b6114c281356133a5565b60135460408051635cebf08d60e11b81528335600482015260208401356024820152908301356044820152606083013560648201526001600160a01b039091166084820152600d60a48201527320a25de3f09a7e2ba9992c426d0b64a22f3978299063b9d7e11a9060c401610c9f565b610de38383836040518060200160405280600081525061232d565b6000818152600a6020526040808220905161156b91600101906151f7565b60408051918290039091206000818152600b6020908152838220829055858252600a9052918220828155909250906115a660018301826142da565b6115b46002830160006142da565b50600060038201556004810180546001600160a01b03199081169091556005909101805490911690556115e6826134f6565b5050565b60006115f683356133a5565b82356000908152600a60205260408120600301805467131a5b9adb1a5cdd60c21b9285929091829061162790614f8f565b919050819055905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53878386868a60405160200161131e91815260200190565b610de38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061355592505050565b60006116ab60085490565b821061170e5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610c14565b6008828154811061172157611721615293565b90600052602060002001549050919050565b61173d813561302d565b60135481356000818152600d60209081526040808320818701358085529083529281902054905163d862986560e01b8152600481019490945290850135602484015260448301919091526001600160a01b03909216606482015260848101919091527320a25de3f09a7e2ba9992c426d0b64a22f3978299063d86298659060a401610c9f565b6117cd813561302d565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f397829906331ba880f9083903090636352211e90602401602060405180830381865afa158015611827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184b9190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600d906004016152a9565b6118868461302d565b61189084846135b4565b6040516001626802bf60e01b0319815273672dc6510e7f7fba3c0b0f35d84c749910296f9f9063ff97fd41906118d3908790879087908790600e90600401615330565b60006040518083038186803b1580156118eb57600080fd5b505af41580156118ff573d6000803e3d6000fd5b5050505050505050565b6000818152600260205260408120546001600160a01b031680610b075760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c14565b61198d60208201826146a6565b6040516331a9108f60e11b8152602083013560048201526001600160a01b039190911690636352211e90602401602060405180830381865afa1580156119d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fb9190614eb1565b6001600160a01b0316336001600160a01b031614611a4c5760405162461bcd60e51b815260206004820152600e60248201526d2737ba22a9219b9918a7bbb732b960911b6044820152606401610c14565b73cdec76a825bb8be252c56612593fe69e243500d163384afeb3611a7360208401846146a6565b6020840135611a8860608601604087016146a6565b611a956060870187614dd8565b60106040518763ffffffff1660e01b8152600401610c9f96959493929190615350565b60006001600160a01b038216611b235760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c14565b506001600160a01b031660009081526003602052604090205490565b611b48826133a5565b611b5282826135b4565b6000828152600e60209081526040808320848452825291829020600501805460ff60a81b1916600160a81b179055905182815283917f036469f3e73c83520cdefa197d7a9c854c2f8bc0164b82e9f2bd4aa7e150fd3091015b60405180910390a25050565b611bc1813561302d565b60135481356000908152600d6020908152604080832060608601358452909152908190205490516317e9a8b160e31b81527320a25de3f09a7e2ba9992c426d0b64a22f3978299263bf4d458892610c9f9286926001600160a01b03169190600401615397565b600080611c3383611909565b6001600160a01b03166000908152600c60205260409020549290921492915050565b60135460405162fba02760e01b8152600481018390526000916001600160a01b03169062fba02790602401602060405180830381865afa158015611c9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0791906150f9565b6000611ccd83356133a5565b82356000908152600a602052604081206003018054664164647265737360c81b926001600160a01b0386169290918290611d0690614f8f565b919050819055905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53878386868a60405160200161131e919060609190911b6bffffffffffffffffffffffff1916815260140190565b611d5f813561302d565b60135481356000908152600d6020908152604080832081860135845290915290819020549051633d7f9b3d60e11b81527320a25de3f09a7e2ba9992c426d0b64a22f39782992637aff367a92610c9f9286926001600160a01b031691906004016153e9565b606060018054610b1c90614da3565b611ddc8261302d565b6040516384b44a2f60e01b8152600481018390526001600160a01b0382166024820152600a604482015273d0ef7a6aad947bccbb43d60411e0bf0dd7e23138906384b44a2f9060640160006040518083038186803b158015611e3d57600080fd5b505af4158015611e51573d6000803e3d6000fd5b505050505050565b611e63813561302d565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f397829906372c61ab09083903090636352211e90602401602060405180830381865afa158015611ebd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee19190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600d90600401615431565b6000611f1f83356133a5565b601354604051635cb46be760e01b81526000600482018190528435602483015260208501356044830152634e6f746560e01b9290916001600160a01b0390911690635cb46be7906064016020604051808303816000875af1158015611f88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fac91906150f9565b85356000908152600a60205260408120600301805492935090918290611fd190614f8f565b919050819055905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53878386868a600001358b6020013560405160200161131e929190918252602082015260400190565b612023614314565b6000838360405161203592919061549a565b604080519182900382206000818152600b602090815283822054808352600a82529184902060c086019094528354855260018401805493965091949392908401919061208090614da3565b80601f01602080910402602001604051908101604052809291908181526020018280546120ac90614da3565b80156120f95780601f106120ce576101008083540402835291602001916120f9565b820191906000526020600020905b8154815290600101906020018083116120dc57829003601f168201915b5050505050815260200160028201805461211290614da3565b80601f016020809104026020016040519081016040528092919081815260200182805461213e90614da3565b801561218b5780601f106121605761010080835404028352916020019161218b565b820191906000526020600020905b81548152906001019060200180831161216e57829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b03908116604083015260059092015490911660609091015295945050505050565b6115e6338383613669565b6121de8361302d565b60405163130f361d60e01b815273d0ef7a6aad947bccbb43d60411e0bf0dd7e231389063130f361d9061221f90869086908690600b90600a906004016154aa565b60006040518083038186803b15801561223757600080fd5b505af41580156113f5573d6000803e3d6000fd5b600061225c823560208401356135b4565b73672dc6510e7f7fba3c0b0f35d84c749910296f9f635be694158335602085013561228d60608701604088016146a6565b61229a6060880188614dd8565b6014546040516001600160e01b031960e089901b1681526122d29695949392916001600160a01b031690600a90600e906004016154d8565b602060405180830381865af4158015611c9d573d6000803e3d6000fd5b60006122fb83356133a5565b82356000908152600a6020526040812060030180546821b430b930b1ba32b960b91b9285929091829061162790614f8f565b6123373383613107565b6123535760405162461bcd60e51b8152600401610c1490614f28565b61235f84848484613738565b50505050565b61236f81356133a5565b612381816020013582604001356135b4565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f3978299063018212d19083903090636352211e90602401602060405180830381865afa1580156123db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ff9190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600e90600d90600401615526565b612445612440826155a5565b61376b565b50565b612451826133a5565b61245b82826135b4565b6000828152600e60209081526040808320848452825291829020600501805460ff60a01b1916600160a01b179055905182815283917f4f1db9708b537c1d26a7af4b235fd079bf2342d92a276e27eb6c8717e8bbcf939101611bab565b6000818152600a602052604090206002018054606091906124d890614da3565b80601f016020809104026020016040519081016040528092919081815260200182805461250490614da3565b80156125515780601f1061252657610100808354040283529160200191612551565b820191906000526020600020905b81548152906001019060200180831161253457829003601f168201915b50505050509050919050565b612567813561302d565b61258461257a60408301602084016146a6565b8260400135613446565b6040516331a9108f60e11b8152813560048201527320a25de3f09a7e2ba9992c426d0b64a22f3978299063e7a15c419083903090636352211e90602401602060405180830381865afa1580156125de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126029190614eb1565b6013546040516001600160e01b031960e086901b168152610c9f9392916001600160a01b031690600d90600401615658565b61263e813561302d565b61264d813560208301356135b4565b73cdec76a825bb8be252c56612593fe69e243500d16320828a028235602084013561267e60608601604087016146a6565b61268b6060870187614dd8565b600e6040518763ffffffff1660e01b8152600401610c9f969594939291906156bd565b6126b6614314565b600a60008381526020019081526020016000206040518060c0016040529081600082015481526020016001820180546126ee90614da3565b80601f016020809104026020016040519081016040528092919081815260200182805461271a90614da3565b80156127675780601f1061273c57610100808354040283529160200191612767565b820191906000526020600020905b81548152906001019060200180831161274a57829003601f168201915b5050505050815260200160028201805461278090614da3565b80601f01602080910402602001604051908101604052809291908181526020018280546127ac90614da3565b80156127f95780601f106127ce576101008083540402835291602001916127f9565b820191906000526020600020905b8154815290600101906020018083116127dc57829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b03908116604083015260059092015490911660609091015292915050565b60408051610100808201835260008083526020808401829052606084860181905284018290526080840182905260a0840182905260c0840182905260e08401829052868252600e815284822086835281529084902084519283018552805483526001810154918301919091526002810180549394929391928401916128b990614da3565b80601f01602080910402602001604051908101604052809291908181526020018280546128e590614da3565b80156129325780601f1061290757610100808354040283529160200191612932565b820191906000526020600020905b81548152906001019060200180831161291557829003601f168201915b505050918352505060038201546001600160a01b039081166020830152600483015481166040830152600590920154918216606082015260ff600160a01b8304811615156080830152600160a81b909204909116151560a090910152905092915050565b6129a0813561302d565b6129af813560208301356135b4565b73cdec76a825bb8be252c56612593fe69e243500d1631f2ffb698235602084013561267e60608601604087016146a6565b601354604051632b05429560e21b8152600481018390526060916001600160a01b03169063ac150a5490602401600060405180830381865afa158015612a2a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b0791908101906156eb565b601454600160a81b900460ff16612a7657601454600160a01b900460ff1615612a7a565b303b155b612add5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c14565b601454600160a81b900460ff16158015612b07576014805461ffff60a01b191661010160a01b1790555b612b138989898961383e565b601380546001600160a01b03199081166001600160a01b0388811691909117909255601480548216878416179055601580548216868416179055601780549091169184169190911790556040514281527f400175a56dd3710794078f7b9dbe8296ac94c5a248dfd51bb22ed4ab9eaa9fbf9060200160405180910390a18015612ba4576014805460ff60a81b191690555b505050505050505050565b612bb88261302d565b6115e6828261388f565b6000818152600a602052604090206001018054606091906124d890614da3565b612bec813561302d565b60135481356000908152600d602090815260408083208186013584529091529081902054905163bf5c00c160e01b81527320a25de3f09a7e2ba9992c426d0b64a22f3978299263bf5c00c192610c9f9286926001600160a01b03169190600401615758565b612c5a8161302d565b336000818152600c602052604080822080549085905590519092839285927fce95332e6082aebeb8058a7b56d1a109f67d6550552ed04d36aca4a6acd4d7de9190a45050565b6000612cac84356133a5565b601354604051633610bf0960e11b815265416e7955726960d01b916000916001600160a01b0390911690636c217e1290612cee9084908990899060040161515d565b6020604051808303816000875af1158015612d0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3191906150f9565b86356000908152600a60205260408120600301805492935090918290612d5690614f8f565b919050819055905073672dc6510e7f7fba3c0b0f35d84c749910296f9f6342a34a53888386868b8b604051602001612d8f92919061549a565b604051602081830303815290604052600e6040518763ffffffff1660e01b8152600401612dc196959493929190615112565b60006040518083038186803b158015612dd957600080fd5b505af4158015612ded573d6000803e3d6000fd5b50929998505050505050505050565b6124458135612e1160408401602085016146a6565b836040013560405180604001604052806002815260200161060f60f31b8152506138f3565b612e40813561302d565b73d0ef7a6aad947bccbb43d60411e0bf0dd7e23138631dc831338235612e6c60408501602086016146a6565b612e796040860186614dd8565b86356000908152600a60205260409081902090516001600160e01b031960e088901b168152610c9f959493929190600401614e86565b60006001600160e01b031982166380ac58cd60e01b1480612ee057506001600160e01b03198216635b5e139f60e01b145b80610b0757506301ffc9a760e01b6001600160e01b0319831614610b07565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612f3482611909565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6013546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e90602401602060405180830381865afa158015612fb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fda9190614eb1565b6001600160a01b0316336001600160a01b0316146124455760405162461bcd60e51b815260206004820152601060248201526f2737ba2634b735a634b9ba27bbb732b960811b6044820152606401610c14565b600061303882611909565b9050336001600160a01b038216148061306e5750326001600160a01b03821614801561306e57506015546001600160a01b031633145b6115e65760405162461bcd60e51b81526020600482015260116024820152702737ba21b430b930b1ba32b927bbb732b960791b6044820152606401610c14565b6000818152600260205260409020546001600160a01b03166124455760405162461bcd60e51b81526020600482015260126024820152714368617261637465724e6f7445786973747360701b6044820152606401610c14565b6000818152600260205260408120546001600160a01b03166131805760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c14565b600061318b83611909565b9050806001600160a01b0316846001600160a01b031614806131c65750836001600160a01b03166131bb84610b9f565b6001600160a01b0316145b806131f657506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661321182611909565b6001600160a01b0316146132755760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610c14565b6001600160a01b0382166132d75760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c14565b6132e2838383613b79565b6132ed600082612eff565b6001600160a01b03831660009081526003602052604081208054600192906133169084906157b0565b90915550506001600160a01b03821660009081526003602052604081208054600192906133449084906157c7565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006133b082611909565b9050336001600160a01b03821614806133df57506000828152601660205260409020546001600160a01b031633145b8061306e5750326001600160a01b03821614801561306e57506015546001600160a01b031633146115e65760405162461bcd60e51b81526020600482015260116024820152702737ba21b430b930b1ba32b927bbb732b960791b6044820152606401610c14565b6040516331a9108f60e11b8152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa15801561348b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134af9190614eb1565b6001600160a01b03166115e65760405162461bcd60e51b815260206004820152600f60248201526e5245433732314e6f7445786973747360881b6044820152606401610c14565b6135003382613107565b61354c5760405162461bcd60e51b815260206004820152601b60248201527f4e4654426173653a204e6f744f776e65724f72417070726f76656400000000006044820152606401610c14565b61244581613be4565b61355e826133a5565b6000828152600a6020908152604090912082516135839260029092019184019061435c565b50817f17d7c9f69270ba135480ef16837f38b9d37d3ab291cbd3ba03982290c663199782604051611bab919061450d565b6000828152600e60209081526040808320848452909152902060050154600160a01b900460ff16156136185760405162461bcd60e51b815260206004820152600d60248201526c139bdd19525cd1195b195d1959609a1b6044820152606401610c14565b6000828152600a60205260409020600301548111156115e65760405162461bcd60e51b815260206004820152600d60248201526c4e6f74654e6f7445786973747360981b6044820152606401610c14565b816001600160a01b0316836001600160a01b031614156136cb5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c14565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6137438484846131fe565b61374f84848484613c8b565b61235f5760405162461bcd60e51b8152600401610c14906157df565b6012546137799060016157c7565b6012819055815161378991613d89565b601254604051632902741560e01b815273d0ef7a6aad947bccbb43d60411e0bf0dd7e23138916329027415916137cd91859160019190600b90600a90600401615831565b60006040518083038186803b1580156137e557600080fd5b505af41580156137f9573d6000803e3d6000fd5b505082516001600160a01b03166000908152600c60205260409020541515915061244590505760125490516001600160a01b03166000908152600c6020526040902055565b61384a84848484613ed7565b7f414cd0b34676984f09a5f76ce9718d4062e50283abe0e7e274a9a5b4e0c99c3084848484426040516138819594939291906158da565b60405180910390a150505050565b60008281526016602090815260409182902080546001600160a01b0319166001600160a01b038516908117909155915142815284917f691b92a93c526c4f5a357e56a33c33f6250f94e19e6c49be805800615c414931910160405180910390a35050565b6138fc8461302d565b6001600160a01b0383166000908152600c6020526040902054156139785760405162461bcd60e51b815260206004820152602d60248201527f546172676574206164647265737320616c726561647920686173207072696d6160448201526c393c9031b430b930b1ba32b91760991b6064820152608401610c14565b600060126000815461398990614f8f565b9182905550905061399a8482613d89565b73d0ef7a6aad947bccbb43d60411e0bf0dd7e2313863290274156040518060a00160405280876001600160a01b031681526020016139e2886001600160a01b03166014613ef0565b815260200160405180602001604052806000815250815260200160006001600160a01b0316815260200160405180602001604052806000815250815250600084600b600a6040518663ffffffff1660e01b8152600401613a46959493929190615831565b60006040518083038186803b158015613a5e57600080fd5b505af4158015613a72573d6000803e3d6000fd5b505050506001600160a01b0384166000908152600c602052604090819020829055516331a9108f60e11b8152600481018690527320a25de3f09a7e2ba9992c426d0b64a22f3978299063957f8a989087908490879087903090636352211e90602401602060405180830381865afa158015613af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b159190614eb1565b6013546040516001600160e01b031960e089901b168152613b4d9695949392916001600160a01b031690600090600d90600401615914565b60006040518083038186803b158015613b6557600080fd5b505af4158015612ba4573d6000803e3d6000fd5b6000818152601660205260409020546001600160a01b031615613ba157613ba181600061388f565b6001600160a01b0383166000908152600c602052604090205415613bd9576001600160a01b0383166000908152600c60205260408120555b610de3838383614092565b6000613bef82611909565b9050613bfd81600084613b79565b613c08600083612eff565b6001600160a01b0381166000908152600360205260408120805460019290613c319084906157b0565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006001600160a01b0384163b15613d7e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613ccf90339089908890889060040161596c565b6020604051808303816000875af1925050508015613d0a575060408051601f3d908101601f19168201909252613d07918101906159a9565b60015b613d64573d808015613d38576040519150601f19603f3d011682016040523d82523d6000602084013e613d3d565b606091505b508051613d5c5760405162461bcd60e51b8152600401610c14906157df565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506131f6565b506001949350505050565b6001600160a01b038216613ddf5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c14565b6000818152600260205260409020546001600160a01b031615613e445760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c14565b613e5060008383613b79565b6001600160a01b0382166000908152600360205260408120805460019290613e799084906157c7565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b613ee3600085856143e0565b50610ccb600183836143e0565b60606000613eff8360026159c6565b613f0a9060026157c7565b6001600160401b03811115613f2157613f2161488a565b6040519080825280601f01601f191660200182016040528015613f4b576020820181803683370190505b509050600360fc1b81600081518110613f6657613f66615293565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613f9557613f95615293565b60200101906001600160f81b031916908160001a9053506000613fb98460026159c6565b613fc49060016157c7565b90505b600181111561403c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613ff857613ff8615293565b1a60f81b82828151811061400e5761400e615293565b60200101906001600160f81b031916908160001a90535060049490941c93614035816159e5565b9050613fc7565b50831561408b5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c14565b9392505050565b6001600160a01b0383166140ed576140e881600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b614110565b816001600160a01b0316836001600160a01b03161461411057614110838261414a565b6001600160a01b03821661412757610de3816141e7565b826001600160a01b0316826001600160a01b031614610de357610de38282614296565b6000600161415784611ab8565b61416191906157b0565b6000838152600760205260409020549091508082146141b4576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906141f9906001906157b0565b6000838152600960205260408120546008805493945090928490811061422157614221615293565b90600052602060002001549050806008838154811061424257614242615293565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061427a5761427a6159fc565b6001900381819060005260206000200160009055905550505050565b60006142a183611ab8565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b5080546142e690614da3565b6000825580601f106142f6575050565b601f0160209004906000526020600020908101906124459190614454565b6040518060c001604052806000815260200160608152602001606081526020016000815260200160006001600160a01b0316815260200160006001600160a01b031681525090565b82805461436890614da3565b90600052602060002090601f01602090048101928261438a57600085556143d0565b82601f106143a357805160ff19168380011785556143d0565b828001600101855582156143d0579182015b828111156143d05782518255916020019190600101906143b5565b506143dc929150614454565b5090565b8280546143ec90614da3565b90600052602060002090601f01602090048101928261440e57600085556143d0565b82601f106144275782800160ff198235161785556143d0565b828001600101855582156143d0579182015b828111156143d0578235825591602001919060010190614439565b5b808211156143dc5760008155600101614455565b6001600160e01b03198116811461244557600080fd5b60006020828403121561449157600080fd5b813561408b81614469565b6000602082840312156144ae57600080fd5b5035919050565b60005b838110156144d05781810151838201526020016144b8565b8381111561235f5750506000910152565b600081518084526144f98160208601602086016144b5565b601f01601f19169290920160200192915050565b60208152600061408b60208301846144e1565b60006060828403121561453257600080fd5b50919050565b60006020828403121561454a57600080fd5b81356001600160401b0381111561456057600080fd5b6131f684828501614520565b6001600160a01b038116811461244557600080fd5b803561458c8161456c565b919050565b600080604083850312156145a457600080fd5b82356145af8161456c565b946020939093013593505050565b6000606082840312156145cf57600080fd5b61408b8383614520565b60006080828403121561453257600080fd5b6000602082840312156145fd57600080fd5b81356001600160401b0381111561461357600080fd5b6131f6848285016145d9565b60008060006060848603121561463457600080fd5b833561463f8161456c565b9250602084013561464f8161456c565b929592945050506040919091013590565b600060e0828403121561453257600080fd5b60006020828403121561468457600080fd5b81356001600160401b0381111561469a57600080fd5b6131f684828501614660565b6000602082840312156146b857600080fd5b813561408b8161456c565b60006040828403121561453257600080fd5b600080606083850312156146e857600080fd5b82356001600160401b038111156146fe57600080fd5b61470a85828601614660565b92505061471a84602085016146c3565b90509250929050565b60008083601f84011261473557600080fd5b5081356001600160401b0381111561474c57600080fd5b60208301915083602082850101111561476457600080fd5b9250929050565b60008060006040848603121561478057600080fd5b8335925060208401356001600160401b0381111561479d57600080fd5b6147a986828701614723565b9497909650939450505050565b6000608082840312156147c857600080fd5b61408b83836145d9565b600080604083850312156147e557600080fd5b82356001600160401b038111156147fb57600080fd5b61480785828601614660565b95602094909401359450505050565b6000806000806060858703121561482c57600080fd5b843593506020850135925060408501356001600160401b0381111561485057600080fd5b61485c87828801614723565b95989497509550505050565b6000806040838503121561487b57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b03811182821017156148c2576148c261488a565b60405290565b604051601f8201601f191681016001600160401b03811182821017156148f0576148f061488a565b604052919050565b60006001600160401b038211156149115761491161488a565b50601f01601f191660200190565b600082601f83011261493057600080fd5b813561494361493e826148f8565b6148c8565b81815284602083860101111561495857600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561498857600080fd5b82356001600160401b0381111561499e57600080fd5b6149aa8582860161491f565b92505060208301356149bb8161456c565b809150509250929050565b600080604083850312156149d957600080fd5b82356001600160401b038111156149ef57600080fd5b6149aa85828601614660565b60008060408385031215614a0e57600080fd5b8235915060208301356149bb8161456c565b60008060208385031215614a3357600080fd5b82356001600160401b03811115614a4957600080fd5b614a5585828601614723565b90969095509350505050565b60208152815160208201526000602083015160c06040840152614a8760e08401826144e1565b90506040840151601f19848303016060850152614aa482826144e1565b91505060608401516080840152608084015160018060a01b0380821660a08601528060a08701511660c086015250508091505092915050565b8035801515811461458c57600080fd5b60008060408385031215614b0057600080fd5b8235614b0b8161456c565b915061471a60208401614add565b60008060008060808587031215614b2f57600080fd5b8435614b3a8161456c565b93506020850135614b4a8161456c565b92506040850135915060608501356001600160401b03811115614b6c57600080fd5b614b788782880161491f565b91505092959194509250565b600060a0828403121561453257600080fd5b600060208284031215614ba857600080fd5b81356001600160401b03811115614bbe57600080fd5b6131f684828501614b84565b60208152815160208201526020820151604082015260006040830151610100806060850152614bfd6101208501836144e1565b9150606085015160018060a01b0380821660808701528060808801511660a0870152505060a0850151614c3b60c08601826001600160a01b03169052565b5060c085015180151560e08601525060e0850151801515858301525090949350505050565b60008060008060008060008060c0898b031215614c7c57600080fd5b88356001600160401b0380821115614c9357600080fd5b614c9f8c838d01614723565b909a50985060208b0135915080821115614cb857600080fd5b50614cc58b828c01614723565b9097509550506040890135614cd98161456c565b93506060890135614ce98161456c565b92506080890135614cf98161456c565b915060a0890135614d098161456c565b809150509295985092959890939650565b60008060408385031215614d2d57600080fd5b8235614d388161456c565b915060208301356149bb8161456c565b600080600060408486031215614d5d57600080fd5b83356001600160401b0380821115614d7457600080fd5b614d8087838801614660565b94506020860135915080821115614d9657600080fd5b506147a986828701614723565b600181811c90821680614db757607f821691505b6020821081141561453257634e487b7160e01b600052602260045260246000fd5b6000808335601e19843603018112614def57600080fd5b8301803591506001600160401b03821115614e0957600080fd5b60200191503681900382131561476457600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03868116825285166020820152608060408201819052600090614e749083018587614e1e565b90508260608301529695505050505050565b8581526001600160a01b0385166020820152608060408201819052600090614e749083018587614e1e565b600060208284031215614ec357600080fd5b815161408b8161456c565b60006101008b83528a6020840152896040840152806060840152614ef5818401898b614e1e565b6001600160a01b03978816608085015295871660a084015250509190931660c082015260e0019190915295945050505050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000600019821415614fa357614fa3614f79565b5060010190565b6000808335601e19843603018112614fc157600080fd5b83016020810192503590506001600160401b03811115614fe057600080fd5b80360383131561476457600080fd5b8035825260006150026020830183614faa565b60e0602086015261501760e086018284614e1e565b91505060408301356150288161456c565b6001600160a01b0381811660408701526150456060860186614faa565b9250868403606088015261505a848483614e1e565b9350506080850135915061506d8261456c565b16608085015261508060a0840184614faa565b85830360a0870152615093838284614e1e565b925050506150a360c08401614add565b151560c08501528091505092915050565b60c0815260006150c760c0830188614fef565b602083810197909752604083019590955250606081019290925281830360808301526000835260a09091015201919050565b60006020828403121561510b57600080fd5b5051919050565b60c08152600061512560c0830189614fef565b876020840152866040840152856060840152828103608084015261514981866144e1565b9150508260a0830152979650505050505050565b838152604060208201526000615177604083018486614e1e565b95945050505050565b60808152843560808201526000602086013561519b8161456c565b6001600160a01b0381811660a0850152604088013560c08501526151c26060890189614faa565b9250608060e08601526151da61010086018483614e1e565b978216602086015250949094166040830152506060015250919050565b600080835481600182811c91508083168061521357607f831692505b602080841082141561523357634e487b7160e01b86526022600452602486fd5b818015615247576001811461525857615285565b60ff19861689528489019650615285565b60008a81526020902060005b8681101561527d5781548b820152908501908301615264565b505084890196505b509498975050505050505050565b634e487b7160e01b600052603260045260246000fd5b608081528435608082015260006152c36020870187614faa565b608060a08501526152d961010085018284614e1e565b915050604087013560c08401526152f36060880188614faa565b848303607f190160e086015261530a838284614e1e565b6001600160a01b0398891660208701529690971660408501525050506060015292915050565b858152846020820152608060408201526000614e74608083018587614e1e565b6001600160a01b038781168252602082018790528516604082015260a0606082018190526000906153849083018587614e1e565b9050826080830152979650505050505050565b8335815260c0810160208501356153ad8161456c565b6001600160a01b039081166020840152604086810135908401526060958601359583019590955292909316608084015260a09092019190915290565b8335815260a0810160208501356153ff8161456c565b6001600160a01b0390811660208401526040958601359583019590955292909316606084015260809092019190915290565b6080815284356080820152602085013560a0820152604085013560c0820152600061545f6060870187614faa565b608060e085015261547561010085018284614e1e565b6001600160a01b03978816602086015295909616604084015250506060015292915050565b8183823760009101908152919050565b8581526080602082015260006154c4608083018688614e1e565b604083019490945250606001529392505050565b888152876020820152600060018060a01b03808916604084015260e0606084015261550760e08401888a614e1e565b951660808301525060a081019290925260c09091015295945050505050565b60a08152853560a0820152602086013560c0820152604086013560e08201526060860135610100820152600061555f6080880188614faa565b60a061012085015261557661014085018284614e1e565b6001600160a01b0398891660208601529690971660408401525050606081019290925260809091015292915050565b600060a082360312156155b757600080fd5b6155bf6148a0565b6155c883614581565b815260208301356001600160401b03808211156155e457600080fd5b6155f03683870161491f565b6020840152604085013591508082111561560957600080fd5b6156153683870161491f565b604084015261562660608601614581565b6060840152608085013591508082111561563f57600080fd5b5061564c3682860161491f565b60808301525092915050565b6080815284356080820152600060208601356156738161456c565b6001600160a01b0381811660a0850152604088013560c0850152606088013560e08501526156a46080890189614faa565b925060a06101008601526151da61012086018483614e1e565b86815285602082015260018060a01b038516604082015260a06060820152600061538460a083018587614e1e565b6000602082840312156156fd57600080fd5b81516001600160401b0381111561571357600080fd5b8201601f8101841361572457600080fd5b805161573261493e826148f8565b81815285602083850101111561574757600080fd5b6151778260208301602086016144b5565b606081528335606082015260006157726020860186614faa565b6060608085015261578760c085018284614e1e565b60409788013560a08601526001600160a01b039690961660208501525050509092019190915290565b6000828210156157c2576157c2614f79565b500390565b600082198211156157da576157da614f79565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60a08152600060018060a01b038088511660a0840152602088015160a060c08501526158616101408501826144e1565b90506040890151609f19808684030160e087015261587f83836144e1565b92508360608c01511661010087015260808b01519350808684030161012087015250506158ac81836144e1565b925050506158be602083018715159052565b8460408301528360608301528260808301529695505050505050565b6060815260006158ee606083018789614e1e565b8281036020840152615901818688614e1e565b9150508260408301529695505050505050565b60006101008a835289602084015288604084015280606084015261593a818401896144e1565b6001600160a01b03978816608085015295871660a084015250509190931660c082015260e00191909152949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061599f908301846144e1565b9695505050505050565b6000602082840312156159bb57600080fd5b815161408b81614469565b60008160001904831182151516156159e0576159e0614f79565b500290565b6000816159f4576159f4614f79565b506000190190565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220588949675c5ae9fe8d5d328ab4796d4056d51cfbf14a4718e654ec6e65fd604464736f6c634300080a0033