- Contract name:
- Web3Entry
- Optimization enabled
- true
- Compiler version
- v0.8.10+commit.fc410830
- Optimization runs
- 200
- Verified at
- 2022-11-03T14:26:06.296070Z
contracts/Web3Entry.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "./Web3EntryBase.sol"; contract Web3Entry is Web3EntryBase { using EnumerableSet for EnumerableSet.AddressSet; mapping(uint256 => EnumerableSet.AddressSet) internal _operatorsByCharacter; function addOperator(uint256 characterId, address operator) external override { _validateCallerIsCharacterOwner(characterId); _addOperator(characterId, operator); } function removeOperator(uint256 characterId, address operator) external override { _validateCallerIsCharacterOwner(characterId); _removeOperator(characterId, operator); } function isOperator(uint256 characterId, address operator) external view override returns (bool) { bool inOperator = _operatorByCharacter[characterId] == operator; bool inOpertors = _operatorsByCharacter[characterId].contains(operator); return inOperator || inOpertors; } function getOperators(uint256 characterId) external view override returns (address[] memory) { return _operatorsByCharacter[characterId].values(); } function _addOperator(uint256 characterId, address operator) internal { _operatorsByCharacter[characterId].add(operator); emit Events.AddOperator(characterId, operator, block.timestamp); } function _removeOperator(uint256 characterId, address operator) internal { _operatorsByCharacter[characterId].remove(operator); emit Events.RemoveOperator(characterId, operator, block.timestamp); } function _validateCallerIsCharacterOwnerOrOperator(uint256 characterId) internal view virtual override { address owner = ownerOf(characterId); require( _operatorsByCharacter[characterId].contains(msg.sender) || msg.sender == owner || msg.sender == _operatorByCharacter[characterId] || (tx.origin == owner && msg.sender == periphery), "NotCharacterOwnerNorOperator" ); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { address[] memory _list = _operatorsByCharacter[tokenId].values(); for (uint256 index = 0; index < _list.length; index++) { address _value = _list[index]; _operatorsByCharacter[tokenId].remove(_value); } super._beforeTokenTransfer(from, to, tokenId); } }
@openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @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); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
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); function getOwnerCharacterId(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 getLinkingAnyUriKeys(uint256 tokenId) external view returns (bytes32[] 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.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; 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. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * 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 prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
@openzeppelin/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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`. * * 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; /** * @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 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 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 the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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); }
@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (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 `IERC721Receiver.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, 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, 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, bytes32 linkType, address linklist, mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists ) external { uint256 linklistId = _mintLinklist(fromCharacterId, linkType, 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 linklist, mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists ) external { uint256 linklistId = _mintLinklist( vars.fromCharacterId, vars.linkType, 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 linklist, mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists ) external { uint256 linklistId = _mintLinklist( vars.fromCharacterId, vars.linkType, 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 linklist, mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists ) external { uint256 linklistId = _mintLinklist( vars.fromCharacterId, vars.linkType, 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 linklist, mapping(uint256 => mapping(bytes32 => uint256)) storage _attachedLinklists ) external { uint256 linklistId = _mintLinklist( vars.fromCharacterId, vars.linkType, 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 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 addOperator(uint256 characterId, address operator) external; function removeOperator(uint256 characterId, address operator) external; function isOperator(uint256 characterId, address operator) external view returns (bool); function getOperators(uint256 characterId) external view returns (address[] memory); 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 AddOperator(uint256 indexed characterId, address indexed operator, uint256 timestamp); event RemoveOperator(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.7.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 /// @solidity memory-safe-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); } }
contracts/Web3EntryBase.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 Web3EntryBase 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 _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 { uint256 characterId = ++_characterCounter; // mint character nft _safeMint(vars.to, characterId); CharacterLogic.createCharacter( vars, true, characterId, _characterIdByHandleHash, _characterById ); // set primary character if (_primaryCharacterByAddress[vars.to] == 0) { _primaryCharacterByAddress[vars.to] = characterId; } } 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 addOperator(uint256, address) external virtual {} function removeOperator(uint256, address) external virtual {} function isOperator(uint256, address) external view virtual returns (bool) {} function getOperators(uint256) external view virtual returns (address[] memory) {} function setLinklistUri(uint256 linklistId, string calldata uri) external { _validateCallerIsLinklistOwner(linklistId); ILinklist(_linklist).setUri(linklistId, uri); } function linkCharacter(DataTypes.linkCharacterData calldata vars) external { _validateCallerIsCharacterOwnerOrOperator(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 { _validateCallerIsCharacterOwnerOrOperator(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 _safeMint(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 { _validateCallerIsCharacterOwnerOrOperator(vars.fromCharacterId); _validateERC721Exists(vars.tokenAddress, vars.tokenId); LinkLogic.linkERC721(vars, _linklist, _attachedLinklists); } function unlinkERC721(DataTypes.unlinkERC721Data calldata vars) external { _validateCallerIsCharacterOwnerOrOperator(vars.fromCharacterId); LinkLogic.unlinkERC721( vars, _linklist, _attachedLinklists[vars.fromCharacterId][vars.linkType] ); } function linkAddress(DataTypes.linkAddressData calldata vars) external { _validateCallerIsCharacterOwnerOrOperator(vars.fromCharacterId); LinkLogic.linkAddress(vars, _linklist, _attachedLinklists); } function unlinkAddress(DataTypes.unlinkAddressData calldata vars) external { _validateCallerIsCharacterOwnerOrOperator(vars.fromCharacterId); LinkLogic.unlinkAddress( vars, _linklist, _attachedLinklists[vars.fromCharacterId][vars.linkType] ); } function linkAnyUri(DataTypes.linkAnyUriData calldata vars) external { _validateCallerIsCharacterOwnerOrOperator(vars.fromCharacterId); LinkLogic.linkAnyUri(vars, _linklist, _attachedLinklists); } function unlinkAnyUri(DataTypes.unlinkAnyUriData calldata vars) external { _validateCallerIsCharacterOwnerOrOperator(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 { _validateCallerIsCharacterOwnerOrOperator(vars.fromCharacterId); LinkLogic.linkLinklist(vars, _linklist, _attachedLinklists); } function unlinkLinklist(DataTypes.unlinkLinklistData calldata vars) external { _validateCallerIsCharacterOwnerOrOperator(vars.fromCharacterId); LinkLogic.unlinkLinklist( vars, _linklist, _attachedLinklists[vars.fromCharacterId][vars.linkType] ); } // set link module for his character function setLinkModule4Character(DataTypes.setLinkModule4CharacterData calldata vars) external { _validateCallerIsCharacterOwnerOrOperator(vars.characterId); CharacterLogic.setCharacterLinkModule( vars.characterId, vars.linkModule, vars.linkModuleInitData, _characterById[vars.characterId] ); } function setLinkModule4Note(DataTypes.setLinkModule4NoteData calldata vars) external { _validateCallerIsCharacterOwnerOrOperator(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 { _validateCallerIsCharacterOwnerOrOperator(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 { _validateCallerIsCharacterOwnerOrOperator(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 { _validateCallerIsCharacterOwner(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 virtual 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); } /** * @dev This is a virtual function and it doesn't check anything, so you should complete validating logic in inheritance contracts that use this Web3EntryBase contract as parent contract. */ function _validateCallerIsCharacterOwnerOrOperator(uint256 characterId) internal view virtual {} 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 getRevision() external pure returns (uint256) { return REVISION; } }
@openzeppelin/contracts/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ 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; /// @solidity memory-safe-assembly 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; /// @solidity memory-safe-assembly 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; // obsoleted address public resolver; // slot 23 }
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 (last updated v4.7.0) (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) { /// @solidity memory-safe-assembly 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) { /// @solidity memory-safe-assembly 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) { /// @solidity memory-safe-assembly 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":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","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":"addOperator","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"address","name":"operator","internalType":"address"}]},{"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":"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":"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":"address[]","name":"","internalType":"address[]"}],"name":"getOperators","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":"isOperator","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"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":"nonpayable","outputs":[],"name":"removeOperator","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"address","name":"operator","internalType":"address"}]},{"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":"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":"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
0x608060405234801561001057600080fd5b50615d4280620000216000396000f3fe608060405234801561001057600080fd5b50600436106104545760003560e01c8063867884e611610241578063c87b56dd1161013b578063e56f2fe4116100c3578063f2ad807511610087578063f2ad807514610a85578063f316bacd14610a98578063f6479d7714610aab578063fd2d866f14610abe578063fe9299fb14610ad157600080fd5b8063e56f2fe4146109fd578063e7a1c1c014610a10578063e985e9c514610a23578063ec81d19414610a5f578063ef0828ab14610a7257600080fd5b8063d70e10c61161010a578063d70e10c614610979578063dabb0531146109a4578063db491e80146109b7578063db8c198d146109d7578063dca27135146109ea57600080fd5b8063c87b56dd1461092d578063cb8e757e14610940578063cd69fe6114610953578063d23b320b1461096657600080fd5b80639a50248d116101c9578063af90b1121161018d578063af90b112146108d0578063b88d4fde146108e3578063b9d32845146108f6578063c053f6b814610909578063c2a6fe3b1461091a57600080fd5b80639a50248d14610864578063a22cb46514610884578063a48047ba14610897578063a6e6178d146108aa578063a7ccb4bf146108bd57600080fd5b806393f057e51161021057806393f057e51461081057806395d89b411461082357806395d9fa7d1461082b5780639864c3071461083e5780639a4dec181461085157600080fd5b8063867884e6146107c45780638734bbfc146107d75780638b4ca06a146107ea57806392f7070b146107fd57600080fd5b806331b9d08c116103525780634f6ccce7116102da57806369492c971161029e57806369492c97146107585780636bf55d5f1461076b57806370a082311461078b57806374f345cf1461079e5780637d46a713146107b157600080fd5b80634f6ccce7146106f95780635a936d101461070c5780635fb881831461071f578063628b644a146107325780636352211e1461074557600080fd5b806340ad34d81161032157806340ad34d81461069a57806342842e0e146106ad57806342966c68146106c057806344b82a24146106d357806347f94de7146106e657600080fd5b806331b9d08c14610635578063327b2a031461066157806333f06ee614610674578063388f50831461068757600080fd5b80630ff98244116103e05780632209d145116103a45780632209d1451461059d57806323b872dd146105d357806329c301c2146105e65780632abc6bf6146105f95780632f745c591461062257600080fd5b80630ff982441461054b5780631316529d1461055e578063144a3e831461056f57806318160ddd14610582578063188b04b31461058a57600080fd5b8063081812fc11610427578063081812fc146104ea57806308cb68ff146104fd578063095ea7b3146105125780630c4dd5f2146105255780630d18d07a1461053857600080fd5b806301ffc9a71461045957806304f3bcec1461048157806305f63c8a146104ac57806306fdde03146104d5575b600080fd5b61046c610467366004614788565b610afa565b60405190151581526020015b60405180910390f35b601754610494906001600160a01b031681565b6040516001600160a01b039091168152602001610478565b6104946104ba3660046147a5565b6000908152601660205260409020546001600160a01b031690565b6104dd610b25565b6040516104789190614816565b6104946104f83660046147a5565b610bb7565b61051061050b366004614841565b610c51565b005b61051061052036600461489a565b610cea565b610510610533366004614841565b610e00565b6105106105463660046148c6565b610e65565b6105106105593660046148f6565b610e7c565b60045b604051908152602001610478565b6104dd61057d3660046147a5565b610f7b565b600854610561565b610510610598366004614924565b610f86565b6104946105ab36600461489a565b6001600160a01b03918216600090815260106020908152604080832093835292905220541690565b6105106105e1366004614958565b611083565b6105616105f43660046149ab565b6110b4565b6105616106073660046149df565b6001600160a01b03166000908152600c602052604090205490565b61056161063036600461489a565b611160565b6104946106433660046149df565b6001600160a01b039081166000908152601160205260409020541690565b61056161066f366004614a0e565b6111f6565b610510610682366004614aa4565b6113b9565b610510610695366004614924565b61142d565b6105106106a8366004614aef565b611480565b6105106106bb366004614958565b6114fa565b6105106106ce3660046147a5565b611515565b6105616106e1366004614b0b565b6115ae565b6105106106f4366004614aa4565b611624565b6105616107073660046147a5565b611664565b61051061071a3660046148f6565b6116f7565b61051061072d366004614924565b611787565b610510610740366004614b4f565b6117da565b6104946107533660046147a5565b611866565b610510610766366004614924565b6118dd565b61077e6107793660046147a5565b611a15565b6040516104789190614ba1565b6105616107993660046149df565b611a2f565b6105106107ac366004614bee565b611ab6565b6105106107bf3660046148c6565b611b2e565b6105106107d2366004614aef565b611b41565b61046c6107e53660046147a5565b611bb1565b6105616107f83660046147a5565b611bdf565b61056161080b366004614c10565b611c4b565b61051061081e3660046148f6565b611cdf565b6104dd611d4e565b6105106108393660046148c6565b611d5d565b61051061084c366004614924565b611de3565b61056161085f366004614a0e565b611e36565b610877610872366004614c56565b611f3e565b6040516104789190614c97565b610510610892366004614d23565b6120ed565b61046c6108a53660046148c6565b6120f8565b6105106108b8366004614aa4565b612143565b6105616108cb366004614924565b6121b9565b6105616108de366004614b0b565b61225d565b6105106108f1366004614e3a565b61229b565b610510610904366004614eb7565b6122d3565b6013546001600160a01b0316610494565b610510610928366004614bee565b6123a2565b6104dd61093b3660046147a5565b612412565b61051061094e366004614eb7565b6124b7565b610510610961366004614eb7565b612527565b610510610974366004614924565b61253b565b610561610987366004614bee565b6000918252600d6020908152604080842092845291905290205490565b6108776109b23660046147a5565b6125b5565b6109ca6109c5366004614bee565b61273c565b6040516104789190614eeb565b6105106109e5366004614924565b61289d565b6104dd6109f83660046147a5565b6128e7565b610510610a0b366004614f81565b612959565b610510610a1e3660046148c6565b612b0e565b61046c610a3136600461503b565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6104dd610a6d3660046147a5565b612b21565b610510610a80366004614841565b612b41565b610510610a933660046147a5565b612bb0565b610561610aa6366004615069565b612bff565b610510610ab93660046148f6565b612d5b565b610510610acc366004614841565b612d95565b610494610adf3660046147a5565b6000908152600f60205260409020546001600160a01b031690565b60006001600160e01b0319821663780e9d6360e01b1480610b1f5750610b1f82612e0e565b92915050565b606060008054610b34906150c4565b80601f0160208091040260200160405190810160405280929190818152602001828054610b60906150c4565b8015610bad5780601f10610b8257610100808354040283529160200191610bad565b820191906000526020600020905b815481529060010190602001808311610b9057829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610c355760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b73fcee9b25df684e8681df3a9d0679bc6182a8038263dfc34f25610c7860208401846149df565b610c8860408501602086016149df565b610c9560408601866150f9565b60116040518663ffffffff1660e01b8152600401610cb7959493929190615168565b60006040518083038186803b158015610ccf57600080fd5b505af4158015610ce3573d6000803e3d6000fd5b5050505050565b6000610cf582611866565b9050806001600160a01b0316836001600160a01b03161415610d635760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c2c565b336001600160a01b0382161480610d7f5750610d7f8133610a31565b610df15760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610c2c565b610dfb8383612e5e565b505050565b610e0a8135612ecc565b73fcee9b25df684e8681df3a9d0679bc6182a80382636252159e8235610e3660408501602086016149df565b610e4360408601866150f9565b600f6040518663ffffffff1660e01b8152600401610cb79594939291906151a7565b610e6e82612f8c565b610e78828261300d565b5050565b610e86813561306e565b6040516331a9108f60e11b81528135600482015273db64ee50f4662c1a131a3e1b72a10756d899860990633019fadd9083903090636352211e90602401602060405180830381865afa158015610ee0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0491906151d2565b60135485356000908152600d60209081526040808320818a0135845282529182902054825160e088901b6001600160e01b031916815286356004820152918601356024830152949091013560448201526001600160a01b0392831660648201529116608482015260a481019190915260c401610cb7565b6060610b1f82612412565b610f90813561306e565b610f9d816020013561313c565b73db64ee50f4662c1a131a3e1b72a10756d899860963957f8a98823560208401356040850135610fd060608701876150f9565b6040516331a9108f60e11b8152883560048201523090636352211e90602401602060405180830381865afa15801561100c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103091906151d2565b6013546020808b01356000908152600a9091526040908190206005015490516001600160e01b031960e08b901b168152610cb7989796959493926001600160a01b03908116921690600d906004016151ef565b61108d3382613195565b6110a95760405162461bcd60e51b8152600401610c2c90615249565b610dfb83838361328c565b60006110c0823561306e565b81356000908152600a60205260408120600301805482906110e0906152b0565b91829055506040516342a34a5360e01b815290915073806130029c792b1d99e6b58afb9e0fda93d16595906342a34a539061112990869085906000908190600e906004016153d5565b60006040518083038186803b15801561114157600080fd5b505af4158015611155573d6000803e3d6000fd5b509295945050505050565b600061116b83611a2f565b82106111cd5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c2c565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6000611202833561306e565b61121c61121260208401846149df565b8360200135613433565b6013546545524337323160d01b906000906001600160a01b0316632ea24efc8261124960208801886149df565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152602087013560448201526064016020604051808303816000875af115801561129f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c3919061541a565b85356000908152600a602052604081206003018054929350909182906112e8906152b0565b9182905550905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a538783868661131a60208c018c6149df565b8b6020013560405160200161134d92919060609290921b6bffffffffffffffffffffffff19168252601482015260340190565b604051602081830303815290604052600e6040518763ffffffff1660e01b815260040161137f96959493929190615433565b60006040518083038186803b15801561139757600080fd5b505af41580156113ab573d6000803e3d6000fd5b509298975050505050505050565b6113c283612ecc565b601354604051633c17845760e11b81526001600160a01b039091169063782f08ae906113f69086908690869060040161547e565b600060405180830381600087803b15801561141057600080fd5b505af1158015611424573d6000803e3d6000fd5b50505050505050565b611437813561306e565b60135460405163e4bb4f2360e01b815273db64ee50f4662c1a131a3e1b72a10756d89986099163e4bb4f2391610cb79185916001600160a01b0390911690600d90600401615498565b61148a813561306e565b60135460408051635cebf08d60e11b81528335600482015260208401356024820152908301356044820152606083013560648201526001600160a01b039091166084820152600d60a482015273db64ee50f4662c1a131a3e1b72a10756d89986099063b9d7e11a9060c401610cb7565b610dfb8383836040518060200160405280600081525061229b565b6000818152600a602052604080822090516115339160010190615506565b60408051918290039091206000818152600b6020908152838220829055858252600a90529182208281559092509061156e60018301826145e3565b61157c6002830160006145e3565b50600060038201556004810180546001600160a01b0319908116909155600590910180549091169055610e78826134e3565b60006115ba833561306e565b82356000908152600a60205260408120600301805467131a5b9adb1a5cdd60c21b928592909182906115eb906152b0565b919050819055905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a53878386868a60405160200161134d91815260200190565b610dfb8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061354292505050565b600061166f60085490565b82106116d25760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610c2c565b600882815481106116e5576116e56155a2565b90600052602060002001549050919050565b611701813561306e565b60135481356000818152600d60209081526040808320818701358085529083529281902054905163d862986560e01b8152600481019490945290850135602484015260448301919091526001600160a01b039092166064820152608481019190915273db64ee50f4662c1a131a3e1b72a10756d89986099063d86298659060a401610cb7565b611791813561306e565b6013546040516332f107bf60e01b815273db64ee50f4662c1a131a3e1b72a10756d8998609916332f107bf91610cb79185916001600160a01b0390911690600d906004016155b8565b6117e38461306e565b6117ed84846135a1565b6040516001626802bf60e01b0319815273806130029c792b1d99e6b58afb9e0fda93d165959063ff97fd4190611830908790879087908790600e90600401615635565b60006040518083038186803b15801561184857600080fd5b505af415801561185c573d6000803e3d6000fd5b5050505050505050565b6000818152600260205260408120546001600160a01b031680610b1f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c2c565b6118ea60208201826149df565b6040516331a9108f60e11b8152602083013560048201526001600160a01b039190911690636352211e90602401602060405180830381865afa158015611934573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195891906151d2565b6001600160a01b0316336001600160a01b0316146119a95760405162461bcd60e51b815260206004820152600e60248201526d2737ba22a9219b9918a7bbb732b960911b6044820152606401610c2c565b73fcee9b25df684e8681df3a9d0679bc6182a8038263384afeb36119d060208401846149df565b60208401356119e560608601604087016149df565b6119f260608701876150f9565b60106040518763ffffffff1660e01b8152600401610cb796959493929190615655565b6000818152601860205260409020606090610b1f90613656565b60006001600160a01b038216611a9a5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c2c565b506001600160a01b031660009081526003602052604090205490565b611abf8261306e565b611ac982826135a1565b6000828152600e60209081526040808320848452825291829020600501805460ff60a81b1916600160a81b179055905182815283917f036469f3e73c83520cdefa197d7a9c854c2f8bc0164b82e9f2bd4aa7e150fd3091015b60405180910390a25050565b611b3782612f8c565b610e78828261366a565b611b4b813561306e565b60135481356000908152600d6020908152604080832060608601358452909152908190205490516317e9a8b160e31b815273db64ee50f4662c1a131a3e1b72a10756d89986099263bf4d458892610cb79286926001600160a01b0316919060040161569c565b600080611bbd83611866565b6001600160a01b03166000908152600c60205260409020549290921492915050565b60135460405162fba02760e01b8152600481018390526000916001600160a01b03169062fba02790602401602060405180830381865afa158015611c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1f919061541a565b6000611c57833561306e565b82356000908152600a602052604081206003018054664164647265737360c81b926001600160a01b0386169290918290611c90906152b0565b919050819055905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a53878386868a60405160200161134d919060609190911b6bffffffffffffffffffffffff1916815260140190565b611ce9813561306e565b60135481356000908152600d6020908152604080832081860135845290915290819020549051633d7f9b3d60e11b815273db64ee50f4662c1a131a3e1b72a10756d899860992637aff367a92610cb79286926001600160a01b031691906004016156ee565b606060018054610b34906150c4565b611d6682612f8c565b6040516384b44a2f60e01b8152600481018390526001600160a01b0382166024820152600a604482015273eac7109f5a475b857547724239dda8bc50cfde67906384b44a2f9060640160006040518083038186803b158015611dc757600080fd5b505af4158015611ddb573d6000803e3d6000fd5b505050505050565b611ded813561306e565b601354604051635fe5df1d60e11b815273db64ee50f4662c1a131a3e1b72a10756d89986099163bfcbbe3a91610cb79185916001600160a01b0390911690600d90600401615736565b6000611e42833561306e565b601354604051635cb46be760e01b81526000600482018190528435602483015260208501356044830152634e6f746560e01b9290916001600160a01b0390911690635cb46be7906064016020604051808303816000875af1158015611eab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecf919061541a565b85356000908152600a60205260408120600301805492935090918290611ef4906152b0565b919050819055905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a53878386868a600001358b6020013560405160200161134d929190918252602082015260400190565b611f4661461d565b60008383604051611f58929190615796565b604080519182900382206000818152600b602090815283822054808352600a82529184902060c0860190945283548552600184018054939650919493929084019190611fa3906150c4565b80601f0160208091040260200160405190810160405280929190818152602001828054611fcf906150c4565b801561201c5780601f10611ff15761010080835404028352916020019161201c565b820191906000526020600020905b815481529060010190602001808311611fff57829003601f168201915b50505050508152602001600282018054612035906150c4565b80601f0160208091040260200160405190810160405280929190818152602001828054612061906150c4565b80156120ae5780601f10612083576101008083540402835291602001916120ae565b820191906000526020600020905b81548152906001019060200180831161209157829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b03908116604083015260059092015490911660609091015295945050505050565b610e783383836136bf565b600082815260166020908152604080832054601890925282206001600160a01b0384811692169190911490829061212f908561378e565b9050818061213a5750805b95945050505050565b61214c83612f8c565b60405163130f361d60e01b815273eac7109f5a475b857547724239dda8bc50cfde679063130f361d9061218d90869086908690600b90600a906004016157a6565b60006040518083038186803b1580156121a557600080fd5b505af4158015611424573d6000803e3d6000fd5b60006121ca823560208401356135a1565b73806130029c792b1d99e6b58afb9e0fda93d16595635be69415833560208501356121fb60608701604088016149df565b61220860608801886150f9565b6014546040516001600160e01b031960e089901b1681526122409695949392916001600160a01b031690600a90600e906004016157d4565b602060405180830381865af4158015611c27573d6000803e3d6000fd5b6000612269833561306e565b82356000908152600a6020526040812060030180546821b430b930b1ba32b960b91b928592909182906115eb906152b0565b6122a53383613195565b6122c15760405162461bcd60e51b8152600401610c2c90615249565b6122cd848484846137b0565b50505050565b6122dd813561306e565b6122ef816020013582604001356135a1565b6040516331a9108f60e11b81528135600482015273db64ee50f4662c1a131a3e1b72a10756d89986099063018212d19083903090636352211e90602401602060405180830381865afa158015612349573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236d91906151d2565b6013546040516001600160e01b031960e086901b168152610cb79392916001600160a01b031690600e90600d90600401615822565b6123ab82612f8c565b6123b582826135a1565b6000828152600e60209081526040808320848452825291829020600501805460ff60a01b1916600160a01b179055905182815283917f4f1db9708b537c1d26a7af4b235fd079bf2342d92a276e27eb6c8717e8bbcf939101611b22565b6000818152600a60205260409020600201805460609190612432906150c4565b80601f016020809104026020016040519081016040528092919081815260200182805461245e906150c4565b80156124ab5780601f10612480576101008083540402835291602001916124ab565b820191906000526020600020905b81548152906001019060200180831161248e57829003601f168201915b50505050509050919050565b6124c1813561306e565b6124de6124d460408301602084016149df565b8260400135613433565b601354604051638f3334ff60e01b815273db64ee50f4662c1a131a3e1b72a10756d899860991638f3334ff91610cb79185916001600160a01b0390911690600d906004016158a1565b61253861253382615904565b6137e3565b50565b612545813561306e565b612554813560208301356135a1565b73fcee9b25df684e8681df3a9d0679bc6182a803826320828a028235602084013561258560608601604087016149df565b61259260608701876150f9565b600e6040518763ffffffff1660e01b8152600401610cb7969594939291906159b7565b6125bd61461d565b600a60008381526020019081526020016000206040518060c0016040529081600082015481526020016001820180546125f5906150c4565b80601f0160208091040260200160405190810160405280929190818152602001828054612621906150c4565b801561266e5780601f106126435761010080835404028352916020019161266e565b820191906000526020600020905b81548152906001019060200180831161265157829003601f168201915b50505050508152602001600282018054612687906150c4565b80601f01602080910402602001604051908101604052809291908181526020018280546126b3906150c4565b80156127005780601f106126d557610100808354040283529160200191612700565b820191906000526020600020905b8154815290600101906020018083116126e357829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b03908116604083015260059092015490911660609091015292915050565b60408051610100808201835260008083526020808401829052606084860181905284018290526080840182905260a0840182905260c0840182905260e08401829052868252600e815284822086835281529084902084519283018552805483526001810154918301919091526002810180549394929391928401916127c0906150c4565b80601f01602080910402602001604051908101604052809291908181526020018280546127ec906150c4565b80156128395780601f1061280e57610100808354040283529160200191612839565b820191906000526020600020905b81548152906001019060200180831161281c57829003601f168201915b505050918352505060038201546001600160a01b039081166020830152600483015481166040830152600590920154918216606082015260ff600160a01b8304811615156080830152600160a81b909204909116151560a090910152905092915050565b6128a7813561306e565b6128b6813560208301356135a1565b73fcee9b25df684e8681df3a9d0679bc6182a80382631f2ffb698235602084013561258560608601604087016149df565b601354604051632b05429560e21b8152600481018390526060916001600160a01b03169063ac150a5490602401600060405180830381865afa158015612931573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b1f91908101906159e5565b601454600160a81b900460ff161580801561298157506014546001600160a01b90910460ff16105b806129a25750303b1580156129a25750601454600160a01b900460ff166001145b612a055760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c2c565b6014805460ff60a01b1916600160a01b1790558015612a32576014805460ff60a81b1916600160a81b1790555b612a3e898989896138b8565b601380546001600160a01b03199081166001600160a01b0388811691909117909255601480548216878416179055601580548216868416179055601780549091169184169190911790556040514281527f400175a56dd3710794078f7b9dbe8296ac94c5a248dfd51bb22ed4ab9eaa9fbf9060200160405180910390a18015612b03576014805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b612b1782612f8c565b610e788282613909565b6000818152600a60205260409020600101805460609190612432906150c4565b612b4b813561306e565b60135481356000908152600d602090815260408083208186013584529091529081902054905163bf5c00c160e01b815273db64ee50f4662c1a131a3e1b72a10756d89986099263bf5c00c192610cb79286926001600160a01b03169190600401615a52565b612bb981612f8c565b336000818152600c602052604080822080549085905590519092839285927fce95332e6082aebeb8058a7b56d1a109f67d6550552ed04d36aca4a6acd4d7de9190a45050565b6000612c0b843561306e565b601354604051633610bf0960e11b815265416e7955726960d01b916000916001600160a01b0390911690636c217e1290612c4d9084908990899060040161547e565b6020604051808303816000875af1158015612c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c90919061541a565b86356000908152600a60205260408120600301805492935090918290612cb5906152b0565b919050819055905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a53888386868b8b604051602001612cee929190615796565b604051602081830303815290604052600e6040518763ffffffff1660e01b8152600401612d2096959493929190615433565b60006040518083038186803b158015612d3857600080fd5b505af4158015612d4c573d6000803e3d6000fd5b50929998505050505050505050565b6125388135612d7060408401602085016149df565b836040013560405180604001604052806002815260200161060f60f31b815250613966565b612d9f813561306e565b73eac7109f5a475b857547724239dda8bc50cfde67631dc831338235612dcb60408501602086016149df565b612dd860408601866150f9565b86356000908152600a60205260409081902090516001600160e01b031960e088901b168152610cb79594939291906004016151a7565b60006001600160e01b031982166380ac58cd60e01b1480612e3f57506001600160e01b03198216635b5e139f60e01b145b80610b1f57506301ffc9a760e01b6001600160e01b0319831614610b1f565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612e9382611866565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6013546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e90602401602060405180830381865afa158015612f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f3991906151d2565b6001600160a01b0316336001600160a01b0316146125385760405162461bcd60e51b815260206004820152601060248201526f2737ba2634b735a634b9ba27bbb732b960811b6044820152606401610c2c565b6000612f9782611866565b9050336001600160a01b0382161480612fcd5750326001600160a01b038216148015612fcd57506015546001600160a01b031633145b610e785760405162461bcd60e51b81526020600482015260116024820152702737ba21b430b930b1ba32b927bbb732b960791b6044820152606401610c2c565b60008281526018602052604090206130259082613bec565b50806001600160a01b0316827faa9506a57073a80893a2d2fdd53f4bd49d281a8548f483ad230f2d5da7f6710c4260405161306291815260200190565b60405180910390a35050565b600061307982611866565b6000838152601860205260409020909150613094903361378e565b806130a75750336001600160a01b038216145b806130c857506000828152601660205260409020546001600160a01b031633145b806130f05750326001600160a01b0382161480156130f057506015546001600160a01b031633145b610e785760405162461bcd60e51b815260206004820152601c60248201527f4e6f744368617261637465724f776e65724e6f724f70657261746f72000000006044820152606401610c2c565b6000818152600260205260409020546001600160a01b03166125385760405162461bcd60e51b81526020600482015260126024820152714368617261637465724e6f7445786973747360701b6044820152606401610c2c565b6000818152600260205260408120546001600160a01b031661320e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c2c565b600061321983611866565b9050806001600160a01b0316846001600160a01b031614806132545750836001600160a01b031661324984610bb7565b6001600160a01b0316145b8061328457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661329f82611866565b6001600160a01b0316146133035760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610c2c565b6001600160a01b0382166133655760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c2c565b613370838383613c01565b61337b600082612e5e565b6001600160a01b03831660009081526003602052604081208054600192906133a4908490615aaa565b90915550506001600160a01b03821660009081526003602052604081208054600192906133d2908490615ac1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040516331a9108f60e11b8152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa158015613478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349c91906151d2565b6001600160a01b0316610e785760405162461bcd60e51b815260206004820152600f60248201526e5245433732314e6f7445786973747360881b6044820152606401610c2c565b6134ed3382613195565b6135395760405162461bcd60e51b815260206004820152601b60248201527f4e4654426173653a204e6f744f776e65724f72417070726f76656400000000006044820152606401610c2c565b61253881613c8a565b61354b8261306e565b6000828152600a60209081526040909120825161357092600290920191840190614665565b50817f17d7c9f69270ba135480ef16837f38b9d37d3ab291cbd3ba03982290c663199782604051611b229190614816565b6000828152600e60209081526040808320848452909152902060050154600160a01b900460ff16156136055760405162461bcd60e51b815260206004820152600d60248201526c139bdd19525cd1195b195d1959609a1b6044820152606401610c2c565b6000828152600a6020526040902060030154811115610e785760405162461bcd60e51b815260206004820152600d60248201526c4e6f74654e6f7445786973747360981b6044820152606401610c2c565b6060600061366383613d31565b9392505050565b60008281526018602052604090206136829082613d8c565b50806001600160a01b0316827f58f51b5bb567864de85c6a422b33491f2418924a44613d7b9341f58657bdd8334260405161306291815260200190565b816001600160a01b0316836001600160a01b031614156137215760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c2c565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b03811660009081526001830160205260408120541515613663565b6137bb84848461328c565b6137c784848484613da1565b6122cd5760405162461bcd60e51b8152600401610c2c90615ad9565b60006012600081546137f4906152b0565b918290555082519091506138089082613e9f565b604051632902741560e01b815273eac7109f5a475b857547724239dda8bc50cfde679063290274159061384a9085906001908690600b90600a90600401615b2b565b60006040518083038186803b15801561386257600080fd5b505af4158015613876573d6000803e3d6000fd5b505083516001600160a01b03166000908152600c602052604090205415159150610e7890505790516001600160a01b03166000908152600c6020526040902055565b6138c484848484613eb9565b7f414cd0b34676984f09a5f76ce9718d4062e50283abe0e7e274a9a5b4e0c99c3084848484426040516138fb959493929190615bd4565b60405180910390a150505050565b60008281526016602090815260409182902080546001600160a01b0319166001600160a01b038516908117909155915142815284917f691b92a93c526c4f5a357e56a33c33f6250f94e19e6c49be805800615c4149319101613062565b61396f84612f8c565b6001600160a01b0383166000908152600c6020526040902054156139eb5760405162461bcd60e51b815260206004820152602d60248201527f546172676574206164647265737320616c726561647920686173207072696d6160448201526c393c9031b430b930b1ba32b91760991b6064820152608401610c2c565b60006012600081546139fc906152b0565b91829055509050613a0d8482613e9f565b73eac7109f5a475b857547724239dda8bc50cfde6763290274156040518060a00160405280876001600160a01b03168152602001613a55886001600160a01b03166014613ed2565b815260200160405180602001604052806000815250815260200160006001600160a01b0316815260200160405180602001604052806000815250815250600084600b600a6040518663ffffffff1660e01b8152600401613ab9959493929190615b2b565b60006040518083038186803b158015613ad157600080fd5b505af4158015613ae5573d6000803e3d6000fd5b505050506001600160a01b0384166000908152600c602052604090819020829055516331a9108f60e11b81526004810186905273db64ee50f4662c1a131a3e1b72a10756d89986099063957f8a989087908490879087903090636352211e90602401602060405180830381865afa158015613b64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b8891906151d2565b6013546040516001600160e01b031960e089901b168152613bc09695949392916001600160a01b031690600090600d90600401615c0e565b60006040518083038186803b158015613bd857600080fd5b505af4158015612b03573d6000803e3d6000fd5b6000613663836001600160a01b03841661406d565b6000818152601860205260408120613c1890613656565b905060005b8151811015613c7e576000828281518110613c3a57613c3a6155a2565b60200260200101519050613c698160186000878152602001908152602001600020613bec90919063ffffffff16565b50508080613c76906152b0565b915050613c1d565b506122cd848484614160565b6000613c9582611866565b9050613ca381600084613c01565b613cae600083612e5e565b6001600160a01b0381166000908152600360205260408120805460019290613cd7908490615aaa565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6060816000018054806020026020016040519081016040528092919081815260200182805480156124ab57602002820191906000526020600020905b815481526020019060010190808311613d6d5750505050509050919050565b6000613663836001600160a01b0384166141cb565b60006001600160a01b0384163b15613e9457604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613de5903390899088908890600401615c66565b6020604051808303816000875af1925050508015613e20575060408051601f3d908101601f19168201909252613e1d91810190615ca3565b60015b613e7a573d808015613e4e576040519150601f19603f3d011682016040523d82523d6000602084013e613e53565b606091505b508051613e725760405162461bcd60e51b8152600401610c2c90615ad9565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613284565b506001949350505050565b610e7882826040518060200160405280600081525061421a565b613ec5600085856146e9565b50610ce3600183836146e9565b60606000613ee1836002615cc0565b613eec906002615ac1565b6001600160401b03811115613f0357613f03614d4f565b6040519080825280601f01601f191660200182016040528015613f2d576020820181803683370190505b509050600360fc1b81600081518110613f4857613f486155a2565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613f7757613f776155a2565b60200101906001600160f81b031916908160001a9053506000613f9b846002615cc0565b613fa6906001615ac1565b90505b600181111561401e576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613fda57613fda6155a2565b1a60f81b828281518110613ff057613ff06155a2565b60200101906001600160f81b031916908160001a90535060049490941c9361401781615cdf565b9050613fa9565b5083156136635760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c2c565b60008181526001830160205260408120548015614156576000614091600183615aaa565b85549091506000906140a590600190615aaa565b905081811461410a5760008660000182815481106140c5576140c56155a2565b90600052602060002001549050808760000184815481106140e8576140e86155a2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061411b5761411b615cf6565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b1f565b6000915050610b1f565b6000818152601660205260409020546001600160a01b03161561418857614188816000613909565b6001600160a01b0383166000908152600c6020526040902054156141c0576001600160a01b0383166000908152600c60205260408120555b610dfb83838361424d565b600081815260018301602052604081205461421257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b1f565b506000610b1f565b6142248383614305565b6142316000848484613da1565b610dfb5760405162461bcd60e51b8152600401610c2c90615ad9565b6001600160a01b0383166142a8576142a381600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6142cb565b816001600160a01b0316836001600160a01b0316146142cb576142cb8382614453565b6001600160a01b0382166142e257610dfb816144f0565b826001600160a01b0316826001600160a01b031614610dfb57610dfb828261459f565b6001600160a01b03821661435b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c2c565b6000818152600260205260409020546001600160a01b0316156143c05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c2c565b6143cc60008383613c01565b6001600160a01b03821660009081526003602052604081208054600192906143f5908490615ac1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000600161446084611a2f565b61446a9190615aaa565b6000838152600760205260409020549091508082146144bd576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061450290600190615aaa565b6000838152600960205260408120546008805493945090928490811061452a5761452a6155a2565b90600052602060002001549050806008838154811061454b5761454b6155a2565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061458357614583615cf6565b6001900381819060005260206000200160009055905550505050565b60006145aa83611a2f565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b5080546145ef906150c4565b6000825580601f106145ff575050565b601f016020900490600052602060002090810190612538919061475d565b6040518060c001604052806000815260200160608152602001606081526020016000815260200160006001600160a01b0316815260200160006001600160a01b031681525090565b828054614671906150c4565b90600052602060002090601f01602090048101928261469357600085556146d9565b82601f106146ac57805160ff19168380011785556146d9565b828001600101855582156146d9579182015b828111156146d95782518255916020019190600101906146be565b506146e592915061475d565b5090565b8280546146f5906150c4565b90600052602060002090601f01602090048101928261471757600085556146d9565b82601f106147305782800160ff198235161785556146d9565b828001600101855582156146d9579182015b828111156146d9578235825591602001919060010190614742565b5b808211156146e5576000815560010161475e565b6001600160e01b03198116811461253857600080fd5b60006020828403121561479a57600080fd5b813561366381614772565b6000602082840312156147b757600080fd5b5035919050565b60005b838110156147d95781810151838201526020016147c1565b838111156122cd5750506000910152565b600081518084526148028160208601602086016147be565b601f01601f19169290920160200192915050565b60208152600061366360208301846147ea565b60006060828403121561483b57600080fd5b50919050565b60006020828403121561485357600080fd5b81356001600160401b0381111561486957600080fd5b61328484828501614829565b6001600160a01b038116811461253857600080fd5b803561489581614875565b919050565b600080604083850312156148ad57600080fd5b82356148b881614875565b946020939093013593505050565b600080604083850312156148d957600080fd5b8235915060208301356148eb81614875565b809150509250929050565b60006060828403121561490857600080fd5b6136638383614829565b60006080828403121561483b57600080fd5b60006020828403121561493657600080fd5b81356001600160401b0381111561494c57600080fd5b61328484828501614912565b60008060006060848603121561496d57600080fd5b833561497881614875565b9250602084013561498881614875565b929592945050506040919091013590565b600060e0828403121561483b57600080fd5b6000602082840312156149bd57600080fd5b81356001600160401b038111156149d357600080fd5b61328484828501614999565b6000602082840312156149f157600080fd5b813561366381614875565b60006040828403121561483b57600080fd5b60008060608385031215614a2157600080fd5b82356001600160401b03811115614a3757600080fd5b614a4385828601614999565b925050614a5384602085016149fc565b90509250929050565b60008083601f840112614a6e57600080fd5b5081356001600160401b03811115614a8557600080fd5b602083019150836020828501011115614a9d57600080fd5b9250929050565b600080600060408486031215614ab957600080fd5b8335925060208401356001600160401b03811115614ad657600080fd5b614ae286828701614a5c565b9497909650939450505050565b600060808284031215614b0157600080fd5b6136638383614912565b60008060408385031215614b1e57600080fd5b82356001600160401b03811115614b3457600080fd5b614b4085828601614999565b95602094909401359450505050565b60008060008060608587031215614b6557600080fd5b843593506020850135925060408501356001600160401b03811115614b8957600080fd5b614b9587828801614a5c565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b81811015614be25783516001600160a01b031683529284019291840191600101614bbd565b50909695505050505050565b60008060408385031215614c0157600080fd5b50508035926020909101359150565b60008060408385031215614c2357600080fd5b82356001600160401b03811115614c3957600080fd5b614c4585828601614999565b92505060208301356148eb81614875565b60008060208385031215614c6957600080fd5b82356001600160401b03811115614c7f57600080fd5b614c8b85828601614a5c565b90969095509350505050565b60208152815160208201526000602083015160c06040840152614cbd60e08401826147ea565b90506040840151601f19848303016060850152614cda82826147ea565b91505060608401516080840152608084015160018060a01b0380821660a08601528060a08701511660c086015250508091505092915050565b8035801515811461489557600080fd5b60008060408385031215614d3657600080fd5b8235614d4181614875565b9150614a5360208401614d13565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b0381118282101715614d8757614d87614d4f565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614db557614db5614d4f565b604052919050565b60006001600160401b03821115614dd657614dd6614d4f565b50601f01601f191660200190565b600082601f830112614df557600080fd5b8135614e08614e0382614dbd565b614d8d565b818152846020838601011115614e1d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215614e5057600080fd5b8435614e5b81614875565b93506020850135614e6b81614875565b92506040850135915060608501356001600160401b03811115614e8d57600080fd5b614e9987828801614de4565b91505092959194509250565b600060a0828403121561483b57600080fd5b600060208284031215614ec957600080fd5b81356001600160401b03811115614edf57600080fd5b61328484828501614ea5565b60208152815160208201526020820151604082015260006040830151610100806060850152614f1e6101208501836147ea565b9150606085015160018060a01b0380821660808701528060808801511660a0870152505060a0850151614f5c60c08601826001600160a01b03169052565b5060c085015180151560e08601525060e0850151801515858301525090949350505050565b60008060008060008060008060c0898b031215614f9d57600080fd5b88356001600160401b0380821115614fb457600080fd5b614fc08c838d01614a5c565b909a50985060208b0135915080821115614fd957600080fd5b50614fe68b828c01614a5c565b9097509550506040890135614ffa81614875565b9350606089013561500a81614875565b9250608089013561501a81614875565b915060a089013561502a81614875565b809150509295985092959890939650565b6000806040838503121561504e57600080fd5b823561505981614875565b915060208301356148eb81614875565b60008060006040848603121561507e57600080fd5b83356001600160401b038082111561509557600080fd5b6150a187838801614999565b945060208601359150808211156150b757600080fd5b50614ae286828701614a5c565b600181811c908216806150d857607f821691505b6020821081141561483b57634e487b7160e01b600052602260045260246000fd5b6000808335601e1984360301811261511057600080fd5b8301803591506001600160401b0382111561512a57600080fd5b602001915036819003821315614a9d57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03868116825285166020820152608060408201819052600090615195908301858761513f565b90508260608301529695505050505050565b8581526001600160a01b0385166020820152608060408201819052600090615195908301858761513f565b6000602082840312156151e457600080fd5b815161366381614875565b60006101008b83528a6020840152896040840152806060840152615216818401898b61513f565b6001600160a01b03978816608085015295871660a084015250509190931660c082015260e0019190915295945050505050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60006000198214156152c4576152c461529a565b5060010190565b6000808335601e198436030181126152e257600080fd5b83016020810192503590506001600160401b0381111561530157600080fd5b803603831315614a9d57600080fd5b80358252600061532360208301836152cb565b60e0602086015261533860e08601828461513f565b915050604083013561534981614875565b6001600160a01b03818116604087015261536660608601866152cb565b9250868403606088015261537b84848361513f565b9350506080850135915061538e82614875565b1660808501526153a160a08401846152cb565b85830360a08701526153b483828461513f565b925050506153c460c08401614d13565b151560c08501528091505092915050565b60c0815260006153e860c0830188615310565b602083810197909752604083019590955250606081019290925281830360808301526000835260a09091015201919050565b60006020828403121561542c57600080fd5b5051919050565b60c08152600061544660c0830189615310565b876020840152866040840152856060840152828103608084015261546a81866147ea565b9150508260a0830152979650505050505050565b83815260406020820152600061213a60408301848661513f565b6060815283356060820152600060208501356154b381614875565b6001600160a01b038181166080850152604087013560a08501526154da60608801886152cb565b9250608060c08601526154f160e08601848361513f565b96909116602085015250505060400152919050565b600080835481600182811c91508083168061552257607f831692505b602080841082141561554257634e487b7160e01b86526022600452602486fd5b818015615556576001811461556757615594565b60ff19861689528489019650615594565b60008a81526020902060005b8681101561558c5781548b820152908501908301615573565b505084890196505b509498975050505050505050565b634e487b7160e01b600052603260045260246000fd5b606081528335606082015260006155d260208601866152cb565b6080808501526155e660e08501828461513f565b915050604086013560a084015261560060608701876152cb565b848303605f190160c086015261561783828461513f565b6001600160a01b039790971660208601525050505060400152919050565b85815284602082015260806040820152600061519560808301858761513f565b6001600160a01b038781168252602082018790528516604082015260a060608201819052600090615689908301858761513f565b9050826080830152979650505050505050565b8335815260c0810160208501356156b281614875565b6001600160a01b039081166020840152604086810135908401526060958601359583019590955292909316608084015260a09092019190915290565b8335815260a08101602085013561570481614875565b6001600160a01b0390811660208401526040958601359583019590955292909316606084015260809092019190915290565b606081528335606082015260208401356080820152604084013560a0820152600061576460608601866152cb565b608060c085015261577960e08501828461513f565b6001600160a01b0396909616602085015250505060400152919050565b8183823760009101908152919050565b8581526080602082015260006157c060808301868861513f565b604083019490945250606001529392505050565b888152876020820152600060018060a01b03808916604084015260e0606084015261580360e08401888a61513f565b951660808301525060a081019290925260c09091015295945050505050565b60a08152853560a0820152602086013560c0820152604086013560e08201526060860135610100820152600061585b60808801886152cb565b60a06101208501526158726101408501828461513f565b6001600160a01b0398891660208601529690971660408401525050606081019290925260809091015292915050565b6060815283356060820152600060208501356158bc81614875565b60018060a01b038082166080850152604087013560a0850152606087013560c08501526158ec60808801886152cb565b925060a060e08601526154f16101008601848361513f565b600060a0823603121561591657600080fd5b61591e614d65565b6159278361488a565b815260208301356001600160401b038082111561594357600080fd5b61594f36838701614de4565b6020840152604085013591508082111561596857600080fd5b61597436838701614de4565b60408401526159856060860161488a565b6060840152608085013591508082111561599e57600080fd5b506159ab36828601614de4565b60808301525092915050565b86815285602082015260018060a01b038516604082015260a06060820152600061568960a08301858761513f565b6000602082840312156159f757600080fd5b81516001600160401b03811115615a0d57600080fd5b8201601f81018413615a1e57600080fd5b8051615a2c614e0382614dbd565b818152856020838501011115615a4157600080fd5b61213a8260208301602086016147be565b60608152833560608201526000615a6c60208601866152cb565b60606080850152615a8160c08501828461513f565b60409788013560a08601526001600160a01b039690961660208501525050509092019190915290565b600082821015615abc57615abc61529a565b500390565b60008219821115615ad457615ad461529a565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60a08152600060018060a01b038088511660a0840152602088015160a060c0850152615b5b6101408501826147ea565b90506040890151609f19808684030160e0870152615b7983836147ea565b92508360608c01511661010087015260808b0151935080868403016101208701525050615ba681836147ea565b92505050615bb8602083018715159052565b8460408301528360608301528260808301529695505050505050565b606081526000615be860608301878961513f565b8281036020840152615bfb81868861513f565b9150508260408301529695505050505050565b60006101008a8352896020840152886040840152806060840152615c34818401896147ea565b6001600160a01b03978816608085015295871660a084015250509190931660c082015260e00191909152949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615c99908301846147ea565b9695505050505050565b600060208284031215615cb557600080fd5b815161366381614772565b6000816000190483118215151615615cda57615cda61529a565b500290565b600081615cee57615cee61529a565b506000190190565b634e487b7160e01b600052603160045260246000fdfea26469706673582212202006319048fa2d12cdc540d2970d3f8dcda12cbea38cb7e2950920dc6e838b2164736f6c634300080a0033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106104545760003560e01c8063867884e611610241578063c87b56dd1161013b578063e56f2fe4116100c3578063f2ad807511610087578063f2ad807514610a85578063f316bacd14610a98578063f6479d7714610aab578063fd2d866f14610abe578063fe9299fb14610ad157600080fd5b8063e56f2fe4146109fd578063e7a1c1c014610a10578063e985e9c514610a23578063ec81d19414610a5f578063ef0828ab14610a7257600080fd5b8063d70e10c61161010a578063d70e10c614610979578063dabb0531146109a4578063db491e80146109b7578063db8c198d146109d7578063dca27135146109ea57600080fd5b8063c87b56dd1461092d578063cb8e757e14610940578063cd69fe6114610953578063d23b320b1461096657600080fd5b80639a50248d116101c9578063af90b1121161018d578063af90b112146108d0578063b88d4fde146108e3578063b9d32845146108f6578063c053f6b814610909578063c2a6fe3b1461091a57600080fd5b80639a50248d14610864578063a22cb46514610884578063a48047ba14610897578063a6e6178d146108aa578063a7ccb4bf146108bd57600080fd5b806393f057e51161021057806393f057e51461081057806395d89b411461082357806395d9fa7d1461082b5780639864c3071461083e5780639a4dec181461085157600080fd5b8063867884e6146107c45780638734bbfc146107d75780638b4ca06a146107ea57806392f7070b146107fd57600080fd5b806331b9d08c116103525780634f6ccce7116102da57806369492c971161029e57806369492c97146107585780636bf55d5f1461076b57806370a082311461078b57806374f345cf1461079e5780637d46a713146107b157600080fd5b80634f6ccce7146106f95780635a936d101461070c5780635fb881831461071f578063628b644a146107325780636352211e1461074557600080fd5b806340ad34d81161032157806340ad34d81461069a57806342842e0e146106ad57806342966c68146106c057806344b82a24146106d357806347f94de7146106e657600080fd5b806331b9d08c14610635578063327b2a031461066157806333f06ee614610674578063388f50831461068757600080fd5b80630ff98244116103e05780632209d145116103a45780632209d1451461059d57806323b872dd146105d357806329c301c2146105e65780632abc6bf6146105f95780632f745c591461062257600080fd5b80630ff982441461054b5780631316529d1461055e578063144a3e831461056f57806318160ddd14610582578063188b04b31461058a57600080fd5b8063081812fc11610427578063081812fc146104ea57806308cb68ff146104fd578063095ea7b3146105125780630c4dd5f2146105255780630d18d07a1461053857600080fd5b806301ffc9a71461045957806304f3bcec1461048157806305f63c8a146104ac57806306fdde03146104d5575b600080fd5b61046c610467366004614788565b610afa565b60405190151581526020015b60405180910390f35b601754610494906001600160a01b031681565b6040516001600160a01b039091168152602001610478565b6104946104ba3660046147a5565b6000908152601660205260409020546001600160a01b031690565b6104dd610b25565b6040516104789190614816565b6104946104f83660046147a5565b610bb7565b61051061050b366004614841565b610c51565b005b61051061052036600461489a565b610cea565b610510610533366004614841565b610e00565b6105106105463660046148c6565b610e65565b6105106105593660046148f6565b610e7c565b60045b604051908152602001610478565b6104dd61057d3660046147a5565b610f7b565b600854610561565b610510610598366004614924565b610f86565b6104946105ab36600461489a565b6001600160a01b03918216600090815260106020908152604080832093835292905220541690565b6105106105e1366004614958565b611083565b6105616105f43660046149ab565b6110b4565b6105616106073660046149df565b6001600160a01b03166000908152600c602052604090205490565b61056161063036600461489a565b611160565b6104946106433660046149df565b6001600160a01b039081166000908152601160205260409020541690565b61056161066f366004614a0e565b6111f6565b610510610682366004614aa4565b6113b9565b610510610695366004614924565b61142d565b6105106106a8366004614aef565b611480565b6105106106bb366004614958565b6114fa565b6105106106ce3660046147a5565b611515565b6105616106e1366004614b0b565b6115ae565b6105106106f4366004614aa4565b611624565b6105616107073660046147a5565b611664565b61051061071a3660046148f6565b6116f7565b61051061072d366004614924565b611787565b610510610740366004614b4f565b6117da565b6104946107533660046147a5565b611866565b610510610766366004614924565b6118dd565b61077e6107793660046147a5565b611a15565b6040516104789190614ba1565b6105616107993660046149df565b611a2f565b6105106107ac366004614bee565b611ab6565b6105106107bf3660046148c6565b611b2e565b6105106107d2366004614aef565b611b41565b61046c6107e53660046147a5565b611bb1565b6105616107f83660046147a5565b611bdf565b61056161080b366004614c10565b611c4b565b61051061081e3660046148f6565b611cdf565b6104dd611d4e565b6105106108393660046148c6565b611d5d565b61051061084c366004614924565b611de3565b61056161085f366004614a0e565b611e36565b610877610872366004614c56565b611f3e565b6040516104789190614c97565b610510610892366004614d23565b6120ed565b61046c6108a53660046148c6565b6120f8565b6105106108b8366004614aa4565b612143565b6105616108cb366004614924565b6121b9565b6105616108de366004614b0b565b61225d565b6105106108f1366004614e3a565b61229b565b610510610904366004614eb7565b6122d3565b6013546001600160a01b0316610494565b610510610928366004614bee565b6123a2565b6104dd61093b3660046147a5565b612412565b61051061094e366004614eb7565b6124b7565b610510610961366004614eb7565b612527565b610510610974366004614924565b61253b565b610561610987366004614bee565b6000918252600d6020908152604080842092845291905290205490565b6108776109b23660046147a5565b6125b5565b6109ca6109c5366004614bee565b61273c565b6040516104789190614eeb565b6105106109e5366004614924565b61289d565b6104dd6109f83660046147a5565b6128e7565b610510610a0b366004614f81565b612959565b610510610a1e3660046148c6565b612b0e565b61046c610a3136600461503b565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6104dd610a6d3660046147a5565b612b21565b610510610a80366004614841565b612b41565b610510610a933660046147a5565b612bb0565b610561610aa6366004615069565b612bff565b610510610ab93660046148f6565b612d5b565b610510610acc366004614841565b612d95565b610494610adf3660046147a5565b6000908152600f60205260409020546001600160a01b031690565b60006001600160e01b0319821663780e9d6360e01b1480610b1f5750610b1f82612e0e565b92915050565b606060008054610b34906150c4565b80601f0160208091040260200160405190810160405280929190818152602001828054610b60906150c4565b8015610bad5780601f10610b8257610100808354040283529160200191610bad565b820191906000526020600020905b815481529060010190602001808311610b9057829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610c355760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b73fcee9b25df684e8681df3a9d0679bc6182a8038263dfc34f25610c7860208401846149df565b610c8860408501602086016149df565b610c9560408601866150f9565b60116040518663ffffffff1660e01b8152600401610cb7959493929190615168565b60006040518083038186803b158015610ccf57600080fd5b505af4158015610ce3573d6000803e3d6000fd5b5050505050565b6000610cf582611866565b9050806001600160a01b0316836001600160a01b03161415610d635760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c2c565b336001600160a01b0382161480610d7f5750610d7f8133610a31565b610df15760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610c2c565b610dfb8383612e5e565b505050565b610e0a8135612ecc565b73fcee9b25df684e8681df3a9d0679bc6182a80382636252159e8235610e3660408501602086016149df565b610e4360408601866150f9565b600f6040518663ffffffff1660e01b8152600401610cb79594939291906151a7565b610e6e82612f8c565b610e78828261300d565b5050565b610e86813561306e565b6040516331a9108f60e11b81528135600482015273db64ee50f4662c1a131a3e1b72a10756d899860990633019fadd9083903090636352211e90602401602060405180830381865afa158015610ee0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0491906151d2565b60135485356000908152600d60209081526040808320818a0135845282529182902054825160e088901b6001600160e01b031916815286356004820152918601356024830152949091013560448201526001600160a01b0392831660648201529116608482015260a481019190915260c401610cb7565b6060610b1f82612412565b610f90813561306e565b610f9d816020013561313c565b73db64ee50f4662c1a131a3e1b72a10756d899860963957f8a98823560208401356040850135610fd060608701876150f9565b6040516331a9108f60e11b8152883560048201523090636352211e90602401602060405180830381865afa15801561100c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103091906151d2565b6013546020808b01356000908152600a9091526040908190206005015490516001600160e01b031960e08b901b168152610cb7989796959493926001600160a01b03908116921690600d906004016151ef565b61108d3382613195565b6110a95760405162461bcd60e51b8152600401610c2c90615249565b610dfb83838361328c565b60006110c0823561306e565b81356000908152600a60205260408120600301805482906110e0906152b0565b91829055506040516342a34a5360e01b815290915073806130029c792b1d99e6b58afb9e0fda93d16595906342a34a539061112990869085906000908190600e906004016153d5565b60006040518083038186803b15801561114157600080fd5b505af4158015611155573d6000803e3d6000fd5b509295945050505050565b600061116b83611a2f565b82106111cd5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c2c565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6000611202833561306e565b61121c61121260208401846149df565b8360200135613433565b6013546545524337323160d01b906000906001600160a01b0316632ea24efc8261124960208801886149df565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152602087013560448201526064016020604051808303816000875af115801561129f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c3919061541a565b85356000908152600a602052604081206003018054929350909182906112e8906152b0565b9182905550905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a538783868661131a60208c018c6149df565b8b6020013560405160200161134d92919060609290921b6bffffffffffffffffffffffff19168252601482015260340190565b604051602081830303815290604052600e6040518763ffffffff1660e01b815260040161137f96959493929190615433565b60006040518083038186803b15801561139757600080fd5b505af41580156113ab573d6000803e3d6000fd5b509298975050505050505050565b6113c283612ecc565b601354604051633c17845760e11b81526001600160a01b039091169063782f08ae906113f69086908690869060040161547e565b600060405180830381600087803b15801561141057600080fd5b505af1158015611424573d6000803e3d6000fd5b50505050505050565b611437813561306e565b60135460405163e4bb4f2360e01b815273db64ee50f4662c1a131a3e1b72a10756d89986099163e4bb4f2391610cb79185916001600160a01b0390911690600d90600401615498565b61148a813561306e565b60135460408051635cebf08d60e11b81528335600482015260208401356024820152908301356044820152606083013560648201526001600160a01b039091166084820152600d60a482015273db64ee50f4662c1a131a3e1b72a10756d89986099063b9d7e11a9060c401610cb7565b610dfb8383836040518060200160405280600081525061229b565b6000818152600a602052604080822090516115339160010190615506565b60408051918290039091206000818152600b6020908152838220829055858252600a90529182208281559092509061156e60018301826145e3565b61157c6002830160006145e3565b50600060038201556004810180546001600160a01b0319908116909155600590910180549091169055610e78826134e3565b60006115ba833561306e565b82356000908152600a60205260408120600301805467131a5b9adb1a5cdd60c21b928592909182906115eb906152b0565b919050819055905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a53878386868a60405160200161134d91815260200190565b610dfb8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061354292505050565b600061166f60085490565b82106116d25760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610c2c565b600882815481106116e5576116e56155a2565b90600052602060002001549050919050565b611701813561306e565b60135481356000818152600d60209081526040808320818701358085529083529281902054905163d862986560e01b8152600481019490945290850135602484015260448301919091526001600160a01b039092166064820152608481019190915273db64ee50f4662c1a131a3e1b72a10756d89986099063d86298659060a401610cb7565b611791813561306e565b6013546040516332f107bf60e01b815273db64ee50f4662c1a131a3e1b72a10756d8998609916332f107bf91610cb79185916001600160a01b0390911690600d906004016155b8565b6117e38461306e565b6117ed84846135a1565b6040516001626802bf60e01b0319815273806130029c792b1d99e6b58afb9e0fda93d165959063ff97fd4190611830908790879087908790600e90600401615635565b60006040518083038186803b15801561184857600080fd5b505af415801561185c573d6000803e3d6000fd5b5050505050505050565b6000818152600260205260408120546001600160a01b031680610b1f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c2c565b6118ea60208201826149df565b6040516331a9108f60e11b8152602083013560048201526001600160a01b039190911690636352211e90602401602060405180830381865afa158015611934573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195891906151d2565b6001600160a01b0316336001600160a01b0316146119a95760405162461bcd60e51b815260206004820152600e60248201526d2737ba22a9219b9918a7bbb732b960911b6044820152606401610c2c565b73fcee9b25df684e8681df3a9d0679bc6182a8038263384afeb36119d060208401846149df565b60208401356119e560608601604087016149df565b6119f260608701876150f9565b60106040518763ffffffff1660e01b8152600401610cb796959493929190615655565b6000818152601860205260409020606090610b1f90613656565b60006001600160a01b038216611a9a5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c2c565b506001600160a01b031660009081526003602052604090205490565b611abf8261306e565b611ac982826135a1565b6000828152600e60209081526040808320848452825291829020600501805460ff60a81b1916600160a81b179055905182815283917f036469f3e73c83520cdefa197d7a9c854c2f8bc0164b82e9f2bd4aa7e150fd3091015b60405180910390a25050565b611b3782612f8c565b610e78828261366a565b611b4b813561306e565b60135481356000908152600d6020908152604080832060608601358452909152908190205490516317e9a8b160e31b815273db64ee50f4662c1a131a3e1b72a10756d89986099263bf4d458892610cb79286926001600160a01b0316919060040161569c565b600080611bbd83611866565b6001600160a01b03166000908152600c60205260409020549290921492915050565b60135460405162fba02760e01b8152600481018390526000916001600160a01b03169062fba02790602401602060405180830381865afa158015611c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1f919061541a565b6000611c57833561306e565b82356000908152600a602052604081206003018054664164647265737360c81b926001600160a01b0386169290918290611c90906152b0565b919050819055905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a53878386868a60405160200161134d919060609190911b6bffffffffffffffffffffffff1916815260140190565b611ce9813561306e565b60135481356000908152600d6020908152604080832081860135845290915290819020549051633d7f9b3d60e11b815273db64ee50f4662c1a131a3e1b72a10756d899860992637aff367a92610cb79286926001600160a01b031691906004016156ee565b606060018054610b34906150c4565b611d6682612f8c565b6040516384b44a2f60e01b8152600481018390526001600160a01b0382166024820152600a604482015273eac7109f5a475b857547724239dda8bc50cfde67906384b44a2f9060640160006040518083038186803b158015611dc757600080fd5b505af4158015611ddb573d6000803e3d6000fd5b505050505050565b611ded813561306e565b601354604051635fe5df1d60e11b815273db64ee50f4662c1a131a3e1b72a10756d89986099163bfcbbe3a91610cb79185916001600160a01b0390911690600d90600401615736565b6000611e42833561306e565b601354604051635cb46be760e01b81526000600482018190528435602483015260208501356044830152634e6f746560e01b9290916001600160a01b0390911690635cb46be7906064016020604051808303816000875af1158015611eab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ecf919061541a565b85356000908152600a60205260408120600301805492935090918290611ef4906152b0565b919050819055905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a53878386868a600001358b6020013560405160200161134d929190918252602082015260400190565b611f4661461d565b60008383604051611f58929190615796565b604080519182900382206000818152600b602090815283822054808352600a82529184902060c0860190945283548552600184018054939650919493929084019190611fa3906150c4565b80601f0160208091040260200160405190810160405280929190818152602001828054611fcf906150c4565b801561201c5780601f10611ff15761010080835404028352916020019161201c565b820191906000526020600020905b815481529060010190602001808311611fff57829003601f168201915b50505050508152602001600282018054612035906150c4565b80601f0160208091040260200160405190810160405280929190818152602001828054612061906150c4565b80156120ae5780601f10612083576101008083540402835291602001916120ae565b820191906000526020600020905b81548152906001019060200180831161209157829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b03908116604083015260059092015490911660609091015295945050505050565b610e783383836136bf565b600082815260166020908152604080832054601890925282206001600160a01b0384811692169190911490829061212f908561378e565b9050818061213a5750805b95945050505050565b61214c83612f8c565b60405163130f361d60e01b815273eac7109f5a475b857547724239dda8bc50cfde679063130f361d9061218d90869086908690600b90600a906004016157a6565b60006040518083038186803b1580156121a557600080fd5b505af4158015611424573d6000803e3d6000fd5b60006121ca823560208401356135a1565b73806130029c792b1d99e6b58afb9e0fda93d16595635be69415833560208501356121fb60608701604088016149df565b61220860608801886150f9565b6014546040516001600160e01b031960e089901b1681526122409695949392916001600160a01b031690600a90600e906004016157d4565b602060405180830381865af4158015611c27573d6000803e3d6000fd5b6000612269833561306e565b82356000908152600a6020526040812060030180546821b430b930b1ba32b960b91b928592909182906115eb906152b0565b6122a53383613195565b6122c15760405162461bcd60e51b8152600401610c2c90615249565b6122cd848484846137b0565b50505050565b6122dd813561306e565b6122ef816020013582604001356135a1565b6040516331a9108f60e11b81528135600482015273db64ee50f4662c1a131a3e1b72a10756d89986099063018212d19083903090636352211e90602401602060405180830381865afa158015612349573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236d91906151d2565b6013546040516001600160e01b031960e086901b168152610cb79392916001600160a01b031690600e90600d90600401615822565b6123ab82612f8c565b6123b582826135a1565b6000828152600e60209081526040808320848452825291829020600501805460ff60a01b1916600160a01b179055905182815283917f4f1db9708b537c1d26a7af4b235fd079bf2342d92a276e27eb6c8717e8bbcf939101611b22565b6000818152600a60205260409020600201805460609190612432906150c4565b80601f016020809104026020016040519081016040528092919081815260200182805461245e906150c4565b80156124ab5780601f10612480576101008083540402835291602001916124ab565b820191906000526020600020905b81548152906001019060200180831161248e57829003601f168201915b50505050509050919050565b6124c1813561306e565b6124de6124d460408301602084016149df565b8260400135613433565b601354604051638f3334ff60e01b815273db64ee50f4662c1a131a3e1b72a10756d899860991638f3334ff91610cb79185916001600160a01b0390911690600d906004016158a1565b61253861253382615904565b6137e3565b50565b612545813561306e565b612554813560208301356135a1565b73fcee9b25df684e8681df3a9d0679bc6182a803826320828a028235602084013561258560608601604087016149df565b61259260608701876150f9565b600e6040518763ffffffff1660e01b8152600401610cb7969594939291906159b7565b6125bd61461d565b600a60008381526020019081526020016000206040518060c0016040529081600082015481526020016001820180546125f5906150c4565b80601f0160208091040260200160405190810160405280929190818152602001828054612621906150c4565b801561266e5780601f106126435761010080835404028352916020019161266e565b820191906000526020600020905b81548152906001019060200180831161265157829003601f168201915b50505050508152602001600282018054612687906150c4565b80601f01602080910402602001604051908101604052809291908181526020018280546126b3906150c4565b80156127005780601f106126d557610100808354040283529160200191612700565b820191906000526020600020905b8154815290600101906020018083116126e357829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b03908116604083015260059092015490911660609091015292915050565b60408051610100808201835260008083526020808401829052606084860181905284018290526080840182905260a0840182905260c0840182905260e08401829052868252600e815284822086835281529084902084519283018552805483526001810154918301919091526002810180549394929391928401916127c0906150c4565b80601f01602080910402602001604051908101604052809291908181526020018280546127ec906150c4565b80156128395780601f1061280e57610100808354040283529160200191612839565b820191906000526020600020905b81548152906001019060200180831161281c57829003601f168201915b505050918352505060038201546001600160a01b039081166020830152600483015481166040830152600590920154918216606082015260ff600160a01b8304811615156080830152600160a81b909204909116151560a090910152905092915050565b6128a7813561306e565b6128b6813560208301356135a1565b73fcee9b25df684e8681df3a9d0679bc6182a80382631f2ffb698235602084013561258560608601604087016149df565b601354604051632b05429560e21b8152600481018390526060916001600160a01b03169063ac150a5490602401600060405180830381865afa158015612931573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b1f91908101906159e5565b601454600160a81b900460ff161580801561298157506014546001600160a01b90910460ff16105b806129a25750303b1580156129a25750601454600160a01b900460ff166001145b612a055760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c2c565b6014805460ff60a01b1916600160a01b1790558015612a32576014805460ff60a81b1916600160a81b1790555b612a3e898989896138b8565b601380546001600160a01b03199081166001600160a01b0388811691909117909255601480548216878416179055601580548216868416179055601780549091169184169190911790556040514281527f400175a56dd3710794078f7b9dbe8296ac94c5a248dfd51bb22ed4ab9eaa9fbf9060200160405180910390a18015612b03576014805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b612b1782612f8c565b610e788282613909565b6000818152600a60205260409020600101805460609190612432906150c4565b612b4b813561306e565b60135481356000908152600d602090815260408083208186013584529091529081902054905163bf5c00c160e01b815273db64ee50f4662c1a131a3e1b72a10756d89986099263bf5c00c192610cb79286926001600160a01b03169190600401615a52565b612bb981612f8c565b336000818152600c602052604080822080549085905590519092839285927fce95332e6082aebeb8058a7b56d1a109f67d6550552ed04d36aca4a6acd4d7de9190a45050565b6000612c0b843561306e565b601354604051633610bf0960e11b815265416e7955726960d01b916000916001600160a01b0390911690636c217e1290612c4d9084908990899060040161547e565b6020604051808303816000875af1158015612c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c90919061541a565b86356000908152600a60205260408120600301805492935090918290612cb5906152b0565b919050819055905073806130029c792b1d99e6b58afb9e0fda93d165956342a34a53888386868b8b604051602001612cee929190615796565b604051602081830303815290604052600e6040518763ffffffff1660e01b8152600401612d2096959493929190615433565b60006040518083038186803b158015612d3857600080fd5b505af4158015612d4c573d6000803e3d6000fd5b50929998505050505050505050565b6125388135612d7060408401602085016149df565b836040013560405180604001604052806002815260200161060f60f31b815250613966565b612d9f813561306e565b73eac7109f5a475b857547724239dda8bc50cfde67631dc831338235612dcb60408501602086016149df565b612dd860408601866150f9565b86356000908152600a60205260409081902090516001600160e01b031960e088901b168152610cb79594939291906004016151a7565b60006001600160e01b031982166380ac58cd60e01b1480612e3f57506001600160e01b03198216635b5e139f60e01b145b80610b1f57506301ffc9a760e01b6001600160e01b0319831614610b1f565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612e9382611866565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6013546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e90602401602060405180830381865afa158015612f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f3991906151d2565b6001600160a01b0316336001600160a01b0316146125385760405162461bcd60e51b815260206004820152601060248201526f2737ba2634b735a634b9ba27bbb732b960811b6044820152606401610c2c565b6000612f9782611866565b9050336001600160a01b0382161480612fcd5750326001600160a01b038216148015612fcd57506015546001600160a01b031633145b610e785760405162461bcd60e51b81526020600482015260116024820152702737ba21b430b930b1ba32b927bbb732b960791b6044820152606401610c2c565b60008281526018602052604090206130259082613bec565b50806001600160a01b0316827faa9506a57073a80893a2d2fdd53f4bd49d281a8548f483ad230f2d5da7f6710c4260405161306291815260200190565b60405180910390a35050565b600061307982611866565b6000838152601860205260409020909150613094903361378e565b806130a75750336001600160a01b038216145b806130c857506000828152601660205260409020546001600160a01b031633145b806130f05750326001600160a01b0382161480156130f057506015546001600160a01b031633145b610e785760405162461bcd60e51b815260206004820152601c60248201527f4e6f744368617261637465724f776e65724e6f724f70657261746f72000000006044820152606401610c2c565b6000818152600260205260409020546001600160a01b03166125385760405162461bcd60e51b81526020600482015260126024820152714368617261637465724e6f7445786973747360701b6044820152606401610c2c565b6000818152600260205260408120546001600160a01b031661320e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c2c565b600061321983611866565b9050806001600160a01b0316846001600160a01b031614806132545750836001600160a01b031661324984610bb7565b6001600160a01b0316145b8061328457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661329f82611866565b6001600160a01b0316146133035760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610c2c565b6001600160a01b0382166133655760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c2c565b613370838383613c01565b61337b600082612e5e565b6001600160a01b03831660009081526003602052604081208054600192906133a4908490615aaa565b90915550506001600160a01b03821660009081526003602052604081208054600192906133d2908490615ac1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040516331a9108f60e11b8152600481018290526001600160a01b03831690636352211e90602401602060405180830381865afa158015613478573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061349c91906151d2565b6001600160a01b0316610e785760405162461bcd60e51b815260206004820152600f60248201526e5245433732314e6f7445786973747360881b6044820152606401610c2c565b6134ed3382613195565b6135395760405162461bcd60e51b815260206004820152601b60248201527f4e4654426173653a204e6f744f776e65724f72417070726f76656400000000006044820152606401610c2c565b61253881613c8a565b61354b8261306e565b6000828152600a60209081526040909120825161357092600290920191840190614665565b50817f17d7c9f69270ba135480ef16837f38b9d37d3ab291cbd3ba03982290c663199782604051611b229190614816565b6000828152600e60209081526040808320848452909152902060050154600160a01b900460ff16156136055760405162461bcd60e51b815260206004820152600d60248201526c139bdd19525cd1195b195d1959609a1b6044820152606401610c2c565b6000828152600a6020526040902060030154811115610e785760405162461bcd60e51b815260206004820152600d60248201526c4e6f74654e6f7445786973747360981b6044820152606401610c2c565b6060600061366383613d31565b9392505050565b60008281526018602052604090206136829082613d8c565b50806001600160a01b0316827f58f51b5bb567864de85c6a422b33491f2418924a44613d7b9341f58657bdd8334260405161306291815260200190565b816001600160a01b0316836001600160a01b031614156137215760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c2c565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b03811660009081526001830160205260408120541515613663565b6137bb84848461328c565b6137c784848484613da1565b6122cd5760405162461bcd60e51b8152600401610c2c90615ad9565b60006012600081546137f4906152b0565b918290555082519091506138089082613e9f565b604051632902741560e01b815273eac7109f5a475b857547724239dda8bc50cfde679063290274159061384a9085906001908690600b90600a90600401615b2b565b60006040518083038186803b15801561386257600080fd5b505af4158015613876573d6000803e3d6000fd5b505083516001600160a01b03166000908152600c602052604090205415159150610e7890505790516001600160a01b03166000908152600c6020526040902055565b6138c484848484613eb9565b7f414cd0b34676984f09a5f76ce9718d4062e50283abe0e7e274a9a5b4e0c99c3084848484426040516138fb959493929190615bd4565b60405180910390a150505050565b60008281526016602090815260409182902080546001600160a01b0319166001600160a01b038516908117909155915142815284917f691b92a93c526c4f5a357e56a33c33f6250f94e19e6c49be805800615c4149319101613062565b61396f84612f8c565b6001600160a01b0383166000908152600c6020526040902054156139eb5760405162461bcd60e51b815260206004820152602d60248201527f546172676574206164647265737320616c726561647920686173207072696d6160448201526c393c9031b430b930b1ba32b91760991b6064820152608401610c2c565b60006012600081546139fc906152b0565b91829055509050613a0d8482613e9f565b73eac7109f5a475b857547724239dda8bc50cfde6763290274156040518060a00160405280876001600160a01b03168152602001613a55886001600160a01b03166014613ed2565b815260200160405180602001604052806000815250815260200160006001600160a01b0316815260200160405180602001604052806000815250815250600084600b600a6040518663ffffffff1660e01b8152600401613ab9959493929190615b2b565b60006040518083038186803b158015613ad157600080fd5b505af4158015613ae5573d6000803e3d6000fd5b505050506001600160a01b0384166000908152600c602052604090819020829055516331a9108f60e11b81526004810186905273db64ee50f4662c1a131a3e1b72a10756d89986099063957f8a989087908490879087903090636352211e90602401602060405180830381865afa158015613b64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b8891906151d2565b6013546040516001600160e01b031960e089901b168152613bc09695949392916001600160a01b031690600090600d90600401615c0e565b60006040518083038186803b158015613bd857600080fd5b505af4158015612b03573d6000803e3d6000fd5b6000613663836001600160a01b03841661406d565b6000818152601860205260408120613c1890613656565b905060005b8151811015613c7e576000828281518110613c3a57613c3a6155a2565b60200260200101519050613c698160186000878152602001908152602001600020613bec90919063ffffffff16565b50508080613c76906152b0565b915050613c1d565b506122cd848484614160565b6000613c9582611866565b9050613ca381600084613c01565b613cae600083612e5e565b6001600160a01b0381166000908152600360205260408120805460019290613cd7908490615aaa565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6060816000018054806020026020016040519081016040528092919081815260200182805480156124ab57602002820191906000526020600020905b815481526020019060010190808311613d6d5750505050509050919050565b6000613663836001600160a01b0384166141cb565b60006001600160a01b0384163b15613e9457604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613de5903390899088908890600401615c66565b6020604051808303816000875af1925050508015613e20575060408051601f3d908101601f19168201909252613e1d91810190615ca3565b60015b613e7a573d808015613e4e576040519150601f19603f3d011682016040523d82523d6000602084013e613e53565b606091505b508051613e725760405162461bcd60e51b8152600401610c2c90615ad9565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613284565b506001949350505050565b610e7882826040518060200160405280600081525061421a565b613ec5600085856146e9565b50610ce3600183836146e9565b60606000613ee1836002615cc0565b613eec906002615ac1565b6001600160401b03811115613f0357613f03614d4f565b6040519080825280601f01601f191660200182016040528015613f2d576020820181803683370190505b509050600360fc1b81600081518110613f4857613f486155a2565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613f7757613f776155a2565b60200101906001600160f81b031916908160001a9053506000613f9b846002615cc0565b613fa6906001615ac1565b90505b600181111561401e576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613fda57613fda6155a2565b1a60f81b828281518110613ff057613ff06155a2565b60200101906001600160f81b031916908160001a90535060049490941c9361401781615cdf565b9050613fa9565b5083156136635760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c2c565b60008181526001830160205260408120548015614156576000614091600183615aaa565b85549091506000906140a590600190615aaa565b905081811461410a5760008660000182815481106140c5576140c56155a2565b90600052602060002001549050808760000184815481106140e8576140e86155a2565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061411b5761411b615cf6565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b1f565b6000915050610b1f565b6000818152601660205260409020546001600160a01b03161561418857614188816000613909565b6001600160a01b0383166000908152600c6020526040902054156141c0576001600160a01b0383166000908152600c60205260408120555b610dfb83838361424d565b600081815260018301602052604081205461421257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b1f565b506000610b1f565b6142248383614305565b6142316000848484613da1565b610dfb5760405162461bcd60e51b8152600401610c2c90615ad9565b6001600160a01b0383166142a8576142a381600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6142cb565b816001600160a01b0316836001600160a01b0316146142cb576142cb8382614453565b6001600160a01b0382166142e257610dfb816144f0565b826001600160a01b0316826001600160a01b031614610dfb57610dfb828261459f565b6001600160a01b03821661435b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c2c565b6000818152600260205260409020546001600160a01b0316156143c05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c2c565b6143cc60008383613c01565b6001600160a01b03821660009081526003602052604081208054600192906143f5908490615ac1565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000600161446084611a2f565b61446a9190615aaa565b6000838152600760205260409020549091508082146144bd576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061450290600190615aaa565b6000838152600960205260408120546008805493945090928490811061452a5761452a6155a2565b90600052602060002001549050806008838154811061454b5761454b6155a2565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061458357614583615cf6565b6001900381819060005260206000200160009055905550505050565b60006145aa83611a2f565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b5080546145ef906150c4565b6000825580601f106145ff575050565b601f016020900490600052602060002090810190612538919061475d565b6040518060c001604052806000815260200160608152602001606081526020016000815260200160006001600160a01b0316815260200160006001600160a01b031681525090565b828054614671906150c4565b90600052602060002090601f01602090048101928261469357600085556146d9565b82601f106146ac57805160ff19168380011785556146d9565b828001600101855582156146d9579182015b828111156146d95782518255916020019190600101906146be565b506146e592915061475d565b5090565b8280546146f5906150c4565b90600052602060002090601f01602090048101928261471757600085556146d9565b82601f106147305782800160ff198235161785556146d9565b828001600101855582156146d9579182015b828111156146d9578235825591602001919060010190614742565b5b808211156146e5576000815560010161475e565b6001600160e01b03198116811461253857600080fd5b60006020828403121561479a57600080fd5b813561366381614772565b6000602082840312156147b757600080fd5b5035919050565b60005b838110156147d95781810151838201526020016147c1565b838111156122cd5750506000910152565b600081518084526148028160208601602086016147be565b601f01601f19169290920160200192915050565b60208152600061366360208301846147ea565b60006060828403121561483b57600080fd5b50919050565b60006020828403121561485357600080fd5b81356001600160401b0381111561486957600080fd5b61328484828501614829565b6001600160a01b038116811461253857600080fd5b803561489581614875565b919050565b600080604083850312156148ad57600080fd5b82356148b881614875565b946020939093013593505050565b600080604083850312156148d957600080fd5b8235915060208301356148eb81614875565b809150509250929050565b60006060828403121561490857600080fd5b6136638383614829565b60006080828403121561483b57600080fd5b60006020828403121561493657600080fd5b81356001600160401b0381111561494c57600080fd5b61328484828501614912565b60008060006060848603121561496d57600080fd5b833561497881614875565b9250602084013561498881614875565b929592945050506040919091013590565b600060e0828403121561483b57600080fd5b6000602082840312156149bd57600080fd5b81356001600160401b038111156149d357600080fd5b61328484828501614999565b6000602082840312156149f157600080fd5b813561366381614875565b60006040828403121561483b57600080fd5b60008060608385031215614a2157600080fd5b82356001600160401b03811115614a3757600080fd5b614a4385828601614999565b925050614a5384602085016149fc565b90509250929050565b60008083601f840112614a6e57600080fd5b5081356001600160401b03811115614a8557600080fd5b602083019150836020828501011115614a9d57600080fd5b9250929050565b600080600060408486031215614ab957600080fd5b8335925060208401356001600160401b03811115614ad657600080fd5b614ae286828701614a5c565b9497909650939450505050565b600060808284031215614b0157600080fd5b6136638383614912565b60008060408385031215614b1e57600080fd5b82356001600160401b03811115614b3457600080fd5b614b4085828601614999565b95602094909401359450505050565b60008060008060608587031215614b6557600080fd5b843593506020850135925060408501356001600160401b03811115614b8957600080fd5b614b9587828801614a5c565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b81811015614be25783516001600160a01b031683529284019291840191600101614bbd565b50909695505050505050565b60008060408385031215614c0157600080fd5b50508035926020909101359150565b60008060408385031215614c2357600080fd5b82356001600160401b03811115614c3957600080fd5b614c4585828601614999565b92505060208301356148eb81614875565b60008060208385031215614c6957600080fd5b82356001600160401b03811115614c7f57600080fd5b614c8b85828601614a5c565b90969095509350505050565b60208152815160208201526000602083015160c06040840152614cbd60e08401826147ea565b90506040840151601f19848303016060850152614cda82826147ea565b91505060608401516080840152608084015160018060a01b0380821660a08601528060a08701511660c086015250508091505092915050565b8035801515811461489557600080fd5b60008060408385031215614d3657600080fd5b8235614d4181614875565b9150614a5360208401614d13565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b0381118282101715614d8757614d87614d4f565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614db557614db5614d4f565b604052919050565b60006001600160401b03821115614dd657614dd6614d4f565b50601f01601f191660200190565b600082601f830112614df557600080fd5b8135614e08614e0382614dbd565b614d8d565b818152846020838601011115614e1d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215614e5057600080fd5b8435614e5b81614875565b93506020850135614e6b81614875565b92506040850135915060608501356001600160401b03811115614e8d57600080fd5b614e9987828801614de4565b91505092959194509250565b600060a0828403121561483b57600080fd5b600060208284031215614ec957600080fd5b81356001600160401b03811115614edf57600080fd5b61328484828501614ea5565b60208152815160208201526020820151604082015260006040830151610100806060850152614f1e6101208501836147ea565b9150606085015160018060a01b0380821660808701528060808801511660a0870152505060a0850151614f5c60c08601826001600160a01b03169052565b5060c085015180151560e08601525060e0850151801515858301525090949350505050565b60008060008060008060008060c0898b031215614f9d57600080fd5b88356001600160401b0380821115614fb457600080fd5b614fc08c838d01614a5c565b909a50985060208b0135915080821115614fd957600080fd5b50614fe68b828c01614a5c565b9097509550506040890135614ffa81614875565b9350606089013561500a81614875565b9250608089013561501a81614875565b915060a089013561502a81614875565b809150509295985092959890939650565b6000806040838503121561504e57600080fd5b823561505981614875565b915060208301356148eb81614875565b60008060006040848603121561507e57600080fd5b83356001600160401b038082111561509557600080fd5b6150a187838801614999565b945060208601359150808211156150b757600080fd5b50614ae286828701614a5c565b600181811c908216806150d857607f821691505b6020821081141561483b57634e487b7160e01b600052602260045260246000fd5b6000808335601e1984360301811261511057600080fd5b8301803591506001600160401b0382111561512a57600080fd5b602001915036819003821315614a9d57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03868116825285166020820152608060408201819052600090615195908301858761513f565b90508260608301529695505050505050565b8581526001600160a01b0385166020820152608060408201819052600090615195908301858761513f565b6000602082840312156151e457600080fd5b815161366381614875565b60006101008b83528a6020840152896040840152806060840152615216818401898b61513f565b6001600160a01b03978816608085015295871660a084015250509190931660c082015260e0019190915295945050505050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60006000198214156152c4576152c461529a565b5060010190565b6000808335601e198436030181126152e257600080fd5b83016020810192503590506001600160401b0381111561530157600080fd5b803603831315614a9d57600080fd5b80358252600061532360208301836152cb565b60e0602086015261533860e08601828461513f565b915050604083013561534981614875565b6001600160a01b03818116604087015261536660608601866152cb565b9250868403606088015261537b84848361513f565b9350506080850135915061538e82614875565b1660808501526153a160a08401846152cb565b85830360a08701526153b483828461513f565b925050506153c460c08401614d13565b151560c08501528091505092915050565b60c0815260006153e860c0830188615310565b602083810197909752604083019590955250606081019290925281830360808301526000835260a09091015201919050565b60006020828403121561542c57600080fd5b5051919050565b60c08152600061544660c0830189615310565b876020840152866040840152856060840152828103608084015261546a81866147ea565b9150508260a0830152979650505050505050565b83815260406020820152600061213a60408301848661513f565b6060815283356060820152600060208501356154b381614875565b6001600160a01b038181166080850152604087013560a08501526154da60608801886152cb565b9250608060c08601526154f160e08601848361513f565b96909116602085015250505060400152919050565b600080835481600182811c91508083168061552257607f831692505b602080841082141561554257634e487b7160e01b86526022600452602486fd5b818015615556576001811461556757615594565b60ff19861689528489019650615594565b60008a81526020902060005b8681101561558c5781548b820152908501908301615573565b505084890196505b509498975050505050505050565b634e487b7160e01b600052603260045260246000fd5b606081528335606082015260006155d260208601866152cb565b6080808501526155e660e08501828461513f565b915050604086013560a084015261560060608701876152cb565b848303605f190160c086015261561783828461513f565b6001600160a01b039790971660208601525050505060400152919050565b85815284602082015260806040820152600061519560808301858761513f565b6001600160a01b038781168252602082018790528516604082015260a060608201819052600090615689908301858761513f565b9050826080830152979650505050505050565b8335815260c0810160208501356156b281614875565b6001600160a01b039081166020840152604086810135908401526060958601359583019590955292909316608084015260a09092019190915290565b8335815260a08101602085013561570481614875565b6001600160a01b0390811660208401526040958601359583019590955292909316606084015260809092019190915290565b606081528335606082015260208401356080820152604084013560a0820152600061576460608601866152cb565b608060c085015261577960e08501828461513f565b6001600160a01b0396909616602085015250505060400152919050565b8183823760009101908152919050565b8581526080602082015260006157c060808301868861513f565b604083019490945250606001529392505050565b888152876020820152600060018060a01b03808916604084015260e0606084015261580360e08401888a61513f565b951660808301525060a081019290925260c09091015295945050505050565b60a08152853560a0820152602086013560c0820152604086013560e08201526060860135610100820152600061585b60808801886152cb565b60a06101208501526158726101408501828461513f565b6001600160a01b0398891660208601529690971660408401525050606081019290925260809091015292915050565b6060815283356060820152600060208501356158bc81614875565b60018060a01b038082166080850152604087013560a0850152606087013560c08501526158ec60808801886152cb565b925060a060e08601526154f16101008601848361513f565b600060a0823603121561591657600080fd5b61591e614d65565b6159278361488a565b815260208301356001600160401b038082111561594357600080fd5b61594f36838701614de4565b6020840152604085013591508082111561596857600080fd5b61597436838701614de4565b60408401526159856060860161488a565b6060840152608085013591508082111561599e57600080fd5b506159ab36828601614de4565b60808301525092915050565b86815285602082015260018060a01b038516604082015260a06060820152600061568960a08301858761513f565b6000602082840312156159f757600080fd5b81516001600160401b03811115615a0d57600080fd5b8201601f81018413615a1e57600080fd5b8051615a2c614e0382614dbd565b818152856020838501011115615a4157600080fd5b61213a8260208301602086016147be565b60608152833560608201526000615a6c60208601866152cb565b60606080850152615a8160c08501828461513f565b60409788013560a08601526001600160a01b039690961660208501525050509092019190915290565b600082821015615abc57615abc61529a565b500390565b60008219821115615ad457615ad461529a565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60a08152600060018060a01b038088511660a0840152602088015160a060c0850152615b5b6101408501826147ea565b90506040890151609f19808684030160e0870152615b7983836147ea565b92508360608c01511661010087015260808b0151935080868403016101208701525050615ba681836147ea565b92505050615bb8602083018715159052565b8460408301528360608301528260808301529695505050505050565b606081526000615be860608301878961513f565b8281036020840152615bfb81868861513f565b9150508260408301529695505050505050565b60006101008a8352896020840152886040840152806060840152615c34818401896147ea565b6001600160a01b03978816608085015295871660a084015250509190931660c082015260e00191909152949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615c99908301846147ea565b9695505050505050565b600060208284031215615cb557600080fd5b815161366381614772565b6000816000190483118215151615615cda57615cda61529a565b500290565b600081615cee57615cee61529a565b506000190190565b634e487b7160e01b600052603160045260246000fdfea26469706673582212202006319048fa2d12cdc540d2970d3f8dcda12cbea38cb7e2950920dc6e838b2164736f6c634300080a0033