Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 71 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Safe Transfer Fr... | 22867832 | 229 days ago | IN | 0 ETH | 0.00035153 | ||||
| Transfer From | 22746721 | 246 days ago | IN | 0 ETH | 0.00011149 | ||||
| Withdraw | 22442179 | 289 days ago | IN | 0 ETH | 0.00006928 | ||||
| Set Withdraw Add... | 22442164 | 289 days ago | IN | 0 ETH | 0.00006579 | ||||
| Set Paused | 22339430 | 303 days ago | IN | 0 ETH | 0.00025002 | ||||
| Set Mint Cost | 22339407 | 303 days ago | IN | 0 ETH | 0.00036052 | ||||
| Safe Transfer Fr... | 22294946 | 310 days ago | IN | 0 ETH | 0.00003871 | ||||
| Safe Transfer Fr... | 22294935 | 310 days ago | IN | 0 ETH | 0.00003947 | ||||
| Safe Transfer Fr... | 22294877 | 310 days ago | IN | 0 ETH | 0.00003675 | ||||
| Airdrop | 22181763 | 325 days ago | IN | 0 ETH | 0.00018439 | ||||
| Set Paused | 22181104 | 325 days ago | IN | 0 ETH | 0.00004758 | ||||
| Mint | 22168015 | 327 days ago | IN | 0.012 ETH | 0.00012356 | ||||
| Mint | 22167644 | 327 days ago | IN | 0.012 ETH | 0.00008297 | ||||
| Mint | 22167627 | 327 days ago | IN | 0.024 ETH | 0.00013717 | ||||
| Mint | 22167439 | 327 days ago | IN | 0.012 ETH | 0.00012616 | ||||
| Mint | 22166698 | 327 days ago | IN | 0.012 ETH | 0.00006818 | ||||
| Mint | 22165988 | 328 days ago | IN | 0.012 ETH | 0.00008434 | ||||
| Mint | 22159957 | 328 days ago | IN | 0.012 ETH | 0.00005559 | ||||
| Mint | 22158500 | 329 days ago | IN | 0.012 ETH | 0.00005609 | ||||
| Mint | 22158442 | 329 days ago | IN | 0.012 ETH | 0.00005592 | ||||
| Mint | 22156963 | 329 days ago | IN | 0.012 ETH | 0.000064 | ||||
| Mint | 22151627 | 330 days ago | IN | 0.036 ETH | 0.00006023 | ||||
| Mint | 22151555 | 330 days ago | IN | 0.012 ETH | 0.00005481 | ||||
| Mint | 22151550 | 330 days ago | IN | 0.012 ETH | 0.00005474 | ||||
| Set Approval For... | 22151498 | 330 days ago | IN | 0 ETH | 0.00004454 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 22442179 | 289 days ago | 1.08 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
RomacoMergeCrowdFunding
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;
import "./ERC721Psi.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
contract RomacoMergeCrowdFunding is ERC721Psi, AccessControl, Ownable, ERC2981 {
using Strings for uint256;
// Role
bytes32 public constant ADMIN = "ADMIN";
bytes32 public constant MINTER = "MINTER";
// Mint
bool public paused = true;
uint256 public maxSupply = 300;
address public withdrawAddress;
uint256 public mintCost = 0.012 ether;
// Metadata
string public baseURI;
string public baseExtension;
// Constructor
constructor() ERC721Psi("RomacoMergeCrowdFunding", "RMCF") Ownable(msg.sender) {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(ADMIN, msg.sender);
withdrawAddress = msg.sender;
_setDefaultRoyalty(msg.sender, 1000);
}
// Mint
function airdrop(address[] calldata _addresses, uint256 _amount) external onlyRole(ADMIN) {
for (uint256 i = 0; i < _addresses.length; i++) {
_safeMint(_addresses[i], _amount);
}
}
function mint(address _to, uint256 _amount) external payable {
require(!paused, "Paused");
require(msg.value >= mintCost * _amount, 'Not Enough Eth');
require(totalSupply() + _amount <= maxSupply, 'Over Max Supply');
_safeMint(_to, _amount);
}
function externalMint(address _to, uint256 _amount) external onlyRole(MINTER) {
_safeMint(_to, _amount);
}
function withdraw() external onlyRole(ADMIN) {
(bool os, ) = payable(withdrawAddress).call{value: address(this).balance}("");
require(os);
}
// Getter
function _startTokenId() internal pure override returns (uint256) {
return 1;
}
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
function tokenURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token");
string memory base = _baseURI();
return bytes(base).length > 0
? string(abi.encodePacked(base, tokenId.toString(), baseExtension))
: "";
}
// Setter
function setBaseURI(string memory _value) external onlyRole(ADMIN) {
baseURI = _value;
}
function setBaseExtension(string memory _value) external onlyRole(ADMIN) {
baseExtension = _value;
}
function resetBaseExtension() external onlyRole(ADMIN) {
baseExtension = "";
}
function setPaused(bool _value) external onlyRole(ADMIN) {
paused = _value;
}
function setDefaultRoyalty(address _receiver, uint96 _feeNumerator) external onlyRole(ADMIN) {
_setDefaultRoyalty(_receiver, _feeNumerator);
}
function setWithdrawAddress(address _value) external onlyRole(ADMIN) {
withdrawAddress = _value;
}
function setMintCost(uint256 _value) external onlyRole(ADMIN) {
mintCost = _value;
}
function setMaxSupply(uint256 _value) external onlyRole(ADMIN) {
maxSupply = _value;
}
// AccessControl
function grantRole(bytes32 role, address account) public override onlyOwner {
_grantRole(role, account);
}
function revokeRole(bytes32 role, address account) public override onlyOwner {
_revokeRole(role, account);
}
// Override
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Psi, AccessControl, ERC2981) returns (bool) {
return
ERC721Psi.supportsInterface(interfaceId) ||
ERC2981.supportsInterface(interfaceId) ||
AccessControl.supportsInterface(interfaceId) ||
super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../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:
*
* ```solidity
* 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}:
*
* ```solidity
* 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. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
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 returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @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 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 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 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 `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @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 Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @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.
*/
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 `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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 v5.0.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../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.
*/
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 v5.0.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.20;
import {IERC2981} from "../../interfaces/IERC2981.sol";
import {IERC165, ERC165} from "../../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.
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);
/**
* @dev The default royalty receiver is invalid.
*/
error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);
/**
* @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);
/**
* @dev The royalty receiver for `tokenId` is invalid.
*/
error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);
/**
* @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 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 {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
}
_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 {
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
}
_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 v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.20;
import {IERC721} from "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../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 address zero.
*
* 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 (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.20;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be
* reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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 (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./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);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @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 v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @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 towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (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 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 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.
uint256 twos = denominator & (0 - denominator);
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 (unsignedRoundsUp(rounding) && 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
* towards zero.
*
* 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)
pragma solidity ^0.8.20;
import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
uint8 private constant ADDRESS_LENGTH = 20;
/**
* @dev The `value` string doesn't fit in the specified `length`.
*/
error StringsInsufficientHexLength(uint256 value, uint256 length);
/**
* @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), HEX_DIGITS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toStringSigned(int256 value) internal pure returns (string memory) {
return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
uint256 localValue = value;
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = HEX_DIGITS[localValue & 0xf];
localValue >>= 4;
}
if (localValue != 0) {
revert StringsInsufficientHexLength(value, length);
}
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
* representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
/**
______ _____ _____ ______ ___ __ _ _ _
| ____| __ \ / ____|____ |__ \/_ | || || |
| |__ | |__) | | / / ) || | \| |/ |
| __| | _ /| | / / / / | |\_ _/
| |____| | \ \| |____ / / / /_ | | | |
|______|_| \_\\_____|/_/ |____||_| |_|
- github: https://github.com/estarriolvetch/ERC721Psi
- npm: https://www.npmjs.com/package/erc721psi
*/
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/StorageSlot.sol";
import "solidity-bits/contracts/BitMaps.sol";
contract ERC721Psi is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
using BitMaps for BitMaps.BitMap;
BitMaps.BitMap private _batchHead;
string private _name;
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) internal _owners;
uint256 private _currentIndex;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal pure virtual returns (uint256) {
// It will become modifiable in the future versions
return 0;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view virtual returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256) {
return _currentIndex - _startTokenId();
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner)
public
view
virtual
override
returns (uint)
{
require(owner != address(0), "ERC721Psi: balance query for the zero address");
uint count;
for( uint i = _startTokenId(); i < _nextTokenId(); ++i ){
if(_exists(i)){
if( owner == ownerOf(i)){
++count;
}
}
}
return count;
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId)
public
view
virtual
override
returns (address)
{
(address owner, ) = _ownerAndBatchHeadOf(tokenId);
return owner;
}
function _ownerAndBatchHeadOf(uint256 tokenId) internal view returns (address owner, uint256 tokenIdBatchHead){
require(_exists(tokenId), "ERC721Psi: owner query for nonexistent token");
tokenIdBatchHead = _getBatchHead(tokenId);
owner = _owners[tokenIdBatchHead];
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721Psi: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721Psi: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
require(
_exists(tokenId),
"ERC721Psi: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
require(operator != _msgSender(), "ERC721Psi: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721Psi: transfer caller is not owner nor approved"
);
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721Psi: transfer caller is not owner nor approved"
);
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, 1,_data),
"ERC721Psi: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return tokenId < _nextTokenId() && _startTokenId() <= tokenId;
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
require(
_exists(tokenId),
"ERC721Psi: operator query for nonexistent token"
);
address owner = ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
/**
* @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.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, "");
}
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
uint256 nextTokenId = _nextTokenId();
_mint(to, quantity);
require(
_checkOnERC721Received(address(0), to, nextTokenId, quantity, _data),
"ERC721Psi: transfer to non ERC721Receiver implementer"
);
}
function _mint(
address to,
uint256 quantity
) internal virtual {
uint256 nextTokenId = _nextTokenId();
require(quantity > 0, "ERC721Psi: quantity must be greater 0");
require(to != address(0), "ERC721Psi: mint to the zero address");
_beforeTokenTransfers(address(0), to, nextTokenId, quantity);
_currentIndex += quantity;
_owners[nextTokenId] = to;
_batchHead.set(nextTokenId);
_afterTokenTransfers(address(0), to, nextTokenId, quantity);
// Emit events
for(uint256 tokenId=nextTokenId; tokenId < nextTokenId + quantity; tokenId++){
emit Transfer(address(0), to, tokenId);
}
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
(address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf(tokenId);
require(
owner == from,
"ERC721Psi: transfer of token that is not own"
);
require(to != address(0), "ERC721Psi: transfer to the zero address");
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
uint256 subsequentTokenId = tokenId + 1;
if(!_batchHead.get(subsequentTokenId) &&
subsequentTokenId < _nextTokenId()
) {
_owners[subsequentTokenId] = from;
_batchHead.set(subsequentTokenId);
}
_owners[tokenId] = to;
if(tokenId != tokenIdBatchHead) {
_batchHead.set(tokenId);
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
function _isContract(address addr) internal view returns (bool) {
uint size;
assembly {
size := extcodesize(addr)
}
return size > 0;
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param startTokenId uint256 the first ID of the tokens to be transferred
* @param quantity uint256 amount of the tokens to be transfered.
* @param _data bytes optional data to send along with the call
* @return r bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 startTokenId,
uint256 quantity,
bytes memory _data
) private returns (bool r) {
if (from == address(0) && _isContract(to)) {
r = true;
for(uint256 tokenId = startTokenId; tokenId < startTokenId + quantity; tokenId++){
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
r = r && retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721Psi: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
return r;
} else {
return true;
}
}
function _getBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdBatchHead) {
tokenIdBatchHead = _batchHead.scanForward(tokenId);
}
function totalSupply() public virtual view returns (uint256) {
return _totalMinted();
}
/**
* @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.
*
* This function is compatiable with ERC721AQueryable.
*/
function tokensOfOwner(address owner) external view virtual returns (uint256[] memory) {
unchecked {
uint256 tokenIdsIdx;
uint256 tokenIdsLength = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenIdsLength);
for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
if (_exists(i)) {
if (ownerOf(i) == owner) {
tokenIds[tokenIdsIdx++] = i;
}
}
}
return tokenIds;
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
*
* 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`.
*/
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.
*
* 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` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}// SPDX-License-Identifier: MIT
/**
_____ ___ ___ __ ____ _ __
/ ___/____ / (_)___/ (_) /___ __ / __ )(_) /______
\__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/
___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ )
/____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/
/____/
- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits
*/
pragma solidity ^0.8.0;
import "./BitScan.sol";
/**
* @dev This Library is a modified version of Openzeppelin's BitMaps library.
* Functions of finding the index of the closest set bit from a given index are added.
* The indexing of each bucket is modifed to count from the MSB to the LSB instead of from the LSB to the MSB.
* The modification of indexing makes finding the closest previous set bit more efficient in gas usage.
*/
/**
* @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
* Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
*/
library BitMaps {
using BitScan for uint256;
uint256 private constant MASK_INDEX_ZERO = (1 << 255);
uint256 private constant MASK_FULL = type(uint256).max;
struct BitMap {
mapping(uint256 => uint256) _data;
}
/**
* @dev Returns whether the bit at `index` is set.
*/
function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
uint256 bucket = index >> 8;
uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
return bitmap._data[bucket] & mask != 0;
}
/**
* @dev Sets the bit at `index` to the boolean `value`.
*/
function setTo(
BitMap storage bitmap,
uint256 index,
bool value
) internal {
if (value) {
set(bitmap, index);
} else {
unset(bitmap, index);
}
}
/**
* @dev Sets the bit at `index`.
*/
function set(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index >> 8;
uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
bitmap._data[bucket] |= mask;
}
/**
* @dev Unsets the bit at `index`.
*/
function unset(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index >> 8;
uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
bitmap._data[bucket] &= ~mask;
}
/**
* @dev Consecutively sets `amount` of bits starting from the bit at `startIndex`.
*/
function setBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal {
uint256 bucket = startIndex >> 8;
uint256 bucketStartIndex = (startIndex & 0xff);
unchecked {
if(bucketStartIndex + amount < 256) {
bitmap._data[bucket] |= MASK_FULL << (256 - amount) >> bucketStartIndex;
} else {
bitmap._data[bucket] |= MASK_FULL >> bucketStartIndex;
amount -= (256 - bucketStartIndex);
bucket++;
while(amount > 256) {
bitmap._data[bucket] = MASK_FULL;
amount -= 256;
bucket++;
}
bitmap._data[bucket] |= MASK_FULL << (256 - amount);
}
}
}
/**
* @dev Consecutively unsets `amount` of bits starting from the bit at `startIndex`.
*/
function unsetBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal {
uint256 bucket = startIndex >> 8;
uint256 bucketStartIndex = (startIndex & 0xff);
unchecked {
if(bucketStartIndex + amount < 256) {
bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount) >> bucketStartIndex);
} else {
bitmap._data[bucket] &= ~(MASK_FULL >> bucketStartIndex);
amount -= (256 - bucketStartIndex);
bucket++;
while(amount > 256) {
bitmap._data[bucket] = 0;
amount -= 256;
bucket++;
}
bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount));
}
}
}
/**
* @dev Find the closest index of the set bit before `index`.
*/
function scanForward(BitMap storage bitmap, uint256 index) internal view returns (uint256 setBitIndex) {
uint256 bucket = index >> 8;
// index within the bucket
uint256 bucketIndex = (index & 0xff);
// load a bitboard from the bitmap.
uint256 bb = bitmap._data[bucket];
// offset the bitboard to scan from `bucketIndex`.
bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex)
if(bb > 0) {
unchecked {
setBitIndex = (bucket << 8) | (bucketIndex - bb.bitScanForward256());
}
} else {
while(true) {
require(bucket > 0, "BitMaps: The set bit before the index doesn't exist.");
unchecked {
bucket--;
}
// No offset. Always scan from the least significiant bit now.
bb = bitmap._data[bucket];
if(bb > 0) {
unchecked {
setBitIndex = (bucket << 8) | (255 - bb.bitScanForward256());
break;
}
}
}
}
}
function getBucket(BitMap storage bitmap, uint256 bucket) internal view returns (uint256) {
return bitmap._data[bucket];
}
}// SPDX-License-Identifier: MIT
/**
_____ ___ ___ __ ____ _ __
/ ___/____ / (_)___/ (_) /___ __ / __ )(_) /______
\__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/
___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ )
/____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/
/____/
- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits
*/
pragma solidity ^0.8.0;
library BitScan {
uint256 constant private DEBRUIJN_256 = 0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff;
bytes constant private LOOKUP_TABLE_256 = hex"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8";
/**
@dev Isolate the least significant set bit.
*/
function isolateLS1B256(uint256 bb) pure internal returns (uint256) {
require(bb > 0);
unchecked {
return bb & (0 - bb);
}
}
/**
@dev Isolate the most significant set bit.
*/
function isolateMS1B256(uint256 bb) pure internal returns (uint256) {
require(bb > 0);
unchecked {
bb |= bb >> 128;
bb |= bb >> 64;
bb |= bb >> 32;
bb |= bb >> 16;
bb |= bb >> 8;
bb |= bb >> 4;
bb |= bb >> 2;
bb |= bb >> 1;
return (bb >> 1) + 1;
}
}
/**
@dev Find the index of the lest significant set bit. (trailing zero count)
*/
function bitScanForward256(uint256 bb) pure internal returns (uint8) {
unchecked {
return uint8(LOOKUP_TABLE_256[(isolateLS1B256(bb) * DEBRUIJN_256) >> 248]);
}
}
/**
@dev Find the index of the most significant set bit.
*/
function bitScanReverse256(uint256 bb) pure internal returns (uint8) {
unchecked {
return 255 - uint8(LOOKUP_TABLE_256[((isolateMS1B256(bb) * DEBRUIJN_256) >> 248)]);
}
}
function log2(uint256 bb) pure internal returns (uint8) {
unchecked {
return uint8(LOOKUP_TABLE_256[(isolateMS1B256(bb) * DEBRUIJN_256) >> 248]);
}
}
}{
"metadata": {
"bytecodeHash": "none"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","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":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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseExtension","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"externalMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","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":"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":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintCost","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":"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":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetBaseExtension","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":[{"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":"nonpayable","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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_value","type":"string"}],"name":"setBaseExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_value","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"setMintCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_value","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_value","type":"address"}],"name":"setWithdrawAddress","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":"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":[],"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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
604060808152346200040757620000156200040c565b906017825260207f526f6d61636f4d6572676543726f776446756e64696e67000000000000000000818401526200004b6200040c565b6004808252632926a1a360e11b83830152845190946001600160401b039290838311620003f2576001928354918483811c93168015620003e7575b87841014620002e8578190601f9384811162000391575b50879084831160011462000329576000926200031d575b5050600019600383901b1c191690841b1783555b81519184831162000308576002548481811c91168015620002fd575b87821014620002e857908183859493116200028f575b5086918311600114620002255760009262000219575b5050600019600383901b1c191690821b176002555b80855533156200020257600880546001600160a01b0319808216339081179093559291906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a360ff19600b541617600b5561012c600c55662aa1efb94e0000600e556200019e3362000442565b50620001aa33620004c3565b503390600d541617600d558251908382019082821090821117620001ed57836103e8949550523381520152607d60a31b331760095551612c2190816200054f8239f35b604185634e487b7160e01b6000525260246000fd5b8351631e4fbdf760e01b8152600081870152602490fd5b01519050388062000110565b90849350601f198316916002600052876000209260005b898282106200027857505084116200025e575b505050811b0160025562000125565b015160001960f88460031b161c191690553880806200024f565b83850151865588979095019493840193016200023c565b909192506002600052866000208380860160051c820192898710620002de575b91869588929594930160051c01915b828110620002ce575050620000fa565b60008155869550879101620002be565b92508192620002af565b602289634e487b7160e01b6000525260246000fd5b90607f1690620000e4565b604188634e487b7160e01b6000525260246000fd5b015190503880620000b4565b90869350601f1983169184600052896000209260005b8b8282106200037a575050841162000360575b505050811b018355620000c8565b015160001960f88460031b161c1916905538808062000352565b8385015186558a979095019493840193016200033f565b90915085600052876000208480850160051c8201928a8610620003dd575b918891869594930160051c01915b828110620003cd5750506200009d565b60008155859450889101620003bd565b92508192620003af565b92607f169262000086565b604187634e487b7160e01b6000525260246000fd5b600080fd5b60408051919082016001600160401b038111838210176200042c57604052565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b031660008181527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df602052604081205490919060ff16620004bf5781805260076020526040822081835260205260408220600160ff198254161790553391600080516020620031708339815191528180a4600190565b5090565b6001600160a01b031660008181527f2fb019b8167f14f5e503ce2e68f0a4ee77135067e5ff9840b14beead991c450860205260408120549091906420a226a4a760d91b9060ff16620005495780835260076020526040832082845260205260408320600160ff1982541617905560008051602062003170833981519152339380a4600190565b50509056fe6080604052600436101561001257600080fd5b60003560e01c806301ffc9a7146102e757806304634d8d146102e257806306fdde03146102dd578063081812fc146102d8578063095ea7b3146102d35780631581b600146102ce57806316c38b3c146102c957806318160ddd146102c457806323b872dd146102bf578063248a9ca3146102ba5780632a0acc6a146102b55780632a55205a146102b05780632f2ff15d146102ab57806336568abe146102a65780633ab1a494146102a15780633ccfd60b1461029c57806340c10f191461029757806342842e0e1461029257806355f804b31461028d5780635c975abb146102885780635f1b1b86146102835780636352211e1461027e5780636c0360eb146102795780636f8b44b01461027457806370a082311461026f578063715018a61461026a5780638462151c146102655780638545f4ea146102605780638da5cb5b1461025b57806391d148541461025657806395d89b411461025157806399f988981461024c578063a217fddf14610247578063a22cb46514610242578063b88d4fde1461023d578063bdb4b84814610238578063c204642c14610233578063c66828621461022e578063c87b56dd14610229578063d547741f14610224578063d5abeb011461021f578063da3ef23f1461021a578063e985e9c514610215578063f2fde38b146102105763fe6d81241461020b57600080fd5b6117a6565b611719565b6116bd565b6115d0565b6115b2565b611582565b6114a5565b611410565b61138a565b61136c565b611304565b611218565b6111fc565b611173565b6110cc565b611076565b61104d565b61102c565b610f66565b610ecd565b610ea6565b610e85565b610e55565b610d2e565b610cc5565b610ca2565b610ba3565b610a4b565b6109ba565b61097c565b610935565b6108ea565b6108ba565b610818565b6107f4565b6107c5565b61079c565b61074d565b610714565b6106dc565b6105e8565b6105b8565b6104d5565b61038f565b610303565b6001600160e01b03198116036102fe57565b600080fd5b346102fe5760203660031901126102fe576020600435610322816102ec565b61032b816129a3565b90811561036d575b811561035c575b811561034c575b506040519015158152f35b610356915061297a565b38610341565b905061036781612951565b9061033a565b90506103788161297a565b90610333565b6001600160a01b038116036102fe57565b346102fe5760403660031901126102fe576004356103ac8161037e565b602435906001600160601b0382168083036102fe576103c96123ad565b61271080821161045b5750506001600160a01b0381161561043e5761041561043c926104056103f6610b05565b6001600160a01b039094168452565b6001600160601b03166020830152565b805160209091015160a01b6001600160a01b0319166001600160a01b039190911617600955565b005b604051635b6cc80560e11b815260006004820152602490fd5b0390fd5b6044925060405191636f483d0960e01b835260048301526024820152fd5b60005b83811061048c5750506000910152565b818101518382015260200161047c565b906020916104b581518092818552858086019101610479565b601f01601f1916010190565b9060206104d292818152019061049c565b90565b346102fe576000806003193601126105b557604051908060018054916104fa83610d5f565b8086529282811690811561058b5750600114610531575b61052d8561052181870382610ae3565b604051918291826104c1565b0390f35b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b8284106105735750505081016020016105218261052d610511565b80546020858701810191909152909301928101610558565b86955061052d9693506020925061052194915060ff191682840152151560051b8201019293610511565b80fd5b346102fe5760203660031901126102fe5760206105d6600435611b4e565b6040516001600160a01b039091168152f35b346102fe5760403660031901126102fe576004356106058161037e565b602435610611816119bb565b50916001600160a01b03808416908216811461068b5761043c9361063f913314908115610644575b50611adc565b61206c565b6001600160a01b03166000908152600660205260409020610685915061067e9033905b9060018060a01b0316600052602052604060002090565b5460ff1690565b38610639565b60405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608490fd5b346102fe5760003660031901126102fe57600d546040516001600160a01b039091168152602090f35b6024359081151582036102fe57565b346102fe5760203660031901126102fe576004358015158091036102fe5761073a6123ad565b60ff8019600b5416911617600b55600080f35b346102fe5760003660031901126102fe57602061076861236d565b604051908152f35b60609060031901126102fe576004356107888161037e565b906024356107958161037e565b9060443590565b346102fe5761043c6107ad36610770565b916107c06107bb8433611d0a565b611bd4565b611e61565b346102fe5760203660031901126102fe5760043560005260076020526020600160406000200154604051908152f35b346102fe5760003660031901126102fe576040516420a226a4a760d91b8152602090f35b346102fe5760403660031901126102fe57600435600052600a60205260406000206040519061084682610a89565b546001600160a01b0380821680845260a09290921c602084015290156108aa575b61088b6108836001600160601b036020850151166024356118cb565b612710900490565b915160408051929091166001600160a01b031682526020820192909252f35b90506108b461188f565b90610867565b346102fe5760403660031901126102fe5761043c6024356108da8161037e565b6108e2611863565b6004356128bd565b346102fe5760403660031901126102fe576024356109078161037e565b336001600160a01b038216036109235761043c906004356117cb565b60405163334bd91960e11b8152600490fd5b346102fe5760203660031901126102fe576004356109528161037e565b61095a6123ad565b600d80546001600160a01b0319166001600160a01b0392909216919091179055005b346102fe576000806003193601126105b5576109966123ad565b8080808060018060a01b03600d541647905af16109b1612142565b50156105b55780f35b60403660031901126102fe576004356109d28161037e565b60243560ff600b5416610a1d5761043c916109fa6109f283600e546118cb565b34101561257d565b610a18610a0e83610a0961236d565b611e54565b600c5410156125ba565b6123f1565b60405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606490fd5b346102fe5761043c610a5c36610770565b9060405192610a6a84610aaa565b60008452611c50565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff821117610aa557604052565b610a73565b6020810190811067ffffffffffffffff821117610aa557604052565b610120810190811067ffffffffffffffff821117610aa557604052565b90601f8019910116810190811067ffffffffffffffff821117610aa557604052565b60405190610b1282610a89565b565b67ffffffffffffffff8111610aa557601f01601f191660200190565b929192610b3c82610b14565b91610b4a6040519384610ae3565b8294818452818301116102fe578281602093846000960137010152565b60206003198201126102fe576004359067ffffffffffffffff82116102fe57806023830112156102fe578160246104d293600401359101610b30565b346102fe57610bb136610b67565b610bb96123ad565b805167ffffffffffffffff8111610aa557610bde81610bd9600f54610d5f565b612818565b602080601f8311600114610c1b57508192600092610c10575b5050600019600383901b1c191660019190911b17600f55005b015190503880610bf7565b90601f19831693610c4e600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac80290565b926000905b868210610c8a5750508360019510610c71575b505050811b01600f55005b015160001960f88460031b161c19169055388080610c66565b80600185968294968601518155019501930190610c53565b346102fe5760003660031901126102fe57602060ff600b54166040519015158152f35b346102fe576000806003193601126105b557610cdf6123ad565b610cea601054610d5f565b601f8111610cfc575b50600060105580f35b601f600080516020612bf5833981519152910160051c8101905b818110610d235750610cf3565b828155600101610d16565b346102fe5760203660031901126102fe576020610d4c6004356119bb565b506040516001600160a01b039091168152f35b90600182811c92168015610d8f575b6020831014610d7957565b634e487b7160e01b600052602260045260246000fd5b91607f1691610d6e565b60405190600082600f5491610dad83610d5f565b80835292600190818116908115610e335750600114610dd4575b50610b1292500383610ae3565b600f600090815291507f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8025b848310610e185750610b12935050810160200138610dc7565b81935090816020925483858a01015201910190918592610dff565b905060209250610b1294915060ff191682840152151560051b82010138610dc7565b346102fe5760003660031901126102fe5761052d610e71610d99565b60405191829160208352602083019061049c565b346102fe5760203660031901126102fe57610e9e6123ad565b600435600c55005b346102fe5760203660031901126102fe576020610768600435610ec88161037e565b6118f2565b346102fe576000806003193601126105b557610ee7611863565b600880546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b6020908160408183019282815285518094520193019160005b828110610f52575050505090565b835185529381019392810192600101610f44565b346102fe576020806003193601126102fe5760043590610f858261037e565b6000610f90836118f2565b90610f9a8261237f565b92610fa86040519485610ae3565b828452601f19610fb78461237f565b013682860137600194855b848403610fd7576040518061052d8882610f2b565b80610fe28892611cf2565b610fed575b01610fc2565b610ff6816119bb565b506001600160a01b03848116911603610fe75793908101938651821015611027578084899360051b89010152610fe7565b612397565b346102fe5760203660031901126102fe576110456123ad565b600435600e55005b346102fe5760003660031901126102fe576008546040516001600160a01b039091168152602090f35b346102fe5760403660031901126102fe57602060ff6110c060243561109a8161037e565b6004356000526007845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b346102fe576000806003193601126105b55760405190806002546110ef81610d5f565b8085529160019180831690811561058b57506001146111185761052d8561052181870382610ae3565b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b82841061115b5750505081016020016105218261052d610511565b80546020858701810191909152909301928101611140565b346102fe5760403660031901126102fe576004356111908161037e565b3360009081527fcafd4c04fc85c95eb7f3034a0225066ab2e1e1e67f41a5cea34e7199f9a8f30260205260409020546526a4a72a22a960d11b9060ff16156111de5761043c602435836123f1565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b346102fe5760003660031901126102fe57602060405160008152f35b346102fe5760403660031901126102fe576004356112358161037e565b61123d610705565b6001600160a01b038216913383146112bf578161127c61128d9233600052600660205260406000209060018060a01b0316600052602052604060002090565b9060ff801983541691151516179055565b604051901515815233907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b60405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606490fd5b346102fe5760803660031901126102fe576004356113218161037e565b60243561132d8161037e565b6064359167ffffffffffffffff83116102fe57366023840112156102fe5761136261043c933690602481600401359101610b30565b9160443591611c50565b346102fe5760003660031901126102fe576020600e54604051908152f35b346102fe5760403660031901126102fe5760043567ffffffffffffffff8082116102fe57366023830112156102fe5781600401359081116102fe57600560243683831b85018201116102fe578035906113e16123ad565b60005b8481106113ed57005b80611406848461140b94881b8a010135610a188161037e565b6118e3565b6113e4565b346102fe576000806003193601126105b557604051908060105461143381610d5f565b8085529160019180831690811561058b575060011461145c5761052d8561052181870382610ae3565b925060108352600080516020612bf58339815191525b82841061148d5750505081016020016105218261052d610511565b80546020858701810191909152909301928101611472565b346102fe5760203660031901126102fe576004356114c281611cf2565b1561152a576114cf610d99565b805115611518576105216114ff9161150a6115056114ef61052d966126be565b60405195869460208601906125f8565b906125f8565b61260f565b03601f198101835282610ae3565b505061052d611525611c3d565b610521565b60405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608490fd5b346102fe5760403660031901126102fe5761043c6024356115a28161037e565b6115aa611863565b6004356117cb565b346102fe5760003660031901126102fe576020600c54604051908152f35b346102fe576115de36610b67565b6115e66123ad565b805167ffffffffffffffff8111610aa55761160b81611606601054610d5f565b612879565b602080601f83116001146116485750819260009261163d575b5050600019600383901b1c191660019190911b17601055005b015190503880611624565b90601f198316936116696010600052600080516020612bf583398151915290565b926000905b8682106116a5575050836001951061168c575b505050811b01601055005b015160001960f88460031b161c19169055388080611681565b8060018596829496860151815501950193019061166e565b346102fe5760403660031901126102fe57602060ff6110c06004356116e18161037e565b602435906116ee8261037e565b60018060a01b03166000526006845260406000209060018060a01b0316600052602052604060002090565b346102fe5760203660031901126102fe576004356117368161037e565b61173e611863565b6001600160a01b0390811690811561178d57600854826001600160601b0360a01b821617600855167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b604051631e4fbdf760e01b815260006004820152602490fd5b346102fe5760003660031901126102fe576040516526a4a72a22a960d11b8152602090f35b600090808252600760205260ff6117f784604085209060018060a01b0316600052602052604060002090565b54161561185d578082526007602090815260408084206001600160a01b038616600090815292529020805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b50905090565b6008546001600160a01b0316330361187757565b60405163118cdaa760e01b8152336004820152602490fd5b6040519061189c82610a89565b6009546001600160a01b038116835260a01c6020830152565b634e487b7160e01b600052601160045260246000fd5b818102929181159184041417156118de57565b6118b5565b60001981146118de5760010190565b6001600160a01b0390811690811561196057600091600191600454925b83811061191d575050505090565b61192681611cf2565b611939575b611934906118e3565b61190f565b81611943826119bb565b5016830361192b5793611958611934916118e3565b94905061192b565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608490fd5b6119c481611cf2565b15611a8257600090600891604060ff83851c9316918381528060205220548160ff181c801515600014611a30576119fd611a0391612a61565b60ff1690565b9003911b175b611a2d611a20826000526003602052604060002090565b546001600160a01b031690565b91565b50505b611a3e8115156129e7565b60001901611a56816000526000602052604060002090565b5480611a625750611a33565b6119fd611a71611a7a92612a61565b60ff9081031690565b911b17611a09565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608490fd5b15611ae357565b60405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608490fd5b611b5781611cf2565b15611b77576000908152600560205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b15611bdb57565b60405162461bcd60e51b815260206004820152603460248201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6044820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b6064820152608490fd5b60405190611c4a82610aaa565b60008252565b91610b129391611c7793611c676107bb8433611d0a565b611c72838383611e61565b612172565b611cd2565b60809060208152603560208201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b60608201520190565b15611cd957565b60405162461bcd60e51b81528061045760048201611c7c565b60045481109081611d01575090565b90506001111590565b611d1382611cf2565b15611d8d57611d21826119bb565b506001600160a01b038281168282168114949091908515611d75575b5050508215611d4b57505090565b6001600160a01b0316600090815260066020526040902060ff9250611d709190610667565b541690565b611d829192939550611b4e565b161491388080611d3d565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b15611df157565b60405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608490fd5b90600182018092116118de57565b919082018092116118de57565b90611e6b836119bb565b6001600160a01b038481169391929091908216849003611fbd57611f1591811694611e97861515611dea565b611ea087612017565b611ea987611e46565b611ed5611ed1828060081c600052600060205260ff6001811b91161c60406000205416151590565b1590565b80611fb2575b611f6e575b5050611ef6866000526003602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b8303611f43575b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4565b611f69838060081c600052600060205260406000209060ff6001811b91161c8154179055565b611f1c565b611f89611fab92611ef6836000526003602052604060002090565b8060081c600052600060205260406000209060ff6001811b91161c8154179055565b3880611ee0565b506004548110611edb565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608490fd5b600081815260056020526040812080546001600160a01b031916905561203c826119bb565b506001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258280a4565b600082815260056020526040902080546001600160a01b0319166001600160a01b03831617905561209c826119bb565b506001600160a01b0391821691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b908160209103126102fe57516104d2816102ec565b6104d2939260809260018060a01b03168252600060208301526040820152816060820152019061049c565b6001600160a01b0391821681529116602082015260408101919091526080606082018190526104d29291019061049c565b3d1561216d573d9061215382610b14565b916121616040519384610ae3565b82523d6000602084013e565b606090565b92939192906001600160a01b038216158061228b575b1561228157839260015b61219b86611e46565b85101561227857604051630a85bd0160e11b80825291816121c28a89893360048601612111565b6000916020918591900381846001600160a01b038b165af1909281612247575b50612215576121ef612142565b805190816122105760405162461bcd60e51b81528061045760048201611c7c565b602001fd5b61219b9261222b9282612233575b5050956118e3565b949050612192565b6001600160e01b0319161490503880612223565b61226a91935060203d602011612271575b6122628183610ae3565b8101906120d1565b91386121e2565b503d612258565b95509350505050565b5050915050600190565b50803b1515612188565b9293909290813b1561236357600184935b6122b08187611e54565b85101561235a57604051630a85bd0160e11b8152806122d4898833600485016120e6565b6000916020918491900381846001600160a01b038b165af1909181612339575b50612301576121ef612142565b6122b092612316918161231e575b50956118e3565b9491506122a6565b6001600160e01b031916630a85bd0160e11b1490503861230f565b61235391925060203d602011612271576122628183610ae3565b90386122f4565b50945092505050565b9350505050600190565b60045460001981019081116118de5790565b67ffffffffffffffff8111610aa55760051b60200190565b634e487b7160e01b600052603260045260246000fd5b3360009081527f2fb019b8167f14f5e503ce2e68f0a4ee77135067e5ff9840b14beead991c450860205260409020546420a226a4a760d91b9060ff16156111de5750565b90916040519061240082610aaa565b6000918281526004549480156124d2576001600160a01b03851695612426871515612525565b6124386124338383611e54565b600455565b61245086611ef6836000526003602052604060002090565b612476818060081c600052600060205260406000209060ff6001811b91161c8154179055565b805b6124828383611e54565b8110156124be57806124b99189887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a46118e3565b612478565b509091929550611c779350610b1294612295565b60405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608490fd5b1561252c57565b60405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b1561258457565b60405162461bcd60e51b815260206004820152600e60248201526d09cdee8408adcdeeaced0408ae8d60931b6044820152606490fd5b156125c157565b60405162461bcd60e51b815260206004820152600f60248201526e4f766572204d617820537570706c7960881b6044820152606490fd5b9061260b60209282815194859201610479565b0190565b6010546000929161261f82610d5f565b91600190818116908115612679575060011461263a57505050565b90919293506010600052600080516020612bf5833981519152906000915b848310612666575050500190565b8181602092548587015201920191612658565b60ff191683525050811515909102019150565b9061269682610b14565b6126a36040519182610ae3565b82815280926126b4601f1991610b14565b0190602036910137565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000808210156127f3575b506d04ee2d6d415b85acef8100000000808310156127e4575b50662386f26fc10000808310156127d5575b506305f5e100808310156127c6575b50612710808310156127b7575b5060648210156127a7575b600a8092101561279d575b60019081602161275582870161268c565b95860101905b612767575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a8353049182156127985791908261275b565b612760565b9160010191612744565b9190606460029104910191612739565b6004919392049101913861272e565b60089193920491019138612721565b60109193920491019138612712565b60209193920491019138612700565b6040935081049150386126e7565b81811061280c575050565b60008155600101612801565b90601f8211612825575050565b610b1291600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802906020601f840160051c8301931061286f575b601f0160051c0190612801565b9091508190612862565b90601f8211612886575050565b610b12916010600052600080516020612bf5833981519152906020601f840160051c8301931061286f57601f0160051c0190612801565b600090808252600760205260ff6128e984604085209060018060a01b0316600052602052604060002090565b541661185d578082526007602090815260408084206001600160a01b038616600090815292529020805460ff1916600117905533926001600160a01b0316917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b6001600160e01b03198116637965db0b60e01b14908115612970575090565b6104d291506129a3565b6001600160e01b0319811663152a902d60e11b14908115612999575090565b6104d29150612951565b63ffffffff60e01b166380ac58cd60e01b81149081156129d6575b81156129c8575090565b6301ffc9a760e01b14919050565b635b5e139f60e01b811491506129be565b156129ee57565b60405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608490fd5b908151811015611027570160200190565b604051612a6d81610ac6565b7ffd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f86101008083527e01020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7560208401527f06264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c960408401527f071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee360608401527f0e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf760808401527fff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c860a08401527f16365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f660c08401527ffe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf560e084015282015281156102fe57612be0612bee917e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff846104d295600003160260f81c90612a50565b516001600160f81b03191690565b60f81c9056fe1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae672a164736f6c6343000814000a2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c806301ffc9a7146102e757806304634d8d146102e257806306fdde03146102dd578063081812fc146102d8578063095ea7b3146102d35780631581b600146102ce57806316c38b3c146102c957806318160ddd146102c457806323b872dd146102bf578063248a9ca3146102ba5780632a0acc6a146102b55780632a55205a146102b05780632f2ff15d146102ab57806336568abe146102a65780633ab1a494146102a15780633ccfd60b1461029c57806340c10f191461029757806342842e0e1461029257806355f804b31461028d5780635c975abb146102885780635f1b1b86146102835780636352211e1461027e5780636c0360eb146102795780636f8b44b01461027457806370a082311461026f578063715018a61461026a5780638462151c146102655780638545f4ea146102605780638da5cb5b1461025b57806391d148541461025657806395d89b411461025157806399f988981461024c578063a217fddf14610247578063a22cb46514610242578063b88d4fde1461023d578063bdb4b84814610238578063c204642c14610233578063c66828621461022e578063c87b56dd14610229578063d547741f14610224578063d5abeb011461021f578063da3ef23f1461021a578063e985e9c514610215578063f2fde38b146102105763fe6d81241461020b57600080fd5b6117a6565b611719565b6116bd565b6115d0565b6115b2565b611582565b6114a5565b611410565b61138a565b61136c565b611304565b611218565b6111fc565b611173565b6110cc565b611076565b61104d565b61102c565b610f66565b610ecd565b610ea6565b610e85565b610e55565b610d2e565b610cc5565b610ca2565b610ba3565b610a4b565b6109ba565b61097c565b610935565b6108ea565b6108ba565b610818565b6107f4565b6107c5565b61079c565b61074d565b610714565b6106dc565b6105e8565b6105b8565b6104d5565b61038f565b610303565b6001600160e01b03198116036102fe57565b600080fd5b346102fe5760203660031901126102fe576020600435610322816102ec565b61032b816129a3565b90811561036d575b811561035c575b811561034c575b506040519015158152f35b610356915061297a565b38610341565b905061036781612951565b9061033a565b90506103788161297a565b90610333565b6001600160a01b038116036102fe57565b346102fe5760403660031901126102fe576004356103ac8161037e565b602435906001600160601b0382168083036102fe576103c96123ad565b61271080821161045b5750506001600160a01b0381161561043e5761041561043c926104056103f6610b05565b6001600160a01b039094168452565b6001600160601b03166020830152565b805160209091015160a01b6001600160a01b0319166001600160a01b039190911617600955565b005b604051635b6cc80560e11b815260006004820152602490fd5b0390fd5b6044925060405191636f483d0960e01b835260048301526024820152fd5b60005b83811061048c5750506000910152565b818101518382015260200161047c565b906020916104b581518092818552858086019101610479565b601f01601f1916010190565b9060206104d292818152019061049c565b90565b346102fe576000806003193601126105b557604051908060018054916104fa83610d5f565b8086529282811690811561058b5750600114610531575b61052d8561052181870382610ae3565b604051918291826104c1565b0390f35b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b8284106105735750505081016020016105218261052d610511565b80546020858701810191909152909301928101610558565b86955061052d9693506020925061052194915060ff191682840152151560051b8201019293610511565b80fd5b346102fe5760203660031901126102fe5760206105d6600435611b4e565b6040516001600160a01b039091168152f35b346102fe5760403660031901126102fe576004356106058161037e565b602435610611816119bb565b50916001600160a01b03808416908216811461068b5761043c9361063f913314908115610644575b50611adc565b61206c565b6001600160a01b03166000908152600660205260409020610685915061067e9033905b9060018060a01b0316600052602052604060002090565b5460ff1690565b38610639565b60405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608490fd5b346102fe5760003660031901126102fe57600d546040516001600160a01b039091168152602090f35b6024359081151582036102fe57565b346102fe5760203660031901126102fe576004358015158091036102fe5761073a6123ad565b60ff8019600b5416911617600b55600080f35b346102fe5760003660031901126102fe57602061076861236d565b604051908152f35b60609060031901126102fe576004356107888161037e565b906024356107958161037e565b9060443590565b346102fe5761043c6107ad36610770565b916107c06107bb8433611d0a565b611bd4565b611e61565b346102fe5760203660031901126102fe5760043560005260076020526020600160406000200154604051908152f35b346102fe5760003660031901126102fe576040516420a226a4a760d91b8152602090f35b346102fe5760403660031901126102fe57600435600052600a60205260406000206040519061084682610a89565b546001600160a01b0380821680845260a09290921c602084015290156108aa575b61088b6108836001600160601b036020850151166024356118cb565b612710900490565b915160408051929091166001600160a01b031682526020820192909252f35b90506108b461188f565b90610867565b346102fe5760403660031901126102fe5761043c6024356108da8161037e565b6108e2611863565b6004356128bd565b346102fe5760403660031901126102fe576024356109078161037e565b336001600160a01b038216036109235761043c906004356117cb565b60405163334bd91960e11b8152600490fd5b346102fe5760203660031901126102fe576004356109528161037e565b61095a6123ad565b600d80546001600160a01b0319166001600160a01b0392909216919091179055005b346102fe576000806003193601126105b5576109966123ad565b8080808060018060a01b03600d541647905af16109b1612142565b50156105b55780f35b60403660031901126102fe576004356109d28161037e565b60243560ff600b5416610a1d5761043c916109fa6109f283600e546118cb565b34101561257d565b610a18610a0e83610a0961236d565b611e54565b600c5410156125ba565b6123f1565b60405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606490fd5b346102fe5761043c610a5c36610770565b9060405192610a6a84610aaa565b60008452611c50565b634e487b7160e01b600052604160045260246000fd5b6040810190811067ffffffffffffffff821117610aa557604052565b610a73565b6020810190811067ffffffffffffffff821117610aa557604052565b610120810190811067ffffffffffffffff821117610aa557604052565b90601f8019910116810190811067ffffffffffffffff821117610aa557604052565b60405190610b1282610a89565b565b67ffffffffffffffff8111610aa557601f01601f191660200190565b929192610b3c82610b14565b91610b4a6040519384610ae3565b8294818452818301116102fe578281602093846000960137010152565b60206003198201126102fe576004359067ffffffffffffffff82116102fe57806023830112156102fe578160246104d293600401359101610b30565b346102fe57610bb136610b67565b610bb96123ad565b805167ffffffffffffffff8111610aa557610bde81610bd9600f54610d5f565b612818565b602080601f8311600114610c1b57508192600092610c10575b5050600019600383901b1c191660019190911b17600f55005b015190503880610bf7565b90601f19831693610c4e600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac80290565b926000905b868210610c8a5750508360019510610c71575b505050811b01600f55005b015160001960f88460031b161c19169055388080610c66565b80600185968294968601518155019501930190610c53565b346102fe5760003660031901126102fe57602060ff600b54166040519015158152f35b346102fe576000806003193601126105b557610cdf6123ad565b610cea601054610d5f565b601f8111610cfc575b50600060105580f35b601f600080516020612bf5833981519152910160051c8101905b818110610d235750610cf3565b828155600101610d16565b346102fe5760203660031901126102fe576020610d4c6004356119bb565b506040516001600160a01b039091168152f35b90600182811c92168015610d8f575b6020831014610d7957565b634e487b7160e01b600052602260045260246000fd5b91607f1691610d6e565b60405190600082600f5491610dad83610d5f565b80835292600190818116908115610e335750600114610dd4575b50610b1292500383610ae3565b600f600090815291507f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8025b848310610e185750610b12935050810160200138610dc7565b81935090816020925483858a01015201910190918592610dff565b905060209250610b1294915060ff191682840152151560051b82010138610dc7565b346102fe5760003660031901126102fe5761052d610e71610d99565b60405191829160208352602083019061049c565b346102fe5760203660031901126102fe57610e9e6123ad565b600435600c55005b346102fe5760203660031901126102fe576020610768600435610ec88161037e565b6118f2565b346102fe576000806003193601126105b557610ee7611863565b600880546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b6020908160408183019282815285518094520193019160005b828110610f52575050505090565b835185529381019392810192600101610f44565b346102fe576020806003193601126102fe5760043590610f858261037e565b6000610f90836118f2565b90610f9a8261237f565b92610fa86040519485610ae3565b828452601f19610fb78461237f565b013682860137600194855b848403610fd7576040518061052d8882610f2b565b80610fe28892611cf2565b610fed575b01610fc2565b610ff6816119bb565b506001600160a01b03848116911603610fe75793908101938651821015611027578084899360051b89010152610fe7565b612397565b346102fe5760203660031901126102fe576110456123ad565b600435600e55005b346102fe5760003660031901126102fe576008546040516001600160a01b039091168152602090f35b346102fe5760403660031901126102fe57602060ff6110c060243561109a8161037e565b6004356000526007845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b346102fe576000806003193601126105b55760405190806002546110ef81610d5f565b8085529160019180831690811561058b57506001146111185761052d8561052181870382610ae3565b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b82841061115b5750505081016020016105218261052d610511565b80546020858701810191909152909301928101611140565b346102fe5760403660031901126102fe576004356111908161037e565b3360009081527fcafd4c04fc85c95eb7f3034a0225066ab2e1e1e67f41a5cea34e7199f9a8f30260205260409020546526a4a72a22a960d11b9060ff16156111de5761043c602435836123f1565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b346102fe5760003660031901126102fe57602060405160008152f35b346102fe5760403660031901126102fe576004356112358161037e565b61123d610705565b6001600160a01b038216913383146112bf578161127c61128d9233600052600660205260406000209060018060a01b0316600052602052604060002090565b9060ff801983541691151516179055565b604051901515815233907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b60405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606490fd5b346102fe5760803660031901126102fe576004356113218161037e565b60243561132d8161037e565b6064359167ffffffffffffffff83116102fe57366023840112156102fe5761136261043c933690602481600401359101610b30565b9160443591611c50565b346102fe5760003660031901126102fe576020600e54604051908152f35b346102fe5760403660031901126102fe5760043567ffffffffffffffff8082116102fe57366023830112156102fe5781600401359081116102fe57600560243683831b85018201116102fe578035906113e16123ad565b60005b8481106113ed57005b80611406848461140b94881b8a010135610a188161037e565b6118e3565b6113e4565b346102fe576000806003193601126105b557604051908060105461143381610d5f565b8085529160019180831690811561058b575060011461145c5761052d8561052181870382610ae3565b925060108352600080516020612bf58339815191525b82841061148d5750505081016020016105218261052d610511565b80546020858701810191909152909301928101611472565b346102fe5760203660031901126102fe576004356114c281611cf2565b1561152a576114cf610d99565b805115611518576105216114ff9161150a6115056114ef61052d966126be565b60405195869460208601906125f8565b906125f8565b61260f565b03601f198101835282610ae3565b505061052d611525611c3d565b610521565b60405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608490fd5b346102fe5760403660031901126102fe5761043c6024356115a28161037e565b6115aa611863565b6004356117cb565b346102fe5760003660031901126102fe576020600c54604051908152f35b346102fe576115de36610b67565b6115e66123ad565b805167ffffffffffffffff8111610aa55761160b81611606601054610d5f565b612879565b602080601f83116001146116485750819260009261163d575b5050600019600383901b1c191660019190911b17601055005b015190503880611624565b90601f198316936116696010600052600080516020612bf583398151915290565b926000905b8682106116a5575050836001951061168c575b505050811b01601055005b015160001960f88460031b161c19169055388080611681565b8060018596829496860151815501950193019061166e565b346102fe5760403660031901126102fe57602060ff6110c06004356116e18161037e565b602435906116ee8261037e565b60018060a01b03166000526006845260406000209060018060a01b0316600052602052604060002090565b346102fe5760203660031901126102fe576004356117368161037e565b61173e611863565b6001600160a01b0390811690811561178d57600854826001600160601b0360a01b821617600855167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b604051631e4fbdf760e01b815260006004820152602490fd5b346102fe5760003660031901126102fe576040516526a4a72a22a960d11b8152602090f35b600090808252600760205260ff6117f784604085209060018060a01b0316600052602052604060002090565b54161561185d578082526007602090815260408084206001600160a01b038616600090815292529020805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4600190565b50905090565b6008546001600160a01b0316330361187757565b60405163118cdaa760e01b8152336004820152602490fd5b6040519061189c82610a89565b6009546001600160a01b038116835260a01c6020830152565b634e487b7160e01b600052601160045260246000fd5b818102929181159184041417156118de57565b6118b5565b60001981146118de5760010190565b6001600160a01b0390811690811561196057600091600191600454925b83811061191d575050505090565b61192681611cf2565b611939575b611934906118e3565b61190f565b81611943826119bb565b5016830361192b5793611958611934916118e3565b94905061192b565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608490fd5b6119c481611cf2565b15611a8257600090600891604060ff83851c9316918381528060205220548160ff181c801515600014611a30576119fd611a0391612a61565b60ff1690565b9003911b175b611a2d611a20826000526003602052604060002090565b546001600160a01b031690565b91565b50505b611a3e8115156129e7565b60001901611a56816000526000602052604060002090565b5480611a625750611a33565b6119fd611a71611a7a92612a61565b60ff9081031690565b911b17611a09565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608490fd5b15611ae357565b60405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608490fd5b611b5781611cf2565b15611b77576000908152600560205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b15611bdb57565b60405162461bcd60e51b815260206004820152603460248201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6044820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b6064820152608490fd5b60405190611c4a82610aaa565b60008252565b91610b129391611c7793611c676107bb8433611d0a565b611c72838383611e61565b612172565b611cd2565b60809060208152603560208201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b60608201520190565b15611cd957565b60405162461bcd60e51b81528061045760048201611c7c565b60045481109081611d01575090565b90506001111590565b611d1382611cf2565b15611d8d57611d21826119bb565b506001600160a01b038281168282168114949091908515611d75575b5050508215611d4b57505090565b6001600160a01b0316600090815260066020526040902060ff9250611d709190610667565b541690565b611d829192939550611b4e565b161491388080611d3d565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b15611df157565b60405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608490fd5b90600182018092116118de57565b919082018092116118de57565b90611e6b836119bb565b6001600160a01b038481169391929091908216849003611fbd57611f1591811694611e97861515611dea565b611ea087612017565b611ea987611e46565b611ed5611ed1828060081c600052600060205260ff6001811b91161c60406000205416151590565b1590565b80611fb2575b611f6e575b5050611ef6866000526003602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b8303611f43575b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4565b611f69838060081c600052600060205260406000209060ff6001811b91161c8154179055565b611f1c565b611f89611fab92611ef6836000526003602052604060002090565b8060081c600052600060205260406000209060ff6001811b91161c8154179055565b3880611ee0565b506004548110611edb565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608490fd5b600081815260056020526040812080546001600160a01b031916905561203c826119bb565b506001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258280a4565b600082815260056020526040902080546001600160a01b0319166001600160a01b03831617905561209c826119bb565b506001600160a01b0391821691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b908160209103126102fe57516104d2816102ec565b6104d2939260809260018060a01b03168252600060208301526040820152816060820152019061049c565b6001600160a01b0391821681529116602082015260408101919091526080606082018190526104d29291019061049c565b3d1561216d573d9061215382610b14565b916121616040519384610ae3565b82523d6000602084013e565b606090565b92939192906001600160a01b038216158061228b575b1561228157839260015b61219b86611e46565b85101561227857604051630a85bd0160e11b80825291816121c28a89893360048601612111565b6000916020918591900381846001600160a01b038b165af1909281612247575b50612215576121ef612142565b805190816122105760405162461bcd60e51b81528061045760048201611c7c565b602001fd5b61219b9261222b9282612233575b5050956118e3565b949050612192565b6001600160e01b0319161490503880612223565b61226a91935060203d602011612271575b6122628183610ae3565b8101906120d1565b91386121e2565b503d612258565b95509350505050565b5050915050600190565b50803b1515612188565b9293909290813b1561236357600184935b6122b08187611e54565b85101561235a57604051630a85bd0160e11b8152806122d4898833600485016120e6565b6000916020918491900381846001600160a01b038b165af1909181612339575b50612301576121ef612142565b6122b092612316918161231e575b50956118e3565b9491506122a6565b6001600160e01b031916630a85bd0160e11b1490503861230f565b61235391925060203d602011612271576122628183610ae3565b90386122f4565b50945092505050565b9350505050600190565b60045460001981019081116118de5790565b67ffffffffffffffff8111610aa55760051b60200190565b634e487b7160e01b600052603260045260246000fd5b3360009081527f2fb019b8167f14f5e503ce2e68f0a4ee77135067e5ff9840b14beead991c450860205260409020546420a226a4a760d91b9060ff16156111de5750565b90916040519061240082610aaa565b6000918281526004549480156124d2576001600160a01b03851695612426871515612525565b6124386124338383611e54565b600455565b61245086611ef6836000526003602052604060002090565b612476818060081c600052600060205260406000209060ff6001811b91161c8154179055565b805b6124828383611e54565b8110156124be57806124b99189887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a46118e3565b612478565b509091929550611c779350610b1294612295565b60405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608490fd5b1561252c57565b60405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b1561258457565b60405162461bcd60e51b815260206004820152600e60248201526d09cdee8408adcdeeaced0408ae8d60931b6044820152606490fd5b156125c157565b60405162461bcd60e51b815260206004820152600f60248201526e4f766572204d617820537570706c7960881b6044820152606490fd5b9061260b60209282815194859201610479565b0190565b6010546000929161261f82610d5f565b91600190818116908115612679575060011461263a57505050565b90919293506010600052600080516020612bf5833981519152906000915b848310612666575050500190565b8181602092548587015201920191612658565b60ff191683525050811515909102019150565b9061269682610b14565b6126a36040519182610ae3565b82815280926126b4601f1991610b14565b0190602036910137565b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000808210156127f3575b506d04ee2d6d415b85acef8100000000808310156127e4575b50662386f26fc10000808310156127d5575b506305f5e100808310156127c6575b50612710808310156127b7575b5060648210156127a7575b600a8092101561279d575b60019081602161275582870161268c565b95860101905b612767575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a8353049182156127985791908261275b565b612760565b9160010191612744565b9190606460029104910191612739565b6004919392049101913861272e565b60089193920491019138612721565b60109193920491019138612712565b60209193920491019138612700565b6040935081049150386126e7565b81811061280c575050565b60008155600101612801565b90601f8211612825575050565b610b1291600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802906020601f840160051c8301931061286f575b601f0160051c0190612801565b9091508190612862565b90601f8211612886575050565b610b12916010600052600080516020612bf5833981519152906020601f840160051c8301931061286f57601f0160051c0190612801565b600090808252600760205260ff6128e984604085209060018060a01b0316600052602052604060002090565b541661185d578082526007602090815260408084206001600160a01b038616600090815292529020805460ff1916600117905533926001600160a01b0316917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9080a4600190565b6001600160e01b03198116637965db0b60e01b14908115612970575090565b6104d291506129a3565b6001600160e01b0319811663152a902d60e11b14908115612999575090565b6104d29150612951565b63ffffffff60e01b166380ac58cd60e01b81149081156129d6575b81156129c8575090565b6301ffc9a760e01b14919050565b635b5e139f60e01b811491506129be565b156129ee57565b60405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608490fd5b908151811015611027570160200190565b604051612a6d81610ac6565b7ffd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f86101008083527e01020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7560208401527f06264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c960408401527f071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee360608401527f0e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf760808401527fff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c860a08401527f16365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f660c08401527ffe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf560e084015282015281156102fe57612be0612bee917e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff846104d295600003160260f81c90612a50565b516001600160f81b03191690565b60f81c9056fe1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae672a164736f6c6343000814000a
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.