- Contract name:
- Linklist
- Optimization enabled
- true
- Compiler version
- v0.8.18+commit.87f61d96
- Optimization runs
- 200
- Verified at
- 2023-08-25T01:29:53.216951Z
contracts/Linklist.sol
// SPDX-License-Identifier: MIT // slither-disable-start unused-return pragma solidity 0.8.18; import {ILinklist} from "./interfaces/ILinklist.sol"; import {LinklistBase} from "./base/LinklistBase.sol"; import {ERC721} from "./base/ERC721.sol"; import {Events} from "./libraries/Events.sol"; import {DataTypes} from "./libraries/DataTypes.sol"; import { ErrCallerNotWeb3Entry, ErrCallerNotWeb3EntryOrNotOwner, ErrTokenNotExists } from "./libraries/Error.sol"; import {LinklistStorage} from "./storage/LinklistStorage.sol"; import {LinklistExtendStorage} from "./storage/LinklistExtendStorage.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; contract Linklist is ILinklist, LinklistBase, LinklistStorage, Initializable, LinklistExtendStorage { using EnumerableSet for EnumerableSet.UintSet; using EnumerableSet for EnumerableSet.Bytes32Set; using EnumerableSet for EnumerableSet.AddressSet; event Transfer(address indexed from, uint256 indexed characterId, uint256 indexed tokenId); event Burn(uint256 indexed from, uint256 indexed tokenId); event UriSet(uint256 indexed tokenId, string uri); event LinkTypeSet(uint256 indexed tokenId, bytes32 indexed newlinkType); modifier onlyWeb3Entry() { if (msg.sender != Web3Entry) revert ErrCallerNotWeb3Entry(); _; } modifier onlyExistingToken(uint256 tokenId) { if (0 == _linklistOwners[tokenId]) revert ErrTokenNotExists(); _; } /// @inheritdoc ILinklist function initialize( string calldata name_, string calldata symbol_, address web3Entry_ ) external override reinitializer(2) { Web3Entry = web3Entry_; // initialize totalSupply for upgrade _totalSupply = _tokenCount; super._initialize(name_, symbol_); emit Events.LinklistNFTInitialized(block.timestamp); } /// @inheritdoc ILinklist function mint( uint256 characterId, bytes32 linkType ) external override onlyWeb3Entry returns (uint256 tokenId) { tokenId = ++_tokenCount; _linkTypes[tokenId] = linkType; // mint tokenId to characterId _linklistOwners[tokenId] = characterId; _linklistBalances[characterId]++; // update totalSupply _totalSupply++; emit Transfer(address(0), characterId, tokenId); } /// @inheritdoc ILinklist function burn(uint256 tokenId) external override onlyWeb3Entry { uint256 characterId = _linklistOwners[tokenId]; if (characterId == 0) revert ErrTokenNotExists(); // Ownership check above ensures no underflow. unchecked { _linklistBalances[characterId]--; _totalSupply--; } delete _linkTypes[tokenId]; delete _linklistOwners[tokenId]; emit Burn(characterId, tokenId); } /// @inheritdoc ILinklist function setUri( uint256 tokenId, string memory uri ) external override onlyExistingToken(tokenId) { // caller must be web3Entry or owner if (msg.sender != Web3Entry && msg.sender != ownerOf(tokenId)) revert ErrCallerNotWeb3EntryOrNotOwner(); _uris[tokenId] = uri; emit UriSet(tokenId, uri); } /// @inheritdoc ILinklist function setLinkType( uint256 tokenId, bytes32 linkType ) external override onlyWeb3Entry onlyExistingToken(tokenId) { _linkTypes[tokenId] = linkType; emit LinkTypeSet(tokenId, linkType); } ///////////////////////////////// // linking Character ///////////////////////////////// /// @inheritdoc ILinklist function addLinkingCharacterId( uint256 tokenId, uint256 toCharacterId ) external override onlyWeb3Entry { _linkingCharacters[tokenId].add(toCharacterId); } /// @inheritdoc ILinklist function removeLinkingCharacterId( uint256 tokenId, uint256 toCharacterId ) external override onlyWeb3Entry { _linkingCharacters[tokenId].remove(toCharacterId); } ///////////////////////////////// // linking Note ///////////////////////////////// /// @inheritdoc ILinklist function addLinkingNote( uint256 tokenId, uint256 toCharacterId, uint256 toNoteId ) external override onlyWeb3Entry returns (bytes32) { bytes32 linkKey = keccak256(abi.encodePacked("Note", toCharacterId, toNoteId)); if (tokenId != 0) { _linkNoteKeys[tokenId].add(linkKey); } _linkNotes[linkKey] = DataTypes.NoteStruct({characterId: toCharacterId, noteId: toNoteId}); return linkKey; } /// @inheritdoc ILinklist function removeLinkingNote( uint256 tokenId, uint256 toCharacterId, uint256 toNoteId ) external override onlyWeb3Entry { bytes32 linkKey = keccak256(abi.encodePacked("Note", toCharacterId, toNoteId)); _linkNoteKeys[tokenId].remove(linkKey); // do note delete // delete linkNoteList[linkKey]; } ///////////////////////////////// // linking ERC721 ///////////////////////////////// /// @inheritdoc ILinklist function addLinkingERC721( uint256 tokenId, address tokenAddress, uint256 erc721TokenId ) external override onlyWeb3Entry returns (bytes32) { bytes32 linkKey = keccak256(abi.encodePacked("ERC721", tokenAddress, erc721TokenId)); if (tokenId != 0) { _linkingERC721Keys[tokenId].add(linkKey); } _linkingERC721s[linkKey] = DataTypes.ERC721Struct({ tokenAddress: tokenAddress, erc721TokenId: erc721TokenId }); return linkKey; } /// @inheritdoc ILinklist function removeLinkingERC721( uint256 tokenId, address tokenAddress, uint256 erc721TokenId ) external override onlyWeb3Entry { bytes32 linkKey = keccak256(abi.encodePacked("ERC721", tokenAddress, erc721TokenId)); _linkingERC721Keys[tokenId].remove(linkKey); // do not delete, maybe others link the same token // delete linkingERC721List[linkKey]; } ///////////////////////////////// // linking Address ///////////////////////////////// /// @inheritdoc ILinklist function addLinkingAddress( uint256 tokenId, address ethAddress ) external override onlyWeb3Entry { _linkingAddresses[tokenId].add(ethAddress); } /// @inheritdoc ILinklist function removeLinkingAddress( uint256 tokenId, address ethAddress ) external override onlyWeb3Entry { _linkingAddresses[tokenId].remove(ethAddress); } ///////////////////////////////// // linking Any Uri ///////////////////////////////// /// @inheritdoc ILinklist function addLinkingAnyUri( uint256 tokenId, string memory toUri ) external override onlyWeb3Entry returns (bytes32) { bytes32 linkKey = keccak256(abi.encodePacked("AnyUri", toUri)); if (tokenId != 0) { _linkingAnyKeys[tokenId].add(linkKey); } _linkingAnys[linkKey] = toUri; return linkKey; } /// @inheritdoc ILinklist function removeLinkingAnyUri( uint256 tokenId, string memory toUri ) external override onlyWeb3Entry { bytes32 linkKey = keccak256(abi.encodePacked("AnyUri", toUri)); _linkingAnyKeys[tokenId].remove(linkKey); // do note delete // delete linkingAnylist[linkKey]; } ///////////////////////////////// // linking Linklist ///////////////////////////////// /// @inheritdoc ILinklist function addLinkingLinklistId( uint256 tokenId, uint256 linklistId ) external override onlyWeb3Entry { _linkingLinklists[tokenId].add(linklistId); } /// @inheritdoc ILinklist function removeLinkingLinklistId( uint256 tokenId, uint256 linklistId ) external override onlyWeb3Entry { _linkingLinklists[tokenId].remove(linklistId); } /// @inheritdoc ILinklist function getLinkingCharacterIds( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256[] memory) { return _linkingCharacters[tokenId].values(); } /// @inheritdoc ILinklist function getLinkingCharacterListLength( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256) { return _linkingCharacters[tokenId].length(); } /// @inheritdoc ILinklist function getOwnerCharacterId( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256) { uint256 characterId = _linklistOwners[tokenId]; return characterId; } /// @inheritdoc ILinklist function getLinkingNotes( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (DataTypes.NoteStruct[] memory results) { bytes32[] memory linkKeys = _linkNoteKeys[tokenId].values(); results = new DataTypes.NoteStruct[](linkKeys.length); for (uint256 i = 0; i < linkKeys.length; i++) { bytes32 key = linkKeys[i]; results[i] = _linkNotes[key]; } } /// @inheritdoc ILinklist function getLinkingNote( bytes32 linkKey ) external view override returns (DataTypes.NoteStruct memory) { return _linkNotes[linkKey]; } /// @inheritdoc ILinklist function getLinkingNoteListLength( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256) { return _linkNoteKeys[tokenId].length(); } /// @inheritdoc ILinklist function getLinkingERC721s( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (DataTypes.ERC721Struct[] memory results) { bytes32[] memory linkKeys = _linkingERC721Keys[tokenId].values(); results = new DataTypes.ERC721Struct[](linkKeys.length); for (uint256 i = 0; i < linkKeys.length; i++) { bytes32 key = linkKeys[i]; results[i] = _linkingERC721s[key]; } } /// @inheritdoc ILinklist function getLinkingERC721( bytes32 linkKey ) external view override returns (DataTypes.ERC721Struct memory) { return _linkingERC721s[linkKey]; } /// @inheritdoc ILinklist function getLinkingERC721ListLength( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256) { return _linkingERC721Keys[tokenId].length(); } /// @inheritdoc ILinklist function getLinkingAddresses( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (address[] memory) { return _linkingAddresses[tokenId].values(); } /// @inheritdoc ILinklist function getLinkingAddressListLength( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256) { return _linkingAddresses[tokenId].length(); } /// @inheritdoc ILinklist function getLinkingAnyUris( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (string[] memory results) { bytes32[] memory linkKeys = _linkingAnyKeys[tokenId].values(); results = new string[](linkKeys.length); for (uint256 i = 0; i < linkKeys.length; i++) { bytes32 key = linkKeys[i]; results[i] = _linkingAnys[key]; } } /// @inheritdoc ILinklist function getLinkingAnyUri(bytes32 linkKey) external view override returns (string memory) { return _linkingAnys[linkKey]; } /// @inheritdoc ILinklist function getLinkingAnyUriKeys( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (bytes32[] memory) { return _linkingAnyKeys[tokenId].values(); } /// @inheritdoc ILinklist function getLinkingAnyListLength( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256) { return _linkingAnyKeys[tokenId].length(); } /// @inheritdoc ILinklist function getLinkingLinklistIds( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256[] memory) { return _linkingLinklists[tokenId].values(); } /// @inheritdoc ILinklist function getLinkingLinklistLength( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256) { return _linkingLinklists[tokenId].length(); } ///////////////////////////////// // common ///////////////////////////////// // solhint-disable-next-line no-empty-blocks function getCurrentTakeOver(uint256 tokenId) external view override returns (uint256) {} /// @inheritdoc ILinklist function getLinkType( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (bytes32) { return _linkTypes[tokenId]; } // slither-disable-start naming-convention // solhint-disable-next-line func-name-mixedcase function Uri( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (string memory) { return _uris[tokenId]; } // slither-disable-end naming-convention /// @inheritdoc ILinklist function characterOwnerOf( uint256 tokenId ) external view override onlyExistingToken(tokenId) returns (uint256) { return _linklistOwners[tokenId]; } /// @inheritdoc ILinklist function balanceOf(uint256 characterId) public view override returns (uint256) { return _linklistBalances[characterId]; } // slither-disable-next-line calls-loop function balanceOf(address account) public view override(ERC721) returns (uint256 balance) { uint256 characterCount = IERC721(Web3Entry).balanceOf(account); for (uint256 i = 0; i < characterCount; i++) { uint256 characterId = IERC721Enumerable(Web3Entry).tokenOfOwnerByIndex(account, i); balance += balanceOf(characterId); } } /// @inheritdoc ERC721 function ownerOf( uint256 tokenId ) public view override(ERC721) onlyExistingToken(tokenId) returns (address) { uint256 characterId = _linklistOwners[tokenId]; address owner = IERC721(Web3Entry).ownerOf(characterId); return owner; } /// @inheritdoc ILinklist function totalSupply() external view override returns (uint256) { return _totalSupply; } function _safeTransfer( address, address, uint256, bytes memory // solhint-disable-next-line no-empty-blocks ) internal pure override { // this function will do nothing, as linklist is a character bounded token // users should never transfer a linklist directly } function _transfer( address, address, uint256 // solhint-disable-next-line no-empty-blocks ) internal pure override { // this function will do nothing, as linklist is a character bounded token // users should never transfer a linklist directly } } // slither-disable-end unused-return
@openzeppelin/contracts/interfaces/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
@openzeppelin/contracts/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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] * ```solidity * 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. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ 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. * * 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. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * 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. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ 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. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
@openzeppelin/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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/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/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); }
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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); } } }
@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; } }
@openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _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) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _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); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
@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; } }
@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); }
@openzeppelin/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
@openzeppelin/contracts/utils/math/SignedMath.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
@openzeppelin/contracts/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. 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. * * ```solidity * 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) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // 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 in 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/base/ERC721.sol
// SPDX-License-Identifier: MIT // solhint-disable ordering pragma solidity 0.8.18; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {Context} from "@openzeppelin/contracts/utils/Context.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import {IERC165} from "@openzeppelin/contracts/interfaces/IERC165.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; // slither-disable-start naming-convention // solhint-disable-next-line func-name-mixedcase 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) public view virtual override 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 // solhint-disable private-vars-leading-underscore ) 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 // solhint-disable private-vars-leading-underscore ) 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 // solhint-disable private-vars-leading-underscore ) 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 */ // slither-disable-next-line unused-return function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data // solhint-disable private-vars-leading-underscore ) private returns (bool) { if (to.isContract()) { // slither-disable-start variable-scope 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 { /* solhint-disable no-inline-assembly */ assembly { revert(add(32, reason), mload(reason)) } /* solhint-enable no-inline-assembly */ } } // slither-disable-end variable-scope } 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]. */ // solhint-disable-next-line no-empty-blocks 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]. */ // solhint-disable-next-line no-empty-blocks function _afterTokenTransfer(address from, address to, uint256 tokenId) internal virtual {} // slither-disable-end naming-convention }
contracts/base/LinklistBase.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; import {ERC721} from "./ERC721.sol"; import {Events} from "../libraries/Events.sol"; abstract contract LinklistBase is ERC721 { /** * @dev For compatibility with previous ERC721Enumerable, we need to keep the unused slots for upgradeability. */ mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // unused slot 6 mapping(uint256 => uint256) private _ownedTokensIndex; // unused slot 7 uint256[] private _allTokens; // unused slot 8 mapping(uint256 => uint256) private _allTokensIndex; // unused slot 9 function _initialize(string calldata name, string calldata symbol) internal { ERC721.__ERC721_Init(name, symbol); emit Events.BaseInitialized(name, symbol, block.timestamp); } }
contracts/interfaces/ILinklist.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; import {DataTypes} from "../libraries/DataTypes.sol"; interface ILinklist { /** * @notice Initializes the contract. * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param web3Entry_ The address of the Web3Entry contract. */ function initialize( string calldata name_, string calldata symbol_, address web3Entry_ ) external; /** * @notice Mints a Linklist NFT to the specified character with linkType. * This can only be called by web3Entry. * @param characterId The character ID to mint to. * @param linkType The type of link. * @return tokenId The minted token ID. */ function mint(uint256 characterId, bytes32 linkType) external returns (uint256 tokenId); /** * @notice Burns a Linklist NFT. * @dev Only web3Entry can burn the Linklist NFT. * @param tokenId The token ID to burn. */ function burn(uint256 tokenId) external; /** * @notice Sets URI for a linklist. * @dev You can set any URI for your linklist, and the functionality of this URI * is undetermined and expandable. One scenario that comes to mind is setting a cover for your liked notes * or following list in your bookmarks. * @param tokenId The token ID to set URI. * @param uri The new URI to set. */ function setUri(uint256 tokenId, string memory uri) external; /** * @notice Sets the link type of the linklist NFT. * @param tokenId The token ID of linklist to set. * @param linkType The link type to set. */ function setLinkType(uint256 tokenId, bytes32 linkType) external; ///////////////////////////////// // linking Character ///////////////////////////////// /** * @notice Adds a linked character to a linklist. * @param tokenId The token ID of linklist. * @param toCharacterId The character ID to link. */ function addLinkingCharacterId(uint256 tokenId, uint256 toCharacterId) external; /** * @notice Removes a linked character from a linklist. * @param tokenId The token ID of linklist. * @param toCharacterId The character ID to remove. */ function removeLinkingCharacterId(uint256 tokenId, uint256 toCharacterId) external; ///////////////////////////////// // linking Note ///////////////////////////////// /** * @notice Adds a linked note to a linklist. * @param tokenId The token ID of linklist. * @param toCharacterId The character ID to link. * @param toNoteId The note ID to link. * @return linkKey The link key. */ function addLinkingNote( uint256 tokenId, uint256 toCharacterId, uint256 toNoteId ) external returns (bytes32); /** * @notice Removes a linked note from a linklist. * @param tokenId The token ID of linklist. * @param toCharacterId The character ID to remove. * @param toNoteId The note ID to remove. */ function removeLinkingNote(uint256 tokenId, uint256 toCharacterId, uint256 toNoteId) external; ///////////////////////////////// // linking ERC721 ///////////////////////////////// /** * @notice Adds a linked ERC721 to a linklist. * @param tokenId The token ID of linklist. * @param tokenAddress The address of ERC721 contract. * @param erc721TokenId The token ID of ERC721. * @return linkKey The link key of ERC721. */ function addLinkingERC721( uint256 tokenId, address tokenAddress, uint256 erc721TokenId ) external returns (bytes32); /** * @notice Removes a linked ERC721 from a linklist. * @param tokenId The token ID of linklist. * @param tokenAddress The address of ERC721 contract. * @param erc721TokenId The token ID of ERC721. */ function removeLinkingERC721( uint256 tokenId, address tokenAddress, uint256 erc721TokenId ) external; ///////////////////////////////// // linking Address ///////////////////////////////// /** * @notice Adds a linked address to a linklist. * @param tokenId The token ID of linklist. * @param ethAddress The address to link. */ function addLinkingAddress(uint256 tokenId, address ethAddress) external; /** * @notice Removes a linked address from a linklist. * @param tokenId The token ID of linklist. * @param ethAddress The address to remove. */ function removeLinkingAddress(uint256 tokenId, address ethAddress) external; ///////////////////////////////// // linking Any ///////////////////////////////// /** * @notice Adds a linked anyURI to a linklist. * @param tokenId The token ID of linklist. * @param toUri The anyURI to link. * @return linkKey The link key of anyURI. */ function addLinkingAnyUri(uint256 tokenId, string memory toUri) external returns (bytes32); /** * @notice Removes a linked anyURI from a linklist. * @param tokenId The token ID of linklist. * @param toUri The anyURI to remove. */ function removeLinkingAnyUri(uint256 tokenId, string memory toUri) external; ///////////////////////////////// // linking Linklist ///////////////////////////////// /** * @notice Adds a linked linklist to a linklist. * @param tokenId The token ID of linklist. * @param linklistId The linklist ID to link. */ function addLinkingLinklistId(uint256 tokenId, uint256 linklistId) external; /** * @notice Removes a linked linklist from a linklist. * @param tokenId The token ID of linklist. * @param linklistId The linklist ID to remove. */ function removeLinkingLinklistId(uint256 tokenId, uint256 linklistId) external; /** * @notice Returns the linked character IDs of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The linked character IDs. */ function getLinkingCharacterIds(uint256 tokenId) external view returns (uint256[] memory); /** * @notice Returns the length of linked character IDs of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The length of linked character IDs . */ function getLinkingCharacterListLength(uint256 tokenId) external view returns (uint256); /** * @notice Returns the character ID who owns the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The character ID who owns the linklist NFT. */ function getOwnerCharacterId(uint256 tokenId) external view returns (uint256); /** * @notice Returns the linked notes of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return results The linked notes. */ function getLinkingNotes( uint256 tokenId ) external view returns (DataTypes.NoteStruct[] memory results); /** * @notice Return the linked note of the linklist NFT by linkKey. * @param linkKey The link key of the note. * @return The linked note. */ function getLinkingNote(bytes32 linkKey) external view returns (DataTypes.NoteStruct memory); /** * @notice Returns the length of linked notes of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The length of linked notes. */ function getLinkingNoteListLength(uint256 tokenId) external view returns (uint256); /** * @notice Returns the linked ERC721s of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return results The linked ERC721s. */ function getLinkingERC721s( uint256 tokenId ) external view returns (DataTypes.ERC721Struct[] memory results); /** * @notice Return the linked ERC721 of the linklist NFT by linkKey. * @param linkKey The link key of the ERC721. * @return The linked ERC721. */ function getLinkingERC721( bytes32 linkKey ) external view returns (DataTypes.ERC721Struct memory); /** * @notice Returns the length of linked ERC721s of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The length of linked ERC721s. */ function getLinkingERC721ListLength(uint256 tokenId) external view returns (uint256); /** * @notice Returns the linked addresses of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The linked addresses. */ function getLinkingAddresses(uint256 tokenId) external view returns (address[] memory); /** * @notice Returns the linked address of the linklist NFT by linkKey. * @param tokenId The token ID of linklist to check. * @return The length of linked address. */ function getLinkingAddressListLength(uint256 tokenId) external view returns (uint256); /** * @notice Returns the linked anyURIs of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return results The linked anyURIs. */ function getLinkingAnyUris(uint256 tokenId) external view returns (string[] memory results); /** * @notice Return the linked anyURI of the linklist NFT by linkKey. * @param linkKey The link key of the anyURI. * @return The linked anyURI. */ function getLinkingAnyUri(bytes32 linkKey) external view returns (string memory); /** * @notice Returns the length of linked anyURIs of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The length of linked anyURIs. */ function getLinkingAnyUriKeys(uint256 tokenId) external view returns (bytes32[] memory); /** * @notice Returns the length of linked Uris of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The length of linked Uris. */ function getLinkingAnyListLength(uint256 tokenId) external view returns (uint256); /** * @notice Returns the linked linklists of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The linked linklists. */ function getLinkingLinklistIds(uint256 tokenId) external view returns (uint256[] memory); /** * @notice Return the length of linked linklist of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The length of linked linklist. */ function getLinkingLinklistLength(uint256 tokenId) external view returns (uint256); /** * @dev This function is deprecated.. */ function getCurrentTakeOver(uint256 tokenId) external view returns (uint256); /** * @notice Returns the link type of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The link type. */ function getLinkType(uint256 tokenId) external view returns (bytes32); /** * @notice Returns the URI of the linklist NFT. * @param tokenId The token ID of linklist to check. * @return The URI of the linklist NFT. */ // slither-disable-next-line naming-convention function Uri(uint256 tokenId) external view returns (string memory); // solhint-disable func-name-mixedcase /** * @notice Returns the character ID who owns the Linklist NFT. * @param tokenId The token ID to check. * @return The character ID. */ function characterOwnerOf(uint256 tokenId) external view returns (uint256); /** * @notice Returns the balance of the character. * @param characterId The character ID to check. * @return The balance of the character. */ function balanceOf(uint256 characterId) external view returns (uint256); /** * @notice Returns the total supply of the Linklist NFTs. * @return The total supply of the Linklist NFTs. */ function totalSupply() external view returns (uint256); }
contracts/libraries/DataTypes.sol
// SPDX-License-Identifier: MIT // solhint-disable contract-name-camelcase pragma solidity 0.8.18; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** * @title DataTypes * @notice A standard library of data types. */ 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; } /** * @dev A struct containing data associated with each new note. * @param linkItemType The link type of this note, if the note is a note with link. * @param linkKey If linkKey is not empty, it is a note with link(eg.a comment to a character or a note). * @param contentURI The URI associated with this note. * @param linkModule The address of the current link module of this note, can be empty. * @param mintModule The address of the current mint module of this note, can be empty. * @param mintNFT The address of the mintNFT associated with this note, if any. * @param deleted Whether the note is deleted. * @param locked Whether the note is locked. If the note is locked, its owner can't set not uri anymore. */ struct Note { bytes32 linkItemType; bytes32 linkKey; 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; } /** @param blocklist The list of blocklist addresses. @param allowlist The list of allowlist addresses. */ struct Operators4Note { EnumerableSet.AddressSet blocklist; EnumerableSet.AddressSet allowlist; } /** * @dev A struct containing the necessary information to reconstruct an EIP-712 typed data signature. * @param v The signature's recovery parameter. * @param r The signature's r parameter. * @param s The signature's s parameter * @param deadline The signature's deadline. */ struct EIP712Signature { uint8 v; bytes32 r; bytes32 s; uint256 deadline; } }
contracts/libraries/Error.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; /// @dev Character ID not exists error ErrCharacterNotExists(uint256 characterId); /// @dev Not owner of address error ErrNotAddressOwner(); /// @dev Caller is not the owner of character error ErrNotCharacterOwner(); /// @dev Note has been locked error ErrNoteLocked(); /// @dev Handle does not exist error ErrHandleExists(); /// @dev Social token address does not exist error ErrSocialTokenExists(); /// @dev Handle length too long or too short error ErrHandleLengthInvalid(); /// @dev Handle contains invalid characters error ErrHandleContainsInvalidCharacters(); /// @dev Operator has not enough permission for this character error ErrNotEnoughPermission(); /// @dev Operator has not enough permissions for this note error ErrNotEnoughPermissionForThisNote(); /// @dev Target address already has primary character error ErrTargetAlreadyHasPrimaryCharacter(); /// @dev Note has been deleted error ErrNoteIsDeleted(); /// @dev Note does not exist error ErrNoteNotExists(); /// @dev Array length mismatch error ErrArrayLengthMismatch(); /// @dev Caller is not web3Entry contract error ErrCallerNotWeb3Entry(); /// @dev Caller is not web3Entry contract, and not the owner of character error ErrCallerNotWeb3EntryOrNotOwner(); /// @dev Token id already exists error ErrTokenIdAlreadyExists(); /// @dev Character does not exist error ErrNotExistingCharacter(); /// @dev Token id of linklist does not exist error ErrNotExistingLinklistToken(); /// @dev Invalid web3Entry address error ErrInvalidWeb3Entry(); /// @dev Not approved by module or exceed the approval amount error ErrNotApprovedOrExceedApproval(); /// @dev Exceed max supply error ErrExceedMaxSupply(); /// @dev Exceed the approval amount error ErrExceedApproval(); /// @dev Signature is expired error ErrSignatureExpired(); /// @dev Signature is invalid error ErrSignatureInvalid(); /// @dev Caller not owner error ErrNotOwner(); /// @dev Token not exists error ErrTokenNotExists(); /// @dev LinkType already exists error ErrLinkTypeExists(uint256 characterId, bytes32 linkType);
contracts/libraries/Events.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.18; 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 GrantOperatorPermissions( uint256 indexed characterId, address indexed operator, uint256 permissionBitMap ); event GrantOperators4Note( uint256 indexed characterId, uint256 indexed noteId, address[] blocklist, address[] allowlist ); 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 linkModuleInitData, bytes returnData ); event SetLinkModule4Note( uint256 indexed characterId, uint256 indexed noteId, address indexed linkModule, bytes linkModuleInitData, bytes returnData ); event SetLinkModule4Address( address indexed account, address indexed linkModule, bytes linkModuleInitData, bytes returnData ); event SetLinkModule4ERC721( address indexed tokenAddress, uint256 indexed tokenId, address indexed linkModule, bytes linkModuleInitData, bytes returnData ); event SetLinkModule4Linklist( uint256 indexed linklistId, address indexed linkModule, bytes linkModuleInitData, bytes returnData ); event SetMintModule4Note( uint256 indexed characterId, uint256 indexed noteId, address indexed mintModule, bytes mintModuleInitData, bytes returnData ); event AttachLinklist( uint256 indexed linklistId, uint256 indexed characterId, bytes32 indexed linkType ); event DetachLinklist( uint256 indexed linklistId, uint256 indexed characterId, bytes32 indexed linkType ); event SetApprovedMintAmount4Addresses( uint256 indexed characterId, uint256 indexed noteId, uint256 indexed amount, address[] approvedAddresses ); }
contracts/storage/LinklistExtendStorage.sol
// SPDX-License-Identifier: MIT // slither-disable-start naming-convention pragma solidity 0.8.18; contract LinklistExtendStorage { uint256 internal _tokenCount; mapping(uint256 tokenId => uint256 characterId) internal _linklistOwners; mapping(uint256 characterId => uint256 balances) internal _linklistBalances; uint256 internal _totalSupply; } // slither-disable-end naming-convention
contracts/storage/LinklistStorage.sol
// SPDX-License-Identifier: MIT // solhint-disable max-states-count // slither-disable-start naming-convention pragma solidity 0.8.18; import {DataTypes} from "../libraries/DataTypes.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; contract LinklistStorage { using EnumerableSet for EnumerableSet.UintSet; using EnumerableSet for EnumerableSet.Bytes32Set; using EnumerableSet for EnumerableSet.AddressSet; // solhint-disable var-name-mixedcase address public Web3Entry; // slot 10 // tokenId => linkType mapping(uint256 => bytes32) internal _linkTypes; // tokenId => characterIds mapping(uint256 => EnumerableSet.UintSet) internal _linkingCharacters; // tokenId => external addresses mapping(uint256 => EnumerableSet.AddressSet) internal _linkingAddresses; // tokenId => LinklistId mapping(uint256 => EnumerableSet.UintSet) internal _linkingLinklists; // tokenId => linkKeys // slither-disable-next-line unused-state mapping(uint256 => EnumerableSet.Bytes32Set) internal _linkKeys; // unused slot // linkKey => linking ERC721 mapping(bytes32 => DataTypes.ERC721Struct) internal _linkingERC721s; // linkKey => linking Note mapping(bytes32 => DataTypes.NoteStruct) internal _linkNotes; // linkKey => linking CharacterLink mapping(bytes32 => DataTypes.CharacterLinkStruct) internal _linkingCharacterLinks; // linkKey => linking Any string mapping(bytes32 => string) internal _linkingAnys; // tokenId => characterId // slither-disable-next-line unused-state mapping(uint256 => uint256) internal _currentTakeOver; //unused slot mapping(uint256 => string) internal _uris; // tokenId => tokenURI // linkKey sets // tokenId => linkKeys mapping(uint256 => EnumerableSet.Bytes32Set) internal _linkingERC721Keys; mapping(uint256 => EnumerableSet.Bytes32Set) internal _linkNoteKeys; mapping(uint256 => EnumerableSet.Bytes32Set) internal _linkingCharacterLinkKeys; mapping(uint256 => EnumerableSet.Bytes32Set) internal _linkingAnyKeys; } // slither-disable-end naming-convention
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"error","name":"ErrCallerNotWeb3Entry","inputs":[]},{"type":"error","name":"ErrCallerNotWeb3EntryOrNotOwner","inputs":[]},{"type":"error","name":"ErrTokenNotExists","inputs":[]},{"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":"Burn","inputs":[{"type":"uint256","name":"from","internalType":"uint256","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"LinkTypeSet","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"bytes32","name":"newlinkType","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"uint256","name":"characterId","internalType":"uint256","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true}],"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":"event","name":"UriSet","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"string","name":"uri","internalType":"string","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"Uri","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"Web3Entry","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addLinkingAddress","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"ethAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"addLinkingAnyUri","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"toUri","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addLinkingCharacterId","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"toCharacterId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"addLinkingERC721","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"erc721TokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addLinkingLinklistId","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"linklistId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"addLinkingNote","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"toCharacterId","internalType":"uint256"},{"type":"uint256","name":"toNoteId","internalType":"uint256"}]},{"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":"balance","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"characterOwnerOf","inputs":[{"type":"uint256","name":"tokenId","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":"uint256","name":"","internalType":"uint256"}],"name":"getCurrentTakeOver","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getLinkType","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLinkingAddressListLength","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getLinkingAddresses","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLinkingAnyListLength","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getLinkingAnyUri","inputs":[{"type":"bytes32","name":"linkKey","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"}],"name":"getLinkingAnyUriKeys","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string[]","name":"results","internalType":"string[]"}],"name":"getLinkingAnyUris","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getLinkingCharacterIds","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLinkingCharacterListLength","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct DataTypes.ERC721Struct","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"erc721TokenId","internalType":"uint256"}]}],"name":"getLinkingERC721","inputs":[{"type":"bytes32","name":"linkKey","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLinkingERC721ListLength","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"results","internalType":"struct DataTypes.ERC721Struct[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"erc721TokenId","internalType":"uint256"}]}],"name":"getLinkingERC721s","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"getLinkingLinklistIds","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLinkingLinklistLength","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct DataTypes.NoteStruct","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"}]}],"name":"getLinkingNote","inputs":[{"type":"bytes32","name":"linkKey","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLinkingNoteListLength","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"results","internalType":"struct DataTypes.NoteStruct[]","components":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"uint256","name":"noteId","internalType":"uint256"}]}],"name":"getLinkingNotes","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getOwnerCharacterId","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"string","name":"name_","internalType":"string"},{"type":"string","name":"symbol_","internalType":"string"},{"type":"address","name":"web3Entry_","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":"nonpayable","outputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}],"name":"mint","inputs":[{"type":"uint256","name":"characterId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]},{"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":[],"name":"removeLinkingAddress","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"ethAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeLinkingAnyUri","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"toUri","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeLinkingCharacterId","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"toCharacterId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeLinkingERC721","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"erc721TokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeLinkingLinklistId","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"linklistId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeLinkingNote","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"toCharacterId","internalType":"uint256"},{"type":"uint256","name":"toNoteId","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":"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":"setLinkType","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes32","name":"linkType","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setUri","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"uri","internalType":"string"}]},{"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":"string","name":"","internalType":"string"}],"name":"tokenURI","inputs":[{"type":"uint256","name":"","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"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50612f2b806100206000396000f3fe608060405234801561001057600080fd5b50600436106103415760003560e01c80636352211e116101b8578063a22cb46511610104578063c87b56dd116100a2578063e985e9c51161007c578063e985e9c514610804578063ed386e6514610840578063ed6223cf14610853578063f61087f61461086657600080fd5b8063c87b56dd146107c3578063cf101ac2146106aa578063e64f2baa146107e457600080fd5b8063ba27f58d116100de578063ba27f58d14610777578063c1cd4f821461078a578063c5a5ed511461079d578063c70881c5146107b057600080fd5b8063a22cb4651461073e578063ac150a5414610751578063b88d4fde1461076457600080fd5b80637803f217116101715780639037c0f91161014b5780639037c0f9146106e357806395d89b411461070357806397ce7df61461070b5780639cc7f7081461071e57600080fd5b80637803f217146106aa578063782f08ae146106bd5780638fd6dc39146106d057600080fd5b80636352211e1461062b5780636c217e121461063e5780636d37d2741461065157806370a082311461066457806373fbe0121461067757806376bac0251461068a57600080fd5b80632ea24efc116102925780634aa7b87a116102305780635c369ec31161020a5780635c369ec3146105c55780635cb46be7146105e55780635e9f678b146105f85780635f799cc61461061857600080fd5b80634aa7b87a1461053d5780635440522b146105505780635956da73146105b257600080fd5b806342c1721f1161026c57806342c1721f146104aa57806348d1b16c146104bd578063493fa4dc146104d05780634a7906b9146104e457600080fd5b80632ea24efc1461047157806342842e0e1461048457806342966c681461049757600080fd5b8063081812fc116102ff57806318160ddd116102d957806318160ddd1461043057806321cb72271461043857806323b872dd1461044b578063288893d61461045e57600080fd5b8063081812fc146103df578063095ea7b31461040a5780631801fbe51461041d57600080fd5b8062fba0271461034657806301ffc9a71461036c5780630370a1611461038f578063040f7618146103a457806306fdde03146103b7578063077f224a146103cc575b600080fd5b6103596103543660046124df565b610879565b6040519081526020015b60405180910390f35b61037f61037a3660046124f8565b6108c1565b6040519015158152602001610363565b6103a261039d36600461253a565b610913565b005b6103a26103b2366004612572565b61098b565b6103bf610a0b565b60405161036391906125ee565b6103a26103da36600461264a565b610a9d565b6103f26103ed3660046124df565b610be6565b6040516001600160a01b039091168152602001610363565b6103a26104183660046126ce565b610c7b565b61035961042b3660046126fa565b610d90565b601e54610359565b6103a26104463660046126fa565b610e58565b6103a261045936600461271c565b610e9b565b6103a261046c3660046126fa565b610ec1565b61035961047f36600461253a565b610f04565b6103a261049236600461271c565b610fd2565b6103a26104a53660046124df565b610fed565b6103a26104b83660046127d8565b6110b2565b6103596104cb3660046124df565b611127565b6103596104de3660046124df565b50600090565b6105306104f23660046124df565b604080518082019091526000808252602082015250600090815260116020908152604091829020825180840190935280548352600101549082015290565b6040516103639190612833565b61035961054b3660046124df565b611175565b6105a561055e3660046124df565b604080518082019091526000808252602082015250600090815260106020908152604091829020825180840190935280546001600160a01b03168352600101549082015290565b604051610363919061284a565b6103a26105c036600461286a565b6111bc565b6105d86105d33660046124df565b6111ff565b604051610363919061289a565b6103596105f3366004612572565b611249565b61060b6106063660046124df565b611309565b60405161036391906128e7565b6103bf6106263660046124df565b61144c565b6103f26106393660046124df565b6114ee565b61035961064c3660046127d8565b6115a4565b61035961065f3660046124df565b61163f565b61035961067236600461293e565b611686565b6103a26106853660046126fa565b6117b4565b61069d6106983660046124df565b61184e565b604051610363919061295b565b6103596106b83660046124df565b611898565b6103a26106cb3660046127d8565b6118dc565b6103596106de3660046124df565b6119b4565b6106f66106f13660046124df565b6119fb565b6040516103639190612993565b6103bf611b3a565b6103596107193660046124df565b611b49565b61035961072c3660046124df565b6000908152601d602052604090205490565b6103a261074c3660046129e6565b611b90565b6103bf61075f3660046124df565b611b9f565b6103a2610772366004612a19565b611c71565b61069d6107853660046124df565b611c9c565b6103a26107983660046126fa565b611ce6565b600a546103f2906001600160a01b031681565b6103a26107be3660046126fa565b611d29565b6103bf6107d13660046124df565b5060408051602081019091526000815290565b6107f76107f23660046124df565b611d6c565b6040516103639190612a99565b61037f610812366004612afb565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6103a261084e36600461286a565b611eff565b61069d6108613660046124df565b611f42565b6103596108743660046124df565b611f8c565b6000818152601c6020526040812054829082036108a9576040516366012df560e11b815260040160405180910390fd5b6000838152600b602052604090205491505b50919050565b60006001600160e01b031982166380ac58cd60e01b14806108f257506001600160e01b03198216635b5e139f60e01b145b8061090d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600a546001600160a01b0316331461093e576040516302b6341b60e41b815260040160405180910390fd5b60008282604051602001610953929190612b29565b60408051601f1981840301815291815281516020928301206000878152601690935291209091506109849082611fd3565b5050505050565b600a546001600160a01b031633146109b6576040516302b6341b60e41b815260040160405180910390fd5b604051634e6f746560e01b6020820152602481018390526044810182905260009060640160408051601f1981840301815291815281516020928301206000878152601790935291209091506109849082611fd3565b606060008054610a1a90612b5a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4690612b5a565b8015610a935780601f10610a6857610100808354040283529160200191610a93565b820191906000526020600020905b815481529060010190602001808311610a7657829003601f168201915b5050505050905090565b601a54600290610100900460ff16158015610abf5750601a5460ff8083169116105b610b275760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b601a805461ffff191660ff831617610100179055600a80546001600160a01b0384166001600160a01b0319909116179055601b54601e55610b6a86868686611fdf565b6040514281527fcfdec2ffedf2f5ec02de6f351c5f9b6150601f657926e9e87b16390d562af4e79060200160405180910390a1601a805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6000818152600260205260408120546001600160a01b0316610c5f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b1e565b506000908152600460205260409020546001600160a01b031690565b6000610c8682612030565b9050806001600160a01b0316836001600160a01b031603610cf35760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610b1e565b336001600160a01b0382161480610d0f5750610d0f8133610812565b610d815760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610b1e565b610d8b83836120a7565b505050565b600a546000906001600160a01b03163314610dbe576040516302b6341b60e41b815260040160405180910390fd5b601b60008154610dcd90612ba4565b91829055506000818152600b60209081526040808320869055601c8252808320879055868352601d9091528120805492935090610e0983612ba4565b9091555050601e8054906000610e1e83612ba4565b9091555050604051819084906000907f7fa9aafeb8bb803d77de5d84bc2f2edbd842ca91b20cd5020aa21dfe26ab0be9908290a492915050565b600a546001600160a01b03163314610e83576040516302b6341b60e41b815260040160405180910390fd5b6000828152600c60205260409020610d8b9082611fd3565b610ea53382612115565b610d8b5760405162461bcd60e51b8152600401610b1e90612bbd565b600a546001600160a01b03163314610eec576040516302b6341b60e41b815260040160405180910390fd5b6000828152600c60205260409020610d8b908261220c565b600a546000906001600160a01b03163314610f32576040516302b6341b60e41b815260040160405180910390fd5b60008383604051602001610f47929190612b29565b60405160208183030381529060405280519060200120905084600014610f81576000858152601660205260409020610f7f908261220c565b505b6040805180820182526001600160a01b0380871682526020808301878152600086815260109092529390209151825491166001600160a01b0319909116178155905160019091015590509392505050565b610d8b83838360405180602001604052806000815250611c71565b600a546001600160a01b03163314611018576040516302b6341b60e41b815260040160405180910390fd5b6000818152601c602052604081205490819003611048576040516366012df560e11b815260040160405180910390fd5b6000818152601d602090815260408083208054600019908101909155601e80549091019055848352600b8252808320839055601c90915280822082905551839183917f410c5c259085cde81fedf70c1aa308ec839373c26e9b7ada6560a2aca0254eb69190a35050565b600a546001600160a01b031633146110dd576040516302b6341b60e41b815260040160405180910390fd5b6000816040516020016110f09190612c0e565b60408051601f1981840301815291815281516020928301206000868152601990935291209091506111219082611fd3565b50505050565b6000818152601c602052604081205482908203611157576040516366012df560e11b815260040160405180910390fd5b6000838152600c6020526040902061116e90612218565b9392505050565b6000818152601c6020526040812054829082036111a5576040516366012df560e11b815260040160405180910390fd5b600083815260196020526040902061116e90612218565b600a546001600160a01b031633146111e7576040516302b6341b60e41b815260040160405180910390fd5b6000828152600d60205260409020610d8b9082612222565b6000818152601c602052604081205460609183919003611232576040516366012df560e11b815260040160405180910390fd5b6000838152600d6020526040902061116e90612237565b600a546000906001600160a01b03163314611277576040516302b6341b60e41b815260040160405180910390fd5b604051634e6f746560e01b60208201526024810184905260448101839052600090606401604051602081830303815290604052805190602001209050846000146112d55760008581526017602052604090206112d3908261220c565b505b6040805180820182529485526020808601948552600083815260119091522093518455915160019093019290925592915050565b6000818152601c60205260408120546060918391900361133c576040516366012df560e11b815260040160405180910390fd5b600083815260176020526040812061135390612237565b9050805167ffffffffffffffff81111561136f5761136f61274c565b6040519080825280602002602001820160405280156113b457816020015b604080518082019091526000808252602082015281526020019060019003908161138d5790505b50925060005b81518110156114445760008282815181106113d7576113d7612c3c565b60200260200101519050601160008281526020019081526020016000206040518060400160405290816000820154815260200160018201548152505085838151811061142557611425612c3c565b602002602001018190525050808061143c90612ba4565b9150506113ba565b505050919050565b600081815260136020526040902080546060919061146990612b5a565b80601f016020809104026020016040519081016040528092919081815260200182805461149590612b5a565b80156114e25780601f106114b7576101008083540402835291602001916114e2565b820191906000526020600020905b8154815290600101906020018083116114c557829003601f168201915b50505050509050919050565b6000818152601c60205260408120548290820361151e576040516366012df560e11b815260040160405180910390fd5b6000838152601c602052604080822054600a5491516331a9108f60e11b8152600481018290529092916001600160a01b031690636352211e90602401602060405180830381865afa158015611577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159b9190612c52565b95945050505050565b600a546000906001600160a01b031633146115d2576040516302b6341b60e41b815260040160405180910390fd5b6000826040516020016115e59190612c0e565b6040516020818303038152906040528051906020012090508360001461161f57600084815260196020526040902061161d908261220c565b505b60008181526013602052604090206116378482612cbd565b509392505050565b6000818152601c60205260408120548290820361166f576040516366012df560e11b815260040160405180910390fd5b600083815260166020526040902061116e90612218565b600a546040516370a0823160e01b81526001600160a01b03838116600483015260009283929116906370a0823190602401602060405180830381865afa1580156116d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f89190612d7d565b905060005b818110156117ad57600a54604051632f745c5960e01b81526001600160a01b038681166004830152602482018490526000921690632f745c5990604401602060405180830381865afa158015611757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177b9190612d7d565b6000818152601d60205260409020549091506117979085612d96565b93505080806117a590612ba4565b9150506116fd565b5050919050565b600a546001600160a01b031633146117df576040516302b6341b60e41b815260040160405180910390fd5b6000828152601c602052604081205483910361180e576040516366012df560e11b815260040160405180910390fd5b6000838152600b602052604080822084905551839185917ff0aea9f7b630d17e54614f5667704230d832f3c25c0ebbbd2cd7b52914ce11aa9190a3505050565b6000818152601c602052604081205460609183919003611881576040516366012df560e11b815260040160405180910390fd5b600083815260196020526040902061116e90612237565b6000818152601c6020526040812054829082036118c8576040516366012df560e11b815260040160405180910390fd5b50506000908152601c602052604090205490565b6000828152601c602052604081205483910361190b576040516366012df560e11b815260040160405180910390fd5b600a546001600160a01b03163314801590611940575061192a836114ee565b6001600160a01b0316336001600160a01b031614155b1561195e57604051631a64ce6560e11b815260040160405180910390fd5b60008381526015602052604090206119768382612cbd565b50827f6d10c59cedadc720a2e20f54f0a461ef82bd35f762430e32ef049dd6d7fc2730836040516119a791906125ee565b60405180910390a2505050565b6000818152601c6020526040812054829082036119e4576040516366012df560e11b815260040160405180910390fd5b6000838152600e6020526040902061116e90612218565b6000818152601c602052604081205460609183919003611a2e576040516366012df560e11b815260040160405180910390fd5b6000838152601660205260408120611a4590612237565b9050805167ffffffffffffffff811115611a6157611a6161274c565b604051908082528060200260200182016040528015611aa657816020015b6040805180820190915260008082526020820152815260200190600190039081611a7f5790505b50925060005b8151811015611444576000828281518110611ac957611ac9612c3c565b602090810291909101810151600081815260108352604090819020815180830190925280546001600160a01b0316825260010154928101929092528651909250869084908110611b1b57611b1b612c3c565b6020026020010181905250508080611b3290612ba4565b915050611aac565b606060018054610a1a90612b5a565b6000818152601c602052604081205482908203611b79576040516366012df560e11b815260040160405180910390fd5b6000838152600d6020526040902061116e90612218565b611b9b338383612244565b5050565b6000818152601c602052604081205460609183919003611bd2576040516366012df560e11b815260040160405180910390fd5b60008381526015602052604090208054611beb90612b5a565b80601f0160208091040260200160405190810160405280929190818152602001828054611c1790612b5a565b8015611c645780601f10611c3957610100808354040283529160200191611c64565b820191906000526020600020905b815481529060010190602001808311611c4757829003601f168201915b5050505050915050919050565b611c7b3383612115565b611c975760405162461bcd60e51b8152600401610b1e90612bbd565b611121565b6000818152601c602052604081205460609183919003611ccf576040516366012df560e11b815260040160405180910390fd5b6000838152600c6020526040902061116e90612237565b600a546001600160a01b03163314611d11576040516302b6341b60e41b815260040160405180910390fd5b6000828152600e60205260409020610d8b908261220c565b600a546001600160a01b03163314611d54576040516302b6341b60e41b815260040160405180910390fd5b6000828152600e60205260409020610d8b9082611fd3565b6000818152601c602052604081205460609183919003611d9f576040516366012df560e11b815260040160405180910390fd5b6000838152601960205260408120611db690612237565b9050805167ffffffffffffffff811115611dd257611dd261274c565b604051908082528060200260200182016040528015611e0557816020015b6060815260200190600190039081611df05790505b50925060005b8151811015611444576000828281518110611e2857611e28612c3c565b60200260200101519050601360008281526020019081526020016000208054611e5090612b5a565b80601f0160208091040260200160405190810160405280929190818152602001828054611e7c90612b5a565b8015611ec95780601f10611e9e57610100808354040283529160200191611ec9565b820191906000526020600020905b815481529060010190602001808311611eac57829003601f168201915b5050505050858381518110611ee057611ee0612c3c565b6020026020010181905250508080611ef790612ba4565b915050611e0b565b600a546001600160a01b03163314611f2a576040516302b6341b60e41b815260040160405180910390fd5b6000828152600d60205260409020610d8b9082612312565b6000818152601c602052604081205460609183919003611f75576040516366012df560e11b815260040160405180910390fd5b6000838152600e6020526040902061116e90612237565b6000818152601c602052604081205482908203611fbc576040516366012df560e11b815260040160405180910390fd5b600083815260176020526040902061116e90612218565b600061116e8383612327565b611feb8484848461241a565b7f414cd0b34676984f09a5f76ce9718d4062e50283abe0e7e274a9a5b4e0c99c308484848442604051612022959493929190612dd2565b60405180910390a150505050565b6000818152600260205260408120546001600160a01b03168061090d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610b1e565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906120dc82612030565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b031661218e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b1e565b600061219983612030565b9050806001600160a01b0316846001600160a01b031614806121d45750836001600160a01b03166121c984610be6565b6001600160a01b0316145b8061220457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b600061116e8383612435565b600061090d825490565b600061116e836001600160a01b038416612327565b6060600061116e83612484565b816001600160a01b0316836001600160a01b0316036122a55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610b1e565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600061116e836001600160a01b038416612435565b6000818152600183016020526040812054801561241057600061234b600183612e0c565b855490915060009061235f90600190612e0c565b90508181146123c457600086600001828154811061237f5761237f612c3c565b90600052602060002001549050808760000184815481106123a2576123a2612c3c565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806123d5576123d5612e1f565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061090d565b600091505061090d565b6000612427848683612e35565b506001610984828483612e35565b600081815260018301602052604081205461247c5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561090d565b50600061090d565b6060816000018054806020026020016040519081016040528092919081815260200182805480156114e257602002820191906000526020600020905b8154815260200190600101908083116124c05750505050509050919050565b6000602082840312156124f157600080fd5b5035919050565b60006020828403121561250a57600080fd5b81356001600160e01b03198116811461116e57600080fd5b6001600160a01b038116811461253757600080fd5b50565b60008060006060848603121561254f57600080fd5b83359250602084013561256181612522565b929592945050506040919091013590565b60008060006060848603121561258757600080fd5b505081359360208301359350604090920135919050565b60005b838110156125b95781810151838201526020016125a1565b50506000910152565b600081518084526125da81602086016020860161259e565b601f01601f19169290920160200192915050565b60208152600061116e60208301846125c2565b60008083601f84011261261357600080fd5b50813567ffffffffffffffff81111561262b57600080fd5b60208301915083602082850101111561264357600080fd5b9250929050565b60008060008060006060868803121561266257600080fd5b853567ffffffffffffffff8082111561267a57600080fd5b61268689838a01612601565b9097509550602088013591508082111561269f57600080fd5b506126ac88828901612601565b90945092505060408601356126c081612522565b809150509295509295909350565b600080604083850312156126e157600080fd5b82356126ec81612522565b946020939093013593505050565b6000806040838503121561270d57600080fd5b50508035926020909101359150565b60008060006060848603121561273157600080fd5b833561273c81612522565b9250602084013561256181612522565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561277d5761277d61274c565b604051601f8501601f19908116603f011681019082821181831017156127a5576127a561274c565b816040528093508581528686860111156127be57600080fd5b858560208301376000602087830101525050509392505050565b600080604083850312156127eb57600080fd5b82359150602083013567ffffffffffffffff81111561280957600080fd5b8301601f8101851361281a57600080fd5b61282985823560208401612762565b9150509250929050565b81518152602080830151908201526040810161090d565b81516001600160a01b03168152602080830151908201526040810161090d565b6000806040838503121561287d57600080fd5b82359150602083013561288f81612522565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156128db5783516001600160a01b0316835292840192918401916001016128b6565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b828110156129315761292184835180518252602090810151910152565b9284019290850190600101612904565b5091979650505050505050565b60006020828403121561295057600080fd5b813561116e81612522565b6020808252825182820181905260009190848201906040850190845b818110156128db57835183529284019291840191600101612977565b602080825282518282018190526000919060409081850190868401855b82811015612931576129d684835180516001600160a01b03168252602090810151910152565b92840192908501906001016129b0565b600080604083850312156129f957600080fd5b8235612a0481612522565b91506020830135801515811461288f57600080fd5b60008060008060808587031215612a2f57600080fd5b8435612a3a81612522565b93506020850135612a4a81612522565b925060408501359150606085013567ffffffffffffffff811115612a6d57600080fd5b8501601f81018713612a7e57600080fd5b612a8d87823560208401612762565b91505092959194509250565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612aee57603f19888603018452612adc8583516125c2565b94509285019290850190600101612ac0565b5092979650505050505050565b60008060408385031215612b0e57600080fd5b8235612b1981612522565b9150602083013561288f81612522565b6545524337323160d01b815260609290921b6bffffffffffffffffffffffff19166006830152601a820152603a0190565b600181811c90821680612b6e57607f821691505b6020821081036108bb57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612bb657612bb6612b8e565b5060010190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b65416e7955726960d01b815260008251612c2f81600685016020870161259e565b9190910160060192915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612c6457600080fd5b815161116e81612522565b601f821115610d8b57600081815260208120601f850160051c81016020861015612c965750805b601f850160051c820191505b81811015612cb557828155600101612ca2565b505050505050565b815167ffffffffffffffff811115612cd757612cd761274c565b612ceb81612ce58454612b5a565b84612c6f565b602080601f831160018114612d205760008415612d085750858301515b600019600386901b1c1916600185901b178555612cb5565b600085815260208120601f198616915b82811015612d4f57888601518255948401946001909101908401612d30565b5085821015612d6d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215612d8f57600080fd5b5051919050565b8082018082111561090d5761090d612b8e565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b606081526000612de6606083018789612da9565b8281036020840152612df9818688612da9565b9150508260408301529695505050505050565b8181038181111561090d5761090d612b8e565b634e487b7160e01b600052603160045260246000fd5b67ffffffffffffffff831115612e4d57612e4d61274c565b612e6183612e5b8354612b5a565b83612c6f565b6000601f841160018114612e955760008515612e7d5750838201355b600019600387901b1c1916600186901b178355610984565b600083815260209020601f19861690835b82811015612ec65786850135825560209485019460019092019101612ea6565b5086821015612ee35760001960f88860031b161c19848701351681555b505060018560011b018355505050505056fea264697066735822122034134ebbdfe4a1f502db962d8a4a084617648da0ea6b758385e8b748935df83964736f6c63430008120033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106103415760003560e01c80636352211e116101b8578063a22cb46511610104578063c87b56dd116100a2578063e985e9c51161007c578063e985e9c514610804578063ed386e6514610840578063ed6223cf14610853578063f61087f61461086657600080fd5b8063c87b56dd146107c3578063cf101ac2146106aa578063e64f2baa146107e457600080fd5b8063ba27f58d116100de578063ba27f58d14610777578063c1cd4f821461078a578063c5a5ed511461079d578063c70881c5146107b057600080fd5b8063a22cb4651461073e578063ac150a5414610751578063b88d4fde1461076457600080fd5b80637803f217116101715780639037c0f91161014b5780639037c0f9146106e357806395d89b411461070357806397ce7df61461070b5780639cc7f7081461071e57600080fd5b80637803f217146106aa578063782f08ae146106bd5780638fd6dc39146106d057600080fd5b80636352211e1461062b5780636c217e121461063e5780636d37d2741461065157806370a082311461066457806373fbe0121461067757806376bac0251461068a57600080fd5b80632ea24efc116102925780634aa7b87a116102305780635c369ec31161020a5780635c369ec3146105c55780635cb46be7146105e55780635e9f678b146105f85780635f799cc61461061857600080fd5b80634aa7b87a1461053d5780635440522b146105505780635956da73146105b257600080fd5b806342c1721f1161026c57806342c1721f146104aa57806348d1b16c146104bd578063493fa4dc146104d05780634a7906b9146104e457600080fd5b80632ea24efc1461047157806342842e0e1461048457806342966c681461049757600080fd5b8063081812fc116102ff57806318160ddd116102d957806318160ddd1461043057806321cb72271461043857806323b872dd1461044b578063288893d61461045e57600080fd5b8063081812fc146103df578063095ea7b31461040a5780631801fbe51461041d57600080fd5b8062fba0271461034657806301ffc9a71461036c5780630370a1611461038f578063040f7618146103a457806306fdde03146103b7578063077f224a146103cc575b600080fd5b6103596103543660046124df565b610879565b6040519081526020015b60405180910390f35b61037f61037a3660046124f8565b6108c1565b6040519015158152602001610363565b6103a261039d36600461253a565b610913565b005b6103a26103b2366004612572565b61098b565b6103bf610a0b565b60405161036391906125ee565b6103a26103da36600461264a565b610a9d565b6103f26103ed3660046124df565b610be6565b6040516001600160a01b039091168152602001610363565b6103a26104183660046126ce565b610c7b565b61035961042b3660046126fa565b610d90565b601e54610359565b6103a26104463660046126fa565b610e58565b6103a261045936600461271c565b610e9b565b6103a261046c3660046126fa565b610ec1565b61035961047f36600461253a565b610f04565b6103a261049236600461271c565b610fd2565b6103a26104a53660046124df565b610fed565b6103a26104b83660046127d8565b6110b2565b6103596104cb3660046124df565b611127565b6103596104de3660046124df565b50600090565b6105306104f23660046124df565b604080518082019091526000808252602082015250600090815260116020908152604091829020825180840190935280548352600101549082015290565b6040516103639190612833565b61035961054b3660046124df565b611175565b6105a561055e3660046124df565b604080518082019091526000808252602082015250600090815260106020908152604091829020825180840190935280546001600160a01b03168352600101549082015290565b604051610363919061284a565b6103a26105c036600461286a565b6111bc565b6105d86105d33660046124df565b6111ff565b604051610363919061289a565b6103596105f3366004612572565b611249565b61060b6106063660046124df565b611309565b60405161036391906128e7565b6103bf6106263660046124df565b61144c565b6103f26106393660046124df565b6114ee565b61035961064c3660046127d8565b6115a4565b61035961065f3660046124df565b61163f565b61035961067236600461293e565b611686565b6103a26106853660046126fa565b6117b4565b61069d6106983660046124df565b61184e565b604051610363919061295b565b6103596106b83660046124df565b611898565b6103a26106cb3660046127d8565b6118dc565b6103596106de3660046124df565b6119b4565b6106f66106f13660046124df565b6119fb565b6040516103639190612993565b6103bf611b3a565b6103596107193660046124df565b611b49565b61035961072c3660046124df565b6000908152601d602052604090205490565b6103a261074c3660046129e6565b611b90565b6103bf61075f3660046124df565b611b9f565b6103a2610772366004612a19565b611c71565b61069d6107853660046124df565b611c9c565b6103a26107983660046126fa565b611ce6565b600a546103f2906001600160a01b031681565b6103a26107be3660046126fa565b611d29565b6103bf6107d13660046124df565b5060408051602081019091526000815290565b6107f76107f23660046124df565b611d6c565b6040516103639190612a99565b61037f610812366004612afb565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6103a261084e36600461286a565b611eff565b61069d6108613660046124df565b611f42565b6103596108743660046124df565b611f8c565b6000818152601c6020526040812054829082036108a9576040516366012df560e11b815260040160405180910390fd5b6000838152600b602052604090205491505b50919050565b60006001600160e01b031982166380ac58cd60e01b14806108f257506001600160e01b03198216635b5e139f60e01b145b8061090d57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600a546001600160a01b0316331461093e576040516302b6341b60e41b815260040160405180910390fd5b60008282604051602001610953929190612b29565b60408051601f1981840301815291815281516020928301206000878152601690935291209091506109849082611fd3565b5050505050565b600a546001600160a01b031633146109b6576040516302b6341b60e41b815260040160405180910390fd5b604051634e6f746560e01b6020820152602481018390526044810182905260009060640160408051601f1981840301815291815281516020928301206000878152601790935291209091506109849082611fd3565b606060008054610a1a90612b5a565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4690612b5a565b8015610a935780601f10610a6857610100808354040283529160200191610a93565b820191906000526020600020905b815481529060010190602001808311610a7657829003601f168201915b5050505050905090565b601a54600290610100900460ff16158015610abf5750601a5460ff8083169116105b610b275760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b601a805461ffff191660ff831617610100179055600a80546001600160a01b0384166001600160a01b0319909116179055601b54601e55610b6a86868686611fdf565b6040514281527fcfdec2ffedf2f5ec02de6f351c5f9b6150601f657926e9e87b16390d562af4e79060200160405180910390a1601a805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b6000818152600260205260408120546001600160a01b0316610c5f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b1e565b506000908152600460205260409020546001600160a01b031690565b6000610c8682612030565b9050806001600160a01b0316836001600160a01b031603610cf35760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610b1e565b336001600160a01b0382161480610d0f5750610d0f8133610812565b610d815760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610b1e565b610d8b83836120a7565b505050565b600a546000906001600160a01b03163314610dbe576040516302b6341b60e41b815260040160405180910390fd5b601b60008154610dcd90612ba4565b91829055506000818152600b60209081526040808320869055601c8252808320879055868352601d9091528120805492935090610e0983612ba4565b9091555050601e8054906000610e1e83612ba4565b9091555050604051819084906000907f7fa9aafeb8bb803d77de5d84bc2f2edbd842ca91b20cd5020aa21dfe26ab0be9908290a492915050565b600a546001600160a01b03163314610e83576040516302b6341b60e41b815260040160405180910390fd5b6000828152600c60205260409020610d8b9082611fd3565b610ea53382612115565b610d8b5760405162461bcd60e51b8152600401610b1e90612bbd565b600a546001600160a01b03163314610eec576040516302b6341b60e41b815260040160405180910390fd5b6000828152600c60205260409020610d8b908261220c565b600a546000906001600160a01b03163314610f32576040516302b6341b60e41b815260040160405180910390fd5b60008383604051602001610f47929190612b29565b60405160208183030381529060405280519060200120905084600014610f81576000858152601660205260409020610f7f908261220c565b505b6040805180820182526001600160a01b0380871682526020808301878152600086815260109092529390209151825491166001600160a01b0319909116178155905160019091015590509392505050565b610d8b83838360405180602001604052806000815250611c71565b600a546001600160a01b03163314611018576040516302b6341b60e41b815260040160405180910390fd5b6000818152601c602052604081205490819003611048576040516366012df560e11b815260040160405180910390fd5b6000818152601d602090815260408083208054600019908101909155601e80549091019055848352600b8252808320839055601c90915280822082905551839183917f410c5c259085cde81fedf70c1aa308ec839373c26e9b7ada6560a2aca0254eb69190a35050565b600a546001600160a01b031633146110dd576040516302b6341b60e41b815260040160405180910390fd5b6000816040516020016110f09190612c0e565b60408051601f1981840301815291815281516020928301206000868152601990935291209091506111219082611fd3565b50505050565b6000818152601c602052604081205482908203611157576040516366012df560e11b815260040160405180910390fd5b6000838152600c6020526040902061116e90612218565b9392505050565b6000818152601c6020526040812054829082036111a5576040516366012df560e11b815260040160405180910390fd5b600083815260196020526040902061116e90612218565b600a546001600160a01b031633146111e7576040516302b6341b60e41b815260040160405180910390fd5b6000828152600d60205260409020610d8b9082612222565b6000818152601c602052604081205460609183919003611232576040516366012df560e11b815260040160405180910390fd5b6000838152600d6020526040902061116e90612237565b600a546000906001600160a01b03163314611277576040516302b6341b60e41b815260040160405180910390fd5b604051634e6f746560e01b60208201526024810184905260448101839052600090606401604051602081830303815290604052805190602001209050846000146112d55760008581526017602052604090206112d3908261220c565b505b6040805180820182529485526020808601948552600083815260119091522093518455915160019093019290925592915050565b6000818152601c60205260408120546060918391900361133c576040516366012df560e11b815260040160405180910390fd5b600083815260176020526040812061135390612237565b9050805167ffffffffffffffff81111561136f5761136f61274c565b6040519080825280602002602001820160405280156113b457816020015b604080518082019091526000808252602082015281526020019060019003908161138d5790505b50925060005b81518110156114445760008282815181106113d7576113d7612c3c565b60200260200101519050601160008281526020019081526020016000206040518060400160405290816000820154815260200160018201548152505085838151811061142557611425612c3c565b602002602001018190525050808061143c90612ba4565b9150506113ba565b505050919050565b600081815260136020526040902080546060919061146990612b5a565b80601f016020809104026020016040519081016040528092919081815260200182805461149590612b5a565b80156114e25780601f106114b7576101008083540402835291602001916114e2565b820191906000526020600020905b8154815290600101906020018083116114c557829003601f168201915b50505050509050919050565b6000818152601c60205260408120548290820361151e576040516366012df560e11b815260040160405180910390fd5b6000838152601c602052604080822054600a5491516331a9108f60e11b8152600481018290529092916001600160a01b031690636352211e90602401602060405180830381865afa158015611577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159b9190612c52565b95945050505050565b600a546000906001600160a01b031633146115d2576040516302b6341b60e41b815260040160405180910390fd5b6000826040516020016115e59190612c0e565b6040516020818303038152906040528051906020012090508360001461161f57600084815260196020526040902061161d908261220c565b505b60008181526013602052604090206116378482612cbd565b509392505050565b6000818152601c60205260408120548290820361166f576040516366012df560e11b815260040160405180910390fd5b600083815260166020526040902061116e90612218565b600a546040516370a0823160e01b81526001600160a01b03838116600483015260009283929116906370a0823190602401602060405180830381865afa1580156116d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f89190612d7d565b905060005b818110156117ad57600a54604051632f745c5960e01b81526001600160a01b038681166004830152602482018490526000921690632f745c5990604401602060405180830381865afa158015611757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061177b9190612d7d565b6000818152601d60205260409020549091506117979085612d96565b93505080806117a590612ba4565b9150506116fd565b5050919050565b600a546001600160a01b031633146117df576040516302b6341b60e41b815260040160405180910390fd5b6000828152601c602052604081205483910361180e576040516366012df560e11b815260040160405180910390fd5b6000838152600b602052604080822084905551839185917ff0aea9f7b630d17e54614f5667704230d832f3c25c0ebbbd2cd7b52914ce11aa9190a3505050565b6000818152601c602052604081205460609183919003611881576040516366012df560e11b815260040160405180910390fd5b600083815260196020526040902061116e90612237565b6000818152601c6020526040812054829082036118c8576040516366012df560e11b815260040160405180910390fd5b50506000908152601c602052604090205490565b6000828152601c602052604081205483910361190b576040516366012df560e11b815260040160405180910390fd5b600a546001600160a01b03163314801590611940575061192a836114ee565b6001600160a01b0316336001600160a01b031614155b1561195e57604051631a64ce6560e11b815260040160405180910390fd5b60008381526015602052604090206119768382612cbd565b50827f6d10c59cedadc720a2e20f54f0a461ef82bd35f762430e32ef049dd6d7fc2730836040516119a791906125ee565b60405180910390a2505050565b6000818152601c6020526040812054829082036119e4576040516366012df560e11b815260040160405180910390fd5b6000838152600e6020526040902061116e90612218565b6000818152601c602052604081205460609183919003611a2e576040516366012df560e11b815260040160405180910390fd5b6000838152601660205260408120611a4590612237565b9050805167ffffffffffffffff811115611a6157611a6161274c565b604051908082528060200260200182016040528015611aa657816020015b6040805180820190915260008082526020820152815260200190600190039081611a7f5790505b50925060005b8151811015611444576000828281518110611ac957611ac9612c3c565b602090810291909101810151600081815260108352604090819020815180830190925280546001600160a01b0316825260010154928101929092528651909250869084908110611b1b57611b1b612c3c565b6020026020010181905250508080611b3290612ba4565b915050611aac565b606060018054610a1a90612b5a565b6000818152601c602052604081205482908203611b79576040516366012df560e11b815260040160405180910390fd5b6000838152600d6020526040902061116e90612218565b611b9b338383612244565b5050565b6000818152601c602052604081205460609183919003611bd2576040516366012df560e11b815260040160405180910390fd5b60008381526015602052604090208054611beb90612b5a565b80601f0160208091040260200160405190810160405280929190818152602001828054611c1790612b5a565b8015611c645780601f10611c3957610100808354040283529160200191611c64565b820191906000526020600020905b815481529060010190602001808311611c4757829003601f168201915b5050505050915050919050565b611c7b3383612115565b611c975760405162461bcd60e51b8152600401610b1e90612bbd565b611121565b6000818152601c602052604081205460609183919003611ccf576040516366012df560e11b815260040160405180910390fd5b6000838152600c6020526040902061116e90612237565b600a546001600160a01b03163314611d11576040516302b6341b60e41b815260040160405180910390fd5b6000828152600e60205260409020610d8b908261220c565b600a546001600160a01b03163314611d54576040516302b6341b60e41b815260040160405180910390fd5b6000828152600e60205260409020610d8b9082611fd3565b6000818152601c602052604081205460609183919003611d9f576040516366012df560e11b815260040160405180910390fd5b6000838152601960205260408120611db690612237565b9050805167ffffffffffffffff811115611dd257611dd261274c565b604051908082528060200260200182016040528015611e0557816020015b6060815260200190600190039081611df05790505b50925060005b8151811015611444576000828281518110611e2857611e28612c3c565b60200260200101519050601360008281526020019081526020016000208054611e5090612b5a565b80601f0160208091040260200160405190810160405280929190818152602001828054611e7c90612b5a565b8015611ec95780601f10611e9e57610100808354040283529160200191611ec9565b820191906000526020600020905b815481529060010190602001808311611eac57829003601f168201915b5050505050858381518110611ee057611ee0612c3c565b6020026020010181905250508080611ef790612ba4565b915050611e0b565b600a546001600160a01b03163314611f2a576040516302b6341b60e41b815260040160405180910390fd5b6000828152600d60205260409020610d8b9082612312565b6000818152601c602052604081205460609183919003611f75576040516366012df560e11b815260040160405180910390fd5b6000838152600e6020526040902061116e90612237565b6000818152601c602052604081205482908203611fbc576040516366012df560e11b815260040160405180910390fd5b600083815260176020526040902061116e90612218565b600061116e8383612327565b611feb8484848461241a565b7f414cd0b34676984f09a5f76ce9718d4062e50283abe0e7e274a9a5b4e0c99c308484848442604051612022959493929190612dd2565b60405180910390a150505050565b6000818152600260205260408120546001600160a01b03168061090d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610b1e565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906120dc82612030565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b031661218e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b1e565b600061219983612030565b9050806001600160a01b0316846001600160a01b031614806121d45750836001600160a01b03166121c984610be6565b6001600160a01b0316145b8061220457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b600061116e8383612435565b600061090d825490565b600061116e836001600160a01b038416612327565b6060600061116e83612484565b816001600160a01b0316836001600160a01b0316036122a55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610b1e565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600061116e836001600160a01b038416612435565b6000818152600183016020526040812054801561241057600061234b600183612e0c565b855490915060009061235f90600190612e0c565b90508181146123c457600086600001828154811061237f5761237f612c3c565b90600052602060002001549050808760000184815481106123a2576123a2612c3c565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806123d5576123d5612e1f565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061090d565b600091505061090d565b6000612427848683612e35565b506001610984828483612e35565b600081815260018301602052604081205461247c5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561090d565b50600061090d565b6060816000018054806020026020016040519081016040528092919081815260200182805480156114e257602002820191906000526020600020905b8154815260200190600101908083116124c05750505050509050919050565b6000602082840312156124f157600080fd5b5035919050565b60006020828403121561250a57600080fd5b81356001600160e01b03198116811461116e57600080fd5b6001600160a01b038116811461253757600080fd5b50565b60008060006060848603121561254f57600080fd5b83359250602084013561256181612522565b929592945050506040919091013590565b60008060006060848603121561258757600080fd5b505081359360208301359350604090920135919050565b60005b838110156125b95781810151838201526020016125a1565b50506000910152565b600081518084526125da81602086016020860161259e565b601f01601f19169290920160200192915050565b60208152600061116e60208301846125c2565b60008083601f84011261261357600080fd5b50813567ffffffffffffffff81111561262b57600080fd5b60208301915083602082850101111561264357600080fd5b9250929050565b60008060008060006060868803121561266257600080fd5b853567ffffffffffffffff8082111561267a57600080fd5b61268689838a01612601565b9097509550602088013591508082111561269f57600080fd5b506126ac88828901612601565b90945092505060408601356126c081612522565b809150509295509295909350565b600080604083850312156126e157600080fd5b82356126ec81612522565b946020939093013593505050565b6000806040838503121561270d57600080fd5b50508035926020909101359150565b60008060006060848603121561273157600080fd5b833561273c81612522565b9250602084013561256181612522565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561277d5761277d61274c565b604051601f8501601f19908116603f011681019082821181831017156127a5576127a561274c565b816040528093508581528686860111156127be57600080fd5b858560208301376000602087830101525050509392505050565b600080604083850312156127eb57600080fd5b82359150602083013567ffffffffffffffff81111561280957600080fd5b8301601f8101851361281a57600080fd5b61282985823560208401612762565b9150509250929050565b81518152602080830151908201526040810161090d565b81516001600160a01b03168152602080830151908201526040810161090d565b6000806040838503121561287d57600080fd5b82359150602083013561288f81612522565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156128db5783516001600160a01b0316835292840192918401916001016128b6565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b828110156129315761292184835180518252602090810151910152565b9284019290850190600101612904565b5091979650505050505050565b60006020828403121561295057600080fd5b813561116e81612522565b6020808252825182820181905260009190848201906040850190845b818110156128db57835183529284019291840191600101612977565b602080825282518282018190526000919060409081850190868401855b82811015612931576129d684835180516001600160a01b03168252602090810151910152565b92840192908501906001016129b0565b600080604083850312156129f957600080fd5b8235612a0481612522565b91506020830135801515811461288f57600080fd5b60008060008060808587031215612a2f57600080fd5b8435612a3a81612522565b93506020850135612a4a81612522565b925060408501359150606085013567ffffffffffffffff811115612a6d57600080fd5b8501601f81018713612a7e57600080fd5b612a8d87823560208401612762565b91505092959194509250565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612aee57603f19888603018452612adc8583516125c2565b94509285019290850190600101612ac0565b5092979650505050505050565b60008060408385031215612b0e57600080fd5b8235612b1981612522565b9150602083013561288f81612522565b6545524337323160d01b815260609290921b6bffffffffffffffffffffffff19166006830152601a820152603a0190565b600181811c90821680612b6e57607f821691505b6020821081036108bb57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612bb657612bb6612b8e565b5060010190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b65416e7955726960d01b815260008251612c2f81600685016020870161259e565b9190910160060192915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612c6457600080fd5b815161116e81612522565b601f821115610d8b57600081815260208120601f850160051c81016020861015612c965750805b601f850160051c820191505b81811015612cb557828155600101612ca2565b505050505050565b815167ffffffffffffffff811115612cd757612cd761274c565b612ceb81612ce58454612b5a565b84612c6f565b602080601f831160018114612d205760008415612d085750858301515b600019600386901b1c1916600185901b178555612cb5565b600085815260208120601f198616915b82811015612d4f57888601518255948401946001909101908401612d30565b5085821015612d6d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215612d8f57600080fd5b5051919050565b8082018082111561090d5761090d612b8e565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b606081526000612de6606083018789612da9565b8281036020840152612df9818688612da9565b9150508260408301529695505050505050565b8181038181111561090d5761090d612b8e565b634e487b7160e01b600052603160045260246000fd5b67ffffffffffffffff831115612e4d57612e4d61274c565b612e6183612e5b8354612b5a565b83612c6f565b6000601f841160018114612e955760008515612e7d5750838201355b600019600387901b1c1916600186901b178355610984565b600083815260209020601f19861690835b82811015612ec65786850135825560209485019460019092019101612ea6565b5086821015612ee35760001960f88860031b161c19848701351681555b505060018560011b018355505050505056fea264697066735822122034134ebbdfe4a1f502db962d8a4a084617648da0ea6b758385e8b748935df83964736f6c63430008120033