Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 185 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Safe Transfer Fr... | 24156443 | 13 days ago | IN | 0 ETH | 0.00008729 | ||||
| Safe Transfer Fr... | 24156442 | 13 days ago | IN | 0 ETH | 0.00009718 | ||||
| Set Approval For... | 23812288 | 61 days ago | IN | 0 ETH | 0.00000204 | ||||
| Set Approval For... | 23385685 | 121 days ago | IN | 0 ETH | 0.00006406 | ||||
| Safe Transfer Fr... | 23378694 | 122 days ago | IN | 0 ETH | 0.00007085 | ||||
| Set Approval For... | 23360824 | 124 days ago | IN | 0 ETH | 0.00001275 | ||||
| Set Approval For... | 23021605 | 172 days ago | IN | 0 ETH | 0.00005742 | ||||
| Safe Transfer Fr... | 22828008 | 199 days ago | IN | 0 ETH | 0.00013964 | ||||
| Safe Transfer Fr... | 22790435 | 204 days ago | IN | 0 ETH | 0.00021765 | ||||
| Safe Transfer Fr... | 22678061 | 220 days ago | IN | 0 ETH | 0.00015817 | ||||
| Set Approval For... | 22612866 | 229 days ago | IN | 0 ETH | 0.0000564 | ||||
| Set Approval For... | 22612816 | 229 days ago | IN | 0 ETH | 0.00003872 | ||||
| Set Approval For... | 22531404 | 240 days ago | IN | 0 ETH | 0.00008201 | ||||
| Set Approval For... | 22502300 | 244 days ago | IN | 0 ETH | 0.00005867 | ||||
| Safe Transfer Fr... | 22502289 | 244 days ago | IN | 0 ETH | 0.00007635 | ||||
| Safe Transfer Fr... | 22427051 | 255 days ago | IN | 0 ETH | 0.00005715 | ||||
| Safe Transfer Fr... | 22127251 | 297 days ago | IN | 0 ETH | 0.00005471 | ||||
| Safe Transfer Fr... | 21931793 | 324 days ago | IN | 0 ETH | 0.00007242 | ||||
| Safe Transfer Fr... | 21925259 | 325 days ago | IN | 0 ETH | 0.00011562 | ||||
| Set Approval For... | 21817987 | 340 days ago | IN | 0 ETH | 0.0000733 | ||||
| Safe Transfer Fr... | 21805197 | 342 days ago | IN | 0 ETH | 0.00007818 | ||||
| Set Approval For... | 21785485 | 344 days ago | IN | 0 ETH | 0.00002233 | ||||
| Set Approval For... | 21741202 | 351 days ago | IN | 0 ETH | 0.00008553 | ||||
| Set Approval For... | 21729122 | 352 days ago | IN | 0 ETH | 0.00004442 | ||||
| Safe Transfer Fr... | 21542927 | 378 days ago | IN | 0 ETH | 0.00051703 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Rebecca_Rose_Decal
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./utils/Errors.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
/// @author @0x__jj, @llio (Deca)
contract Rebecca_Rose_Decal is ERC721, ReentrancyGuard, AccessControl, Ownable {
using Address for address;
using Strings for *;
event ArtistMinted(uint256 numberOfTokens, uint256 remainingArtistSupply);
uint8 public constant MAX_SUPPLY = 100;
address public artist;
uint16 public artistBps;
uint256 public totalSupply = 0;
uint256 public artistMaxSupply;
uint256 public artistSupply;
bytes32 public merkleRoot;
string public baseUri;
mapping(address => bool) public minted;
constructor(
string memory _baseUri,
address[] memory _admins,
uint256 _artistMaxSupply,
address _artist,
uint16 _artistBps
) ERC721("Decal by Rebecca Rose", "DECAL") Ownable(msg.sender) {
if (_artist == address(0)) revert NoArtist();
if (_artistMaxSupply > MAX_SUPPLY) revert MaxSupplyReached();
if (_artistBps > 10000) revert InvalidBps();
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
for (uint256 i = 0; i < _admins.length; i++) {
_grantRole(DEFAULT_ADMIN_ROLE, _admins[i]);
}
baseUri = _baseUri;
artistMaxSupply = _artistMaxSupply;
artist = _artist;
artistBps = _artistBps;
}
function setArtist(address _artist) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (_artist == address(0)) revert NoArtist();
artist = _artist;
}
function setArtistMaxSupply(
uint256 _artistMaxSupply
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if ((_artistMaxSupply - artistSupply) > (MAX_SUPPLY - totalSupply)) {
revert MaxArtistSupplyReached();
}
artistMaxSupply = _artistMaxSupply;
}
function setArtistBps(
uint16 _artistBps
) external onlyRole(DEFAULT_ADMIN_ROLE) {
if (_artistBps > 10000) revert InvalidBps();
artistBps = _artistBps;
}
function setMerkleRoot(
bytes32 _merkleRoot
) external onlyRole(DEFAULT_ADMIN_ROLE) {
merkleRoot = _merkleRoot;
}
function setBaseUri(
string memory _newBaseUri
) external onlyRole(DEFAULT_ADMIN_ROLE) {
baseUri = _newBaseUri;
}
function mint(
bytes32[] calldata _merkleProof
) external nonReentrant returns (uint256 tokenId) {
if (minted[msg.sender]) revert AlreadyMinted();
if (totalSupply >= MAX_SUPPLY) revert MaxSupplyReached();
if (publicSupplyRemaining() < 1) revert MaxPublicSupplyReached();
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
if (!MerkleProof.verify(_merkleProof, merkleRoot, leaf)) {
revert NotOnAllowlist();
}
minted[msg.sender] = true;
tokenId = totalSupply;
totalSupply++;
_safeMint(msg.sender, tokenId);
}
function artistMintForAdmin(
uint256 _numberOfTokens
) external nonReentrant onlyRole(DEFAULT_ADMIN_ROLE) {
if (_numberOfTokens == 0) revert CannotMintZero();
uint256 remaining = artistMaxSupply - artistSupply;
if (remaining == 0) revert MaxArtistSupplyReached();
_numberOfTokens = uint256(Math.min(_numberOfTokens, remaining));
uint256 tokenId = totalSupply;
for (uint256 i = 0; i < _numberOfTokens; i++) {
_safeMint(artist, tokenId);
tokenId++;
}
artistSupply += _numberOfTokens;
totalSupply = tokenId;
emit ArtistMinted(_numberOfTokens, remaining);
}
function artistMint(uint256 _numberOfTokens) external nonReentrant {
if (_numberOfTokens == 0) revert CannotMintZero();
if (msg.sender != artist) revert NotArtist();
uint256 remaining = artistMaxSupply - artistSupply;
if (remaining == 0) revert MaxArtistSupplyReached();
_numberOfTokens = uint256(Math.min(_numberOfTokens, remaining));
uint256 tokenId = totalSupply;
for (uint256 i = 0; i < _numberOfTokens; i++) {
_safeMint(msg.sender, tokenId);
tokenId++;
}
artistSupply += _numberOfTokens;
totalSupply = tokenId;
emit ArtistMinted(_numberOfTokens, remaining);
}
function publicSupplyRemaining() public view returns (uint256) {
return MAX_SUPPLY - totalSupply - (artistMaxSupply - artistSupply);
}
function artistSupplyRemaining() external view returns (uint256) {
return artistMaxSupply - artistSupply;
}
function tokenURI(
uint256 _tokenId
) public view override(ERC721) returns (string memory) {
require(
_ownerOf(_tokenId) != address(0),
"DECAL: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
require(bytes(baseURI).length > 0, "baseURI not set");
return string(abi.encodePacked(baseURI, _tokenId.toString()));
}
function getTokensOfOwner(
address owner_
) external view returns (uint256[] memory) {
uint256 tokenCount = balanceOf(owner_);
uint256[] memory tokenIds = new uint256[](tokenCount);
uint256 seen = 0;
for (uint256 i = 0; i < totalSupply; i++) {
if (ownerOf(i) == owner_) {
tokenIds[seen] = i;
seen++;
}
if (seen == tokenCount) break;
}
return tokenIds;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC721, AccessControl) returns (bool) {
return super.supportsInterface(interfaceId);
}
function _baseURI() internal view override(ERC721) returns (string memory) {
return baseUri;
}
/**
* @notice Returns the EIP2981 royalty info for a given token.
* @param _salePrice The sale price of the token.
* @return receiver The royalty recipient.
* @return royaltyAmount The royalty amount.
*/
function royaltyInfo(
uint256,
uint256 _salePrice
) external view returns (address receiver, uint256 royaltyAmount) {
return (artist, (_salePrice * artistBps) / 10000);
}
}// 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/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.20;
import {IERC721} from "./IERC721.sol";
import {IERC721Receiver} from "./IERC721Receiver.sol";
import {IERC721Metadata} from "./extensions/IERC721Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {Strings} from "../../utils/Strings.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {IERC721Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors {
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
mapping(uint256 tokenId => address) private _owners;
mapping(address owner => uint256) private _balances;
mapping(uint256 tokenId => address) private _tokenApprovals;
mapping(address owner => mapping(address operator => 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_;
}
/**
* @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 returns (uint256) {
if (owner == address(0)) {
revert ERC721InvalidOwner(address(0));
}
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual returns (address) {
return _requireOwned(tokenId);
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual returns (string memory) {
_requireOwned(tokenId);
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string.concat(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 overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual {
_approve(to, tokenId, _msgSender());
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual returns (address) {
_requireOwned(tokenId);
return _getApproved(tokenId);
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(address from, address to, uint256 tokenId) public virtual {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
// Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
// (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
address previousOwner = _update(to, tokenId, _msgSender());
if (previousOwner != from) {
revert ERC721IncorrectOwner(from, tokenId, previousOwner);
}
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
transferFrom(from, to, tokenId);
_checkOnERC721Received(from, to, tokenId, data);
}
/**
* @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
*
* IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
* core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
* consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
* `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
*/
function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
/**
* @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
*/
function _getApproved(uint256 tokenId) internal view virtual returns (address) {
return _tokenApprovals[tokenId];
}
/**
* @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
* particular (ignoring whether it is owned by `owner`).
*
* WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
* assumption.
*/
function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
return
spender != address(0) &&
(owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
}
/**
* @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
* Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
* the `spender` for the specific `tokenId`.
*
* WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
* assumption.
*/
function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
if (!_isAuthorized(owner, spender, tokenId)) {
if (owner == address(0)) {
revert ERC721NonexistentToken(tokenId);
} else {
revert ERC721InsufficientApproval(spender, tokenId);
}
}
}
/**
* @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
*
* NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
* a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
*
* WARNING: Increasing an account's balance using this function tends to be paired with an override of the
* {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
* remain consistent with one another.
*/
function _increaseBalance(address account, uint128 value) internal virtual {
unchecked {
_balances[account] += value;
}
}
/**
* @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
* (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
*
* The `auth` argument is optional. If the value passed is non 0, then this function will check that
* `auth` is either the owner of the token, or approved to operate on the token (by the owner).
*
* Emits a {Transfer} event.
*
* NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
*/
function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
address from = _ownerOf(tokenId);
// Perform (optional) operator check
if (auth != address(0)) {
_checkAuthorized(from, auth, tokenId);
}
// Execute the update
if (from != address(0)) {
// Clear approval. No need to re-authorize or emit the Approval event
_approve(address(0), tokenId, address(0), false);
unchecked {
_balances[from] -= 1;
}
}
if (to != address(0)) {
unchecked {
_balances[to] += 1;
}
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
return from;
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
address previousOwner = _update(to, tokenId, address(0));
if (previousOwner != address(0)) {
revert ERC721InvalidSender(address(0));
}
}
/**
* @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
_mint(to, tokenId);
_checkOnERC721Received(address(0), to, tokenId, data);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
* This is an internal function that does not check if the sender is authorized to operate on the token.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal {
address previousOwner = _update(address(0), tokenId, address(0));
if (previousOwner == address(0)) {
revert ERC721NonexistentToken(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 {
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
address previousOwner = _update(to, tokenId, address(0));
if (previousOwner == address(0)) {
revert ERC721NonexistentToken(tokenId);
} else if (previousOwner != from) {
revert ERC721IncorrectOwner(from, tokenId, previousOwner);
}
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
* are aware of the ERC721 standard 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 like {safeTransferFrom} in the sense that it invokes
* {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `tokenId` token must exist and be owned by `from`.
* - `to` cannot be the zero address.
* - `from` cannot be the zero address.
* - 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) internal {
_safeTransfer(from, to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
_transfer(from, to, tokenId);
_checkOnERC721Received(from, to, tokenId, data);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
* either the owner of the token, or approved to operate on all tokens held by this owner.
*
* Emits an {Approval} event.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address to, uint256 tokenId, address auth) internal {
_approve(to, tokenId, auth, true);
}
/**
* @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
* emitted in the context of transfers.
*/
function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
// Avoid reading the owner unless necessary
if (emitEvent || auth != address(0)) {
address owner = _requireOwned(tokenId);
// We do not use _isAuthorized because single-token approvals should not be able to call approve
if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
revert ERC721InvalidApprover(auth);
}
if (emitEvent) {
emit Approval(owner, to, tokenId);
}
}
_tokenApprovals[tokenId] = to;
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Requirements:
* - operator can't be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
if (operator == address(0)) {
revert ERC721InvalidOperator(operator);
}
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
* Returns the owner.
*
* Overrides to ownership logic should be done to {_ownerOf}.
*/
function _requireOwned(uint256 tokenId) internal view returns (address) {
address owner = _ownerOf(tokenId);
if (owner == address(0)) {
revert ERC721NonexistentToken(tokenId);
}
return owner;
}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the
* recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param data bytes optional data to send along with the call
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
if (to.code.length > 0) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
if (retval != IERC721Receiver.onERC721Received.selector) {
revert ERC721InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
revert ERC721InvalidReceiver(to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
}// 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.1) (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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.20;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the Merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates Merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProof {
/**
*@dev The multiproof provided is not valid.
*/
error MerkleProofInvalidMultiproof();
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the Merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
if (leavesLen + proofLen != totalHashes + 1) {
revert MerkleProofInvalidMultiproof();
}
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
if (proofPos != proofLen) {
revert MerkleProofInvalidMultiproof();
}
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Sorts the pair (a, b) and hashes the result.
*/
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
/**
* @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
*/
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// 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/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}// 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 pragma solidity ^0.8.17; error MaxSupplyReached(); error AlreadyMinted(); error NotOnAllowlist(); error NotArtist(); error NoArtist(); error MaxArtistSupplyReached(); error CannotMintZero(); error MaxPublicSupplyReached(); error InvalidBps();
{
"optimizer": {
"enabled": true,
"runs": 1
},
"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":[{"internalType":"string","name":"_baseUri","type":"string"},{"internalType":"address[]","name":"_admins","type":"address[]"},{"internalType":"uint256","name":"_artistMaxSupply","type":"uint256"},{"internalType":"address","name":"_artist","type":"address"},{"internalType":"uint16","name":"_artistBps","type":"uint16"}],"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":[],"name":"AlreadyMinted","type":"error"},{"inputs":[],"name":"CannotMintZero","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[],"name":"InvalidBps","type":"error"},{"inputs":[],"name":"MaxArtistSupplyReached","type":"error"},{"inputs":[],"name":"MaxPublicSupplyReached","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"NoArtist","type":"error"},{"inputs":[],"name":"NotArtist","type":"error"},{"inputs":[],"name":"NotOnAllowlist","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"numberOfTokens","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingArtistSupply","type":"uint256"}],"name":"ArtistMinted","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":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"artist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"artistBps","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"artistMaxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numberOfTokens","type":"uint256"}],"name":"artistMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numberOfTokens","type":"uint256"}],"name":"artistMintForAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"artistSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"artistSupplyRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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":"address","name":"owner_","type":"address"}],"name":"getTokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"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":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"mint","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"publicSupplyRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","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":"address","name":"_artist","type":"address"}],"name":"setArtist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_artistBps","type":"uint16"}],"name":"setArtistBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_artistMaxSupply","type":"uint256"}],"name":"setArtistMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseUri","type":"string"}],"name":"setBaseUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","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":[],"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"}]Contract Creation Code
60806040525f600a5534801562000014575f80fd5b50604051620026f7380380620026f7833981016040819052620000379162000413565b336040518060400160405280601581526020017f446563616c206279205265626563636120526f7365000000000000000000000081525060405180604001604052806005815260200164111150d05360da1b815250815f90816200009c9190620005a0565b506001620000ab8282620005a0565b50506001600655506001600160a01b038116620000e157604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b620000ec816200020f565b506001600160a01b03821662000115576040516340f028e160e11b815260040160405180910390fd5b6064831115620001385760405163d05cb60960e01b815260040160405180910390fd5b6127108161ffff161115620001605760405163c6cc5d7f60e01b815260040160405180910390fd5b6200016c5f3362000260565b505f5b8451811015620001bf57620001a95f801b86838151811062000195576200019562000668565b60200260200101516200026060201b60201c565b5080620001b6816200067c565b9150506200016f565b50600e620001ce8682620005a0565b50600b929092556009805461ffff909316600160a01b026001600160b01b03199093166001600160a01b039092169190911791909117905550620006a19050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f8281526007602090815260408083206001600160a01b038516845290915281205460ff1662000307575f8381526007602090815260408083206001600160a01b03861684529091529020805460ff19166001179055620002be3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016200030a565b505f5b92915050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b03811182821017156200034f576200034f62000310565b604052919050565b80516001600160a01b03811681146200036e575f80fd5b919050565b5f82601f83011262000383575f80fd5b815160206001600160401b03821115620003a157620003a162000310565b8160051b620003b282820162000324565b9283528481018201928281019087851115620003cc575f80fd5b83870192505b84831015620003f657620003e68362000357565b82529183019190830190620003d2565b979650505050505050565b805161ffff811681146200036e575f80fd5b5f805f805f60a0868803121562000428575f80fd5b85516001600160401b03808211156200043f575f80fd5b818801915088601f83011262000453575f80fd5b81518181111562000468576200046862000310565b60206200047e601f8301601f1916820162000324565b8281528b8284870101111562000492575f80fd5b5f5b83811015620004b157858101830151828201840152820162000494565b505f928101820192909252890151909750915080821115620004d1575f80fd5b50620004e08882890162000373565b94505060408601519250620004f86060870162000357565b9150620005086080870162000401565b90509295509295909350565b600181811c908216806200052957607f821691505b6020821081036200054857634e487b7160e01b5f52602260045260245ffd5b50919050565b601f8211156200059b575f81815260208120601f850160051c81016020861015620005765750805b601f850160051c820191505b81811015620005975782815560010162000582565b5050505b505050565b81516001600160401b03811115620005bc57620005bc62000310565b620005d481620005cd845462000514565b846200054e565b602080601f8311600181146200060a575f8415620005f25750858301515b5f19600386901b1c1916600185901b17855562000597565b5f85815260208120601f198616915b828110156200063a5788860151825594840194600190910190840162000619565b50858210156200065857878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52603260045260245ffd5b5f600182016200069a57634e487b7160e01b5f52601160045260245ffd5b5060010190565b61204880620006af5f395ff3fe608060405234801561000f575f80fd5b50600436106101f7575f3560e01c806301ffc9a7146101fb57806306fdde03146102235780630798f69714610238578063081812fc1461024d578063095ea7b31461026d57806318160ddd146102805780631e7269c51461029757806323b872dd146102b9578063248a9ca3146102cc578063297b551b146102df5780632a55205a146102f25780632eb4a7ab146103135780632f2ff15d1461031c57806332cb6b0c1461032f57806336568abe1461034957806342842e0e1461035c57806343bc16121461036f5780635de6dc55146103825780636352211e146103a257806370a08231146103b557806371424249146103c8578063715018a6146103f057806371a4c485146103f85780637cb64759146104015780637e5b8106146104145780638da5cb5b1461041d57806391d148541461042557806395d89b41146104385780639abc8320146104405780639f3632fb14610448578063a0bcfc7f1461045b578063a217fddf1461046e578063a22cb46514610475578063a96f38dd14610488578063b77a147b14610490578063b88d4fde146104a3578063bf113baf146104b6578063c3ad8e98146104c9578063c87b56dd146104d1578063d4c97533146104e4578063d547741f146104f7578063e985e9c51461050a578063f2fde38b1461051d575b5f80fd5b61020e610209366004611981565b610530565b60405190151581526020015b60405180910390f35b61022b610540565b60405161021a91906119e9565b61024b6102463660046119fb565b6105cf565b005b61026061025b3660046119fb565b610619565b60405161021a9190611a12565b61024b61027b366004611a41565b61062d565b610289600a5481565b60405190815260200161021a565b61020e6102a5366004611a69565b600f6020525f908152604090205460ff1681565b61024b6102c7366004611a82565b61063c565b6102896102da3660046119fb565b6106ce565b61024b6102ed366004611abb565b6106e2565b610305610300366004611adc565b610736565b60405161021a929190611afc565b610289600d5481565b61024b61032a366004611b15565b610776565b610337606481565b60405160ff909116815260200161021a565b61024b610357366004611b15565b610792565b61024b61036a366004611a82565b6107ca565b600954610260906001600160a01b031681565b610395610390366004611a69565b6107e4565b60405161021a9190611b3f565b6102606103b03660046119fb565b6108b4565b6102896103c3366004611a69565b6108be565b6009546103dd90600160a01b900461ffff1681565b60405161ffff909116815260200161021a565b61024b610903565b610289600b5481565b61024b61040f3660046119fb565b610916565b610289600c5481565b610260610926565b61020e610433366004611b15565b610935565b61022b61095f565b61022b61096e565b61024b6104563660046119fb565b6109fa565b61024b610469366004611c08565b610b01565b6102895f81565b61024b610483366004611c4c565b610b17565b610289610b22565b61028961049e366004611c85565b610b50565b61024b6104b1366004611cf3565b610ca9565b61024b6104c43660046119fb565b610cc0565b610289610dd8565b61022b6104df3660046119fb565b610de9565b61024b6104f2366004611a69565b610ed9565b61024b610505366004611b15565b610f2d565b61020e610518366004611d69565b610f49565b61024b61052b366004611a69565b610f76565b5f61053a82610fb0565b92915050565b60605f805461054e90611d91565b80601f016020809104026020016040519081016040528092919081815260200182805461057a90611d91565b80156105c55780601f1061059c576101008083540402835291602001916105c5565b820191905f5260205f20905b8154815290600101906020018083116105a857829003601f168201915b5050505050905090565b5f6105d981610fd4565b600a546105e7906064611ddd565b600c546105f49084611ddd565b11156106135760405163d5c4417960e01b815260040160405180910390fd5b50600b55565b5f61062382610fde565b5061053a82611015565b61063882823361102f565b5050565b6001600160a01b03821661066e575f604051633250574960e11b81526004016106659190611a12565b60405180910390fd5b5f61067a83833361103c565b9050836001600160a01b0316816001600160a01b0316146106c8576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610665565b50505050565b5f9081526007602052604090206001015490565b5f6106ec81610fd4565b6127108261ffff1611156107135760405163c6cc5d7f60e01b815260040160405180910390fd5b506009805461ffff909216600160a01b0261ffff60a01b19909216919091179055565b6009545f9081906001600160a01b038116906127109061076190600160a01b900461ffff1686611df0565b61076b9190611e07565b915091509250929050565b61077f826106ce565b61078881610fd4565b6106c88383611129565b6001600160a01b03811633146107bb5760405163334bd91960e11b815260040160405180910390fd5b6107c582826111ba565b505050565b6107c583838360405180602001604052805f815250610ca9565b60605f6107f0836108be565b90505f816001600160401b0381111561080b5761080b611b82565b604051908082528060200260200182016040528015610834578160200160208202803683370190505b5090505f805b600a548110156108aa57856001600160a01b0316610857826108b4565b6001600160a01b031603610891578083838151811061087857610878611e26565b60209081029190910101528161088d81611e3a565b9250505b8184146108aa57806108a281611e3a565b91505061083a565b5090949350505050565b5f61053a82610fde565b5f6001600160a01b0382166108e8575f6040516322718ad960e21b81526004016106659190611a12565b506001600160a01b03165f9081526003602052604090205490565b61090b611225565b6109145f611257565b565b5f61092081610fd4565b50600d55565b6008546001600160a01b031690565b5f9182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606001805461054e90611d91565b600e805461097b90611d91565b80601f01602080910402602001604051908101604052809291908181526020018280546109a790611d91565b80156109f25780601f106109c9576101008083540402835291602001916109f2565b820191905f5260205f20905b8154815290600101906020018083116109d557829003601f168201915b505050505081565b610a026112a8565b5f610a0c81610fd4565b815f03610a2c57604051632a6ce29960e11b815260040160405180910390fd5b5f600c54600b54610a3d9190611ddd565b9050805f03610a5f5760405163d5c4417960e01b815260040160405180910390fd5b610a6983826112d2565b600a549093505f5b84811015610aaf57600954610a8f906001600160a01b0316836112e9565b81610a9981611e3a565b9250508080610aa790611e3a565b915050610a71565b5083600c5f828254610ac19190611e52565b9091555050600a81905560408051858152602081018490525f80516020611ff3833981519152910160405180910390a1505050610afe6001600655565b50565b5f610b0b81610fd4565b600e6107c58382611eb2565b610638338383611302565b5f600c54600b54610b339190611ddd565b600a54610b41906064611ddd565b610b4b9190611ddd565b905090565b5f610b596112a8565b335f908152600f602052604090205460ff1615610b8957604051631bbdf5c560e31b815260040160405180910390fd5b600a54606411610bac5760405163d05cb60960e01b815260040160405180910390fd5b6001610bb6610b22565b1015610bd5576040516321bccf3f60e01b815260040160405180910390fd5b6040516001600160601b03193360601b1660208201525f90603401604051602081830303815290604052805190602001209050610c488484808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050600d549150849050611397565b610c655760405163231e418360e01b815260040160405180910390fd5b335f908152600f60205260408120805460ff19166001179055600a805493508391610c8f83611e3a565b9190505550610c9e33836112e9565b5061053a6001600655565b610cb484848461063c565b6106c8848484846113ac565b610cc86112a8565b805f03610ce857604051632a6ce29960e11b815260040160405180910390fd5b6009546001600160a01b03163314610d1357604051636bebaa5360e01b815260040160405180910390fd5b5f600c54600b54610d249190611ddd565b9050805f03610d465760405163d5c4417960e01b815260040160405180910390fd5b610d5082826112d2565b600a549092505f5b83811015610d8a57610d6a33836112e9565b81610d7481611e3a565b9250508080610d8290611e3a565b915050610d58565b5082600c5f828254610d9c9190611e52565b9091555050600a81905560408051848152602081018490525f80516020611ff3833981519152910160405180910390a15050610afe6001600655565b5f600c54600b54610b4b9190611ddd565b60605f610df5836114c0565b6001600160a01b031603610e5a5760405162461bcd60e51b815260206004820152602660248201527f444543414c3a2055524920717565727920666f72206e6f6e6578697374656e74604482015265103a37b5b2b760d11b6064820152608401610665565b5f610e636114da565b90505f815111610ea75760405162461bcd60e51b815260206004820152600f60248201526e18985cd9555492481b9bdd081cd95d608a1b6044820152606401610665565b80610eb1846114e9565b604051602001610ec2929190611f6d565b604051602081830303815290604052915050919050565b5f610ee381610fd4565b6001600160a01b038216610f0a576040516340f028e160e11b815260040160405180910390fd5b50600980546001600160a01b0319166001600160a01b0392909216919091179055565b610f36826106ce565b610f3f81610fd4565b6106c883836111ba565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b610f7e611225565b6001600160a01b038116610fa7575f604051631e4fbdf760e01b81526004016106659190611a12565b610afe81611257565b5f6001600160e01b03198216637965db0b60e01b148061053a575061053a82611578565b610afe81336115c7565b5f80610fe9836114c0565b90506001600160a01b03811661053a57604051637e27328960e01b815260048101849052602401610665565b5f908152600460205260409020546001600160a01b031690565b6107c583838360016115f2565b5f80611047846114c0565b90506001600160a01b03831615611063576110638184866116ed565b6001600160a01b0381161561109d5761107e5f855f806115f2565b6001600160a01b0381165f90815260036020526040902080545f190190555b6001600160a01b038516156110cb576001600160a01b0385165f908152600360205260409020805460010190555b5f8481526002602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b5f6111348383610935565b6111b3575f8381526007602090815260408083206001600160a01b03861684529091529020805460ff1916600117905561116b3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161053a565b505f61053a565b5f6111c58383610935565b156111b3575f8381526007602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161053a565b3361122e610926565b6001600160a01b031614610914573360405163118cdaa760e01b81526004016106659190611a12565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6002600654036112cb57604051633ee5aeb560e01b815260040160405180910390fd5b6002600655565b5f8183106112e057816112e2565b825b9392505050565b610638828260405180602001604052805f815250611743565b6001600160a01b03821661132b5781604051630b61174360e31b81526004016106659190611a12565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b5f826113a38584611759565b14949350505050565b6001600160a01b0383163b156106c857604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906113ee903390889087908790600401611f9b565b6020604051808303815f875af1925050508015611428575060408051601f3d908101601f1916820190925261142591810190611fd7565b60015b611486573d808015611455576040519150601f19603f3d011682016040523d82523d5f602084013e61145a565b606091505b5080515f0361147e5783604051633250574960e11b81526004016106659190611a12565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b146114b95783604051633250574960e11b81526004016106659190611a12565b5050505050565b5f908152600260205260409020546001600160a01b031690565b6060600e805461054e90611d91565b60605f6114f5836117a5565b60010190505f816001600160401b0381111561151357611513611b82565b6040519080825280601f01601f19166020018201604052801561153d576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461154757509392505050565b5f6001600160e01b031982166380ac58cd60e01b14806115a857506001600160e01b03198216635b5e139f60e01b145b8061053a57506301ffc9a760e01b6001600160e01b031983161461053a565b6115d18282610935565b61063857808260405163e2517d3f60e01b8152600401610665929190611afc565b808061160657506001600160a01b03821615155b156116be575f61161584610fde565b90506001600160a01b038316158015906116415750826001600160a01b0316816001600160a01b031614155b801561165457506116528184610f49565b155b15611674578260405163a9fbf51f60e01b81526004016106659190611a12565b81156116bc5783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50505f90815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6116f883838361187a565b6107c5576001600160a01b03831661172657604051637e27328960e01b815260048101829052602401610665565b818160405163177e802f60e01b8152600401610665929190611afc565b61174d83836118df565b6107c55f8484846113ac565b5f81815b845181101561179d576117898286838151811061177c5761177c611e26565b6020026020010151611940565b91508061179581611e3a565b91505061175d565b509392505050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106117e35772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b831061180d576904ee2d6d415b85acef8160201b830492506020015b662386f26fc10000831061182b57662386f26fc10000830492506010015b6305f5e1008310611843576305f5e100830492506008015b612710831061185757612710830492506004015b60648310611869576064830492506002015b600a831061053a5760010192915050565b5f6001600160a01b038316158015906118d75750826001600160a01b0316846001600160a01b031614806118b357506118b38484610f49565b806118d75750826001600160a01b03166118cc83611015565b6001600160a01b0316145b949350505050565b6001600160a01b038216611908575f604051633250574960e11b81526004016106659190611a12565b5f61191483835f61103c565b90506001600160a01b038116156107c5575f6040516339e3563760e11b81526004016106659190611a12565b5f81831061195a575f8281526020849052604090206112e2565b5f8381526020839052604090206112e2565b6001600160e01b031981168114610afe575f80fd5b5f60208284031215611991575f80fd5b81356112e28161196c565b5f5b838110156119b657818101518382015260200161199e565b50505f910152565b5f81518084526119d581602086016020860161199c565b601f01601f19169290920160200192915050565b602081525f6112e260208301846119be565b5f60208284031215611a0b575f80fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b0381168114611a3c575f80fd5b919050565b5f8060408385031215611a52575f80fd5b611a5b83611a26565b946020939093013593505050565b5f60208284031215611a79575f80fd5b6112e282611a26565b5f805f60608486031215611a94575f80fd5b611a9d84611a26565b9250611aab60208501611a26565b9150604084013590509250925092565b5f60208284031215611acb575f80fd5b813561ffff811681146112e2575f80fd5b5f8060408385031215611aed575f80fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b5f8060408385031215611b26575f80fd5b82359150611b3660208401611a26565b90509250929050565b602080825282518282018190525f9190848201906040850190845b81811015611b7657835183529284019291840191600101611b5a565b50909695505050505050565b634e487b7160e01b5f52604160045260245ffd5b5f6001600160401b0380841115611baf57611baf611b82565b604051601f8501601f19908116603f01168101908282118183101715611bd757611bd7611b82565b81604052809350858152868686011115611bef575f80fd5b858560208301375f602087830101525050509392505050565b5f60208284031215611c18575f80fd5b81356001600160401b03811115611c2d575f80fd5b8201601f81018413611c3d575f80fd5b6118d784823560208401611b96565b5f8060408385031215611c5d575f80fd5b611c6683611a26565b915060208301358015158114611c7a575f80fd5b809150509250929050565b5f8060208385031215611c96575f80fd5b82356001600160401b0380821115611cac575f80fd5b818501915085601f830112611cbf575f80fd5b813581811115611ccd575f80fd5b8660208260051b8501011115611ce1575f80fd5b60209290920196919550909350505050565b5f805f8060808587031215611d06575f80fd5b611d0f85611a26565b9350611d1d60208601611a26565b92506040850135915060608501356001600160401b03811115611d3e575f80fd5b8501601f81018713611d4e575f80fd5b611d5d87823560208401611b96565b91505092959194509250565b5f8060408385031215611d7a575f80fd5b611d8383611a26565b9150611b3660208401611a26565b600181811c90821680611da557607f821691505b602082108103611dc357634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561053a5761053a611dc9565b808202811582820484141761053a5761053a611dc9565b5f82611e2157634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffd5b5f60018201611e4b57611e4b611dc9565b5060010190565b8082018082111561053a5761053a611dc9565b601f8211156107c5575f81815260208120601f850160051c81016020861015611e8b5750805b601f850160051c820191505b81811015611eaa57828155600101611e97565b505050505050565b81516001600160401b03811115611ecb57611ecb611b82565b611edf81611ed98454611d91565b84611e65565b602080601f831160018114611f12575f8415611efb5750858301515b5f19600386901b1c1916600185901b178555611eaa565b5f85815260208120601f198616915b82811015611f4057888601518255948401946001909101908401611f21565b5085821015611f5d57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b5f8351611f7e81846020880161199c565b835190830190611f9281836020880161199c565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90611fcd908301846119be565b9695505050505050565b5f60208284031215611fe7575f80fd5b81516112e28161196c56fe0b3544e12b031cb05a003a4e0cb691f6809a97e68d9f3d5d00387b0ee985acbaa26469706673582212204973f1f4bdb7ea34136b0ccae67ae84cf73464eba310a1fef9f476724cc176d264736f6c6343000814003300000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000300000000000000000000000038e23cea342deea0744a4f68780053f347b8bfa600000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000003268747470733a2f2f636c69656e742d6170692e646563612e73797374656d732f646563616c2f6d657461646174612f34302f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a57ec3a618b6969a6b1fec2ef4bf54b2afc5ca30
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106101f7575f3560e01c806301ffc9a7146101fb57806306fdde03146102235780630798f69714610238578063081812fc1461024d578063095ea7b31461026d57806318160ddd146102805780631e7269c51461029757806323b872dd146102b9578063248a9ca3146102cc578063297b551b146102df5780632a55205a146102f25780632eb4a7ab146103135780632f2ff15d1461031c57806332cb6b0c1461032f57806336568abe1461034957806342842e0e1461035c57806343bc16121461036f5780635de6dc55146103825780636352211e146103a257806370a08231146103b557806371424249146103c8578063715018a6146103f057806371a4c485146103f85780637cb64759146104015780637e5b8106146104145780638da5cb5b1461041d57806391d148541461042557806395d89b41146104385780639abc8320146104405780639f3632fb14610448578063a0bcfc7f1461045b578063a217fddf1461046e578063a22cb46514610475578063a96f38dd14610488578063b77a147b14610490578063b88d4fde146104a3578063bf113baf146104b6578063c3ad8e98146104c9578063c87b56dd146104d1578063d4c97533146104e4578063d547741f146104f7578063e985e9c51461050a578063f2fde38b1461051d575b5f80fd5b61020e610209366004611981565b610530565b60405190151581526020015b60405180910390f35b61022b610540565b60405161021a91906119e9565b61024b6102463660046119fb565b6105cf565b005b61026061025b3660046119fb565b610619565b60405161021a9190611a12565b61024b61027b366004611a41565b61062d565b610289600a5481565b60405190815260200161021a565b61020e6102a5366004611a69565b600f6020525f908152604090205460ff1681565b61024b6102c7366004611a82565b61063c565b6102896102da3660046119fb565b6106ce565b61024b6102ed366004611abb565b6106e2565b610305610300366004611adc565b610736565b60405161021a929190611afc565b610289600d5481565b61024b61032a366004611b15565b610776565b610337606481565b60405160ff909116815260200161021a565b61024b610357366004611b15565b610792565b61024b61036a366004611a82565b6107ca565b600954610260906001600160a01b031681565b610395610390366004611a69565b6107e4565b60405161021a9190611b3f565b6102606103b03660046119fb565b6108b4565b6102896103c3366004611a69565b6108be565b6009546103dd90600160a01b900461ffff1681565b60405161ffff909116815260200161021a565b61024b610903565b610289600b5481565b61024b61040f3660046119fb565b610916565b610289600c5481565b610260610926565b61020e610433366004611b15565b610935565b61022b61095f565b61022b61096e565b61024b6104563660046119fb565b6109fa565b61024b610469366004611c08565b610b01565b6102895f81565b61024b610483366004611c4c565b610b17565b610289610b22565b61028961049e366004611c85565b610b50565b61024b6104b1366004611cf3565b610ca9565b61024b6104c43660046119fb565b610cc0565b610289610dd8565b61022b6104df3660046119fb565b610de9565b61024b6104f2366004611a69565b610ed9565b61024b610505366004611b15565b610f2d565b61020e610518366004611d69565b610f49565b61024b61052b366004611a69565b610f76565b5f61053a82610fb0565b92915050565b60605f805461054e90611d91565b80601f016020809104026020016040519081016040528092919081815260200182805461057a90611d91565b80156105c55780601f1061059c576101008083540402835291602001916105c5565b820191905f5260205f20905b8154815290600101906020018083116105a857829003601f168201915b5050505050905090565b5f6105d981610fd4565b600a546105e7906064611ddd565b600c546105f49084611ddd565b11156106135760405163d5c4417960e01b815260040160405180910390fd5b50600b55565b5f61062382610fde565b5061053a82611015565b61063882823361102f565b5050565b6001600160a01b03821661066e575f604051633250574960e11b81526004016106659190611a12565b60405180910390fd5b5f61067a83833361103c565b9050836001600160a01b0316816001600160a01b0316146106c8576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610665565b50505050565b5f9081526007602052604090206001015490565b5f6106ec81610fd4565b6127108261ffff1611156107135760405163c6cc5d7f60e01b815260040160405180910390fd5b506009805461ffff909216600160a01b0261ffff60a01b19909216919091179055565b6009545f9081906001600160a01b038116906127109061076190600160a01b900461ffff1686611df0565b61076b9190611e07565b915091509250929050565b61077f826106ce565b61078881610fd4565b6106c88383611129565b6001600160a01b03811633146107bb5760405163334bd91960e11b815260040160405180910390fd5b6107c582826111ba565b505050565b6107c583838360405180602001604052805f815250610ca9565b60605f6107f0836108be565b90505f816001600160401b0381111561080b5761080b611b82565b604051908082528060200260200182016040528015610834578160200160208202803683370190505b5090505f805b600a548110156108aa57856001600160a01b0316610857826108b4565b6001600160a01b031603610891578083838151811061087857610878611e26565b60209081029190910101528161088d81611e3a565b9250505b8184146108aa57806108a281611e3a565b91505061083a565b5090949350505050565b5f61053a82610fde565b5f6001600160a01b0382166108e8575f6040516322718ad960e21b81526004016106659190611a12565b506001600160a01b03165f9081526003602052604090205490565b61090b611225565b6109145f611257565b565b5f61092081610fd4565b50600d55565b6008546001600160a01b031690565b5f9182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606001805461054e90611d91565b600e805461097b90611d91565b80601f01602080910402602001604051908101604052809291908181526020018280546109a790611d91565b80156109f25780601f106109c9576101008083540402835291602001916109f2565b820191905f5260205f20905b8154815290600101906020018083116109d557829003601f168201915b505050505081565b610a026112a8565b5f610a0c81610fd4565b815f03610a2c57604051632a6ce29960e11b815260040160405180910390fd5b5f600c54600b54610a3d9190611ddd565b9050805f03610a5f5760405163d5c4417960e01b815260040160405180910390fd5b610a6983826112d2565b600a549093505f5b84811015610aaf57600954610a8f906001600160a01b0316836112e9565b81610a9981611e3a565b9250508080610aa790611e3a565b915050610a71565b5083600c5f828254610ac19190611e52565b9091555050600a81905560408051858152602081018490525f80516020611ff3833981519152910160405180910390a1505050610afe6001600655565b50565b5f610b0b81610fd4565b600e6107c58382611eb2565b610638338383611302565b5f600c54600b54610b339190611ddd565b600a54610b41906064611ddd565b610b4b9190611ddd565b905090565b5f610b596112a8565b335f908152600f602052604090205460ff1615610b8957604051631bbdf5c560e31b815260040160405180910390fd5b600a54606411610bac5760405163d05cb60960e01b815260040160405180910390fd5b6001610bb6610b22565b1015610bd5576040516321bccf3f60e01b815260040160405180910390fd5b6040516001600160601b03193360601b1660208201525f90603401604051602081830303815290604052805190602001209050610c488484808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050600d549150849050611397565b610c655760405163231e418360e01b815260040160405180910390fd5b335f908152600f60205260408120805460ff19166001179055600a805493508391610c8f83611e3a565b9190505550610c9e33836112e9565b5061053a6001600655565b610cb484848461063c565b6106c8848484846113ac565b610cc86112a8565b805f03610ce857604051632a6ce29960e11b815260040160405180910390fd5b6009546001600160a01b03163314610d1357604051636bebaa5360e01b815260040160405180910390fd5b5f600c54600b54610d249190611ddd565b9050805f03610d465760405163d5c4417960e01b815260040160405180910390fd5b610d5082826112d2565b600a549092505f5b83811015610d8a57610d6a33836112e9565b81610d7481611e3a565b9250508080610d8290611e3a565b915050610d58565b5082600c5f828254610d9c9190611e52565b9091555050600a81905560408051848152602081018490525f80516020611ff3833981519152910160405180910390a15050610afe6001600655565b5f600c54600b54610b4b9190611ddd565b60605f610df5836114c0565b6001600160a01b031603610e5a5760405162461bcd60e51b815260206004820152602660248201527f444543414c3a2055524920717565727920666f72206e6f6e6578697374656e74604482015265103a37b5b2b760d11b6064820152608401610665565b5f610e636114da565b90505f815111610ea75760405162461bcd60e51b815260206004820152600f60248201526e18985cd9555492481b9bdd081cd95d608a1b6044820152606401610665565b80610eb1846114e9565b604051602001610ec2929190611f6d565b604051602081830303815290604052915050919050565b5f610ee381610fd4565b6001600160a01b038216610f0a576040516340f028e160e11b815260040160405180910390fd5b50600980546001600160a01b0319166001600160a01b0392909216919091179055565b610f36826106ce565b610f3f81610fd4565b6106c883836111ba565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b610f7e611225565b6001600160a01b038116610fa7575f604051631e4fbdf760e01b81526004016106659190611a12565b610afe81611257565b5f6001600160e01b03198216637965db0b60e01b148061053a575061053a82611578565b610afe81336115c7565b5f80610fe9836114c0565b90506001600160a01b03811661053a57604051637e27328960e01b815260048101849052602401610665565b5f908152600460205260409020546001600160a01b031690565b6107c583838360016115f2565b5f80611047846114c0565b90506001600160a01b03831615611063576110638184866116ed565b6001600160a01b0381161561109d5761107e5f855f806115f2565b6001600160a01b0381165f90815260036020526040902080545f190190555b6001600160a01b038516156110cb576001600160a01b0385165f908152600360205260409020805460010190555b5f8481526002602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b5f6111348383610935565b6111b3575f8381526007602090815260408083206001600160a01b03861684529091529020805460ff1916600117905561116b3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161053a565b505f61053a565b5f6111c58383610935565b156111b3575f8381526007602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161053a565b3361122e610926565b6001600160a01b031614610914573360405163118cdaa760e01b81526004016106659190611a12565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6002600654036112cb57604051633ee5aeb560e01b815260040160405180910390fd5b6002600655565b5f8183106112e057816112e2565b825b9392505050565b610638828260405180602001604052805f815250611743565b6001600160a01b03821661132b5781604051630b61174360e31b81526004016106659190611a12565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b5f826113a38584611759565b14949350505050565b6001600160a01b0383163b156106c857604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906113ee903390889087908790600401611f9b565b6020604051808303815f875af1925050508015611428575060408051601f3d908101601f1916820190925261142591810190611fd7565b60015b611486573d808015611455576040519150601f19603f3d011682016040523d82523d5f602084013e61145a565b606091505b5080515f0361147e5783604051633250574960e11b81526004016106659190611a12565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b146114b95783604051633250574960e11b81526004016106659190611a12565b5050505050565b5f908152600260205260409020546001600160a01b031690565b6060600e805461054e90611d91565b60605f6114f5836117a5565b60010190505f816001600160401b0381111561151357611513611b82565b6040519080825280601f01601f19166020018201604052801561153d576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461154757509392505050565b5f6001600160e01b031982166380ac58cd60e01b14806115a857506001600160e01b03198216635b5e139f60e01b145b8061053a57506301ffc9a760e01b6001600160e01b031983161461053a565b6115d18282610935565b61063857808260405163e2517d3f60e01b8152600401610665929190611afc565b808061160657506001600160a01b03821615155b156116be575f61161584610fde565b90506001600160a01b038316158015906116415750826001600160a01b0316816001600160a01b031614155b801561165457506116528184610f49565b155b15611674578260405163a9fbf51f60e01b81526004016106659190611a12565b81156116bc5783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50505f90815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6116f883838361187a565b6107c5576001600160a01b03831661172657604051637e27328960e01b815260048101829052602401610665565b818160405163177e802f60e01b8152600401610665929190611afc565b61174d83836118df565b6107c55f8484846113ac565b5f81815b845181101561179d576117898286838151811061177c5761177c611e26565b6020026020010151611940565b91508061179581611e3a565b91505061175d565b509392505050565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106117e35772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b831061180d576904ee2d6d415b85acef8160201b830492506020015b662386f26fc10000831061182b57662386f26fc10000830492506010015b6305f5e1008310611843576305f5e100830492506008015b612710831061185757612710830492506004015b60648310611869576064830492506002015b600a831061053a5760010192915050565b5f6001600160a01b038316158015906118d75750826001600160a01b0316846001600160a01b031614806118b357506118b38484610f49565b806118d75750826001600160a01b03166118cc83611015565b6001600160a01b0316145b949350505050565b6001600160a01b038216611908575f604051633250574960e11b81526004016106659190611a12565b5f61191483835f61103c565b90506001600160a01b038116156107c5575f6040516339e3563760e11b81526004016106659190611a12565b5f81831061195a575f8281526020849052604090206112e2565b5f8381526020839052604090206112e2565b6001600160e01b031981168114610afe575f80fd5b5f60208284031215611991575f80fd5b81356112e28161196c565b5f5b838110156119b657818101518382015260200161199e565b50505f910152565b5f81518084526119d581602086016020860161199c565b601f01601f19169290920160200192915050565b602081525f6112e260208301846119be565b5f60208284031215611a0b575f80fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b0381168114611a3c575f80fd5b919050565b5f8060408385031215611a52575f80fd5b611a5b83611a26565b946020939093013593505050565b5f60208284031215611a79575f80fd5b6112e282611a26565b5f805f60608486031215611a94575f80fd5b611a9d84611a26565b9250611aab60208501611a26565b9150604084013590509250925092565b5f60208284031215611acb575f80fd5b813561ffff811681146112e2575f80fd5b5f8060408385031215611aed575f80fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b5f8060408385031215611b26575f80fd5b82359150611b3660208401611a26565b90509250929050565b602080825282518282018190525f9190848201906040850190845b81811015611b7657835183529284019291840191600101611b5a565b50909695505050505050565b634e487b7160e01b5f52604160045260245ffd5b5f6001600160401b0380841115611baf57611baf611b82565b604051601f8501601f19908116603f01168101908282118183101715611bd757611bd7611b82565b81604052809350858152868686011115611bef575f80fd5b858560208301375f602087830101525050509392505050565b5f60208284031215611c18575f80fd5b81356001600160401b03811115611c2d575f80fd5b8201601f81018413611c3d575f80fd5b6118d784823560208401611b96565b5f8060408385031215611c5d575f80fd5b611c6683611a26565b915060208301358015158114611c7a575f80fd5b809150509250929050565b5f8060208385031215611c96575f80fd5b82356001600160401b0380821115611cac575f80fd5b818501915085601f830112611cbf575f80fd5b813581811115611ccd575f80fd5b8660208260051b8501011115611ce1575f80fd5b60209290920196919550909350505050565b5f805f8060808587031215611d06575f80fd5b611d0f85611a26565b9350611d1d60208601611a26565b92506040850135915060608501356001600160401b03811115611d3e575f80fd5b8501601f81018713611d4e575f80fd5b611d5d87823560208401611b96565b91505092959194509250565b5f8060408385031215611d7a575f80fd5b611d8383611a26565b9150611b3660208401611a26565b600181811c90821680611da557607f821691505b602082108103611dc357634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561053a5761053a611dc9565b808202811582820484141761053a5761053a611dc9565b5f82611e2157634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffd5b5f60018201611e4b57611e4b611dc9565b5060010190565b8082018082111561053a5761053a611dc9565b601f8211156107c5575f81815260208120601f850160051c81016020861015611e8b5750805b601f850160051c820191505b81811015611eaa57828155600101611e97565b505050505050565b81516001600160401b03811115611ecb57611ecb611b82565b611edf81611ed98454611d91565b84611e65565b602080601f831160018114611f12575f8415611efb5750858301515b5f19600386901b1c1916600185901b178555611eaa565b5f85815260208120601f198616915b82811015611f4057888601518255948401946001909101908401611f21565b5085821015611f5d57878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b5f8351611f7e81846020880161199c565b835190830190611f9281836020880161199c565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90611fcd908301846119be565b9695505050505050565b5f60208284031215611fe7575f80fd5b81516112e28161196c56fe0b3544e12b031cb05a003a4e0cb691f6809a97e68d9f3d5d00387b0ee985acbaa26469706673582212204973f1f4bdb7ea34136b0ccae67ae84cf73464eba310a1fef9f476724cc176d264736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000300000000000000000000000038e23cea342deea0744a4f68780053f347b8bfa600000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000003268747470733a2f2f636c69656e742d6170692e646563612e73797374656d732f646563616c2f6d657461646174612f34302f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a57ec3a618b6969a6b1fec2ef4bf54b2afc5ca30
-----Decoded View---------------
Arg [0] : _baseUri (string): https://client-api.deca.systems/decal/metadata/40/
Arg [1] : _admins (address[]): 0xA57ec3a618b6969a6B1fEc2eF4BF54B2AfC5ca30
Arg [2] : _artistMaxSupply (uint256): 3
Arg [3] : _artist (address): 0x38E23CeA342DeeA0744A4F68780053f347B8BFa6
Arg [4] : _artistBps (uint16): 1000
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [3] : 00000000000000000000000038e23cea342deea0744a4f68780053f347b8bfa6
Arg [4] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [6] : 68747470733a2f2f636c69656e742d6170692e646563612e73797374656d732f
Arg [7] : 646563616c2f6d657461646174612f34302f0000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [9] : 000000000000000000000000a57ec3a618b6969a6b1fec2ef4bf54b2afc5ca30
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.