|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
interface IBatch {
|
|
function isOwnerOf( address account, uint[] calldata tokenIds ) external view returns( bool );
|
|
function transferBatch( address from, address to, uint[] calldata tokenIds, bytes calldata data ) external;
|
|
function walletOfOwner( address account ) external view returns( uint[] memory );
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface IERC721Receiver {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onERC721Received(
|
|
address operator,
|
|
address from,
|
|
uint256 tokenId,
|
|
bytes calldata data
|
|
) external returns (bytes4);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface IERC165 {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function supportsInterface(bytes4 interfaceId) external view returns (bool);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract ERC165 is IERC165 {
|
|
|
|
|
|
|
|
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
|
|
return interfaceId == type(IERC165).interfaceId;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
interface IERC721 is IERC165 {
|
|
|
|
|
|
|
|
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
|
|
|
|
|
|
|
|
|
|
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
|
|
|
|
|
|
|
|
|
|
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
|
|
|
|
|
|
|
|
|
|
function balanceOf(address owner) external view returns (uint256 balance);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ownerOf(uint256 tokenId) external view returns (address owner);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function safeTransferFrom(
|
|
address from,
|
|
address to,
|
|
uint256 tokenId,
|
|
bytes calldata data
|
|
) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function safeTransferFrom(
|
|
address from,
|
|
address to,
|
|
uint256 tokenId
|
|
) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function transferFrom(
|
|
address from,
|
|
address to,
|
|
uint256 tokenId
|
|
) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function approve(address to, uint256 tokenId) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setApprovalForAll(address operator, bool _approved) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getApproved(uint256 tokenId) external view returns (address operator);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isApprovedForAll(address owner, address operator) external view returns (bool);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface IERC721Enumerable is IERC721 {
|
|
|
|
|
|
|
|
function totalSupply() external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
|
|
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
|
|
function tokenByIndex(uint256 index) external view returns (uint256);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface IERC721Metadata is IERC721 {
|
|
|
|
|
|
|
|
function name() external view returns (string memory);
|
|
|
|
|
|
|
|
|
|
function symbol() external view returns (string memory);
|
|
|
|
|
|
|
|
|
|
function tokenURI(uint256 tokenId) external view returns (string memory);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
library Math {
|
|
enum Rounding {
|
|
Down,
|
|
Up,
|
|
Zero
|
|
}
|
|
|
|
|
|
|
|
|
|
function max(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
return a > b ? a : b;
|
|
}
|
|
|
|
|
|
|
|
|
|
function min(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
return a < b ? a : b;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function average(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
|
|
return (a & b) + (a ^ b) / 2;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
|
|
return a == 0 ? 0 : (a - 1) / b + 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function mulDiv(
|
|
uint256 x,
|
|
uint256 y,
|
|
uint256 denominator
|
|
) internal pure returns (uint256 result) {
|
|
unchecked {
|
|
|
|
|
|
|
|
uint256 prod0;
|
|
uint256 prod1;
|
|
assembly {
|
|
let mm := mulmod(x, y, not(0))
|
|
prod0 := mul(x, y)
|
|
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
|
|
}
|
|
|
|
|
|
if (prod1 == 0) {
|
|
return prod0 / denominator;
|
|
}
|
|
|
|
|
|
require(denominator > prod1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint256 remainder;
|
|
assembly {
|
|
|
|
remainder := mulmod(x, y, denominator)
|
|
|
|
|
|
prod1 := sub(prod1, gt(remainder, prod0))
|
|
prod0 := sub(prod0, remainder)
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint256 twos = denominator & (~denominator + 1);
|
|
assembly {
|
|
|
|
denominator := div(denominator, twos)
|
|
|
|
|
|
prod0 := div(prod0, twos)
|
|
|
|
|
|
twos := add(div(sub(0, twos), twos), 1)
|
|
}
|
|
|
|
|
|
prod0 |= prod1 * twos;
|
|
|
|
|
|
|
|
|
|
uint256 inverse = (3 * denominator) ^ 2;
|
|
|
|
|
|
|
|
inverse *= 2 - denominator * inverse;
|
|
inverse *= 2 - denominator * inverse;
|
|
inverse *= 2 - denominator * inverse;
|
|
inverse *= 2 - denominator * inverse;
|
|
inverse *= 2 - denominator * inverse;
|
|
inverse *= 2 - denominator * inverse;
|
|
|
|
|
|
|
|
|
|
|
|
result = prod0 * inverse;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function mulDiv(
|
|
uint256 x,
|
|
uint256 y,
|
|
uint256 denominator,
|
|
Rounding rounding
|
|
) internal pure returns (uint256) {
|
|
uint256 result = mulDiv(x, y, denominator);
|
|
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
|
|
result += 1;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sqrt(uint256 a) internal pure returns (uint256) {
|
|
if (a == 0) {
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint256 result = 1 << (log2(a) >> 1);
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
|
|
unchecked {
|
|
uint256 result = sqrt(a);
|
|
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
|
|
unchecked {
|
|
uint256 result = log2(value);
|
|
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
|
|
unchecked {
|
|
uint256 result = log10(value);
|
|
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
|
|
unchecked {
|
|
uint256 result = log256(value);
|
|
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
library Strings {
|
|
bytes16 private constant _SYMBOLS = "0123456789abcdef";
|
|
uint8 private constant _ADDRESS_LENGTH = 20;
|
|
|
|
|
|
|
|
|
|
function toString(uint256 value) internal pure returns (string memory) {
|
|
unchecked {
|
|
uint256 length = Math.log10(value) + 1;
|
|
string memory buffer = new string(length);
|
|
uint256 ptr;
|
|
|
|
assembly {
|
|
ptr := add(buffer, add(32, length))
|
|
}
|
|
while (true) {
|
|
ptr--;
|
|
|
|
assembly {
|
|
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
|
|
}
|
|
value /= 10;
|
|
if (value == 0) break;
|
|
}
|
|
return buffer;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function toHexString(uint256 value) internal pure returns (string memory) {
|
|
unchecked {
|
|
return toHexString(value, Math.log256(value) + 1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
|
|
bytes memory buffer = new bytes(2 * length + 2);
|
|
buffer[0] = "0";
|
|
buffer[1] = "x";
|
|
for (uint256 i = 2 * length + 1; i > 1; --i) {
|
|
buffer[i] = _SYMBOLS[value & 0xf];
|
|
value >>= 4;
|
|
}
|
|
require(value == 0, "Strings: hex length insufficient");
|
|
return string(buffer);
|
|
}
|
|
|
|
|
|
|
|
|
|
function toHexString(address addr) internal pure returns (string memory) {
|
|
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract Context {
|
|
function _msgSender() internal view virtual returns (address) {
|
|
return msg.sender;
|
|
}
|
|
|
|
function _msgData() internal view virtual returns (bytes calldata) {
|
|
return msg.data;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract Ownable is Context {
|
|
address private _owner;
|
|
|
|
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
_transferOwnership(_msgSender());
|
|
}
|
|
|
|
|
|
|
|
|
|
modifier onlyOwner() {
|
|
_checkOwner();
|
|
_;
|
|
}
|
|
|
|
|
|
|
|
|
|
function owner() public view virtual returns (address) {
|
|
return _owner;
|
|
}
|
|
|
|
|
|
|
|
|
|
function _checkOwner() internal view virtual {
|
|
require(owner() == _msgSender(), "Ownable: caller is not the owner");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renounceOwnership() public virtual onlyOwner {
|
|
_transferOwnership(address(0));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function transferOwnership(address newOwner) public virtual onlyOwner {
|
|
require(newOwner != address(0), "Ownable: new owner is the zero address");
|
|
_transferOwnership(newOwner);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function _transferOwnership(address newOwner) internal virtual {
|
|
address oldOwner = _owner;
|
|
_owner = newOwner;
|
|
emit OwnershipTransferred(oldOwner, newOwner);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.1;
|
|
|
|
|
|
|
|
|
|
library Address {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isContract(address account) internal view returns (bool) {
|
|
|
|
|
|
|
|
|
|
return account.code.length > 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sendValue(address payable recipient, uint256 amount) internal {
|
|
require(address(this).balance >= amount, "Address: insufficient balance");
|
|
|
|
(bool success, ) = recipient.call{value: amount}("");
|
|
require(success, "Address: unable to send value, recipient may have reverted");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
|
|
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionCall(
|
|
address target,
|
|
bytes memory data,
|
|
string memory errorMessage
|
|
) internal returns (bytes memory) {
|
|
return functionCallWithValue(target, data, 0, errorMessage);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionCallWithValue(
|
|
address target,
|
|
bytes memory data,
|
|
uint256 value
|
|
) internal returns (bytes memory) {
|
|
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionCallWithValue(
|
|
address target,
|
|
bytes memory data,
|
|
uint256 value,
|
|
string memory errorMessage
|
|
) internal returns (bytes memory) {
|
|
require(address(this).balance >= value, "Address: insufficient balance for call");
|
|
(bool success, bytes memory returndata) = target.call{value: value}(data);
|
|
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
|
|
return functionStaticCall(target, data, "Address: low-level static call failed");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionStaticCall(
|
|
address target,
|
|
bytes memory data,
|
|
string memory errorMessage
|
|
) internal view returns (bytes memory) {
|
|
(bool success, bytes memory returndata) = target.staticcall(data);
|
|
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
|
|
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function functionDelegateCall(
|
|
address target,
|
|
bytes memory data,
|
|
string memory errorMessage
|
|
) internal returns (bytes memory) {
|
|
(bool success, bytes memory returndata) = target.delegatecall(data);
|
|
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function verifyCallResultFromTarget(
|
|
address target,
|
|
bool success,
|
|
bytes memory returndata,
|
|
string memory errorMessage
|
|
) internal view returns (bytes memory) {
|
|
if (success) {
|
|
if (returndata.length == 0) {
|
|
|
|
|
|
require(isContract(target), "Address: call to non-contract");
|
|
}
|
|
return returndata;
|
|
} else {
|
|
_revert(returndata, errorMessage);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function verifyCallResult(
|
|
bool success,
|
|
bytes memory returndata,
|
|
string memory errorMessage
|
|
) internal pure returns (bytes memory) {
|
|
if (success) {
|
|
return returndata;
|
|
} else {
|
|
_revert(returndata, errorMessage);
|
|
}
|
|
}
|
|
|
|
function _revert(bytes memory returndata, string memory errorMessage) private pure {
|
|
|
|
if (returndata.length > 0) {
|
|
|
|
|
|
assembly {
|
|
let returndata_size := mload(returndata)
|
|
revert(add(32, returndata), returndata_size)
|
|
}
|
|
} else {
|
|
revert(errorMessage);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract ERC721B is Context, ERC165, IERC721, IERC721Metadata {
|
|
using Address for address;
|
|
|
|
string private _name;
|
|
string private _symbol;
|
|
|
|
uint internal _offset;
|
|
address[] internal _owners;
|
|
|
|
mapping(uint => address) private _tokenApprovals;
|
|
mapping(address => mapping(address => bool)) private _operatorApprovals;
|
|
|
|
constructor(string memory name_, string memory symbol_, uint offset) {
|
|
_name = name_;
|
|
_symbol = symbol_;
|
|
_offset = offset;
|
|
for(uint i; i < _offset; ++i ){
|
|
_owners.push(address(0));
|
|
}
|
|
}
|
|
|
|
|
|
function balanceOf(address owner) public view virtual override returns (uint) {
|
|
require(owner != address(0), "ERC721: balance query for the zero address");
|
|
|
|
uint count;
|
|
for( uint i; i < _owners.length; ++i ){
|
|
if( owner == _owners[i] )
|
|
++count;
|
|
}
|
|
return count;
|
|
}
|
|
|
|
function name() external view virtual override returns (string memory) {
|
|
return _name;
|
|
}
|
|
|
|
function next() public view returns( uint ){
|
|
return _owners.length;
|
|
}
|
|
|
|
function ownerOf(uint tokenId) public view virtual override returns (address) {
|
|
address owner = _owners[tokenId];
|
|
require(owner != address(0), "ERC721: owner query for nonexistent token");
|
|
return owner;
|
|
}
|
|
|
|
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
|
|
return
|
|
interfaceId == type(IERC721).interfaceId ||
|
|
interfaceId == type(IERC721Metadata).interfaceId ||
|
|
super.supportsInterface(interfaceId);
|
|
}
|
|
|
|
function symbol() external view virtual override returns (string memory) {
|
|
return _symbol;
|
|
}
|
|
|
|
function totalSupply() public view virtual returns (uint) {
|
|
return _owners.length - _offset;
|
|
}
|
|
|
|
|
|
function approve(address to, uint tokenId) public virtual override {
|
|
address owner = ERC721B.ownerOf(tokenId);
|
|
require(to != owner, "ERC721: approval to current owner");
|
|
|
|
require(
|
|
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
|
|
"ERC721: approve caller is not owner nor approved for all"
|
|
);
|
|
|
|
_approve(to, tokenId);
|
|
}
|
|
|
|
function getApproved(uint tokenId) public view virtual override returns (address) {
|
|
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
|
|
return _tokenApprovals[tokenId];
|
|
}
|
|
|
|
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
|
|
return _operatorApprovals[owner][operator];
|
|
}
|
|
|
|
function setApprovalForAll(address operator, bool approved) public virtual override {
|
|
require(operator != _msgSender(), "ERC721: approve to caller");
|
|
_operatorApprovals[_msgSender()][operator] = approved;
|
|
emit ApprovalForAll(_msgSender(), operator, approved);
|
|
}
|
|
|
|
function transferFrom(
|
|
address from,
|
|
address to,
|
|
uint tokenId
|
|
) public virtual override {
|
|
|
|
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
|
|
_transfer(from, to, tokenId);
|
|
}
|
|
|
|
function safeTransferFrom(
|
|
address from,
|
|
address to,
|
|
uint tokenId
|
|
) public virtual override {
|
|
safeTransferFrom(from, to, tokenId, "");
|
|
}
|
|
|
|
function safeTransferFrom(
|
|
address from,
|
|
address to,
|
|
uint tokenId,
|
|
bytes memory _data
|
|
) public virtual override {
|
|
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
|
|
_safeTransfer(from, to, tokenId, _data);
|
|
}
|
|
|
|
|
|
|
|
function _safeTransfer(
|
|
address from,
|
|
address to,
|
|
uint tokenId,
|
|
bytes memory _data
|
|
) internal virtual {
|
|
_transfer(from, to, tokenId);
|
|
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
|
|
}
|
|
|
|
function _exists(uint tokenId) internal view virtual returns (bool) {
|
|
return tokenId < _owners.length && _owners[tokenId] != address(0);
|
|
}
|
|
|
|
function _isApprovedOrOwner(address spender, uint tokenId) internal view virtual returns (bool) {
|
|
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
|
|
address owner = ERC721B.ownerOf(tokenId);
|
|
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
|
|
}
|
|
|
|
function _safeMint(address to, uint tokenId) internal virtual {
|
|
_safeMint(to, tokenId, "");
|
|
}
|
|
|
|
function _safeMint(
|
|
address to,
|
|
uint tokenId,
|
|
bytes memory _data
|
|
) internal virtual {
|
|
_mint(to, tokenId);
|
|
require(
|
|
_checkOnERC721Received(address(0), to, tokenId, _data),
|
|
"ERC721: transfer to non ERC721Receiver implementer"
|
|
);
|
|
}
|
|
|
|
function _mint(address to, uint tokenId) internal virtual {
|
|
require(to != address(0), "ERC721: mint to the zero address");
|
|
require(!_exists(tokenId), "ERC721: token already minted");
|
|
|
|
_beforeTokenTransfer(address(0), to, tokenId);
|
|
_owners.push(to);
|
|
|
|
emit Transfer(address(0), to, tokenId);
|
|
}
|
|
|
|
function _burn(uint tokenId) internal virtual {
|
|
address owner = ERC721B.ownerOf(tokenId);
|
|
|
|
_beforeTokenTransfer(owner, address(0), tokenId);
|
|
|
|
|
|
_approve(address(0), tokenId);
|
|
_owners[tokenId] = address(0);
|
|
|
|
emit Transfer(owner, address(0), tokenId);
|
|
}
|
|
|
|
function _transfer(
|
|
address from,
|
|
address to,
|
|
uint tokenId
|
|
) internal virtual {
|
|
require(ERC721B.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
|
|
require(to != address(0), "ERC721: transfer to the zero address");
|
|
|
|
_beforeTokenTransfer(from, to, tokenId);
|
|
|
|
|
|
_approve(address(0), tokenId);
|
|
_owners[tokenId] = to;
|
|
|
|
emit Transfer(from, to, tokenId);
|
|
}
|
|
|
|
function _approve(address to, uint tokenId) internal virtual {
|
|
_tokenApprovals[tokenId] = to;
|
|
emit Approval(ERC721B.ownerOf(tokenId), to, tokenId);
|
|
}
|
|
|
|
function _checkOnERC721Received(
|
|
address from,
|
|
address to,
|
|
uint tokenId,
|
|
bytes memory _data
|
|
) private returns (bool) {
|
|
if (to.isContract()) {
|
|
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
|
|
return retval == IERC721Receiver.onERC721Received.selector;
|
|
} catch (bytes memory reason) {
|
|
if (reason.length == 0) {
|
|
revert("ERC721: transfer to non ERC721Receiver implementer");
|
|
} else {
|
|
assembly {
|
|
revert(add(32, reason), mload(reason))
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
function _beforeTokenTransfer(
|
|
address from,
|
|
address to,
|
|
uint tokenId
|
|
) internal virtual {}
|
|
}
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract ERC721EnumerableLite is ERC721B, IBatch, IERC721Enumerable {
|
|
function isOwnerOf( address account, uint[] calldata tokenIds ) external view override returns( bool ){
|
|
for(uint i; i < tokenIds.length; ++i ){
|
|
if( _owners[ tokenIds[i] ] != account )
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721B) returns (bool) {
|
|
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
|
|
}
|
|
|
|
function tokenOfOwnerByIndex(address owner, uint index) public view override returns (uint tokenId) {
|
|
uint count;
|
|
for( uint i; i < _owners.length; ++i ){
|
|
if( owner == _owners[i] ){
|
|
if( count == index )
|
|
return i;
|
|
else
|
|
++count;
|
|
}
|
|
}
|
|
|
|
require(false, "ERC721Enumerable: owner index out of bounds");
|
|
}
|
|
|
|
function tokenByIndex(uint index) external view virtual override returns (uint) {
|
|
require(index < totalSupply(), "ERC721Enumerable: global index out of bounds");
|
|
return index;
|
|
}
|
|
|
|
function totalSupply() public view virtual override( ERC721B, IERC721Enumerable ) returns (uint) {
|
|
return _owners.length - _offset;
|
|
}
|
|
|
|
function transferBatch( address from, address to, uint[] calldata tokenIds, bytes calldata data ) external override{
|
|
for(uint i; i < tokenIds.length; ++i ){
|
|
safeTransferFrom( from, to, tokenIds[i], data );
|
|
}
|
|
}
|
|
|
|
function walletOfOwner( address account ) external view override returns( uint[] memory ){
|
|
uint quantity = balanceOf( account );
|
|
uint[] memory wallet = new uint[]( quantity );
|
|
for( uint i; i < quantity; ++i ){
|
|
wallet[i] = tokenOfOwnerByIndex( account, i );
|
|
}
|
|
return wallet;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface IERC20Permit {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function permit(
|
|
address owner,
|
|
address spender,
|
|
uint256 value,
|
|
uint256 deadline,
|
|
uint8 v,
|
|
bytes32 r,
|
|
bytes32 s
|
|
) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function nonces(address owner) external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
|
|
function DOMAIN_SEPARATOR() external view returns (bytes32);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
interface IERC20 {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
event Transfer(address indexed from, address indexed to, uint256 value);
|
|
|
|
|
|
|
|
|
|
|
|
event Approval(address indexed owner, address indexed spender, uint256 value);
|
|
|
|
|
|
|
|
|
|
function totalSupply() external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
function balanceOf(address account) external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function transfer(address to, uint256 amount) external returns (bool);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function allowance(address owner, address spender) external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function approve(address spender, uint256 amount) external returns (bool);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function transferFrom(
|
|
address from,
|
|
address to,
|
|
uint256 amount
|
|
) external returns (bool);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
library SafeERC20 {
|
|
using Address for address;
|
|
|
|
function safeTransfer(
|
|
IERC20 token,
|
|
address to,
|
|
uint256 value
|
|
) internal {
|
|
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
|
|
}
|
|
|
|
function safeTransferFrom(
|
|
IERC20 token,
|
|
address from,
|
|
address to,
|
|
uint256 value
|
|
) internal {
|
|
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function safeApprove(
|
|
IERC20 token,
|
|
address spender,
|
|
uint256 value
|
|
) internal {
|
|
|
|
|
|
|
|
require(
|
|
(value == 0) || (token.allowance(address(this), spender) == 0),
|
|
"SafeERC20: approve from non-zero to non-zero allowance"
|
|
);
|
|
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
|
|
}
|
|
|
|
function safeIncreaseAllowance(
|
|
IERC20 token,
|
|
address spender,
|
|
uint256 value
|
|
) internal {
|
|
uint256 newAllowance = token.allowance(address(this), spender) + value;
|
|
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
|
|
}
|
|
|
|
function safeDecreaseAllowance(
|
|
IERC20 token,
|
|
address spender,
|
|
uint256 value
|
|
) internal {
|
|
unchecked {
|
|
uint256 oldAllowance = token.allowance(address(this), spender);
|
|
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
|
|
uint256 newAllowance = oldAllowance - value;
|
|
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
|
|
}
|
|
}
|
|
|
|
function safePermit(
|
|
IERC20Permit token,
|
|
address owner,
|
|
address spender,
|
|
uint256 value,
|
|
uint256 deadline,
|
|
uint8 v,
|
|
bytes32 r,
|
|
bytes32 s
|
|
) internal {
|
|
uint256 nonceBefore = token.nonces(owner);
|
|
token.permit(owner, spender, value, deadline, v, r, s);
|
|
uint256 nonceAfter = token.nonces(owner);
|
|
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _callOptionalReturn(IERC20 token, bytes memory data) private {
|
|
|
|
|
|
|
|
|
|
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
|
|
if (returndata.length > 0) {
|
|
|
|
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contract PaymentSplitter is Context {
|
|
event PayeeAdded(address account, uint256 shares);
|
|
event PaymentReleased(address to, uint256 amount);
|
|
event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);
|
|
event PaymentReceived(address from, uint256 amount);
|
|
|
|
uint256 private _totalShares;
|
|
uint256 private _totalReleased;
|
|
|
|
mapping(address => uint256) private _shares;
|
|
mapping(address => uint256) private _released;
|
|
address[] private _payees;
|
|
|
|
mapping(IERC20 => uint256) private _erc20TotalReleased;
|
|
mapping(IERC20 => mapping(address => uint256)) private _erc20Released;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(address[] memory payees, uint256[] memory shares_) payable {
|
|
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
|
|
require(payees.length > 0, "PaymentSplitter: no payees");
|
|
|
|
for (uint256 i = 0; i < payees.length; i++) {
|
|
_addPayee(payees[i], shares_[i]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
receive() external payable virtual {
|
|
emit PaymentReceived(_msgSender(), msg.value);
|
|
}
|
|
|
|
|
|
|
|
|
|
function totalShares() public view returns (uint256) {
|
|
return _totalShares;
|
|
}
|
|
|
|
|
|
|
|
|
|
function totalReleased() public view returns (uint256) {
|
|
return _totalReleased;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function totalReleased(IERC20 token) public view returns (uint256) {
|
|
return _erc20TotalReleased[token];
|
|
}
|
|
|
|
|
|
|
|
|
|
function shares(address account) public view returns (uint256) {
|
|
return _shares[account];
|
|
}
|
|
|
|
|
|
|
|
|
|
function released(address account) public view returns (uint256) {
|
|
return _released[account];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function released(IERC20 token, address account) public view returns (uint256) {
|
|
return _erc20Released[token][account];
|
|
}
|
|
|
|
|
|
|
|
|
|
function payee(uint256 index) public view returns (address) {
|
|
return _payees[index];
|
|
}
|
|
|
|
|
|
|
|
|
|
function releasable(address account) public view returns (uint256) {
|
|
uint256 totalReceived = address(this).balance + totalReleased();
|
|
return _pendingPayment(account, totalReceived, released(account));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function releasable(IERC20 token, address account) public view returns (uint256) {
|
|
uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);
|
|
return _pendingPayment(account, totalReceived, released(token, account));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function release(address payable account) public virtual {
|
|
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
|
|
|
|
uint256 payment = releasable(account);
|
|
|
|
require(payment != 0, "PaymentSplitter: account is not due payment");
|
|
|
|
|
|
|
|
_totalReleased += payment;
|
|
unchecked {
|
|
_released[account] += payment;
|
|
}
|
|
|
|
Address.sendValue(account, payment);
|
|
emit PaymentReleased(account, payment);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function release(IERC20 token, address account) public virtual {
|
|
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
|
|
|
|
uint256 payment = releasable(token, account);
|
|
|
|
require(payment != 0, "PaymentSplitter: account is not due payment");
|
|
|
|
|
|
|
|
|
|
_erc20TotalReleased[token] += payment;
|
|
unchecked {
|
|
_erc20Released[token][account] += payment;
|
|
}
|
|
|
|
SafeERC20.safeTransfer(token, account, payment);
|
|
emit ERC20PaymentReleased(token, account, payment);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function _pendingPayment(
|
|
address account,
|
|
uint256 totalReceived,
|
|
uint256 alreadyReleased
|
|
) private view returns (uint256) {
|
|
return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _addPayee(address account, uint256 shares_) private {
|
|
require(account != address(0), "PaymentSplitter: account is the zero address");
|
|
require(shares_ > 0, "PaymentSplitter: shares are 0");
|
|
require(_shares[account] == 0, "PaymentSplitter: account already has shares");
|
|
|
|
_payees.push(account);
|
|
_shares[account] = shares_;
|
|
_totalShares = _totalShares + shares_;
|
|
emit PayeeAdded(account, shares_);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.13;
|
|
|
|
interface IOperatorFilterRegistry {
|
|
function isOperatorAllowed(address registrant, address operator) external view returns (bool);
|
|
function register(address registrant) external;
|
|
function registerAndSubscribe(address registrant, address subscription) external;
|
|
function registerAndCopyEntries(address registrant, address registrantToCopy) external;
|
|
function unregister(address addr) external;
|
|
function updateOperator(address registrant, address operator, bool filtered) external;
|
|
function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
|
|
function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
|
|
function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
|
|
function subscribe(address registrant, address registrantToSubscribe) external;
|
|
function unsubscribe(address registrant, bool copyExistingEntries) external;
|
|
function subscriptionOf(address addr) external returns (address registrant);
|
|
function subscribers(address registrant) external returns (address[] memory);
|
|
function subscriberAt(address registrant, uint256 index) external returns (address);
|
|
function copyEntriesOf(address registrant, address registrantToCopy) external;
|
|
function isOperatorFiltered(address registrant, address operator) external returns (bool);
|
|
function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
|
|
function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
|
|
function filteredOperators(address addr) external returns (address[] memory);
|
|
function filteredCodeHashes(address addr) external returns (bytes32[] memory);
|
|
function filteredOperatorAt(address registrant, uint256 index) external returns (address);
|
|
function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
|
|
function isRegistered(address addr) external returns (bool);
|
|
function codeHashOf(address addr) external returns (bytes32);
|
|
}
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.13;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract OperatorFilterer {
|
|
error OperatorNotAllowed(address operator);
|
|
|
|
IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY =
|
|
IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
|
|
|
|
constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
|
|
|
|
|
|
|
|
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
|
|
if (subscribe) {
|
|
OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
|
|
} else {
|
|
if (subscriptionOrRegistrantToCopy != address(0)) {
|
|
OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
|
|
} else {
|
|
OPERATOR_FILTER_REGISTRY.register(address(this));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
modifier onlyAllowedOperator(address from) virtual {
|
|
|
|
|
|
|
|
if (from != msg.sender) {
|
|
_checkFilterOperator(msg.sender);
|
|
}
|
|
_;
|
|
}
|
|
|
|
modifier onlyAllowedOperatorApproval(address operator) virtual {
|
|
_checkFilterOperator(operator);
|
|
_;
|
|
}
|
|
|
|
function _checkFilterOperator(address operator) internal view virtual {
|
|
|
|
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
|
|
if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
|
|
revert OperatorNotAllowed(operator);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.13;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract DefaultOperatorFilterer is OperatorFilterer {
|
|
address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
|
|
|
|
constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {}
|
|
}
|
|
|
|
|
|
|
|
|
|
pragma solidity 0.8.17;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contract NFTCoinLaundryWashers is
|
|
ERC721EnumerableLite,
|
|
PaymentSplitter,
|
|
DefaultOperatorFilterer,
|
|
Ownable {
|
|
using Strings for uint;
|
|
|
|
uint public MAX_ORDER = 20;
|
|
uint public MAX_SUPPLY = 105;
|
|
uint public PRICE = 0.08 ether;
|
|
|
|
bool public isActive = true;
|
|
|
|
string private _baseTokenURI;
|
|
string private _tokenURISuffix;
|
|
|
|
address[] private addressList = [
|
|
0x74371cd314AC736F5ce9e52afb488cC2eE6C4828,
|
|
0x327EC442254e9Dc1dd91c2156725e0A523C06850
|
|
|
|
];
|
|
uint[] private shareList = [
|
|
80,
|
|
20
|
|
];
|
|
|
|
constructor()
|
|
ERC721B("Coin-Laundry Official", "WASH", 1)
|
|
PaymentSplitter(addressList, shareList) {
|
|
_baseTokenURI = "ipfs://bafybeielahtpv7xai4g2px337kcu5w7ocrkxdu4rlshxko2bag2pqczowu/";
|
|
_tokenURISuffix = ".json";
|
|
|
|
for(uint i = 1; i <= 74; ++i){
|
|
_mint( msg.sender, i);
|
|
}
|
|
_mint(0x5f7d007aB2A395a288ff83cCf2a8B921D6d96193, 75);
|
|
}
|
|
|
|
fallback() external payable {}
|
|
|
|
|
|
function mint( uint quantity ) external payable {
|
|
require( isActive, "ERR:NA");
|
|
require( quantity <= MAX_ORDER, "ERR:OO");
|
|
if (msg.sender != owner()) {
|
|
require( msg.value >= PRICE * quantity, "ERR:TU");
|
|
}
|
|
|
|
uint supply = totalSupply();
|
|
require( supply + quantity <= MAX_SUPPLY, "ERR:MO" );
|
|
for(uint i; i < quantity; ++i){
|
|
_mint( msg.sender, supply + (i+1));
|
|
}
|
|
}
|
|
|
|
function tokenURI(uint tokenId) external view virtual override returns (string memory) {
|
|
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
|
|
return string(abi.encodePacked(_baseTokenURI, tokenId.toString(), _tokenURISuffix));
|
|
}
|
|
|
|
|
|
function _mint(address to, uint tokenId) internal virtual override {
|
|
_owners.push(to);
|
|
emit Transfer(address(0), to, tokenId);
|
|
}
|
|
|
|
|
|
function setActive(bool isActive_) external onlyOwner{
|
|
require( isActive != isActive_, "ERR:NC" );
|
|
isActive = isActive_;
|
|
}
|
|
|
|
function setBaseURI(string calldata _newBaseURI, string calldata _newSuffix) external onlyOwner{
|
|
_baseTokenURI = _newBaseURI;
|
|
_tokenURISuffix = _newSuffix;
|
|
}
|
|
|
|
function setMaxOrder(uint maxOrder) external onlyOwner{
|
|
require( MAX_ORDER != maxOrder, "ERR:NC" );
|
|
MAX_ORDER = maxOrder;
|
|
}
|
|
|
|
function setPrice(uint price ) external onlyOwner{
|
|
require( PRICE != price, "ERR:NC" );
|
|
PRICE = price;
|
|
}
|
|
|
|
|
|
|
|
function setMaxSupply(uint maxSupply) external onlyOwner{
|
|
require( MAX_SUPPLY != maxSupply, "ERR:NC" );
|
|
require( maxSupply >= totalSupply(), "ERR:SL" );
|
|
MAX_SUPPLY = maxSupply;
|
|
}
|
|
|
|
|
|
function setApprovalForAll(address operator, bool approved) public virtual override(ERC721B, IERC721) onlyAllowedOperatorApproval(operator) {
|
|
super.setApprovalForAll(operator, approved);
|
|
}
|
|
|
|
function approve(address operator, uint256 tokenId) public override(ERC721B, IERC721) onlyAllowedOperatorApproval(operator) {
|
|
super.approve(operator, tokenId);
|
|
}
|
|
|
|
function transferFrom(address from, address to, uint256 tokenId) public override(ERC721B, IERC721) onlyAllowedOperator(from) {
|
|
super.transferFrom(from, to, tokenId);
|
|
}
|
|
|
|
function safeTransferFrom(address from, address to, uint256 tokenId) public override(ERC721B, IERC721) onlyAllowedOperator(from) {
|
|
super.safeTransferFrom(from, to, tokenId);
|
|
}
|
|
|
|
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
|
|
public
|
|
override(ERC721B, IERC721)
|
|
onlyAllowedOperator(from)
|
|
{
|
|
super.safeTransferFrom(from, to, tokenId, data);
|
|
}
|
|
|
|
} |