Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 725 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Set Approval For... | 23635696 | 21 days ago | IN | 0 ETH | 0.00023907 | ||||
| Safe Transfer Fr... | 23334774 | 63 days ago | IN | 0 ETH | 0.00017318 | ||||
| Set Approval For... | 23303567 | 68 days ago | IN | 0 ETH | 0.00001235 | ||||
| Set Approval For... | 23262306 | 73 days ago | IN | 0 ETH | 0.0000274 | ||||
| Set Approval For... | 23261829 | 73 days ago | IN | 0 ETH | 0.00001433 | ||||
| Set Approval For... | 23179649 | 85 days ago | IN | 0 ETH | 0.00001494 | ||||
| Set Approval For... | 23160556 | 87 days ago | IN | 0 ETH | 0.00020242 | ||||
| Transfer From | 23160545 | 87 days ago | IN | 0 ETH | 0.00003059 | ||||
| Transfer From | 23160545 | 87 days ago | IN | 0 ETH | 0.00003059 | ||||
| Transfer From | 23160545 | 87 days ago | IN | 0 ETH | 0.00003812 | ||||
| Set Approval For... | 23156772 | 88 days ago | IN | 0 ETH | 0.00001678 | ||||
| Transfer From | 23140245 | 90 days ago | IN | 0 ETH | 0.00030274 | ||||
| Set Approval For... | 22901796 | 124 days ago | IN | 0 ETH | 0.00006234 | ||||
| Set Approval For... | 22737930 | 147 days ago | IN | 0 ETH | 0.00023598 | ||||
| Set Approval For... | 22517074 | 177 days ago | IN | 0 ETH | 0.00018382 | ||||
| Set Approval For... | 22503218 | 179 days ago | IN | 0 ETH | 0.00011951 | ||||
| Transfer From | 22306475 | 207 days ago | IN | 0 ETH | 0.0000695 | ||||
| Set Approval For... | 22074629 | 239 days ago | IN | 0 ETH | 0.00007009 | ||||
| Set Approval For... | 21849988 | 271 days ago | IN | 0 ETH | 0.0000876 | ||||
| Set Approval For... | 21849454 | 271 days ago | IN | 0 ETH | 0.0001074 | ||||
| Set Approval For... | 21837174 | 273 days ago | IN | 0 ETH | 0.00008144 | ||||
| Safe Transfer Fr... | 21824713 | 274 days ago | IN | 0 ETH | 0.00017508 | ||||
| Set Approval For... | 21805959 | 277 days ago | IN | 0 ETH | 0.0001378 | ||||
| Set Approval For... | 21751889 | 284 days ago | IN | 0 ETH | 0.00022251 | ||||
| Safe Transfer Fr... | 21609199 | 304 days ago | IN | 0 ETH | 0.00041935 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ZuttoMamo
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "operator-filter-registry/src/UpdatableOperatorFilterer.sol";
import "operator-filter-registry/src/RevokableDefaultOperatorFilterer.sol";
import "./base/ERC721AntiScam/ERC721AntiScam.sol";
import { DataType } from "./lib/type/DataType.sol";
import "./interface/IZuttoMamo.sol";
import "./interface/IZuttoMamoStage.sol";
import "./interface/IParentLinkSbt.sol";
import "./interface/IERC5192PLConnector.sol";
import "./interface/IERC4906.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
abstract contract ZuttoMamoConfig {
// =============================================================
// EXTERNAL CONTRACT
// =============================================================
IZuttoMamoStage public zuttoMamoStage;
IERC5192PLConnector public connector;
// =============================================================
// CONSTANTS
// =============================================================
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN");
bytes32 public constant METADATA_ROLE = keccak256("METADATA");
bytes32 public constant MINTER_ROLE = keccak256("MINTER");
// =============================================================
// STORAGE
// =============================================================
uint256 public maxSupply = 5210;
uint256 public unlockLeadTime = 3 hours;
uint96 public royaltyFee = 1000;
address public royaltyAddress = 0x853dac8E9115E30220857C8bDb4486e34Ba93fEa;
/* time lock */
// tokenId -> unlock time
mapping(uint256 => uint256) internal unlockTokenTimestamp;
// wallet -> unlock time
mapping(address => uint256) internal unlockWalletTimestamp;
mapping(uint256 => DataType.TokenLocation) internal tokenLocation;
}
abstract contract ZuttoMamoAdmin is
ZuttoMamoConfig,
Ownable,
AccessControl,
ERC721AntiScam,
ERC2981,
IZuttoMamo,
IERC4906
{
// =============================================================
// SUPPORTS INTERFACE
// =============================================================
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC721AntiScam, AccessControl, IERC721A, ERC2981) returns (bool) {
return
AccessControl.supportsInterface(interfaceId) ||
ERC721AntiScam.supportsInterface(interfaceId) ||
ERC2981.supportsInterface(interfaceId) ||
interfaceId == bytes4(0x49064906) ||
ERC165.supportsInterface(interfaceId) ||
super.supportsInterface(interfaceId);
}
// =============================================================
// ACCESS CONTROL
// =============================================================
function grantAdmin(address _account) external onlyOwner {
_grantRole(ADMIN_ROLE, _account);
}
function revokeAdmin(address _account) external onlyOwner {
_revokeRole(ADMIN_ROLE, _account);
}
// =============================================================
// EXTERNAL CONTRACT
// =============================================================
function setZuttoMamoStage(IZuttoMamoStage _zuttoMamoStage) external onlyRole(ADMIN_ROLE) {
zuttoMamoStage = _zuttoMamoStage;
}
function setERC5192PLConnector(IERC5192PLConnector _address) external onlyRole(ADMIN_ROLE) {
connector = _address;
}
// =============================================================
// ERC-2981
// =============================================================
function setRoyaltyFee(uint96 _value) external onlyRole(ADMIN_ROLE) {
royaltyFee = _value;
_setDefaultRoyalty(royaltyAddress, royaltyFee);
}
function setRoyaltyAddress(address _royaltyAddress) external onlyRole(ADMIN_ROLE) {
royaltyAddress = _royaltyAddress;
_setDefaultRoyalty(royaltyAddress, royaltyFee);
}
// =============================================================
// ERC-4906
// =============================================================
function refreshMetadata(uint256 _tokenId) external onlyRole(METADATA_ROLE) {
emit MetadataUpdate(_tokenId);
}
function refreshMetadata(uint256 _fromTokenId, uint256 _toTokenId) external onlyRole(METADATA_ROLE) {
emit BatchMetadataUpdate(_fromTokenId, _toTokenId);
}
// =============================================================
// OVERRIDES ERC721RESTRICT APPROVE
// =============================================================
function setEnableRestrict(bool _value) external onlyOwner {
enableRestrict = _value;
}
function setCALLevel(uint256 _level) external override onlyRole(ADMIN_ROLE) {
CALLevel = _level;
}
function setCAL(address _calAddress) external onlyRole(ADMIN_ROLE) {
_setCAL(_calAddress);
}
function addLocalContractAllowList(address _transferer) external onlyRole(ADMIN_ROLE) {
_addLocalContractAllowList(_transferer);
}
function removeLocalContractAllowList(address _transferer) external onlyRole(ADMIN_ROLE) {
_removeLocalContractAllowList(_transferer);
}
// =============================================================
// ERC721LOCKABLE
// =============================================================
function setEnableLock(bool _value) external onlyOwner {
enableLock = _value;
}
function setContractLock(LockStatus _lockStatus) external override onlyOwner {
_setContractLock(_lockStatus);
}
function setUnlockLeadTime(uint256 _value) external onlyRole(ADMIN_ROLE) {
unlockLeadTime = _value;
}
function setTokenLockByAdmin(uint256[] calldata _tokenIds, LockStatus _lockStatus) external onlyRole(ADMIN_ROLE) {
require(_tokenIds.length > 0, "tokenIds must be greater than 0");
_setTokenLock(_tokenIds, _lockStatus);
}
// =============================================================
// MINT FUNCTION
// =============================================================
function airdropMint(
address[] calldata _to,
uint256[] calldata _quantity,
bool _withSleep
) external onlyRole(ADMIN_ROLE) {
require(_to.length == _quantity.length, "the address and quantity do not match");
for (uint256 i = 0; i < _quantity.length; i++) {
require(_quantity[i] != 0, "the quantity is zero");
if (_withSleep) {
_birthWithSleeping(_to[i], _quantity[i]);
} else {
_birth(_to[i], _quantity[i]);
}
}
}
function birth(address _to, uint256 _amount) external onlyRole(MINTER_ROLE) {
_birth(_to, _amount);
}
function birthWithSleeping(address _to, uint256 _amount) external onlyRole(MINTER_ROLE) {
_birthWithSleeping(_to, _amount);
}
/**
* @dev Minted time and period to grow to token ID and transfer NFT to address.
*/
function _birth(address _to, uint256 _amount) private {
for (uint256 i = 0; i < _amount; i++) {
uint256 tokenId = _nextTokenId() + i;
tokenLocation[tokenId] = DataType.TokenLocation.Other;
}
_mint(_to, _amount);
}
function _birthWithSleeping(address _to, uint256 _amount) private {
uint256 startTokenId = _nextTokenId();
_mint(_to, _amount);
for (uint256 i = 0; i < _amount; i++) {
uint256 tokenId = startTokenId + i;
tokenLocation[tokenId] = DataType.TokenLocation.Operator;
}
}
// =============================================================
// OTHER FUNCTION
// =============================================================
function setMaxSupply(uint256 _value) external onlyRole(ADMIN_ROLE) {
maxSupply = _value;
}
}
contract ZuttoMamo is ZuttoMamoAdmin, RevokableDefaultOperatorFilterer {
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor() ERC721A("ZUTTO MAMORU", "ZM") {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
_grantRole(ADMIN_ROLE, msg.sender);
_grantRole(METADATA_ROLE, msg.sender);
_setDefaultRoyalty(royaltyAddress, royaltyFee);
}
// =============================================================
// OVERRIDES ERC721RESTRICT APPROVE
// =============================================================
function getLocalContractAllowList() external view returns (address[] memory) {
return _getLocalContractAllowList();
}
// =============================================================
// OVERRIDES ERC721LOCKABLE
// =============================================================
function setTokenLock(uint256[] calldata _tokenIds, LockStatus _newLockStatus) external {
require(_tokenIds.length > 0, "tokenIds must be greater than 0");
for (uint256 i = 0; i < _tokenIds.length; i++) {
require(msg.sender == ownerOf(_tokenIds[i]), "not owner");
}
for (uint256 i = 0; i < _tokenIds.length; i++) {
if (_isTokenLockToUnlock(_tokenIds[i], _newLockStatus)) {
unlockTokenTimestamp[_tokenIds[i]] = block.timestamp;
}
}
_setTokenLock(_tokenIds, _newLockStatus);
for (uint256 i = 0; i < _tokenIds.length; i++) {
emit MetadataUpdate(_tokenIds[i]);
}
}
function setWalletLock(address _to, LockStatus _lockStatus) external {
require(msg.sender == _to, "only yourself");
if (walletLock[_to] == LockStatus.Lock && _lockStatus != LockStatus.Lock) {
unlockWalletTimestamp[_to] = block.timestamp;
}
_setWalletLock(_to, _lockStatus);
}
function _isTokenLockToUnlock(uint256 _tokenId, LockStatus _newLockStatus) private view returns (bool) {
if (_newLockStatus == LockStatus.UnLock) {
LockStatus currentWalletLock = walletLock[msg.sender];
bool isWalletLock_TokenLockOrUnset = (currentWalletLock == LockStatus.Lock &&
tokenLock[_tokenId] != LockStatus.UnLock);
bool isWalletUnlockOrUnset_TokenLock = (currentWalletLock != LockStatus.Lock &&
tokenLock[_tokenId] == LockStatus.Lock);
return isWalletLock_TokenLockOrUnset || isWalletUnlockOrUnset_TokenLock;
} else if (_newLockStatus == LockStatus.UnSet) {
LockStatus currentWalletLock = walletLock[msg.sender];
bool isNotWalletLock = currentWalletLock != LockStatus.Lock;
bool isTokenLock = tokenLock[_tokenId] == LockStatus.Lock;
return isNotWalletLock && isTokenLock;
} else {
return false;
}
}
function _isTokenTimeLock(uint256 _tokenId) private view returns (bool) {
return unlockTokenTimestamp[_tokenId] + unlockLeadTime > block.timestamp;
}
function _isWalletTimeLock(uint256 _tokenId) private view returns (bool) {
return unlockWalletTimestamp[ownerOf(_tokenId)] + unlockLeadTime > block.timestamp;
}
function isLocked(uint256 _tokenId) public view override(IERC721Lockable, ERC721Lockable) returns (bool) {
return ERC721Lockable.isLocked(_tokenId) || _isTokenTimeLock(_tokenId) || _isWalletTimeLock(_tokenId);
}
// =============================================================
// ERC-5192PL CONNECTOR
// =============================================================
function _afterParentTokenTransfer(DataType.AfterParentTokenTransferParams memory _params) private {
for (uint256 i = 0; i < _params.totalAmountParentLinkSbtContracts; i++) {
address parentLinkSbtContract = connector.getParentLinkSbtContractByIndex(_params.tokenId, i);
uint256 parentLinkSbtTokenId = connector.getParentLinkSbtTokenByIndex(_params.tokenId, parentLinkSbtContract, 0);
require(_params.to == ownerOfParentLinkSbt(parentLinkSbtContract, parentLinkSbtTokenId), "not token owner");
IParentLinkSbt(parentLinkSbtContract).setIsTokenUnLocked(parentLinkSbtTokenId, true);
IERC721(parentLinkSbtContract).transferFrom(_params.from, _params.to, parentLinkSbtTokenId);
}
}
/**
* @dev Returns the owner's address by retrieving the token ID associated with the parent link sbt.
*/
function ownerOfParentLinkSbt(
address _parentLinkSbtContract,
uint256 _parentLinkSbtTokenId
) public view returns (address parentTokenOwner) {
uint256 parentTokenId = connector.getParentLinkSbtTokenOwnerId(_parentLinkSbtContract, _parentLinkSbtTokenId);
require(
parentTokenId > 0 ||
connector.getParentLinkSbtTokenIndex(parentTokenId, _parentLinkSbtContract, _parentLinkSbtTokenId) > 0,
"not parent link sbt token"
);
return ownerOf(parentTokenId);
}
// =============================================================
// ERC-721A OVERRIDE
// =============================================================
function _mint(address _to, uint256 _quantity) internal override {
require(_quantity + totalSupply() <= maxSupply, "claim is over the max supply");
super._mint(_to, _quantity);
}
function setApprovalForAll(
address operator,
bool approved
) public override(ERC721AntiScam, IERC721A) onlyAllowedOperatorApproval(operator) {
super.setApprovalForAll(operator, approved);
}
function approve(
address operator,
uint256 tokenId
) public payable override(ERC721AntiScam, IERC721A) onlyAllowedOperatorApproval(operator) {
super.approve(operator, tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* If parent link sbt are tied to Zuttomamo NFT, they are moved together.
*/
function transferFrom(
address _from,
address _to,
uint256 _tokenId
) public payable virtual override(ERC721A, IERC721A) onlyAllowedOperator(_from) {
uint256 totalAmountParentLinkSbtContracts = address(connector) != address(0)
? connector.getTotalParentLinkSbtContracts(_tokenId)
: 0;
super.transferFrom(_from, _to, _tokenId);
if (totalAmountParentLinkSbtContracts != 0) {
_afterParentTokenTransfer(
DataType.AfterParentTokenTransferParams(_from, _to, _tokenId, totalAmountParentLinkSbtContracts)
);
}
}
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
) public payable override(ERC721A, IERC721A) onlyAllowedOperator(_from) {
super.safeTransferFrom(_from, _to, _tokenId);
}
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
) public payable override(ERC721A, IERC721A) onlyAllowedOperator(_from) {
super.safeTransferFrom(_from, _to, _tokenId, _data);
}
function owner() public view virtual override(Ownable, UpdatableOperatorFilterer) returns (address) {
return Ownable.owner();
}
function tokenURI(uint256 tokenId) public view virtual override(ERC721A, IERC721A) returns (string memory) {
require(_exists(tokenId), "URI query for nonexistent token");
return zuttoMamoStage.tokenURI(tokenId);
}
/**
* @dev Hook that is called after a set of serially-ordered token IDs
* have been transferred. This includes minting.
* And also called after one token has been burned.
* If the transferred token ID is in sleep mode, the current time is set.
*/
function _afterTokenTransfers(address _from, address _to, uint256 _tokenId, uint256 _quantity) internal override {
if (tokenLocation[_tokenId] == DataType.TokenLocation.Operator) {
if (zuttoMamoStage.getTimeGrowingUpToHighSchooler() <= block.timestamp) {
zuttoMamoStage.setHighSchoolerLock(_tokenId);
}
tokenLocation[_tokenId] = DataType.TokenLocation.Other;
}
super._afterTokenTransfers(_from, _to, _tokenId, _quantity);
}
function exists(uint256 tokenId) public view virtual returns (bool) {
return _exists(tokenId);
}
function nextTokenId() external view returns (uint256) {
return _nextTokenId();
}
function _startTokenId() internal view virtual override returns (uint256) {
return 1;
}
// =============================================================
// GET FUNCTION
// =============================================================
function getTokenLocation(uint256 _tokenId) external view returns (DataType.TokenLocation) {
return tokenLocation[_tokenId];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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);
}// 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;
}
}// 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;
}
}// 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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 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 10, 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 * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.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 `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);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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.
*
* ```
* 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;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
interface IContractAllowListProxy {
function isAllowed(address _transferer, uint256 _level)
external
view
returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "./IERC721AntiScam.sol";
import "./lockable/ERC721Lockable.sol";
import "./restrictApprove/ERC721RestrictApprove.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title AntiScam機能付きERC721A
/// @dev Readmeを見てください。
abstract contract ERC721AntiScam is IERC721AntiScam, ERC721Lockable, ERC721RestrictApprove, Ownable {
/*///////////////////////////////////////////////////////////////
OVERRIDES
//////////////////////////////////////////////////////////////*/
function isApprovedForAll(
address owner,
address operator
) public view virtual override(ERC721Lockable, ERC721RestrictApprove) returns (bool) {
if (isLocked(owner) || !_isAllowed(owner, operator)) {
return false;
}
return super.isApprovedForAll(owner, operator);
}
function setApprovalForAll(
address operator,
bool approved
) public virtual override(ERC721Lockable, ERC721RestrictApprove) {
require(isLocked(msg.sender) == false || approved == false, "Can not approve locked token");
require(_isAllowed(operator) || approved == false, "RestrictApprove: Can not approve locked token");
super.setApprovalForAll(operator, approved);
}
function _beforeApprove(
address to,
uint256 tokenId
) internal virtual override(ERC721Lockable, ERC721RestrictApprove) {
ERC721Lockable._beforeApprove(to, tokenId);
ERC721RestrictApprove._beforeApprove(to, tokenId);
}
function approve(address to, uint256 tokenId) public payable virtual override(ERC721Lockable, ERC721RestrictApprove) {
_beforeApprove(to, tokenId);
ERC721A.approve(to, tokenId);
}
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override(ERC721A, ERC721Lockable) {
ERC721Lockable._beforeTokenTransfers(from, to, startTokenId, quantity);
}
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override(ERC721Lockable, ERC721RestrictApprove) {
ERC721Lockable._afterTokenTransfers(from, to, startTokenId, quantity);
ERC721RestrictApprove._afterTokenTransfers(from, to, startTokenId, quantity);
}
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC721Lockable, ERC721RestrictApprove) returns (bool) {
return
ERC721A.supportsInterface(interfaceId) ||
ERC721Lockable.supportsInterface(interfaceId) ||
ERC721RestrictApprove.supportsInterface(interfaceId) ||
interfaceId == type(IERC721AntiScam).interfaceId;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "./lockable/IERC721Lockable.sol";
import "./restrictApprove/IERC721RestrictApprove.sol";
/// @title IERC721AntiScam
/// @dev 詐欺防止機能付きコントラクトのインターフェース
/// @author hayatti.eth
interface IERC721AntiScam is IERC721Lockable, IERC721RestrictApprove {
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "erc721a/contracts/extensions/ERC721AQueryable.sol";
import "./IERC721Lockable.sol";
/// @title トークンのtransfer抑止機能付きコントラクト
/// @dev Readmeを見てください。
abstract contract ERC721Lockable is ERC721AQueryable, IERC721Lockable {
/*//////////////////////////////////////////////////////////////
ロック変数。トークンごとに個別ロック設定を行う
//////////////////////////////////////////////////////////////*/
bool public enableLock = false;
LockStatus public contractLockStatus = LockStatus.UnLock;
// token lock
mapping(uint256 => LockStatus) public tokenLock;
// wallet lock
mapping(address => LockStatus) public walletLock;
/*//////////////////////////////////////////////////////////////
modifier
//////////////////////////////////////////////////////////////*/
modifier existToken(uint256 tokenId) {
require(_exists(tokenId), "Lockable: locking query for nonexistent token");
_;
}
/*///////////////////////////////////////////////////////////////
ロック機能ロジック
//////////////////////////////////////////////////////////////*/
// function getLockStatus(uint256 tokenId) external view returns (LockStatus) existToken(tokenId) {
// return _getLockStatus(ownerOf(tokenId), tokenId);
// }
function isLocked(uint256 tokenId) public view virtual existToken(tokenId) returns (bool) {
if (!enableLock) {
return false;
}
if (
tokenLock[tokenId] == LockStatus.Lock || (tokenLock[tokenId] == LockStatus.UnSet && isLocked(ownerOf(tokenId)))
) {
return true;
}
return false;
}
function isLocked(address holder) public view virtual returns (bool) {
if (!enableLock) {
return false;
}
if (
walletLock[holder] == LockStatus.Lock ||
(walletLock[holder] == LockStatus.UnSet && contractLockStatus == LockStatus.Lock)
) {
return true;
}
return false;
}
function getTokensUnderLock() public view virtual returns (uint256[] memory) {
uint256 start = _startTokenId();
uint256 end = _nextTokenId();
return getTokensUnderLock(start, end);
}
function getTokensUnderLock(uint256 start, uint256 end) public view virtual returns (uint256[] memory) {
bool[] memory lockList = new bool[](end - start + 1);
uint256 i = 0;
uint256 lockCount = 0;
for (uint256 tokenId = start; tokenId <= end; tokenId++) {
if (_exists(tokenId) && isLocked(tokenId)) {
lockList[i] = true;
lockCount++;
} else {
lockList[i] = false;
}
i++;
}
uint256[] memory tokensUnderLock = new uint256[](lockCount);
i = 0;
uint256 j = 0;
for (uint256 tokenId = start; tokenId <= end; tokenId++) {
if (lockList[i]) {
tokensUnderLock[j] = tokenId;
j++;
}
i++;
}
return tokensUnderLock;
}
function _deleteTokenLock(uint256 tokenId) internal virtual {
delete tokenLock[tokenId];
}
function _setTokenLock(uint256[] calldata tokenIds, LockStatus lockStatus) internal virtual {
for (uint256 i = 0; i < tokenIds.length; i++) {
tokenLock[tokenIds[i]] = lockStatus;
emit TokenLock(ownerOf(tokenIds[i]), tokenIds[i], lockStatus, block.timestamp);
}
}
function _setWalletLock(address to, LockStatus lockStatus) internal virtual {
walletLock[to] = lockStatus;
emit WalletLock(to, msg.sender, lockStatus);
}
function _setContractLock(LockStatus lockStatus) internal virtual {
contractLockStatus = lockStatus;
}
/*///////////////////////////////////////////////////////////////
OVERRIDES
//////////////////////////////////////////////////////////////*/
function isApprovedForAll(
address owner,
address operator
) public view virtual override(ERC721A, IERC721A) returns (bool) {
if (isLocked(owner)) {
return false;
}
return super.isApprovedForAll(owner, operator);
}
function setApprovalForAll(address operator, bool approved) public virtual override(ERC721A, IERC721A) {
require(isLocked(msg.sender) == false || approved == false, "Can not approve locked token");
super.setApprovalForAll(operator, approved);
}
function _beforeApprove(address /**to**/, uint256 tokenId) internal virtual {
require(isLocked(tokenId) == false, "Lockable: Can not approve locked token");
}
function approve(address to, uint256 tokenId) public payable virtual override(ERC721A, IERC721A) {
_beforeApprove(to, tokenId);
super.approve(to, tokenId);
}
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 /*quantity*/
) internal virtual override {
// 転送やバーンにおいては、常にstartTokenIdは TokenIDそのものとなります。
if (from != address(0) && to != address(0)) {
// トークンがロックされている場合、転送を許可しない
require(isLocked(startTokenId) == false, "Lockable: Can not transfer locked token");
}
}
function _afterTokenTransfers(
address from,
address /*to*/,
uint256 startTokenId,
uint256 /*quantity*/
) internal virtual override {
// 転送やバーンにおいては、常にstartTokenIdは TokenIDそのものとなります。
if (from != address(0)) {
// ロックをデフォルトに戻す。
_deleteTokenLock(startTokenId);
}
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, IERC721A) returns (bool) {
return interfaceId == type(IERC721Lockable).interfaceId || super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/**
* @title IERC721Lockable
* @dev トークンのtransfer抑止機能付きコントラクトのインターフェース
* @author Lavulite
*/
interface IERC721Lockable {
enum LockStatus {
UnSet,
UnLock,
Lock
}
/**
* @dev 個別ロックが指定された場合のイベント
*/
// event TokenLock(address indexed holder, address indexed operator, LockStatus lockStatus, uint256 indexed tokenId);
event TokenLock(address indexed holder, uint256 indexed tokenId, LockStatus indexed lockStatus, uint256 timestamp);
/**
* @dev ウォレットロックが指定された場合のイベント
*/
event WalletLock(address indexed holder, address indexed operator, LockStatus lockStatus);
/**
* @dev 該当トークンIDのロックステータスを変更する。
*/
function setTokenLock(uint256[] calldata tokenIds, LockStatus lockStatus) external;
/**
* @dev 該当ウォレットのロックステータスを変更する。
*/
function setWalletLock(address to, LockStatus lockStatus) external;
/**
* @dev コントラクトのロックステータスを変更する。
*/
function setContractLock(LockStatus lockStatus) external;
/**
* @dev 該当トークンIDがロックされているかを返す
*/
function isLocked(uint256 tokenId) external view returns (bool);
/**
* @dev ウォレットロックを行っているかを返す
*/
function isLocked(address holder) external view returns (bool);
/**
* @dev 転送が拒否されているトークンを全て返す
*/
function getTokensUnderLock() external view returns (uint256[] memory);
/**
* @dev 転送が拒否されているstartからstopまでのトークンIDを返す
*/
function getTokensUnderLock(uint256 start, uint256 end) external view returns (uint256[] memory);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "erc721a/contracts/extensions/ERC721AQueryable.sol";
import "contract-allow-list/contracts/proxy/interface/IContractAllowListProxy.sol";
import "./IERC721RestrictApprove.sol";
/// @title AntiScam機能付きERC721A
/// @dev Readmeを見てください。
abstract contract ERC721RestrictApprove is ERC721AQueryable, IERC721RestrictApprove {
using EnumerableSet for EnumerableSet.AddressSet;
IContractAllowListProxy public CAL;
EnumerableSet.AddressSet localAllowedAddresses;
modifier onlyHolder(uint256 tokenId) {
require(msg.sender == ownerOf(tokenId), "RestrictApprove: operation is only holder.");
_;
}
/*//////////////////////////////////////////////////////////////
変数
//////////////////////////////////////////////////////////////*/
bool public enableRestrict = true;
// token lock
mapping(uint256 => uint256) public tokenCALLevel;
// wallet lock
mapping(address => uint256) public walletCALLevel;
// contract lock
uint256 public CALLevel = 1;
/*///////////////////////////////////////////////////////////////
Approve抑制機能ロジック
//////////////////////////////////////////////////////////////*/
function _addLocalContractAllowList(address transferer) internal virtual {
localAllowedAddresses.add(transferer);
emit LocalCalAdded(msg.sender, transferer);
}
function _removeLocalContractAllowList(address transferer) internal virtual {
localAllowedAddresses.remove(transferer);
emit LocalCalRemoved(msg.sender, transferer);
}
function _getLocalContractAllowList() internal view virtual returns (address[] memory) {
return localAllowedAddresses.values();
}
function _isLocalAllowed(address transferer) internal view virtual returns (bool) {
return localAllowedAddresses.contains(transferer);
}
function _isAllowed(address transferer) internal view virtual returns (bool) {
return _isAllowed(msg.sender, transferer);
}
function _isAllowed(uint256 tokenId, address transferer) internal view virtual returns (bool) {
uint256 level = _getCALLevel(msg.sender, tokenId);
return _isAllowed(transferer, level);
}
function _isAllowed(address holder, address transferer) internal view virtual returns (bool) {
uint256 level = _getCALLevel(holder);
return _isAllowed(transferer, level);
}
function _isAllowed(address transferer, uint256 level) internal view virtual returns (bool) {
if (!enableRestrict) {
return true;
}
return _isLocalAllowed(transferer) || CAL.isAllowed(transferer, level);
}
function _getCALLevel(address holder, uint256 tokenId) internal view virtual returns (uint256) {
if (tokenCALLevel[tokenId] > 0) {
return tokenCALLevel[tokenId];
}
return _getCALLevel(holder);
}
function _getCALLevel(address holder) internal view virtual returns (uint256) {
if (walletCALLevel[holder] > 0) {
return walletCALLevel[holder];
}
return CALLevel;
}
function _setCAL(address _cal) internal virtual {
CAL = IContractAllowListProxy(_cal);
}
function _deleteTokenCALLevel(uint256 tokenId) internal virtual {
delete tokenCALLevel[tokenId];
}
function setTokenCALLevel(uint256 tokenId, uint256 level) external virtual onlyHolder(tokenId) {
tokenCALLevel[tokenId] = level;
}
function setWalletCALLevel(uint256 level) external virtual {
walletCALLevel[msg.sender] = level;
}
/*///////////////////////////////////////////////////////////////
OVERRIDES
//////////////////////////////////////////////////////////////*/
function isApprovedForAll(
address owner,
address operator
) public view virtual override(ERC721A, IERC721A) returns (bool) {
if (_isAllowed(owner, operator) == false) {
return false;
}
return super.isApprovedForAll(owner, operator);
}
function setApprovalForAll(address operator, bool approved) public virtual override(ERC721A, IERC721A) {
require(_isAllowed(operator) || approved == false, "RestrictApprove: Can not approve locked token");
super.setApprovalForAll(operator, approved);
}
function _beforeApprove(address to, uint256 tokenId) internal virtual {
if (to != address(0)) {
require(_isAllowed(tokenId, to), "RestrictApprove: The contract is not allowed.");
}
}
function approve(address to, uint256 tokenId) public payable virtual override(ERC721A, IERC721A) {
_beforeApprove(to, tokenId);
super.approve(to, tokenId);
}
function _afterTokenTransfers(
address from,
address /*to*/,
uint256 startTokenId,
uint256 /*quantity*/
) internal virtual override {
// 転送やバーンにおいては、常にstartTokenIdは TokenIDそのものとなります。
if (from != address(0)) {
// CALレベルをデフォルトに戻す。
_deleteTokenCALLevel(startTokenId);
}
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, IERC721A) returns (bool) {
return interfaceId == type(IERC721RestrictApprove).interfaceId || super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/// @title IERC721RestrictApprove
/// @dev Approve抑制機能付きコントラクトのインターフェース
/// @author Lavulite
interface IERC721RestrictApprove {
/**
* @dev CALレベルが変更された場合のイベント
*/
event CalLevelChanged(address indexed operator, uint256 indexed level);
/**
* @dev LocalContractAllowListnに追加された場合のイベント
*/
event LocalCalAdded(address indexed operator, address indexed transferer);
/**
* @dev LocalContractAllowListnに削除された場合のイベント
*/
event LocalCalRemoved(address indexed operator, address indexed transferer);
/**
* @dev CALを利用する場合のCALのレベルを設定する。レベルが高いほど、許可されるコントラクトの範囲が狭い。
*/
function setCALLevel(uint256 level) external;
/**
* @dev CALのアドレスをセットする。
*/
function setCAL(address calAddress) external;
/**
* @dev CALのリストに無い独自の許可アドレスを追加する場合、こちらにアドレスを記載する。
*/
function addLocalContractAllowList(address transferer) external;
/**
* @dev CALのリストにある独自の許可アドレスを削除する場合、こちらにアドレスを記載する。
*/
function removeLocalContractAllowList(address transferer) external;
/**
* @dev CALのリストにある独自の許可アドレスの一覧を取得する。
*/
function getLocalContractAllowList() external view returns (address[] memory);
}// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.7.0 <0.9.0;
import { IERC721A } from "erc721a/contracts/interfaces/IERC721A.sol";
/// @title EIP-721 Metadata Update Extension
interface IERC4906 is IERC721A {
/// @dev This event emits when the metadata of a token is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFT.
event MetadataUpdate(uint256 _tokenId);
/// @dev This event emits when the metadata of a range of tokens is changed.
/// So that the third-party platforms such as NFT market could
/// timely update the images and related attributes of the NFTs.
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
}// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.7.0 <0.9.0;
interface IERC5192 {
/// @notice Emitted when the locking status is changed to locked.
/// @dev If a token is minted and the status is locked, this event should be emitted.
/// @param tokenId The identifier for a token.
event Locked(uint256 tokenId);
/// @notice Emitted when the locking status is changed to unlocked.
/// @dev If a token is minted and the status is unlocked, this event should be emitted.
/// @param tokenId The identifier for a token.
event Unlocked(uint256 tokenId);
/// @notice Returns the locking status of an Soulbound Token
/// @dev SBTs assigned to zero address are considered invalid, and queries
/// about them do throw.
/// @param tokenId The identifier for an SBT.
function locked(uint256 tokenId) external view returns (bool);
}// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.7.0 <0.9.0;
import { IERC5192 } from "./IERC5192.sol";
/**
* @title IERC5192PL
* @dev Interface of ERC5192PL.
*/
interface IERC5192PL is IERC5192 {
/**
* @dev Cannot transfer when locked.
*/
error ErrLocked();
/**
* @dev Cannot transfer when token locked.
*/
error ErrTokenLocked();
/**
* @dev The token does not exist.
*/
error ErrNotFound();
/**
* @dev Cannot query set function for the null address.
*/
error ErrNullAddress();
/**
* @dev Error if not parent contract address.
*/
error ErrNotAllowtedAddress();
/**
* @dev Error if sale has not started.
*/
error ErrNotSaleActive();
/**
* @dev Unlock tokens only when called from the parent contract address.
*/
function setIsTokenUnLocked(uint256 _tokenId, bool _value) external;
/**
* @dev Set parent contract address.
*/
function setParentContractAddress(address _parentContractAddress) external;
}// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title IERC5192PLConnector
* @dev Interface to tie to parent.
*/
interface IERC5192PLConnector {
/**
* @dev Returns true/false values for the existence of NFTs associated with the parent.
*/
function isParentLinkSbtExists(
address _parentLinkSbtContract,
uint256 _parentLinkSbtTokenId
) external view returns (bool);
/**
* @dev Returns the parent's token ID.
*/
function getParentLinkSbtTokenOwnerId(
address _parentLinkSbtContract,
uint256 _parentLinkSbtTokenId
) external view returns (uint256);
/**
* @dev Returns the value of index.
*/
function getParentLinkSbtTokenIndex(
uint256 _parentTokenId,
address _parentLinkSbtContract,
uint256 _parentLinkSbtTokenId
) external view returns (uint256);
/**
* @dev Returns the number of contracts associated with the parent token ID.
*/
function getTotalParentLinkSbtContracts(uint256 _tokenId) external view returns (uint256);
/**
* @dev Returns the number of token IDs associated with the parent token ID.
*/
function getTotalParentLinkSbtTokens(
uint256 _tokenId,
address _parentLinkSbtContract
) external view returns (uint256);
/**
* @dev Returns the contract address associated with the parent.
*/
function getParentLinkSbtContractByIndex(
uint256 _tokenId,
uint256 _index
) external view returns (address parentLinkSbtContract);
/**
* @dev Returns the token ID associated with the parent.
*/
function getParentLinkSbtTokenByIndex(
uint256 _tokenId,
address _parentLinkSbtContract,
uint256 _index
) external view returns (uint256 parentLinkSbtTokenId);
}// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title IERC5192PLTop
* @dev Interface to be implemented in the parent NFT.
*/
interface IERC5192PLTop {
/**
* @dev Returns the owner address of the NFT associated with the parent。
*/
function ownerOfParentLinkSbt(
address _parentLinkSbtContract,
uint256 _parentLinkSbtTokenId
) external view returns (address parentTokenOwner);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import { IERC5192PL } from "./IERC5192PL.sol";
interface IParentLinkSbt is IERC5192PL {
function exists(uint256 tokenId) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import { IERC721A } from "erc721a/contracts/interfaces/IERC721A.sol";
import { IERC5192PLTop } from "./IERC5192PLTop.sol";
import { IERC721Lockable } from "../base/ERC721AntiScam/lockable/IERC721Lockable.sol";
import { DataType } from "../lib/type/DataType.sol";
interface IZuttoMamo is IERC721A, IERC721Lockable, IERC5192PLTop {
function getTokenLocation(uint256 _tokenId) external view returns (DataType.TokenLocation);
function refreshMetadata(uint256 _tokenId) external;
function refreshMetadata(uint256 _fromTokenId, uint256 _toTokenId) external;
function birth(address _to, uint256 _amount) external;
function birthWithSleeping(address _to, uint256 _amount) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import { DataType } from "../lib/type/DataType.sol";
interface IZuttoMamoStage {
function tokenURI(uint256 tokenId) external view returns (string memory);
function isHighSchooler(uint256 _tokenId) external view returns (bool);
function isWorkingAdult(uint256 _tokenId) external view returns (bool);
function isElapsedTimeWorkingAdult(uint256 _tokenId) external view returns (bool);
function isMarriage(uint256 _tokenId) external view returns (bool);
function isElapsedTimeMarriage(uint256 _tokenId) external view returns (bool);
function isFamily(uint256 _tokenId) external view returns (bool);
function isOldAge(uint256 _tokenId) external view returns (bool);
function isTomb(uint256 _tokenId) external view returns (bool);
function setHighSchoolerLock(uint256 _tokenId) external;
function setFamilyLock(uint256 _tokenId) external;
function setOldAgeLock(uint256 _tokenId) external;
function setTombLock(uint256 _tokenId) external;
function getTimeGrowingUpToHighSchooler() external view returns (uint256);
function getTimeGrowingUpToFamily() external view returns (uint256);
function getTimeGrowingUpToOldAge() external view returns (uint256);
function getTimeGrowingUpToTomb() external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
library DataType {
enum TokenLocation {
Operator,
Other
}
enum LockStatus {
UnLock,
Lock
}
struct AfterParentTokenTransferParams {
address from;
address to;
uint256 tokenId;
uint256 totalAmountParentLinkSbtContracts;
}
struct CreateParentLinkSbtParams {
string name;
string symbol;
string baseUri;
address ownerAddress;
address parentContractAddress;
}
struct ConnectParentLinkSbtParams {
uint256 tokenId;
address parentLinkSbtContract;
uint256 parentLinkSbtTokenId;
}
struct AllStageParams {
uint256 highSchooler;
uint256 workingAdult;
uint256 marriage;
uint256 family;
uint256 oldAge;
uint256 tomb;
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721A.sol';
/**
* @dev Interface of ERC721 token receiver.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC721A
*
* @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
* Non-Fungible Token Standard, including the Metadata extension.
* Optimized for lower gas during batch mints.
*
* Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
* starting from `_startTokenId()`.
*
* Assumptions:
*
* - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
* - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is IERC721A {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =============================================================
// Mask of an entry in packed address data.
uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant _BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant _BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant _BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant _BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant _BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// STORAGE
// =============================================================
// The next token ID to be minted.
uint256 private _currentIndex;
// The number of tokens burned.
uint256 private _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned.
// See {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
// - [232..255] `extraData`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// Mapping from token ID to approved address.
mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view virtual returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() public view virtual override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than `_currentIndex - _startTokenId()` times.
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return _burnCounter;
}
// =============================================================
// ADDRESS DATA OPERATIONS
// =============================================================
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
}
/**
* Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal virtual {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
auxCasted := aux
}
packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
_packedAddressData[owner] = packed;
}
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes
// of the XOR of all function selectors in the interface.
// See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
// (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
return
interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the token collection symbol.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, it can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
// =============================================================
// OWNERSHIPS OPERATIONS
// =============================================================
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around over time.
*/
function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
// Invariant:
// There will always be an initialized ownership slot
// (i.e. `ownership.addr != address(0) && ownership.burned == false`)
// before an unintialized ownership slot
// (i.e. `ownership.addr == address(0) && ownership.burned == false`)
// Hence, `curr` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
while (packed == 0) {
packed = _packedOwnerships[--curr];
}
return packed;
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
ownership.burned = packed & _BITMASK_BURNED != 0;
ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
}
/**
* @dev Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @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) public payable virtual override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId].value;
}
/**
* @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) public virtual override {
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @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. See {_mint}.
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return
_startTokenId() <= tokenId &&
tokenId < _currentIndex && // If within bounds,
_packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
}
/**
* @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
*/
function _isSenderApprovedOrOwner(
address approvedAddress,
address owner,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, _BITMASK_ADDRESS)
// `msgSender == owner || msgSender == approvedAddress`.
result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
}
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
to,
_BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @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 memory _data
) public payable virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @dev Hook that is called before a set of serially-ordered token IDs
* are about to be transferred. This includes minting.
* And also called before burning one token.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* 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, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token IDs
* have been transferred. This includes minting.
* And also called after one token has been burned.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* `from` - Previous owner of the given token ID.
* `to` - Target address that will receive the token.
* `tokenId` - Token ID to be transferred.
* `_data` - Optional data to send along with the call.
*
* Returns whether the call correctly returned the expected magic value.
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
// =============================================================
// MINT OPERATIONS
// =============================================================
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
uint256 toMasked;
uint256 end = startTokenId + quantity;
// Use assembly to loop and emit the `Transfer` event for gas savings.
// The duplicated `log4` removes an extra check and reduces stack juggling.
// The assembly, together with the surrounding Solidity code, have been
// delicately arranged to nudge the compiler into producing optimized opcodes.
assembly {
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
toMasked := and(to, _BITMASK_ADDRESS)
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
startTokenId // `tokenId`.
)
// The `iszero(eq(,))` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
// The compiler will optimize the `iszero` away for performance.
for {
let tokenId := add(startTokenId, 1)
} iszero(eq(tokenId, end)) {
tokenId := add(tokenId, 1)
} {
// Emit the `Transfer` event. Similar to above.
log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
}
}
if (toMasked == 0) revert MintToZeroAddress();
_currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
_currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = _currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) revert();
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
// =============================================================
// BURN OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_burn(tokenId, false)`.
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
from,
(_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
// =============================================================
// EXTRA DATA OPERATIONS
// =============================================================
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = _packedOwnerships[index];
if (packed == 0) revert OwnershipNotInitializedForExtraData();
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
_packedOwnerships[index] = packed;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* 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, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual returns (uint24) {}
/**
* @dev Returns the next extra data for the packed ownership data.
* The returned result is shifted into position.
*/
function _nextExtraData(
address from,
address to,
uint256 prevOwnershipPacked
) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
}
// =============================================================
// OTHER OPERATIONS
// =============================================================
/**
* @dev Returns the message sender (defaults to `msg.sender`).
*
* If you are writing GSN compatible contracts, you need to override this function.
*/
function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
/**
* @dev Converts a uint256 to its ASCII string decimal representation.
*/
function _toString(uint256 value) internal pure virtual returns (string memory str) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
// We will need 1 word for the trailing zeros padding, 1 word for the length,
// and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
let m := add(mload(0x40), 0xa0)
// Update the free memory pointer to allocate.
mstore(0x40, m)
// Assign the `str` to the end.
str := sub(m, 0x20)
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end of the memory to calculate the length later.
let end := str
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// prettier-ignore
for { let temp := value } 1 {} {
str := sub(str, 1)
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
// prettier-ignore
if iszero(temp) { break }
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721AQueryable.sol';
import '../ERC721A.sol';
/**
* @title ERC721AQueryable.
*
* @dev ERC721A subclass with convenience query functions.
*/
abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) {
TokenOwnership memory ownership;
if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) {
return ownership;
}
ownership = _ownershipAt(tokenId);
if (ownership.burned) {
return ownership;
}
return _ownershipOf(tokenId);
}
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(uint256[] calldata tokenIds)
external
view
virtual
override
returns (TokenOwnership[] memory)
{
unchecked {
uint256 tokenIdsLength = tokenIds.length;
TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength);
for (uint256 i; i != tokenIdsLength; ++i) {
ownerships[i] = explicitOwnershipOf(tokenIds[i]);
}
return ownerships;
}
}
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view virtual override returns (uint256[] memory) {
unchecked {
if (start >= stop) revert InvalidQueryRange();
uint256 tokenIdsIdx;
uint256 stopLimit = _nextTokenId();
// Set `start = max(start, _startTokenId())`.
if (start < _startTokenId()) {
start = _startTokenId();
}
// Set `stop = min(stop, stopLimit)`.
if (stop > stopLimit) {
stop = stopLimit;
}
uint256 tokenIdsMaxLength = balanceOf(owner);
// Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`,
// to cater for cases where `balanceOf(owner)` is too big.
if (start < stop) {
uint256 rangeLength = stop - start;
if (rangeLength < tokenIdsMaxLength) {
tokenIdsMaxLength = rangeLength;
}
} else {
tokenIdsMaxLength = 0;
}
uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength);
if (tokenIdsMaxLength == 0) {
return tokenIds;
}
// We need to call `explicitOwnershipOf(start)`,
// because the slot at `start` may not be initialized.
TokenOwnership memory ownership = explicitOwnershipOf(start);
address currOwnershipAddr;
// If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`.
// `ownership.address` will not be zero, as `start` is clamped to the valid token ID range.
if (!ownership.burned) {
currOwnershipAddr = ownership.addr;
}
for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) {
ownership = _ownershipAt(i);
if (ownership.burned) {
continue;
}
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
tokenIds[tokenIdsIdx++] = i;
}
}
// Downsize the array to fit.
assembly {
mstore(tokenIds, tokenIdsIdx)
}
return tokenIds;
}
}
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
unchecked {
uint256 tokenIdsIdx;
address currOwnershipAddr;
uint256 tokenIdsLength = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenIdsLength);
TokenOwnership memory ownership;
for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
ownership = _ownershipAt(i);
if (ownership.burned) {
continue;
}
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
tokenIds[tokenIdsIdx++] = i;
}
}
return tokenIds;
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import '../IERC721A.sol';
/**
* @dev Interface of ERC721AQueryable.
*/
interface IERC721AQueryable is IERC721A {
/**
* Invalid query range (`start` >= `stop`).
*/
error InvalidQueryRange();
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view returns (uint256[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view returns (uint256[] memory);
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the
* ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() external view returns (uint256);
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
// =============================================================
// IERC721
// =============================================================
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables
* (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`,
* checking first that contract recipients are aware of the ERC721 protocol
* to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move
* this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external payable;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom}
* whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @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 payable;
/**
* @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);
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @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);
// =============================================================
// IERC2309
// =============================================================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId`
* (inclusive) is transferred from `from` to `to`, as defined in the
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol';
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IOperatorFilterRegistry {
/**
* @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns
* true if supplied registrant address is not registered.
*/
function isOperatorAllowed(address registrant, address operator) external view returns (bool);
/**
* @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.
*/
function register(address registrant) external;
/**
* @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes.
*/
function registerAndSubscribe(address registrant, address subscription) external;
/**
* @notice Registers an address with the registry and copies the filtered operators and codeHashes from another
* address without subscribing.
*/
function registerAndCopyEntries(address registrant, address registrantToCopy) external;
/**
* @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.
* Note that this does not remove any filtered addresses or codeHashes.
* Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.
*/
function unregister(address addr) external;
/**
* @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.
*/
function updateOperator(address registrant, address operator, bool filtered) external;
/**
* @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.
*/
function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
/**
* @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.
*/
function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
/**
* @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.
*/
function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
/**
* @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous
* subscription if present.
* Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,
* subscriptions will not be forwarded. Instead the former subscription's existing entries will still be
* used.
*/
function subscribe(address registrant, address registrantToSubscribe) external;
/**
* @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.
*/
function unsubscribe(address registrant, bool copyExistingEntries) external;
/**
* @notice Get the subscription address of a given registrant, if any.
*/
function subscriptionOf(address addr) external returns (address registrant);
/**
* @notice Get the set of addresses subscribed to a given registrant.
* Note that order is not guaranteed as updates are made.
*/
function subscribers(address registrant) external returns (address[] memory);
/**
* @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.
* Note that order is not guaranteed as updates are made.
*/
function subscriberAt(address registrant, uint256 index) external returns (address);
/**
* @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.
*/
function copyEntriesOf(address registrant, address registrantToCopy) external;
/**
* @notice Returns true if operator is filtered by a given address or its subscription.
*/
function isOperatorFiltered(address registrant, address operator) external returns (bool);
/**
* @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.
*/
function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
/**
* @notice Returns true if a codeHash is filtered by a given address or its subscription.
*/
function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
/**
* @notice Returns a list of filtered operators for a given address or its subscription.
*/
function filteredOperators(address addr) external returns (address[] memory);
/**
* @notice Returns the set of filtered codeHashes for a given address or its subscription.
* Note that order is not guaranteed as updates are made.
*/
function filteredCodeHashes(address addr) external returns (bytes32[] memory);
/**
* @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or
* its subscription.
* Note that order is not guaranteed as updates are made.
*/
function filteredOperatorAt(address registrant, uint256 index) external returns (address);
/**
* @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or
* its subscription.
* Note that order is not guaranteed as updates are made.
*/
function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
/**
* @notice Returns true if an address has registered
*/
function isRegistered(address addr) external returns (bool);
/**
* @dev Convenience method to compute the code hash of an arbitrary contract
*/
function codeHashOf(address addr) external returns (bytes32);
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {RevokableOperatorFilterer} from "./RevokableOperatorFilterer.sol";
import {CANONICAL_CORI_SUBSCRIPTION, CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol";
/**
* @title RevokableDefaultOperatorFilterer
* @notice Inherits from RevokableOperatorFilterer and automatically subscribes to the default OpenSea subscription.
* Note that OpenSea will disable creator earnings enforcement if filtered operators begin fulfilling orders
* on-chain, eg, if the registry is revoked or bypassed.
*/
abstract contract RevokableDefaultOperatorFilterer is RevokableOperatorFilterer {
/// @dev The constructor that is called when the contract is being deployed.
constructor()
RevokableOperatorFilterer(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS, CANONICAL_CORI_SUBSCRIPTION, true)
{}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {UpdatableOperatorFilterer} from "./UpdatableOperatorFilterer.sol";
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
/**
* @title RevokableOperatorFilterer
* @notice This contract is meant to allow contracts to permanently skip OperatorFilterRegistry checks if desired. The
* Registry itself has an "unregister" function, but if the contract is ownable, the owner can re-register at
* any point. As implemented, this abstract contract allows the contract owner to permanently skip the
* OperatorFilterRegistry checks by calling revokeOperatorFilterRegistry. Once done, the registry
* address cannot be further updated.
* Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders
* on-chain, eg, if the registry is revoked or bypassed.
*/
abstract contract RevokableOperatorFilterer is UpdatableOperatorFilterer {
/// @dev Emitted when the registry has already been revoked.
error RegistryHasBeenRevoked();
/// @dev Emitted when the initial registry address is attempted to be set to the zero address.
error InitialRegistryAddressCannotBeZeroAddress();
event OperatorFilterRegistryRevoked();
bool public isOperatorFilterRegistryRevoked;
/// @dev The constructor that is called when the contract is being deployed.
constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe)
UpdatableOperatorFilterer(_registry, subscriptionOrRegistrantToCopy, subscribe)
{
// don't allow creating a contract with a permanently revoked registry
if (_registry == address(0)) {
revert InitialRegistryAddressCannotBeZeroAddress();
}
}
/**
* @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
* address, checks will be permanently bypassed, and the address cannot be updated again. OnlyOwner.
*/
function updateOperatorFilterRegistryAddress(address newRegistry) public override {
if (msg.sender != owner()) {
revert OnlyOwner();
}
// if registry has been revoked, do not allow further updates
if (isOperatorFilterRegistryRevoked) {
revert RegistryHasBeenRevoked();
}
operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
emit OperatorFilterRegistryAddressUpdated(newRegistry);
}
/**
* @notice Revoke the OperatorFilterRegistry address, permanently bypassing checks. OnlyOwner.
*/
function revokeOperatorFilterRegistry() public {
if (msg.sender != owner()) {
revert OnlyOwner();
}
// if registry has been revoked, do not allow further updates
if (isOperatorFilterRegistryRevoked) {
revert RegistryHasBeenRevoked();
}
// set to zero address to bypass checks
operatorFilterRegistry = IOperatorFilterRegistry(address(0));
isOperatorFilterRegistryRevoked = true;
emit OperatorFilterRegistryRevoked();
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
/**
* @title UpdatableOperatorFilterer
* @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
* registrant's entries in the OperatorFilterRegistry. This contract allows the Owner to update the
* OperatorFilterRegistry address via updateOperatorFilterRegistryAddress, including to the zero address,
* which will bypass registry checks.
* Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders
* on-chain, eg, if the registry is revoked or bypassed.
* @dev This smart contract is meant to be inherited by token contracts so they can use the following:
* - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
* - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
*/
abstract contract UpdatableOperatorFilterer {
/// @dev Emitted when an operator is not allowed.
error OperatorNotAllowed(address operator);
/// @dev Emitted when someone other than the owner is trying to call an only owner function.
error OnlyOwner();
event OperatorFilterRegistryAddressUpdated(address newRegistry);
IOperatorFilterRegistry public operatorFilterRegistry;
/// @dev The constructor that is called when the contract is being deployed.
constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe) {
IOperatorFilterRegistry registry = IOperatorFilterRegistry(_registry);
operatorFilterRegistry = registry;
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for the modifier to filter addresses.
if (address(registry).code.length > 0) {
if (subscribe) {
registry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
registry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
} else {
registry.register(address(this));
}
}
}
}
/**
* @dev A helper function to check if the operator is allowed.
*/
modifier onlyAllowedOperator(address from) virtual {
// Allow spending tokens from addresses with balance
// Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
// from an EOA.
if (from != msg.sender) {
_checkFilterOperator(msg.sender);
}
_;
}
/**
* @dev A helper function to check if the operator approval is allowed.
*/
modifier onlyAllowedOperatorApproval(address operator) virtual {
_checkFilterOperator(operator);
_;
}
/**
* @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
* address, checks will be bypassed. OnlyOwner.
*/
function updateOperatorFilterRegistryAddress(address newRegistry) public virtual {
if (msg.sender != owner()) {
revert OnlyOwner();
}
operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
emit OperatorFilterRegistryAddressUpdated(newRegistry);
}
/**
* @dev Assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract.
*/
function owner() public view virtual returns (address);
/**
* @dev A helper function to check if the operator is allowed.
*/
function _checkFilterOperator(address operator) internal view virtual {
IOperatorFilterRegistry registry = operatorFilterRegistry;
// Check registry code length to facilitate testing in environments without a deployed registry.
if (address(registry) != address(0) && address(registry).code.length > 0) {
// under normal circumstances, this function will revert rather than return false, but inheriting contracts
// may specify their own OperatorFilterRegistry implementations, which may behave differently
if (!registry.isOperatorAllowed(address(this), operator)) {
revert OperatorNotAllowed(operator);
}
}
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InitialRegistryAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"RegistryHasBeenRevoked","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"uint256","name":"level","type":"uint256"}],"name":"CalLevelChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"transferer","type":"address"}],"name":"LocalCalAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"transferer","type":"address"}],"name":"LocalCalRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newRegistry","type":"address"}],"name":"OperatorFilterRegistryAddressUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"OperatorFilterRegistryRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"TokenLock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"WalletLock","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CAL","outputs":[{"internalType":"contract IContractAllowListProxy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CALLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"METADATA_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_transferer","type":"address"}],"name":"addLocalContractAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_to","type":"address[]"},{"internalType":"uint256[]","name":"_quantity","type":"uint256[]"},{"internalType":"bool","name":"_withSleep","type":"bool"}],"name":"airdropMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"birth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"birthWithSleeping","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"connector","outputs":[{"internalType":"contract IERC5192PLConnector","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractLockStatus","outputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableLock","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableRestrict","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLocalContractAllowList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getTokenLocation","outputs":[{"internalType":"enum DataType.TokenLocation","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"getTokensUnderLock","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensUnderLock","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"grantAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOperatorFilterRegistryRevoked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilterRegistry","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_parentLinkSbtContract","type":"address"},{"internalType":"uint256","name":"_parentLinkSbtTokenId","type":"uint256"}],"name":"ownerOfParentLinkSbt","outputs":[{"internalType":"address","name":"parentTokenOwner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"refreshMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"refreshMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_transferer","type":"address"}],"name":"removeLocalContractAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"revokeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revokeOperatorFilterRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"royaltyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyFee","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_calAddress","type":"address"}],"name":"setCAL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_level","type":"uint256"}],"name":"setCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"_lockStatus","type":"uint8"}],"name":"setContractLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC5192PLConnector","name":"_address","type":"address"}],"name":"setERC5192PLConnector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_value","type":"bool"}],"name":"setEnableLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_value","type":"bool"}],"name":"setEnableRestrict","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyAddress","type":"address"}],"name":"setRoyaltyAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"_value","type":"uint96"}],"name":"setRoyaltyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"level","type":"uint256"}],"name":"setTokenCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"enum IERC721Lockable.LockStatus","name":"_newLockStatus","type":"uint8"}],"name":"setTokenLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"enum IERC721Lockable.LockStatus","name":"_lockStatus","type":"uint8"}],"name":"setTokenLockByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setUnlockLeadTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"level","type":"uint256"}],"name":"setWalletCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"enum IERC721Lockable.LockStatus","name":"_lockStatus","type":"uint8"}],"name":"setWalletLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IZuttoMamoStage","name":"_zuttoMamoStage","type":"address"}],"name":"setZuttoMamoStage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenCALLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenLock","outputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unlockLeadTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newRegistry","type":"address"}],"name":"updateOperatorFilterRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"walletCALLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"walletLock","outputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zuttoMamoStage","outputs":[{"internalType":"contract IZuttoMamoStage","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
608060405261145a600255612a306003557f853dac8e9115e30220857c8bdb4486e34ba93fea0000000000000000000003e86004556010805461ffff19166101001790556016805460ff191660019081179091556019553480156200006357600080fd5b506daaeb6d7670e522a718067333cd4e733cc6cdda760b79bafa08df41ecfa224f810dceb660018282826040518060400160405280600c81526020016b5a5554544f204d414d4f525560a01b815250604051806040016040528060028152602001615a4d60f01b81525081600a9081620000de9190620005fd565b50600b620000ed8282620005fd565b5050600160085550620001003362000311565b601e80546001600160a01b0319166001600160a01b03851690811790915583903b15620002395781156200019857604051633e9f1edf60e11b81523060048201526001600160a01b038481166024830152821690637d3e3dbe906044015b600060405180830381600087803b1580156200017957600080fd5b505af11580156200018e573d6000803e3d6000fd5b5050505062000239565b6001600160a01b03831615620001dd5760405163a0af290360e01b81523060048201526001600160a01b03848116602483015282169063a0af2903906044016200015e565b604051632210724360e11b81523060048201526001600160a01b03821690634420e48690602401600060405180830381600087803b1580156200021f57600080fd5b505af115801562000234573d6000803e3d6000fd5b505050505b5050506001600160a01b0384169050620002665760405163c49d17ad60e01b815260040160405180910390fd5b50620002789150600090503362000363565b62000293600080516020620056af8339815191528062000408565b620002ae600080516020620056af8339815191523362000363565b620002da7f6afae84a1cc73825b77b2d8f14dc55a052ec6456df5cb0940e5de49ee56c0bd33362000363565b6004546200030b906001600160a01b036c01000000000000000000000000820416906001600160601b031662000453565b620006c9565b601a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000828152601b602090815260408083206001600160a01b038516845290915290205460ff1662000404576000828152601b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003c33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000828152601b6020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6127106001600160601b0382161115620004c75760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b0382166200051f5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401620004be565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601c55565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200058357607f821691505b602082108103620005a457634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620005f857600081815260208120601f850160051c81016020861015620005d35750805b601f850160051c820191505b81811015620005f457828155600101620005df565b5050505b505050565b81516001600160401b0381111562000619576200061962000558565b62000631816200062a84546200056e565b84620005aa565b602080601f831160018114620006695760008415620006505750858301515b600019600386901b1c1916600185901b178555620005f4565b600085815260208120601f198616915b828110156200069a5788860151825594840194600190910190840162000679565b5085821015620006b95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b614fd680620006d96000396000f3fe60806040526004361061049e5760003560e01c806372b44d7111610260578063b0ccc31e11610144578063d5abeb01116100c1578063ecba222a11610085578063ecba222a14610f05578063f2fde38b14610f26578063f3b3059e14610f46578063f444ee5514610f66578063f6aacfb114610f86578063ff76821214610fa657600080fd5b8063d5abeb0114610e7a578063d95ba42f14610e90578063e0c8efac14610eb0578063e985e9c514610ed0578063eb05629714610ef057600080fd5b8063c23dc68f11610108578063c23dc68f14610dc3578063c87b56dd14610df0578063ca6932d514610e10578063d539139314610e26578063d547741f14610e5a57600080fd5b8063b0ccc31e14610d0b578063b31391cb14610d2b578063b88d4fde14610d58578063b8997a9714610d6b578063b8d1e53214610da357600080fd5b806391d14854116101dd578063a217fddf116101a1578063a217fddf14610c42578063a22cb46514610c57578063a35c23ad14610c77578063a3dc00fd14610ca4578063a41216ac14610cc4578063ad2f852a14610ce457600080fd5b806391d1485414610bad57806395d89b4114610bcd57806399a2557a14610be25780639e00acfb14610c02578063a059b16414610c2257600080fd5b80637c3dc173116102245780637c3dc17314610b1857806383f3084f14610b385780638462151c14610b58578063874a8b0214610b785780638da5cb5b14610b9857600080fd5b806372b44d7114610a7157806374202a9f14610a9157806375794a3c14610ab157806375b238fc14610ac65780637988426914610ae857600080fd5b806336568abe116103875780634fdaf052116103045780636352211e116102c85780636352211e146109bc57806369bfdcdf146109dc5780636f8b44b0146109fc57806370a0823114610a1c578063715018a614610a3c57806371745b6214610a5157600080fd5b80634fdaf052146108fd5780635bbb21771461091d5780635eeacefc1461094a5780635ef9432a1461096a5780636033d48c1461097f57600080fd5b806342842e0e1161034b57806342842e0e146108675780634a4fbeec1461087a5780634b81d8bd1461089a5780634f3db346146108c75780634f558e79146108dd57600080fd5b806336568abe146107b9578063374032a1146107d957806338841782146107f3578063396e8f53146108275780633c8df72e1461084757600080fd5b806313c5282611610420578063248a9ca3116103e4578063248a9ca3146106ca5780632a55205a146106fa5780632d345670146107395780632f2ff15d1461075957806331faafb41461077957806335bb3e161461079957600080fd5b806313c528261461061357806315ba03521461064357806318160ddd146106635780632398f8431461068a57806323b872dd146106b757600080fd5b806307265389116104675780630726538914610562578063081812fc1461057c578063095ea7b3146105b45780630f4345e2146105c757806310c395bf146105e757600080fd5b80623f332f146104a357806301ffc9a7146104ce578063025e332e146104fe57806306d254da1461052057806306fdde0314610540575b600080fd5b3480156104af57600080fd5b506104b8610fc6565b6040516104c591906145ee565b60405180910390f35b3480156104da57600080fd5b506104ee6104e9366004614645565b610fd5565b60405190151581526020016104c5565b34801561050a57600080fd5b5061051e610519366004614677565b61103d565b005b34801561052c57600080fd5b5061051e61053b366004614677565b611078565b34801561054c57600080fd5b506105556110c9565b6040516104c591906146e4565b34801561056e57600080fd5b506016546104ee9060ff1681565b34801561058857600080fd5b5061059c6105973660046146f7565b61115b565b6040516001600160a01b0390911681526020016104c5565b61051e6105c2366004614710565b61119f565b3480156105d357600080fd5b5061051e6105e23660046146f7565b6111b8565b3480156105f357600080fd5b5060105461060690610100900460ff1681565b6040516104c59190614752565b34801561061f57600080fd5b5061060661062e366004614677565b60126020526000908152604090205460ff1681565b34801561064f57600080fd5b5061051e61065e3660046146f7565b6111d6565b34801561066f57600080fd5b5060095460085403600019015b6040519081526020016104c5565b34801561069657600080fd5b5061067c6106a5366004614677565b60186020526000908152604090205481565b61051e6106c536600461476c565b6111f4565b3480156106d657600080fd5b5061067c6106e53660046146f7565b6000908152601b602052604090206001015490565b34801561070657600080fd5b5061071a6107153660046147ad565b6112ea565b604080516001600160a01b0390931683526020830191909152016104c5565b34801561074557600080fd5b5061051e610754366004614677565b611398565b34801561076557600080fd5b5061051e6107743660046147cf565b6113bb565b34801561078557600080fd5b5061051e6107943660046147ff565b6113e0565b3480156107a557600080fd5b5061051e6107b4366004614677565b611436565b3480156107c557600080fd5b5061051e6107d43660046147cf565b611456565b3480156107e557600080fd5b506010546104ee9060ff1681565b3480156107ff57600080fd5b5061067c7f6afae84a1cc73825b77b2d8f14dc55a052ec6456df5cb0940e5de49ee56c0bd381565b34801561083357600080fd5b5060135461059c906001600160a01b031681565b34801561085357600080fd5b5061051e610862366004614677565b6114d5565b61051e61087536600461476c565b611510565b34801561088657600080fd5b506104ee610895366004614677565b61153b565b3480156108a657600080fd5b506108ba6108b53660046147ad565b6115f0565b6040516104c59190614828565b3480156108d357600080fd5b5061067c60195481565b3480156108e957600080fd5b506104ee6108f83660046146f7565b6117be565b34801561090957600080fd5b5061051e610918366004614874565b6117c9565b34801561092957600080fd5b5061093d6109383660046148d3565b6117da565b6040516104c59190614950565b34801561095657600080fd5b5061051e6109653660046149a0565b6118a5565b34801561097657600080fd5b5061051e611a3a565b34801561098b57600080fd5b506109af61099a3660046146f7565b60009081526007602052604090205460ff1690565b6040516104c59190614a23565b3480156109c857600080fd5b5061059c6109d73660046146f7565b611adf565b3480156109e857600080fd5b5061051e6109f73660046147ad565b611aea565b348015610a0857600080fd5b5061051e610a173660046146f7565b611b52565b348015610a2857600080fd5b5061067c610a37366004614677565b611b70565b348015610a4857600080fd5b5061051e611bbe565b348015610a5d57600080fd5b5061051e610a6c366004614a37565b611bd2565b348015610a7d57600080fd5b5061051e610a8c366004614677565b611c42565b348015610a9d57600080fd5b5061051e610aac366004614710565b611c63565b348015610abd57600080fd5b5061067c611c97565b348015610ad257600080fd5b5061067c600080516020614f8183398151915281565b348015610af457600080fd5b50610606610b033660046146f7565b60116020526000908152604090205460ff1681565b348015610b2457600080fd5b5061051e610b333660046147ad565b611ca2565b348015610b4457600080fd5b5060015461059c906001600160a01b031681565b348015610b6457600080fd5b506108ba610b73366004614677565b611d32565b348015610b8457600080fd5b5061051e610b93366004614a8a565b611e3a565b348015610ba457600080fd5b5061059c611efb565b348015610bb957600080fd5b506104ee610bc83660046147cf565b611f0f565b348015610bd957600080fd5b50610555611f3a565b348015610bee57600080fd5b506108ba610bfd366004614abf565b611f49565b348015610c0e57600080fd5b5061059c610c1d366004614710565b6120d0565b348015610c2e57600080fd5b5061051e610c3d366004614af4565b612231565b348015610c4e57600080fd5b5061067c600081565b348015610c6357600080fd5b5061051e610c72366004614b11565b61224c565b348015610c8357600080fd5b5061051e610c923660046146f7565b33600090815260186020526040902055565b348015610cb057600080fd5b5061051e610cbf366004614677565b612260565b348015610cd057600080fd5b5061051e610cdf366004614af4565b61229b565b348015610cf057600080fd5b5060045461059c90600160601b90046001600160a01b031681565b348015610d1757600080fd5b50601e5461059c906001600160a01b031681565b348015610d3757600080fd5b5061067c610d463660046146f7565b60176020526000908152604090205481565b61051e610d66366004614bac565b6122b6565b348015610d7757600080fd5b50600454610d8b906001600160601b031681565b6040516001600160601b0390911681526020016104c5565b348015610daf57600080fd5b5061051e610dbe366004614677565b6122dc565b348015610dcf57600080fd5b50610de3610dde3660046146f7565b612394565b6040516104c59190614c5a565b348015610dfc57600080fd5b50610555610e0b3660046146f7565b61241c565b348015610e1c57600080fd5b5061067c60035481565b348015610e3257600080fd5b5061067c7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b348015610e6657600080fd5b5061051e610e753660046147cf565b6124e4565b348015610e8657600080fd5b5061067c60025481565b348015610e9c57600080fd5b5061051e610eab3660046146f7565b612509565b348015610ebc57600080fd5b5060005461059c906001600160a01b031681565b348015610edc57600080fd5b506104ee610eeb366004614c68565b61256a565b348015610efc57600080fd5b506108ba61259e565b348015610f1157600080fd5b50601e546104ee90600160a01b900460ff1681565b348015610f3257600080fd5b5061051e610f41366004614677565b6125b8565b348015610f5257600080fd5b5061051e610f61366004614a37565b61262e565b348015610f7257600080fd5b5061051e610f81366004614710565b6127f5565b348015610f9257600080fd5b506104ee610fa13660046146f7565b612829565b348015610fb257600080fd5b5061051e610fc1366004614677565b612852565b6060610fd0612873565b905090565b6000610fe08261287f565b80610fef5750610fef826128a4565b80610ffe5750610ffe826128e2565b8061101957506001600160e01b03198216632483248360e11b145b80611028575061102882612907565b806110375750611037826128e2565b92915050565b600080516020614f818339815191526110558161291d565b601380546001600160a01b0319166001600160a01b0384161790555050565b5050565b600080516020614f818339815191526110908161291d565b600480546001600160601b03908116600160601b6001600160a01b03868116820283811795869055611074959290920416921617612927565b6060600a80546110d890614c96565b80601f016020809104026020016040519081016040528092919081815260200182805461110490614c96565b80156111515780601f1061112657610100808354040283529160200191611151565b820191906000526020600020905b81548152906001019060200180831161113457829003601f168201915b5050505050905090565b600061116682612a24565b611183576040516333d1c03960e21b815260040160405180910390fd5b506000908152600e60205260409020546001600160a01b031690565b816111a981612a59565b6111b38383612b1b565b505050565b600080516020614f818339815191526111d08161291d565b50601955565b600080516020614f818339815191526111ee8161291d565b50600355565b826001600160a01b038116331461120e5761120e33612a59565b6001546000906001600160a01b0316611228576000611295565b6001546040516330de20d360e21b8152600481018590526001600160a01b039091169063c378834c90602401602060405180830381865afa158015611271573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112959190614cca565b90506112a2858585612b2f565b80156112e3576112e36040518060800160405280876001600160a01b03168152602001866001600160a01b0316815260200185815260200183815250612ce1565b5050505050565b6000828152601d602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161135f575060408051808201909152601c546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061137e906001600160601b031687614cf9565b6113889190614d10565b91519350909150505b9250929050565b6113a0612f3c565b6113b8600080516020614f8183398151915282612f9b565b50565b6000828152601b60205260409020600101546113d68161291d565b6111b38383613002565b600080516020614f818339815191526113f88161291d565b600480546bffffffffffffffffffffffff19166001600160601b0384169081179182905561107491600160601b90046001600160a01b031690612927565b61143e612f3c565b6113b8600080516020614f8183398151915282613002565b6001600160a01b03811633146114cb5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6110748282612f9b565b600080516020614f818339815191526114ed8161291d565b50600180546001600160a01b0319166001600160a01b0392909216919091179055565b826001600160a01b038116331461152a5761152a33612a59565b611535848484613088565b50505050565b60105460009060ff1661155057506000919050565b60026001600160a01b03831660009081526012602052604090205460ff16600281111561157f5761157f61473c565b14806115db57506001600160a01b03821660009081526012602052604081205460ff1660028111156115b3576115b361473c565b1480156115db57506002601054610100900460ff1660028111156115d9576115d961473c565b145b156115e857506001919050565b506000919050565b606060006115fe8484614d32565b611609906001614d45565b6001600160401b0381111561162057611620614b3f565b604051908082528060200260200182016040528015611649578160200160208202803683370190505b509050600080855b8581116116f15761166181612a24565b8015611671575061167181612829565b156116ac57600184848151811061168a5761168a614d58565b91151560209283029190910190910152816116a481614d6e565b9250506116d1565b60008484815181106116c0576116c0614d58565b911515602092830291909101909101525b826116db81614d6e565b93505080806116e990614d6e565b915050611651565b506000816001600160401b0381111561170c5761170c614b3f565b604051908082528060200260200182016040528015611735578160200160208202803683370190505b5060009350905082875b8781116117b15785858151811061175857611758614d58565b602002602001015115611791578083838151811061177857611778614d58565b60209081029190910101528161178d81614d6e565b9250505b8461179b81614d6e565b95505080806117a990614d6e565b91505061173f565b5090979650505050505050565b600061103782612a24565b6117d1612f3c565b6113b8816130a3565b6060816000816001600160401b038111156117f7576117f7614b3f565b60405190808252806020026020018201604052801561184957816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816118155790505b50905060005b82811461189c5761187786868381811061186b5761186b614d58565b90506020020135612394565b82828151811061188957611889614d58565b602090810291909101015260010161184f565b50949350505050565b600080516020614f818339815191526118bd8161291d565b84831461191a5760405162461bcd60e51b815260206004820152602560248201527f746865206164647265737320616e64207175616e7469747920646f206e6f74206044820152640dac2e8c6d60db1b60648201526084016114c2565b60005b83811015611a315784848281811061193757611937614d58565b905060200201356000036119845760405162461bcd60e51b8152602060048201526014602482015273746865207175616e74697479206973207a65726f60601b60448201526064016114c2565b82156119d7576119d287878381811061199f5761199f614d58565b90506020020160208101906119b49190614677565b8686848181106119c6576119c6614d58565b905060200201356130cc565b611a1f565b611a1f8787838181106119ec576119ec614d58565b9050602002016020810190611a019190614677565b868684818110611a1357611a13614d58565b90506020020135613123565b80611a2981614d6e565b91505061191d565b50505050505050565b611a42611efb565b6001600160a01b0316336001600160a01b031614611a7357604051635fc483c560e01b815260040160405180910390fd5b601e54600160a01b900460ff1615611a9e57604051631551a48f60e11b815260040160405180910390fd5b601e80546001600160a81b031916600160a01b1790556040517f51e2d870cc2e10853e38dc06fcdae46ad3c3f588f326608803dac6204541ad1690600090a1565b60006110378261317b565b7f6afae84a1cc73825b77b2d8f14dc55a052ec6456df5cb0940e5de49ee56c0bd3611b148161291d565b60408051848152602081018490527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c910160405180910390a1505050565b600080516020614f81833981519152611b6a8161291d565b50600255565b60006001600160a01b038216611b99576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600d60205260409020546001600160401b031690565b611bc6612f3c565b611bd060006131ea565b565b600080516020614f81833981519152611bea8161291d565b82611c375760405162461bcd60e51b815260206004820152601f60248201527f746f6b656e496473206d7573742062652067726561746572207468616e20300060448201526064016114c2565b61153584848461323c565b600080516020614f81833981519152611c5a8161291d565b6110748261332a565b7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9611c8d8161291d565b6111b383836130cc565b6000610fd060085490565b81611cac81611adf565b6001600160a01b0316336001600160a01b031614611d1f5760405162461bcd60e51b815260206004820152602a60248201527f5265737472696374417070726f76653a206f7065726174696f6e206973206f6e604482015269363c903437b63232b91760b11b60648201526084016114c2565b5060009182526017602052604090912055565b60606000806000611d4285611b70565b90506000816001600160401b03811115611d5e57611d5e614b3f565b604051908082528060200260200182016040528015611d87578160200160208202803683370190505b509050611db460408051608081018252600080825260208201819052918101829052606081019190915290565b60015b838614611e2e57611dc78161336f565b91508160400151611e265781516001600160a01b031615611de757815194505b876001600160a01b0316856001600160a01b031603611e265780838780600101985081518110611e1957611e19614d58565b6020026020010181815250505b600101611db7565b50909695505050505050565b336001600160a01b03831614611e825760405162461bcd60e51b815260206004820152600d60248201526c37b7363c903cb7bab939b2b63360991b60448201526064016114c2565b60026001600160a01b03831660009081526012602052604090205460ff166002811115611eb157611eb161473c565b148015611ed057506002816002811115611ecd57611ecd61473c565b14155b15611ef1576001600160a01b03821660009081526006602052604090204290555b61107482826133ab565b6000610fd0601a546001600160a01b031690565b6000918252601b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600b80546110d890614c96565b6060818310611f6b57604051631960ccad60e11b815260040160405180910390fd5b600080611f7760085490565b90506001851015611f8757600194505b80841115611f93578093505b6000611f9e87611b70565b905084861015611fbd5785850381811015611fb7578091505b50611fc1565b5060005b6000816001600160401b03811115611fdb57611fdb614b3f565b604051908082528060200260200182016040528015612004578160200160208202803683370190505b5090508160000361201a5793506120c992505050565b600061202588612394565b905060008160400151612036575080515b885b8881141580156120485750848714155b156120bd576120568161336f565b925082604001516120b55782516001600160a01b03161561207657825191505b8a6001600160a01b0316826001600160a01b0316036120b557808488806001019950815181106120a8576120a8614d58565b6020026020010181815250505b600101612038565b50505092835250909150505b9392505050565b6001546040516366073b6b60e01b81526001600160a01b0384811660048301526024820184905260009283929116906366073b6b90604401602060405180830381865afa158015612125573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121499190614cca565b905060008111806121d457506001546040516302b42f3960e01b8152600481018390526001600160a01b0386811660248301526044820186905260009216906302b42f3990606401602060405180830381865afa1580156121ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d29190614cca565b115b6122205760405162461bcd60e51b815260206004820152601960248201527f6e6f7420706172656e74206c696e6b2073627420746f6b656e0000000000000060448201526064016114c2565b61222981611adf565b949350505050565b612239612f3c565b6016805460ff1916911515919091179055565b8161225681612a59565b6111b38383613434565b600080516020614f818339815191526122788161291d565b50600080546001600160a01b0319166001600160a01b0392909216919091179055565b6122a3612f3c565b6010805460ff1916911515919091179055565b836001600160a01b03811633146122d0576122d033612a59565b6112e3858585856134cb565b6122e4611efb565b6001600160a01b0316336001600160a01b03161461231557604051635fc483c560e01b815260040160405180910390fd5b601e54600160a01b900460ff161561234057604051631551a48f60e11b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f9f513fe86dc42fdbac355fa4d9b1d5be7b5e6cd2df67e30db8003766568de4769060200160405180910390a150565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806123ed57506008548310155b156123f85792915050565b6124018361336f565b90508060400151156124135792915050565b6120c98361350f565b606061242782612a24565b6124735760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e0060448201526064016114c2565b60005460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa1580156124bc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110379190810190614d87565b6000828152601b60205260409020600101546124ff8161291d565b6111b38383612f9b565b7f6afae84a1cc73825b77b2d8f14dc55a052ec6456df5cb0940e5de49ee56c0bd36125338161291d565b6040518281527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b60006125758361153b565b8061258757506125858383613544565b155b1561259457506000611037565b6120c9838361355c565b6008546060906001906125b182826115f0565b9250505090565b6125c0612f3c565b6001600160a01b0381166126255760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016114c2565b6113b8816131ea565b8161267b5760405162461bcd60e51b815260206004820152601f60248201527f746f6b656e496473206d7573742062652067726561746572207468616e20300060448201526064016114c2565b60005b82811015612705576126a784848381811061269b5761269b614d58565b90506020020135611adf565b6001600160a01b0316336001600160a01b0316146126f35760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064016114c2565b806126fd81614d6e565b91505061267e565b5060005b8281101561277b5761273384848381811061272657612726614d58565b9050602002013583613583565b1561276957426005600086868581811061274f5761274f614d58565b905060200201358152602001908152602001600020819055505b8061277381614d6e565b915050612709565b5061278783838361323c565b60005b82811015611535577ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce78484838181106127c5576127c5614d58565b905060200201356040516127db91815260200190565b60405180910390a1806127ed81614d6e565b91505061278a565b7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc961281f8161291d565b6111b38383613123565b6000612834826136dc565b806128435750612843826137d9565b80611037575061103782613800565b600080516020614f8183398151915261286a8161291d565b6110748261383e565b6060610fd06014613883565b60006001600160e01b03198216637965db0b60e01b1480611037575061103782612907565b60006128af82613890565b806128be57506128be826138de565b806128cd57506128cd82613903565b806110375750506001600160e01b0319161590565b60006001600160e01b0319821663152a902d60e11b14806110375750611037826128a4565b6001600160e01b0319166301ffc9a760e01b1490565b6113b88133613928565b6127106001600160601b03821611156129955760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084016114c2565b6001600160a01b0382166129eb5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016114c2565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601c55565b600081600111158015612a38575060085482105b80156110375750506000908152600c6020526040902054600160e01b161590565b601e546001600160a01b03168015801590612a7e57506000816001600160a01b03163b115b1561107457604051633185c44d60e21b81523060048201526001600160a01b03838116602483015282169063c617113490604401602060405180830381865afa158015612acf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af39190614dfd565b61107457604051633b79c77360e21b81526001600160a01b03831660048201526024016114c2565b612b258282613981565b6110748282613995565b6000612b3a8261317b565b9050836001600160a01b0316816001600160a01b031614612b6d5760405162a1148160e81b815260040160405180910390fd5b6000828152600e602052604090208054338082146001600160a01b03881690911417612bba57612b9d863361256a565b612bba57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516612be157604051633a954ecd60e21b815260040160405180910390fd5b612bee8686866001613a35565b8015612bf957600082555b6001600160a01b038681166000908152600d60205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b176000858152600c6020526040812091909155600160e11b84169003612c8b57600184016000818152600c60205260408120549003612c89576008548114612c89576000818152600c602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612cd98686866001613a41565b505050505050565b60005b8160600151811015611074576001546040838101519051631341cd8f60e21b81526004810191909152602481018390526000916001600160a01b031690634d07363c90604401602060405180830381865afa158015612d47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d6b9190614e1a565b60015460408581015190516301e0cabf60e21b815260048101919091526001600160a01b038084166024830152600060448301819052939450909116906307832afc90606401602060405180830381865afa158015612dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612df29190614cca565b9050612dfe82826120d0565b6001600160a01b031684602001516001600160a01b031614612e545760405162461bcd60e51b815260206004820152600f60248201526e3737ba103a37b5b2b71037bbb732b960891b60448201526064016114c2565b60405163a0ee76f160e01b815260048101829052600160248201526001600160a01b0383169063a0ee76f190604401600060405180830381600087803b158015612e9d57600080fd5b505af1158015612eb1573d6000803e3d6000fd5b5050855160208701516040516323b872dd60e01b81526001600160a01b03928316600482015290821660248201526044810185905290851692506323b872dd9150606401600060405180830381600087803b158015612f0f57600080fd5b505af1158015612f23573d6000803e3d6000fd5b5050505050508080612f3490614d6e565b915050612ce4565b33612f45611efb565b6001600160a01b031614611bd05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016114c2565b612fa58282611f0f565b15611074576000828152601b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61300c8282611f0f565b611074576000828152601b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556130443390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6111b3838383604051806020016040528060008152506122b6565b6010805482919061ff0019166101008360028111156130c4576130c461473c565b021790555050565b60006130d760085490565b90506130e38383613b60565b60005b828110156115355760006130fa8284614d45565b6000908152600760205260409020805460ff19169055508061311b81614d6e565b9150506130e6565b60005b818110156131705760008161313a60085490565b6131449190614d45565b6000908152600760205260409020805460ff19166001179055508061316881614d6e565b915050613126565b506110748282613b60565b600081806001116131d1576008548110156131d1576000818152600c602052604081205490600160e01b821690036131cf575b806000036120c95750600019016000818152600c60205260409020546131ae565b505b604051636f96cda160e11b815260040160405180910390fd5b601a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005b8281101561153557816011600086868581811061325e5761325e614d58565b60209081029290920135835250810191909152604001600020805460ff191660018360028111156132915761329161473c565b02179055508160028111156132a8576132a861473c565b8484838181106132ba576132ba614d58565b905060200201356132d686868581811061269b5761269b614d58565b6001600160a01b03167fc2b9bdb88f6723b48e57bd5eee65bf3718ed64f8dcae05bb63a2c5c14e3c44eb4260405161331091815260200190565b60405180910390a48061332281614d6e565b91505061323f565b613335601482613bd0565b506040516001600160a01b0382169033907f3b01c97343869ca2757fcc37cdb8f71683b0a7aed858e3755f4529a1db85729290600090a350565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600c602052604090205461103790613be5565b6001600160a01b0382166000908152601260205260409020805482919060ff191660018360028111156133e0576133e061473c565b0217905550336001600160a01b0316826001600160a01b03167f9fdb14457e6a7bd3753c649831b026de987c06e52d16459a928540738c2ea34b836040516134289190614752565b60405180910390a35050565b61343d3361153b565b1580613447575080155b6134935760405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e0000000060448201526064016114c2565b61349c82613c2c565b806134a5575080155b6134c15760405162461bcd60e51b81526004016114c290614e37565b6110748282613c38565b6134d68484846111f4565b6001600160a01b0383163b15611535576134f284848484613c70565b611535576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608081018252600080825260208201819052918101829052606081019190915261103761353f8361317b565b613be5565b60008061355084613d5b565b90506122298382613d9d565b60006135688383613544565b151560000361357957506000611037565b6120c98383613e36565b600060018260028111156135995761359961473c565b03613653573360009081526012602052604081205460ff169060028260028111156135c6576135c661473c565b1480156135f65750600160008681526011602052604090205460ff1660028111156135f3576135f361473c565b14155b90506000600283600281111561360e5761360e61473c565b1415801561363e5750600260008781526011602052604090205460ff16600281111561363c5761363c61473c565b145b905081806136495750805b9350505050611037565b60008260028111156136675761366761473c565b036136d4573360009081526012602052604081205460ff169060028260028111156136945761369461473c565b141590506000600260008781526011602052604090205460ff1660028111156136bf576136bf61473c565b14905081801561364957509250611037915050565b506000611037565b6000816136e881612a24565b61374a5760405162461bcd60e51b815260206004820152602d60248201527f4c6f636b61626c653a206c6f636b696e6720717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b60648201526084016114c2565b60105460ff1661375d57600091506137d3565b600260008481526011602052604090205460ff1660028111156137825761378261473c565b14806137c0575060008381526011602052604081205460ff1660028111156137ac576137ac61473c565b1480156137c057506137c061089584611adf565b156137ce57600191506137d3565b600091505b50919050565b600354600082815260056020526040812054909142916137f99190614d45565b1192915050565b6000426003546006600061381386611adf565b6001600160a01b03166001600160a01b03168152602001908152602001600020546137f99190614d45565b613849601482613e7c565b506040516001600160a01b0382169033907fbd0af1fe0a2c1c7bb340c17a284a291138979c8eeb797e176dbd1c415199af3c90600090a350565b606060006120c983613e91565b60006301ffc9a760e01b6001600160e01b0319831614806138c157506380ac58cd60e01b6001600160e01b03198316145b806110375750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216632742b5b960e01b1480611037575061103782613890565b60006001600160e01b03198216630101c11560e71b14806110375750611037826138de565b6139328282611f0f565b6110745761393f81613eed565b61394a836020613eff565b60405160200161395b929190614e84565b60408051601f198184030181529082905262461bcd60e51b82526114c2916004016146e4565b61398b828261409a565b61107482826140ff565b60006139a082611adf565b9050336001600160a01b038216146139d9576139bc813361256a565b6139d9576040516367d9dca160e11b815260040160405180910390fd5b6000828152600e602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6115358484848461417a565b60008281526007602052604081205460ff166001811115613a6457613a6461473c565b03613b54576000546040805163292625cd60e21b8152905142926001600160a01b03169163a49897349160048083019260209291908290030181865afa158015613ab2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ad69190614cca565b11613b3a576000546040516339aa269d60e11b8152600481018490526001600160a01b03909116906373544d3a90602401600060405180830381600087803b158015613b2157600080fd5b505af1158015613b35573d6000803e3d6000fd5b505050505b6000828152600760205260409020805460ff191660011790555b61153584848484614205565b6002546009546008540360001901613b789083614d45565b1115613bc65760405162461bcd60e51b815260206004820152601c60248201527f636c61696d206973206f76657220746865206d617820737570706c790000000060448201526064016114c2565b611074828261421d565b60006120c9836001600160a01b038416614330565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b60006110373383613544565b613c4182613c2c565b80613c4a575080155b613c665760405162461bcd60e51b81526004016114c290614e37565b6110748282614423565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613ca5903390899088908890600401614ef9565b6020604051808303816000875af1925050508015613ce0575060408051601f3d908101601f19168201909252613cdd91810190614f36565b60015b613d3e573d808015613d0e576040519150601f19603f3d011682016040523d82523d6000602084013e613d13565b606091505b508051600003613d36576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6001600160a01b03811660009081526018602052604081205415613d9557506001600160a01b031660009081526018602052604090205490565b505060195490565b60165460009060ff16613db257506001611037565b613dbb8361448c565b806120c95750601354604051630f8350ed60e41b81526001600160a01b038581166004830152602482018590529091169063f8350ed090604401602060405180830381865afa158015613e12573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c99190614dfd565b6000613e418361153b565b15613e4e57506000611037565b6001600160a01b038084166000908152600f602090815260408083209386168352929052205460ff166120c9565b60006120c9836001600160a01b0384166144b6565b606081600001805480602002602001604051908101604052809291908181526020018280548015613ee157602002820191906000526020600020905b815481526020019060010190808311613ecd575b50505050509050919050565b60606110376001600160a01b03831660145b60606000613f0e836002614cf9565b613f19906002614d45565b6001600160401b03811115613f3057613f30614b3f565b6040519080825280601f01601f191660200182016040528015613f5a576020820181803683370190505b509050600360fc1b81600081518110613f7557613f75614d58565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613fa457613fa4614d58565b60200101906001600160f81b031916908160001a9053506000613fc8846002614cf9565b613fd3906001614d45565b90505b600181111561404b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061400757614007614d58565b1a60f81b82828151811061401d5761401d614d58565b60200101906001600160f81b031916908160001a90535060049490941c9361404481614f53565b9050613fd6565b5083156120c95760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016114c2565b6140a381612829565b156110745760405162461bcd60e51b815260206004820152602660248201527f4c6f636b61626c653a2043616e206e6f7420617070726f7665206c6f636b6564604482015265103a37b5b2b760d11b60648201526084016114c2565b6001600160a01b038216156110745761411881836144fd565b6110745760405162461bcd60e51b815260206004820152602d60248201527f5265737472696374417070726f76653a2054686520636f6e747261637420697360448201526c103737ba1030b63637bbb2b21760991b60648201526084016114c2565b6001600160a01b0384161580159061419a57506001600160a01b03831615155b15611535576141a882612829565b156115355760405162461bcd60e51b815260206004820152602760248201527f4c6f636b61626c653a2043616e206e6f74207472616e73666572206c6f636b6560448201526632103a37b5b2b760c91b60648201526084016114c2565b6142118484848461450a565b61153584848484614534565b60085460008290036142425760405163b562e8dd60e01b815260040160405180910390fd5b61424f6000848385613a35565b6001600160a01b0383166000818152600d602090815260408083208054680100000000000000018802019055848352600c90915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146142fe57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a46001016142c6565b508160000361431f57604051622e076360e81b815260040160405180910390fd5b600855506111b36000848385613a41565b60008181526001830160205260408120548015614419576000614354600183614d32565b855490915060009061436890600190614d32565b90508181146143cd57600086600001828154811061438857614388614d58565b90600052602060002001549050808760000184815481106143ab576143ab614d58565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806143de576143de614f6a565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611037565b6000915050611037565b61442c3361153b565b1580614436575080155b6144825760405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e0000000060448201526064016114c2565b6110748282614557565b60006110376014836001600160a01b038116600090815260018301602052604081205415156120c9565b60008181526001830160205260408120546136d457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611037565b60008061355033856145bc565b6001600160a01b03841615611535576000828152601160205260409020805460ff19169055611535565b6001600160a01b0384161561153557600082815260176020526040812055611535565b336000818152600f602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101613428565b600081815260176020526040812054156145e55750600081815260176020526040902054611037565b6120c983613d5b565b6020808252825182820181905260009190848201906040850190845b81811015611e2e5783516001600160a01b03168352928401929184019160010161460a565b6001600160e01b0319811681146113b857600080fd5b60006020828403121561465757600080fd5b81356120c98161462f565b6001600160a01b03811681146113b857600080fd5b60006020828403121561468957600080fd5b81356120c981614662565b60005b838110156146af578181015183820152602001614697565b50506000910152565b600081518084526146d0816020860160208601614694565b601f01601f19169290920160200192915050565b6020815260006120c960208301846146b8565b60006020828403121561470957600080fd5b5035919050565b6000806040838503121561472357600080fd5b823561472e81614662565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b60208101600383106147665761476661473c565b91905290565b60008060006060848603121561478157600080fd5b833561478c81614662565b9250602084013561479c81614662565b929592945050506040919091013590565b600080604083850312156147c057600080fd5b50508035926020909101359150565b600080604083850312156147e257600080fd5b8235915060208301356147f481614662565b809150509250929050565b60006020828403121561481157600080fd5b81356001600160601b03811681146120c957600080fd5b6020808252825182820181905260009190848201906040850190845b81811015611e2e57835183529284019291840191600101614844565b80356003811061486f57600080fd5b919050565b60006020828403121561488657600080fd5b6120c982614860565b60008083601f8401126148a157600080fd5b5081356001600160401b038111156148b857600080fd5b6020830191508360208260051b850101111561139157600080fd5b600080602083850312156148e657600080fd5b82356001600160401b038111156148fc57600080fd5b6149088582860161488f565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611e2e5761497f838551614914565b928401926080929092019160010161496c565b80151581146113b857600080fd5b6000806000806000606086880312156149b857600080fd5b85356001600160401b03808211156149cf57600080fd5b6149db89838a0161488f565b909750955060208801359150808211156149f457600080fd5b50614a018882890161488f565b9094509250506040860135614a1581614992565b809150509295509295909350565b60208101600283106147665761476661473c565b600080600060408486031215614a4c57600080fd5b83356001600160401b03811115614a6257600080fd5b614a6e8682870161488f565b9094509250614a81905060208501614860565b90509250925092565b60008060408385031215614a9d57600080fd5b8235614aa881614662565b9150614ab660208401614860565b90509250929050565b600080600060608486031215614ad457600080fd5b8335614adf81614662565b95602085013595506040909401359392505050565b600060208284031215614b0657600080fd5b81356120c981614992565b60008060408385031215614b2457600080fd5b8235614b2f81614662565b915060208301356147f481614992565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614b7d57614b7d614b3f565b604052919050565b60006001600160401b03821115614b9e57614b9e614b3f565b50601f01601f191660200190565b60008060008060808587031215614bc257600080fd5b8435614bcd81614662565b93506020850135614bdd81614662565b92506040850135915060608501356001600160401b03811115614bff57600080fd5b8501601f81018713614c1057600080fd5b8035614c23614c1e82614b85565b614b55565b818152886020838501011115614c3857600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b608081016110378284614914565b60008060408385031215614c7b57600080fd5b8235614c8681614662565b915060208301356147f481614662565b600181811c90821680614caa57607f821691505b6020821081036137d357634e487b7160e01b600052602260045260246000fd5b600060208284031215614cdc57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761103757611037614ce3565b600082614d2d57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561103757611037614ce3565b8082018082111561103757611037614ce3565b634e487b7160e01b600052603260045260246000fd5b600060018201614d8057614d80614ce3565b5060010190565b600060208284031215614d9957600080fd5b81516001600160401b03811115614daf57600080fd5b8201601f81018413614dc057600080fd5b8051614dce614c1e82614b85565b818152856020838501011115614de357600080fd5b614df4826020830160208601614694565b95945050505050565b600060208284031215614e0f57600080fd5b81516120c981614992565b600060208284031215614e2c57600080fd5b81516120c981614662565b6020808252602d908201527f5265737472696374417070726f76653a2043616e206e6f7420617070726f766560408201526c103637b1b5b2b2103a37b5b2b760991b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614ebc816017850160208801614694565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614eed816028840160208801614694565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614f2c908301846146b8565b9695505050505050565b600060208284031215614f4857600080fd5b81516120c98161462f565b600081614f6257614f62614ce3565b506000190190565b634e487b7160e01b600052603160045260246000fdfedf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42a264697066735822122024fe26250e361edc22cbd962c1119cb8be552e6637a9fff3b87a725f0331592664736f6c63430008130033df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42
Deployed Bytecode
0x60806040526004361061049e5760003560e01c806372b44d7111610260578063b0ccc31e11610144578063d5abeb01116100c1578063ecba222a11610085578063ecba222a14610f05578063f2fde38b14610f26578063f3b3059e14610f46578063f444ee5514610f66578063f6aacfb114610f86578063ff76821214610fa657600080fd5b8063d5abeb0114610e7a578063d95ba42f14610e90578063e0c8efac14610eb0578063e985e9c514610ed0578063eb05629714610ef057600080fd5b8063c23dc68f11610108578063c23dc68f14610dc3578063c87b56dd14610df0578063ca6932d514610e10578063d539139314610e26578063d547741f14610e5a57600080fd5b8063b0ccc31e14610d0b578063b31391cb14610d2b578063b88d4fde14610d58578063b8997a9714610d6b578063b8d1e53214610da357600080fd5b806391d14854116101dd578063a217fddf116101a1578063a217fddf14610c42578063a22cb46514610c57578063a35c23ad14610c77578063a3dc00fd14610ca4578063a41216ac14610cc4578063ad2f852a14610ce457600080fd5b806391d1485414610bad57806395d89b4114610bcd57806399a2557a14610be25780639e00acfb14610c02578063a059b16414610c2257600080fd5b80637c3dc173116102245780637c3dc17314610b1857806383f3084f14610b385780638462151c14610b58578063874a8b0214610b785780638da5cb5b14610b9857600080fd5b806372b44d7114610a7157806374202a9f14610a9157806375794a3c14610ab157806375b238fc14610ac65780637988426914610ae857600080fd5b806336568abe116103875780634fdaf052116103045780636352211e116102c85780636352211e146109bc57806369bfdcdf146109dc5780636f8b44b0146109fc57806370a0823114610a1c578063715018a614610a3c57806371745b6214610a5157600080fd5b80634fdaf052146108fd5780635bbb21771461091d5780635eeacefc1461094a5780635ef9432a1461096a5780636033d48c1461097f57600080fd5b806342842e0e1161034b57806342842e0e146108675780634a4fbeec1461087a5780634b81d8bd1461089a5780634f3db346146108c75780634f558e79146108dd57600080fd5b806336568abe146107b9578063374032a1146107d957806338841782146107f3578063396e8f53146108275780633c8df72e1461084757600080fd5b806313c5282611610420578063248a9ca3116103e4578063248a9ca3146106ca5780632a55205a146106fa5780632d345670146107395780632f2ff15d1461075957806331faafb41461077957806335bb3e161461079957600080fd5b806313c528261461061357806315ba03521461064357806318160ddd146106635780632398f8431461068a57806323b872dd146106b757600080fd5b806307265389116104675780630726538914610562578063081812fc1461057c578063095ea7b3146105b45780630f4345e2146105c757806310c395bf146105e757600080fd5b80623f332f146104a357806301ffc9a7146104ce578063025e332e146104fe57806306d254da1461052057806306fdde0314610540575b600080fd5b3480156104af57600080fd5b506104b8610fc6565b6040516104c591906145ee565b60405180910390f35b3480156104da57600080fd5b506104ee6104e9366004614645565b610fd5565b60405190151581526020016104c5565b34801561050a57600080fd5b5061051e610519366004614677565b61103d565b005b34801561052c57600080fd5b5061051e61053b366004614677565b611078565b34801561054c57600080fd5b506105556110c9565b6040516104c591906146e4565b34801561056e57600080fd5b506016546104ee9060ff1681565b34801561058857600080fd5b5061059c6105973660046146f7565b61115b565b6040516001600160a01b0390911681526020016104c5565b61051e6105c2366004614710565b61119f565b3480156105d357600080fd5b5061051e6105e23660046146f7565b6111b8565b3480156105f357600080fd5b5060105461060690610100900460ff1681565b6040516104c59190614752565b34801561061f57600080fd5b5061060661062e366004614677565b60126020526000908152604090205460ff1681565b34801561064f57600080fd5b5061051e61065e3660046146f7565b6111d6565b34801561066f57600080fd5b5060095460085403600019015b6040519081526020016104c5565b34801561069657600080fd5b5061067c6106a5366004614677565b60186020526000908152604090205481565b61051e6106c536600461476c565b6111f4565b3480156106d657600080fd5b5061067c6106e53660046146f7565b6000908152601b602052604090206001015490565b34801561070657600080fd5b5061071a6107153660046147ad565b6112ea565b604080516001600160a01b0390931683526020830191909152016104c5565b34801561074557600080fd5b5061051e610754366004614677565b611398565b34801561076557600080fd5b5061051e6107743660046147cf565b6113bb565b34801561078557600080fd5b5061051e6107943660046147ff565b6113e0565b3480156107a557600080fd5b5061051e6107b4366004614677565b611436565b3480156107c557600080fd5b5061051e6107d43660046147cf565b611456565b3480156107e557600080fd5b506010546104ee9060ff1681565b3480156107ff57600080fd5b5061067c7f6afae84a1cc73825b77b2d8f14dc55a052ec6456df5cb0940e5de49ee56c0bd381565b34801561083357600080fd5b5060135461059c906001600160a01b031681565b34801561085357600080fd5b5061051e610862366004614677565b6114d5565b61051e61087536600461476c565b611510565b34801561088657600080fd5b506104ee610895366004614677565b61153b565b3480156108a657600080fd5b506108ba6108b53660046147ad565b6115f0565b6040516104c59190614828565b3480156108d357600080fd5b5061067c60195481565b3480156108e957600080fd5b506104ee6108f83660046146f7565b6117be565b34801561090957600080fd5b5061051e610918366004614874565b6117c9565b34801561092957600080fd5b5061093d6109383660046148d3565b6117da565b6040516104c59190614950565b34801561095657600080fd5b5061051e6109653660046149a0565b6118a5565b34801561097657600080fd5b5061051e611a3a565b34801561098b57600080fd5b506109af61099a3660046146f7565b60009081526007602052604090205460ff1690565b6040516104c59190614a23565b3480156109c857600080fd5b5061059c6109d73660046146f7565b611adf565b3480156109e857600080fd5b5061051e6109f73660046147ad565b611aea565b348015610a0857600080fd5b5061051e610a173660046146f7565b611b52565b348015610a2857600080fd5b5061067c610a37366004614677565b611b70565b348015610a4857600080fd5b5061051e611bbe565b348015610a5d57600080fd5b5061051e610a6c366004614a37565b611bd2565b348015610a7d57600080fd5b5061051e610a8c366004614677565b611c42565b348015610a9d57600080fd5b5061051e610aac366004614710565b611c63565b348015610abd57600080fd5b5061067c611c97565b348015610ad257600080fd5b5061067c600080516020614f8183398151915281565b348015610af457600080fd5b50610606610b033660046146f7565b60116020526000908152604090205460ff1681565b348015610b2457600080fd5b5061051e610b333660046147ad565b611ca2565b348015610b4457600080fd5b5060015461059c906001600160a01b031681565b348015610b6457600080fd5b506108ba610b73366004614677565b611d32565b348015610b8457600080fd5b5061051e610b93366004614a8a565b611e3a565b348015610ba457600080fd5b5061059c611efb565b348015610bb957600080fd5b506104ee610bc83660046147cf565b611f0f565b348015610bd957600080fd5b50610555611f3a565b348015610bee57600080fd5b506108ba610bfd366004614abf565b611f49565b348015610c0e57600080fd5b5061059c610c1d366004614710565b6120d0565b348015610c2e57600080fd5b5061051e610c3d366004614af4565b612231565b348015610c4e57600080fd5b5061067c600081565b348015610c6357600080fd5b5061051e610c72366004614b11565b61224c565b348015610c8357600080fd5b5061051e610c923660046146f7565b33600090815260186020526040902055565b348015610cb057600080fd5b5061051e610cbf366004614677565b612260565b348015610cd057600080fd5b5061051e610cdf366004614af4565b61229b565b348015610cf057600080fd5b5060045461059c90600160601b90046001600160a01b031681565b348015610d1757600080fd5b50601e5461059c906001600160a01b031681565b348015610d3757600080fd5b5061067c610d463660046146f7565b60176020526000908152604090205481565b61051e610d66366004614bac565b6122b6565b348015610d7757600080fd5b50600454610d8b906001600160601b031681565b6040516001600160601b0390911681526020016104c5565b348015610daf57600080fd5b5061051e610dbe366004614677565b6122dc565b348015610dcf57600080fd5b50610de3610dde3660046146f7565b612394565b6040516104c59190614c5a565b348015610dfc57600080fd5b50610555610e0b3660046146f7565b61241c565b348015610e1c57600080fd5b5061067c60035481565b348015610e3257600080fd5b5061067c7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b348015610e6657600080fd5b5061051e610e753660046147cf565b6124e4565b348015610e8657600080fd5b5061067c60025481565b348015610e9c57600080fd5b5061051e610eab3660046146f7565b612509565b348015610ebc57600080fd5b5060005461059c906001600160a01b031681565b348015610edc57600080fd5b506104ee610eeb366004614c68565b61256a565b348015610efc57600080fd5b506108ba61259e565b348015610f1157600080fd5b50601e546104ee90600160a01b900460ff1681565b348015610f3257600080fd5b5061051e610f41366004614677565b6125b8565b348015610f5257600080fd5b5061051e610f61366004614a37565b61262e565b348015610f7257600080fd5b5061051e610f81366004614710565b6127f5565b348015610f9257600080fd5b506104ee610fa13660046146f7565b612829565b348015610fb257600080fd5b5061051e610fc1366004614677565b612852565b6060610fd0612873565b905090565b6000610fe08261287f565b80610fef5750610fef826128a4565b80610ffe5750610ffe826128e2565b8061101957506001600160e01b03198216632483248360e11b145b80611028575061102882612907565b806110375750611037826128e2565b92915050565b600080516020614f818339815191526110558161291d565b601380546001600160a01b0319166001600160a01b0384161790555050565b5050565b600080516020614f818339815191526110908161291d565b600480546001600160601b03908116600160601b6001600160a01b03868116820283811795869055611074959290920416921617612927565b6060600a80546110d890614c96565b80601f016020809104026020016040519081016040528092919081815260200182805461110490614c96565b80156111515780601f1061112657610100808354040283529160200191611151565b820191906000526020600020905b81548152906001019060200180831161113457829003601f168201915b5050505050905090565b600061116682612a24565b611183576040516333d1c03960e21b815260040160405180910390fd5b506000908152600e60205260409020546001600160a01b031690565b816111a981612a59565b6111b38383612b1b565b505050565b600080516020614f818339815191526111d08161291d565b50601955565b600080516020614f818339815191526111ee8161291d565b50600355565b826001600160a01b038116331461120e5761120e33612a59565b6001546000906001600160a01b0316611228576000611295565b6001546040516330de20d360e21b8152600481018590526001600160a01b039091169063c378834c90602401602060405180830381865afa158015611271573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112959190614cca565b90506112a2858585612b2f565b80156112e3576112e36040518060800160405280876001600160a01b03168152602001866001600160a01b0316815260200185815260200183815250612ce1565b5050505050565b6000828152601d602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161135f575060408051808201909152601c546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061137e906001600160601b031687614cf9565b6113889190614d10565b91519350909150505b9250929050565b6113a0612f3c565b6113b8600080516020614f8183398151915282612f9b565b50565b6000828152601b60205260409020600101546113d68161291d565b6111b38383613002565b600080516020614f818339815191526113f88161291d565b600480546bffffffffffffffffffffffff19166001600160601b0384169081179182905561107491600160601b90046001600160a01b031690612927565b61143e612f3c565b6113b8600080516020614f8183398151915282613002565b6001600160a01b03811633146114cb5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6110748282612f9b565b600080516020614f818339815191526114ed8161291d565b50600180546001600160a01b0319166001600160a01b0392909216919091179055565b826001600160a01b038116331461152a5761152a33612a59565b611535848484613088565b50505050565b60105460009060ff1661155057506000919050565b60026001600160a01b03831660009081526012602052604090205460ff16600281111561157f5761157f61473c565b14806115db57506001600160a01b03821660009081526012602052604081205460ff1660028111156115b3576115b361473c565b1480156115db57506002601054610100900460ff1660028111156115d9576115d961473c565b145b156115e857506001919050565b506000919050565b606060006115fe8484614d32565b611609906001614d45565b6001600160401b0381111561162057611620614b3f565b604051908082528060200260200182016040528015611649578160200160208202803683370190505b509050600080855b8581116116f15761166181612a24565b8015611671575061167181612829565b156116ac57600184848151811061168a5761168a614d58565b91151560209283029190910190910152816116a481614d6e565b9250506116d1565b60008484815181106116c0576116c0614d58565b911515602092830291909101909101525b826116db81614d6e565b93505080806116e990614d6e565b915050611651565b506000816001600160401b0381111561170c5761170c614b3f565b604051908082528060200260200182016040528015611735578160200160208202803683370190505b5060009350905082875b8781116117b15785858151811061175857611758614d58565b602002602001015115611791578083838151811061177857611778614d58565b60209081029190910101528161178d81614d6e565b9250505b8461179b81614d6e565b95505080806117a990614d6e565b91505061173f565b5090979650505050505050565b600061103782612a24565b6117d1612f3c565b6113b8816130a3565b6060816000816001600160401b038111156117f7576117f7614b3f565b60405190808252806020026020018201604052801561184957816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816118155790505b50905060005b82811461189c5761187786868381811061186b5761186b614d58565b90506020020135612394565b82828151811061188957611889614d58565b602090810291909101015260010161184f565b50949350505050565b600080516020614f818339815191526118bd8161291d565b84831461191a5760405162461bcd60e51b815260206004820152602560248201527f746865206164647265737320616e64207175616e7469747920646f206e6f74206044820152640dac2e8c6d60db1b60648201526084016114c2565b60005b83811015611a315784848281811061193757611937614d58565b905060200201356000036119845760405162461bcd60e51b8152602060048201526014602482015273746865207175616e74697479206973207a65726f60601b60448201526064016114c2565b82156119d7576119d287878381811061199f5761199f614d58565b90506020020160208101906119b49190614677565b8686848181106119c6576119c6614d58565b905060200201356130cc565b611a1f565b611a1f8787838181106119ec576119ec614d58565b9050602002016020810190611a019190614677565b868684818110611a1357611a13614d58565b90506020020135613123565b80611a2981614d6e565b91505061191d565b50505050505050565b611a42611efb565b6001600160a01b0316336001600160a01b031614611a7357604051635fc483c560e01b815260040160405180910390fd5b601e54600160a01b900460ff1615611a9e57604051631551a48f60e11b815260040160405180910390fd5b601e80546001600160a81b031916600160a01b1790556040517f51e2d870cc2e10853e38dc06fcdae46ad3c3f588f326608803dac6204541ad1690600090a1565b60006110378261317b565b7f6afae84a1cc73825b77b2d8f14dc55a052ec6456df5cb0940e5de49ee56c0bd3611b148161291d565b60408051848152602081018490527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c910160405180910390a1505050565b600080516020614f81833981519152611b6a8161291d565b50600255565b60006001600160a01b038216611b99576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600d60205260409020546001600160401b031690565b611bc6612f3c565b611bd060006131ea565b565b600080516020614f81833981519152611bea8161291d565b82611c375760405162461bcd60e51b815260206004820152601f60248201527f746f6b656e496473206d7573742062652067726561746572207468616e20300060448201526064016114c2565b61153584848461323c565b600080516020614f81833981519152611c5a8161291d565b6110748261332a565b7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9611c8d8161291d565b6111b383836130cc565b6000610fd060085490565b81611cac81611adf565b6001600160a01b0316336001600160a01b031614611d1f5760405162461bcd60e51b815260206004820152602a60248201527f5265737472696374417070726f76653a206f7065726174696f6e206973206f6e604482015269363c903437b63232b91760b11b60648201526084016114c2565b5060009182526017602052604090912055565b60606000806000611d4285611b70565b90506000816001600160401b03811115611d5e57611d5e614b3f565b604051908082528060200260200182016040528015611d87578160200160208202803683370190505b509050611db460408051608081018252600080825260208201819052918101829052606081019190915290565b60015b838614611e2e57611dc78161336f565b91508160400151611e265781516001600160a01b031615611de757815194505b876001600160a01b0316856001600160a01b031603611e265780838780600101985081518110611e1957611e19614d58565b6020026020010181815250505b600101611db7565b50909695505050505050565b336001600160a01b03831614611e825760405162461bcd60e51b815260206004820152600d60248201526c37b7363c903cb7bab939b2b63360991b60448201526064016114c2565b60026001600160a01b03831660009081526012602052604090205460ff166002811115611eb157611eb161473c565b148015611ed057506002816002811115611ecd57611ecd61473c565b14155b15611ef1576001600160a01b03821660009081526006602052604090204290555b61107482826133ab565b6000610fd0601a546001600160a01b031690565b6000918252601b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600b80546110d890614c96565b6060818310611f6b57604051631960ccad60e11b815260040160405180910390fd5b600080611f7760085490565b90506001851015611f8757600194505b80841115611f93578093505b6000611f9e87611b70565b905084861015611fbd5785850381811015611fb7578091505b50611fc1565b5060005b6000816001600160401b03811115611fdb57611fdb614b3f565b604051908082528060200260200182016040528015612004578160200160208202803683370190505b5090508160000361201a5793506120c992505050565b600061202588612394565b905060008160400151612036575080515b885b8881141580156120485750848714155b156120bd576120568161336f565b925082604001516120b55782516001600160a01b03161561207657825191505b8a6001600160a01b0316826001600160a01b0316036120b557808488806001019950815181106120a8576120a8614d58565b6020026020010181815250505b600101612038565b50505092835250909150505b9392505050565b6001546040516366073b6b60e01b81526001600160a01b0384811660048301526024820184905260009283929116906366073b6b90604401602060405180830381865afa158015612125573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121499190614cca565b905060008111806121d457506001546040516302b42f3960e01b8152600481018390526001600160a01b0386811660248301526044820186905260009216906302b42f3990606401602060405180830381865afa1580156121ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d29190614cca565b115b6122205760405162461bcd60e51b815260206004820152601960248201527f6e6f7420706172656e74206c696e6b2073627420746f6b656e0000000000000060448201526064016114c2565b61222981611adf565b949350505050565b612239612f3c565b6016805460ff1916911515919091179055565b8161225681612a59565b6111b38383613434565b600080516020614f818339815191526122788161291d565b50600080546001600160a01b0319166001600160a01b0392909216919091179055565b6122a3612f3c565b6010805460ff1916911515919091179055565b836001600160a01b03811633146122d0576122d033612a59565b6112e3858585856134cb565b6122e4611efb565b6001600160a01b0316336001600160a01b03161461231557604051635fc483c560e01b815260040160405180910390fd5b601e54600160a01b900460ff161561234057604051631551a48f60e11b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f9f513fe86dc42fdbac355fa4d9b1d5be7b5e6cd2df67e30db8003766568de4769060200160405180910390a150565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806123ed57506008548310155b156123f85792915050565b6124018361336f565b90508060400151156124135792915050565b6120c98361350f565b606061242782612a24565b6124735760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e0060448201526064016114c2565b60005460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa1580156124bc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110379190810190614d87565b6000828152601b60205260409020600101546124ff8161291d565b6111b38383612f9b565b7f6afae84a1cc73825b77b2d8f14dc55a052ec6456df5cb0940e5de49ee56c0bd36125338161291d565b6040518281527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b60006125758361153b565b8061258757506125858383613544565b155b1561259457506000611037565b6120c9838361355c565b6008546060906001906125b182826115f0565b9250505090565b6125c0612f3c565b6001600160a01b0381166126255760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016114c2565b6113b8816131ea565b8161267b5760405162461bcd60e51b815260206004820152601f60248201527f746f6b656e496473206d7573742062652067726561746572207468616e20300060448201526064016114c2565b60005b82811015612705576126a784848381811061269b5761269b614d58565b90506020020135611adf565b6001600160a01b0316336001600160a01b0316146126f35760405162461bcd60e51b81526020600482015260096024820152683737ba1037bbb732b960b91b60448201526064016114c2565b806126fd81614d6e565b91505061267e565b5060005b8281101561277b5761273384848381811061272657612726614d58565b9050602002013583613583565b1561276957426005600086868581811061274f5761274f614d58565b905060200201358152602001908152602001600020819055505b8061277381614d6e565b915050612709565b5061278783838361323c565b60005b82811015611535577ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce78484838181106127c5576127c5614d58565b905060200201356040516127db91815260200190565b60405180910390a1806127ed81614d6e565b91505061278a565b7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc961281f8161291d565b6111b38383613123565b6000612834826136dc565b806128435750612843826137d9565b80611037575061103782613800565b600080516020614f8183398151915261286a8161291d565b6110748261383e565b6060610fd06014613883565b60006001600160e01b03198216637965db0b60e01b1480611037575061103782612907565b60006128af82613890565b806128be57506128be826138de565b806128cd57506128cd82613903565b806110375750506001600160e01b0319161590565b60006001600160e01b0319821663152a902d60e11b14806110375750611037826128a4565b6001600160e01b0319166301ffc9a760e01b1490565b6113b88133613928565b6127106001600160601b03821611156129955760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084016114c2565b6001600160a01b0382166129eb5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016114c2565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601c55565b600081600111158015612a38575060085482105b80156110375750506000908152600c6020526040902054600160e01b161590565b601e546001600160a01b03168015801590612a7e57506000816001600160a01b03163b115b1561107457604051633185c44d60e21b81523060048201526001600160a01b03838116602483015282169063c617113490604401602060405180830381865afa158015612acf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612af39190614dfd565b61107457604051633b79c77360e21b81526001600160a01b03831660048201526024016114c2565b612b258282613981565b6110748282613995565b6000612b3a8261317b565b9050836001600160a01b0316816001600160a01b031614612b6d5760405162a1148160e81b815260040160405180910390fd5b6000828152600e602052604090208054338082146001600160a01b03881690911417612bba57612b9d863361256a565b612bba57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516612be157604051633a954ecd60e21b815260040160405180910390fd5b612bee8686866001613a35565b8015612bf957600082555b6001600160a01b038681166000908152600d60205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b176000858152600c6020526040812091909155600160e11b84169003612c8b57600184016000818152600c60205260408120549003612c89576008548114612c89576000818152600c602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612cd98686866001613a41565b505050505050565b60005b8160600151811015611074576001546040838101519051631341cd8f60e21b81526004810191909152602481018390526000916001600160a01b031690634d07363c90604401602060405180830381865afa158015612d47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d6b9190614e1a565b60015460408581015190516301e0cabf60e21b815260048101919091526001600160a01b038084166024830152600060448301819052939450909116906307832afc90606401602060405180830381865afa158015612dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612df29190614cca565b9050612dfe82826120d0565b6001600160a01b031684602001516001600160a01b031614612e545760405162461bcd60e51b815260206004820152600f60248201526e3737ba103a37b5b2b71037bbb732b960891b60448201526064016114c2565b60405163a0ee76f160e01b815260048101829052600160248201526001600160a01b0383169063a0ee76f190604401600060405180830381600087803b158015612e9d57600080fd5b505af1158015612eb1573d6000803e3d6000fd5b5050855160208701516040516323b872dd60e01b81526001600160a01b03928316600482015290821660248201526044810185905290851692506323b872dd9150606401600060405180830381600087803b158015612f0f57600080fd5b505af1158015612f23573d6000803e3d6000fd5b5050505050508080612f3490614d6e565b915050612ce4565b33612f45611efb565b6001600160a01b031614611bd05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016114c2565b612fa58282611f0f565b15611074576000828152601b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61300c8282611f0f565b611074576000828152601b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556130443390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6111b3838383604051806020016040528060008152506122b6565b6010805482919061ff0019166101008360028111156130c4576130c461473c565b021790555050565b60006130d760085490565b90506130e38383613b60565b60005b828110156115355760006130fa8284614d45565b6000908152600760205260409020805460ff19169055508061311b81614d6e565b9150506130e6565b60005b818110156131705760008161313a60085490565b6131449190614d45565b6000908152600760205260409020805460ff19166001179055508061316881614d6e565b915050613126565b506110748282613b60565b600081806001116131d1576008548110156131d1576000818152600c602052604081205490600160e01b821690036131cf575b806000036120c95750600019016000818152600c60205260409020546131ae565b505b604051636f96cda160e11b815260040160405180910390fd5b601a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005b8281101561153557816011600086868581811061325e5761325e614d58565b60209081029290920135835250810191909152604001600020805460ff191660018360028111156132915761329161473c565b02179055508160028111156132a8576132a861473c565b8484838181106132ba576132ba614d58565b905060200201356132d686868581811061269b5761269b614d58565b6001600160a01b03167fc2b9bdb88f6723b48e57bd5eee65bf3718ed64f8dcae05bb63a2c5c14e3c44eb4260405161331091815260200190565b60405180910390a48061332281614d6e565b91505061323f565b613335601482613bd0565b506040516001600160a01b0382169033907f3b01c97343869ca2757fcc37cdb8f71683b0a7aed858e3755f4529a1db85729290600090a350565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600c602052604090205461103790613be5565b6001600160a01b0382166000908152601260205260409020805482919060ff191660018360028111156133e0576133e061473c565b0217905550336001600160a01b0316826001600160a01b03167f9fdb14457e6a7bd3753c649831b026de987c06e52d16459a928540738c2ea34b836040516134289190614752565b60405180910390a35050565b61343d3361153b565b1580613447575080155b6134935760405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e0000000060448201526064016114c2565b61349c82613c2c565b806134a5575080155b6134c15760405162461bcd60e51b81526004016114c290614e37565b6110748282613c38565b6134d68484846111f4565b6001600160a01b0383163b15611535576134f284848484613c70565b611535576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608081018252600080825260208201819052918101829052606081019190915261103761353f8361317b565b613be5565b60008061355084613d5b565b90506122298382613d9d565b60006135688383613544565b151560000361357957506000611037565b6120c98383613e36565b600060018260028111156135995761359961473c565b03613653573360009081526012602052604081205460ff169060028260028111156135c6576135c661473c565b1480156135f65750600160008681526011602052604090205460ff1660028111156135f3576135f361473c565b14155b90506000600283600281111561360e5761360e61473c565b1415801561363e5750600260008781526011602052604090205460ff16600281111561363c5761363c61473c565b145b905081806136495750805b9350505050611037565b60008260028111156136675761366761473c565b036136d4573360009081526012602052604081205460ff169060028260028111156136945761369461473c565b141590506000600260008781526011602052604090205460ff1660028111156136bf576136bf61473c565b14905081801561364957509250611037915050565b506000611037565b6000816136e881612a24565b61374a5760405162461bcd60e51b815260206004820152602d60248201527f4c6f636b61626c653a206c6f636b696e6720717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b60648201526084016114c2565b60105460ff1661375d57600091506137d3565b600260008481526011602052604090205460ff1660028111156137825761378261473c565b14806137c0575060008381526011602052604081205460ff1660028111156137ac576137ac61473c565b1480156137c057506137c061089584611adf565b156137ce57600191506137d3565b600091505b50919050565b600354600082815260056020526040812054909142916137f99190614d45565b1192915050565b6000426003546006600061381386611adf565b6001600160a01b03166001600160a01b03168152602001908152602001600020546137f99190614d45565b613849601482613e7c565b506040516001600160a01b0382169033907fbd0af1fe0a2c1c7bb340c17a284a291138979c8eeb797e176dbd1c415199af3c90600090a350565b606060006120c983613e91565b60006301ffc9a760e01b6001600160e01b0319831614806138c157506380ac58cd60e01b6001600160e01b03198316145b806110375750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216632742b5b960e01b1480611037575061103782613890565b60006001600160e01b03198216630101c11560e71b14806110375750611037826138de565b6139328282611f0f565b6110745761393f81613eed565b61394a836020613eff565b60405160200161395b929190614e84565b60408051601f198184030181529082905262461bcd60e51b82526114c2916004016146e4565b61398b828261409a565b61107482826140ff565b60006139a082611adf565b9050336001600160a01b038216146139d9576139bc813361256a565b6139d9576040516367d9dca160e11b815260040160405180910390fd5b6000828152600e602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6115358484848461417a565b60008281526007602052604081205460ff166001811115613a6457613a6461473c565b03613b54576000546040805163292625cd60e21b8152905142926001600160a01b03169163a49897349160048083019260209291908290030181865afa158015613ab2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ad69190614cca565b11613b3a576000546040516339aa269d60e11b8152600481018490526001600160a01b03909116906373544d3a90602401600060405180830381600087803b158015613b2157600080fd5b505af1158015613b35573d6000803e3d6000fd5b505050505b6000828152600760205260409020805460ff191660011790555b61153584848484614205565b6002546009546008540360001901613b789083614d45565b1115613bc65760405162461bcd60e51b815260206004820152601c60248201527f636c61696d206973206f76657220746865206d617820737570706c790000000060448201526064016114c2565b611074828261421d565b60006120c9836001600160a01b038416614330565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b60006110373383613544565b613c4182613c2c565b80613c4a575080155b613c665760405162461bcd60e51b81526004016114c290614e37565b6110748282614423565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613ca5903390899088908890600401614ef9565b6020604051808303816000875af1925050508015613ce0575060408051601f3d908101601f19168201909252613cdd91810190614f36565b60015b613d3e573d808015613d0e576040519150601f19603f3d011682016040523d82523d6000602084013e613d13565b606091505b508051600003613d36576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6001600160a01b03811660009081526018602052604081205415613d9557506001600160a01b031660009081526018602052604090205490565b505060195490565b60165460009060ff16613db257506001611037565b613dbb8361448c565b806120c95750601354604051630f8350ed60e41b81526001600160a01b038581166004830152602482018590529091169063f8350ed090604401602060405180830381865afa158015613e12573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c99190614dfd565b6000613e418361153b565b15613e4e57506000611037565b6001600160a01b038084166000908152600f602090815260408083209386168352929052205460ff166120c9565b60006120c9836001600160a01b0384166144b6565b606081600001805480602002602001604051908101604052809291908181526020018280548015613ee157602002820191906000526020600020905b815481526020019060010190808311613ecd575b50505050509050919050565b60606110376001600160a01b03831660145b60606000613f0e836002614cf9565b613f19906002614d45565b6001600160401b03811115613f3057613f30614b3f565b6040519080825280601f01601f191660200182016040528015613f5a576020820181803683370190505b509050600360fc1b81600081518110613f7557613f75614d58565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613fa457613fa4614d58565b60200101906001600160f81b031916908160001a9053506000613fc8846002614cf9565b613fd3906001614d45565b90505b600181111561404b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061400757614007614d58565b1a60f81b82828151811061401d5761401d614d58565b60200101906001600160f81b031916908160001a90535060049490941c9361404481614f53565b9050613fd6565b5083156120c95760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016114c2565b6140a381612829565b156110745760405162461bcd60e51b815260206004820152602660248201527f4c6f636b61626c653a2043616e206e6f7420617070726f7665206c6f636b6564604482015265103a37b5b2b760d11b60648201526084016114c2565b6001600160a01b038216156110745761411881836144fd565b6110745760405162461bcd60e51b815260206004820152602d60248201527f5265737472696374417070726f76653a2054686520636f6e747261637420697360448201526c103737ba1030b63637bbb2b21760991b60648201526084016114c2565b6001600160a01b0384161580159061419a57506001600160a01b03831615155b15611535576141a882612829565b156115355760405162461bcd60e51b815260206004820152602760248201527f4c6f636b61626c653a2043616e206e6f74207472616e73666572206c6f636b6560448201526632103a37b5b2b760c91b60648201526084016114c2565b6142118484848461450a565b61153584848484614534565b60085460008290036142425760405163b562e8dd60e01b815260040160405180910390fd5b61424f6000848385613a35565b6001600160a01b0383166000818152600d602090815260408083208054680100000000000000018802019055848352600c90915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146142fe57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a46001016142c6565b508160000361431f57604051622e076360e81b815260040160405180910390fd5b600855506111b36000848385613a41565b60008181526001830160205260408120548015614419576000614354600183614d32565b855490915060009061436890600190614d32565b90508181146143cd57600086600001828154811061438857614388614d58565b90600052602060002001549050808760000184815481106143ab576143ab614d58565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806143de576143de614f6a565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611037565b6000915050611037565b61442c3361153b565b1580614436575080155b6144825760405162461bcd60e51b815260206004820152601c60248201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e0000000060448201526064016114c2565b6110748282614557565b60006110376014836001600160a01b038116600090815260018301602052604081205415156120c9565b60008181526001830160205260408120546136d457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611037565b60008061355033856145bc565b6001600160a01b03841615611535576000828152601160205260409020805460ff19169055611535565b6001600160a01b0384161561153557600082815260176020526040812055611535565b336000818152600f602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101613428565b600081815260176020526040812054156145e55750600081815260176020526040902054611037565b6120c983613d5b565b6020808252825182820181905260009190848201906040850190845b81811015611e2e5783516001600160a01b03168352928401929184019160010161460a565b6001600160e01b0319811681146113b857600080fd5b60006020828403121561465757600080fd5b81356120c98161462f565b6001600160a01b03811681146113b857600080fd5b60006020828403121561468957600080fd5b81356120c981614662565b60005b838110156146af578181015183820152602001614697565b50506000910152565b600081518084526146d0816020860160208601614694565b601f01601f19169290920160200192915050565b6020815260006120c960208301846146b8565b60006020828403121561470957600080fd5b5035919050565b6000806040838503121561472357600080fd5b823561472e81614662565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b60208101600383106147665761476661473c565b91905290565b60008060006060848603121561478157600080fd5b833561478c81614662565b9250602084013561479c81614662565b929592945050506040919091013590565b600080604083850312156147c057600080fd5b50508035926020909101359150565b600080604083850312156147e257600080fd5b8235915060208301356147f481614662565b809150509250929050565b60006020828403121561481157600080fd5b81356001600160601b03811681146120c957600080fd5b6020808252825182820181905260009190848201906040850190845b81811015611e2e57835183529284019291840191600101614844565b80356003811061486f57600080fd5b919050565b60006020828403121561488657600080fd5b6120c982614860565b60008083601f8401126148a157600080fd5b5081356001600160401b038111156148b857600080fd5b6020830191508360208260051b850101111561139157600080fd5b600080602083850312156148e657600080fd5b82356001600160401b038111156148fc57600080fd5b6149088582860161488f565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611e2e5761497f838551614914565b928401926080929092019160010161496c565b80151581146113b857600080fd5b6000806000806000606086880312156149b857600080fd5b85356001600160401b03808211156149cf57600080fd5b6149db89838a0161488f565b909750955060208801359150808211156149f457600080fd5b50614a018882890161488f565b9094509250506040860135614a1581614992565b809150509295509295909350565b60208101600283106147665761476661473c565b600080600060408486031215614a4c57600080fd5b83356001600160401b03811115614a6257600080fd5b614a6e8682870161488f565b9094509250614a81905060208501614860565b90509250925092565b60008060408385031215614a9d57600080fd5b8235614aa881614662565b9150614ab660208401614860565b90509250929050565b600080600060608486031215614ad457600080fd5b8335614adf81614662565b95602085013595506040909401359392505050565b600060208284031215614b0657600080fd5b81356120c981614992565b60008060408385031215614b2457600080fd5b8235614b2f81614662565b915060208301356147f481614992565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614b7d57614b7d614b3f565b604052919050565b60006001600160401b03821115614b9e57614b9e614b3f565b50601f01601f191660200190565b60008060008060808587031215614bc257600080fd5b8435614bcd81614662565b93506020850135614bdd81614662565b92506040850135915060608501356001600160401b03811115614bff57600080fd5b8501601f81018713614c1057600080fd5b8035614c23614c1e82614b85565b614b55565b818152886020838501011115614c3857600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b608081016110378284614914565b60008060408385031215614c7b57600080fd5b8235614c8681614662565b915060208301356147f481614662565b600181811c90821680614caa57607f821691505b6020821081036137d357634e487b7160e01b600052602260045260246000fd5b600060208284031215614cdc57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761103757611037614ce3565b600082614d2d57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561103757611037614ce3565b8082018082111561103757611037614ce3565b634e487b7160e01b600052603260045260246000fd5b600060018201614d8057614d80614ce3565b5060010190565b600060208284031215614d9957600080fd5b81516001600160401b03811115614daf57600080fd5b8201601f81018413614dc057600080fd5b8051614dce614c1e82614b85565b818152856020838501011115614de357600080fd5b614df4826020830160208601614694565b95945050505050565b600060208284031215614e0f57600080fd5b81516120c981614992565b600060208284031215614e2c57600080fd5b81516120c981614662565b6020808252602d908201527f5265737472696374417070726f76653a2043616e206e6f7420617070726f766560408201526c103637b1b5b2b2103a37b5b2b760991b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614ebc816017850160208801614694565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614eed816028840160208801614694565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614f2c908301846146b8565b9695505050505050565b600060208284031215614f4857600080fd5b81516120c98161462f565b600081614f6257614f62614ce3565b506000190190565b634e487b7160e01b600052603160045260246000fdfedf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42a264697066735822122024fe26250e361edc22cbd962c1119cb8be552e6637a9fff3b87a725f0331592664736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.