文件 1 的 13:Address.sol
pragma solidity ^0.8.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 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 functionCall(target, data, "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");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(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) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(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) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 13:Context.sol
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;
}
}
文件 3 的 13:ECDSA.sol
pragma solidity ^0.8.0;
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return;
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
文件 4 的 13:ERC165.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 5 的 13:ERC721SVS.sol
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
contract ERC721SVS is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
struct OwnerData {
uint64 balance;
uint16 usedTier1;
uint16 usedTier2;
bool usedWhitelist;
}
string private _name;
string private _symbol;
uint256 internal _totalSupply;
mapping(uint256 => address) private _owners;
mapping(address => OwnerData) internal _ownerData;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
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 balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _ownerData[owner].balance;
}
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
if (owner == address(0)) {
require(_exists(tokenId), "ERC721: owner query for nonexistent token");
unchecked {
do {
owner = _owners[--tokenId];
} while (owner == address(0));
}
}
return owner;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
function _baseURI() internal view virtual returns (string memory) {
return "";
}
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721SVS.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, owner);
}
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
_transfer(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
_safeTransfer(from, to, tokenId, _data);
}
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return tokenId >= 1 && tokenId <= _totalSupply;
}
function _mint(address to, uint256 quantity) internal virtual {
require(quantity > 0, "ERC721: mint zero quantity");
unchecked {
uint256 tokenId = _totalSupply;
_totalSupply += quantity;
_ownerData[to].balance += uint64(quantity);
for (uint256 i; i < quantity; i++) {
tokenId++;
if ((i & 15) == 0) {
_owners[tokenId] = to;
}
emit Transfer(address(0), to, tokenId);
}
}
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721SVS.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
require((_msgSender() == from || getApproved(tokenId) == _msgSender() || isApprovedForAll(from, _msgSender())), "ERC721: transfer caller is not owner nor approved");
_approve(address(0), tokenId, from);
unchecked {
uint64 balance = _ownerData[from].balance - 1;
_ownerData[from].balance = balance;
_ownerData[to].balance += 1;
_owners[tokenId] = to;
if (balance > 0) {
uint256 nextTokenId = tokenId + 1;
if (_owners[nextTokenId] == address(0) && nextTokenId <= _totalSupply) {
_owners[nextTokenId] = from;
}
}
}
emit Transfer(from, to, tokenId);
}
function _approve(address to, uint256 tokenId, address owner) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
function _checkOnERC721Received(
address from,
address to,
uint256 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;
}
}
}
文件 6 的 13:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 7 的 13:IERC721.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
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
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
文件 8 的 13:IERC721Enumerable.sol
pragma solidity ^0.8.0;
import "../IERC721.sol";
interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenByIndex(uint256 index) external view returns (uint256);
}
文件 9 的 13:IERC721Metadata.sol
pragma solidity ^0.8.0;
import "../IERC721.sol";
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);
}
文件 10 的 13:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 11 的 13:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_setOwner(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 12 的 13:SneakyVampiressSyndicate.sol
pragma solidity ^0.8.4;
import "./ERC721SVS.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract SneakyVampiressSyndicate is ERC721SVS, Ownable {
enum SaleState { CLOSED, PRESALE, OPEN }
uint256 constant public SVS_MAX = 12345;
uint256 constant public SVS_HOLDERS_MAX = 8888;
uint256 constant public SVS_WHITELIST_MAX = 1900;
uint256 constant public SVS_TEAM_MAX = 200;
uint256 constant public SVS_PUBLIC_MAX_PER_TX = 3;
uint256 constant public SVS_PRICE = 0.16 ether;
uint256 constant public SVS_PRICE_TIER1 = 0.12 ether;
uint256 constant public SVS_PRICE_TIER2 = 0.08 ether;
string public baseURI = "https://svs.gg/api/v2/metadata/";
address public signer = 0x6d821F67BBD6961f42a5dde6fd99360e1Ab12345;
uint16 public holdersCounter;
uint16 public whitelistCounter;
uint16 public teamCounter;
SaleState public saleState;
bool public locked;
mapping(bytes32 => bool) usedNonces;
uint256[35] claimedGen1Tokens;
constructor() ERC721SVS("Sneaky Vampiress Syndicate", "SVS2") {}
function mintTeamTokens(address[] calldata to, uint256[] calldata amounts) external onlyOwner {
uint256 combinedAmount;
for (uint256 i; i < amounts.length; i++) {
combinedAmount += amounts[i];
}
teamCounter += uint16(combinedAmount);
require(teamCounter <= SVS_TEAM_MAX, "Team tokens sold out.");
for (uint256 i; i < to.length; i++) {
_mint(to[i], amounts[i]);
}
}
function purchasePresale(uint256[] calldata tokens, bytes calldata signature) external payable {
require(saleState == SaleState.PRESALE, "Sale is not live.");
require(_totalSupply + tokens.length - teamCounter <= SVS_MAX - SVS_TEAM_MAX, "Sold out.");
require(ECDSA.recover(keccak256(abi.encodePacked(msg.sender, tokens)), signature) == signer, "Invalid signature.");
require(tokens.length * SVS_PRICE <= msg.value, "Insufficient funds.");
OwnerData storage ownerData = _ownerData[msg.sender];
if (tokens[0] == 0) {
require(!ownerData.usedWhitelist, "Whitelist already claimed");
ownerData.usedWhitelist = true;
require(whitelistCounter++ < SVS_WHITELIST_MAX, "Sold out.");
if (tokens.length > 1) {
holdersCounter += uint16(tokens.length - 1);
require(holdersCounter <= SVS_HOLDERS_MAX, "Sold out.");
}
} else {
holdersCounter += uint16(tokens.length);
require(holdersCounter <= SVS_HOLDERS_MAX, "Sold out.");
}
_setUsedTokens(tokens);
_mint(msg.sender, tokens.length);
}
function purchasePresaleWithDiscount(uint256 amount, uint16 tier1, uint16 tier2, uint16 tier1Max, uint16 tier2Max, uint256[] calldata tokens, bytes calldata signature) external payable {
require(saleState == SaleState.PRESALE, "Sale is not live.");
require(_totalSupply + tokens.length - teamCounter <= SVS_MAX - SVS_TEAM_MAX, "Sold out.");
require(ECDSA.recover(keccak256(abi.encodePacked(msg.sender, amount, tier1, tier2, tier1Max, tier2Max, tokens)), signature) == signer, "Invalid signature.");
require((amount * SVS_PRICE + tier1 * SVS_PRICE_TIER1 + tier2 * SVS_PRICE_TIER2) <= msg.value, "Insufficient funds.");
OwnerData storage ownerData = _ownerData[msg.sender];
if (tokens[0] == 0) {
require(!ownerData.usedWhitelist, "Whitelist already claimed");
ownerData.usedWhitelist = true;
require(whitelistCounter++ < SVS_WHITELIST_MAX, "Sold out.");
if (tokens.length > 1) {
holdersCounter += uint16(tokens.length - 1);
require(holdersCounter <= SVS_HOLDERS_MAX, "Sold out.");
}
} else {
holdersCounter += uint16(tokens.length);
require(holdersCounter <= SVS_HOLDERS_MAX, "Sold out.");
}
_setUsedTokens(tokens);
uint16 newUsedTier1 = ownerData.usedTier1 + tier1;
uint16 newUsedTier2 = ownerData.usedTier2 + tier2;
require(newUsedTier1 <= tier1Max && newUsedTier2 <= tier2Max, "Discounts exceeded.");
ownerData.usedTier1 = newUsedTier1;
ownerData.usedTier2 = newUsedTier2;
_mint(msg.sender, tokens.length);
}
function purchasePublic(uint256 amount, bytes32 nonce, bytes calldata signature) external payable {
require(saleState == SaleState.OPEN, "Sale is not live.");
require(_totalSupply + amount - holdersCounter - whitelistCounter - teamCounter <= SVS_MAX - SVS_HOLDERS_MAX - SVS_WHITELIST_MAX - SVS_TEAM_MAX, "Sold out.");
require(amount <= SVS_PUBLIC_MAX_PER_TX, "Too many tokens.");
require(!usedNonces[nonce], "Nonce already used.");
usedNonces[nonce] = true;
require(ECDSA.recover(keccak256(abi.encodePacked(msg.sender, amount, nonce)), signature) == signer, "Invalid signature.");
require(amount * SVS_PRICE <= msg.value, "Insufficient funds.");
_mint(msg.sender, amount);
}
function purchasePublicWithDiscount(uint256 amount, uint16 tier1, uint16 tier2, uint16 tier1Max, uint16 tier2Max, bytes32 nonce, bytes calldata signature) external payable {
require(saleState == SaleState.OPEN, "Sale is not live.");
uint256 totalAmount = amount + tier1 + tier2;
require(totalSupply() + totalAmount - holdersCounter - whitelistCounter - teamCounter <= SVS_MAX - SVS_HOLDERS_MAX - SVS_WHITELIST_MAX - SVS_TEAM_MAX, "Sold out.");
require(totalAmount <= SVS_PUBLIC_MAX_PER_TX, "Too many tokens.");
require(!usedNonces[nonce], "Nonce already used.");
usedNonces[nonce] = true;
require(ECDSA.recover(keccak256(abi.encodePacked(msg.sender, amount, tier1, tier2, tier1Max, tier2Max, nonce)), signature) == signer, "Invalid signature.");
require((amount * SVS_PRICE + tier1 * SVS_PRICE_TIER1 + tier2 * SVS_PRICE_TIER2) <= msg.value, "Insufficient funds.");
OwnerData storage ownerData = _ownerData[msg.sender];
uint16 newUsedTier1 = ownerData.usedTier1 + tier1;
uint16 newUsedTier2 = ownerData.usedTier2 + tier2;
require(newUsedTier1 <= tier1Max && newUsedTier2 <= tier2Max, "Discounts exceeded.");
ownerData.usedTier1 = newUsedTier1;
ownerData.usedTier2 = newUsedTier2;
_mint(msg.sender, totalAmount);
}
function setSaleState(SaleState newState) external onlyOwner {
saleState = newState;
}
function setBaseURI(string calldata uri) external onlyOwner {
require(!locked, "Contract is locked.");
baseURI = uri;
}
function setSignerAddress(address newSigner) external onlyOwner {
signer = newSigner;
}
function lock() external onlyOwner {
locked = true;
}
function withdraw() external onlyOwner {
payable(0x2c65908D37bF90EaA95506b42758613F6C1b9299).transfer((address(this).balance * 15) / 100);
uint256 split = address(this).balance / 6;
payable(0xea68212b0450A929B14726b90550933bC12fF813).transfer(split);
payable(0x2772A2B7B37108FC80AFB864084b7897E8f232ef).transfer(split);
payable(0x5BB440e7948d80Dec00A88Fd80e374546BB2D42C).transfer(split);
payable(0x6ff547F546Bd8f4c8C4E7Fb30E32B10af818Ac82).transfer(split);
payable(0xC43CB0EBb90f41f0E640ee18A0E2C6A4BB497a2A).transfer(split);
payable(0x94D58bcA73953f1CEC41327a24D3DD0fc388d2f7).transfer(address(this).balance);
}
function addressState(address account) view external returns (OwnerData memory ownerData) {
ownerData = _ownerData[account];
}
function unclaimedTokens(uint256[] calldata tokens) view external returns (uint256[] memory) {
uint256[] memory unclaimed = new uint256[](tokens.length);
for (uint256 i; i < tokens.length; i++) {
uint256 token = tokens[i];
if (claimedGen1Tokens[token >> 8] >> (token & 0xff) & 1 == 0) {
unclaimed[i] = token;
}
}
return unclaimed;
}
function _setUsedTokens(uint256[] calldata tokens) internal {
uint256 currentBitMap;
uint256 currentBitMapIndex = type(uint256).max;
unchecked {
for (uint256 i; i < tokens.length; i++) {
uint256 token = tokens[i];
if (token == 0) continue;
uint256 index = token >> 8;
if (currentBitMapIndex != index) {
if (currentBitMapIndex < type(uint256).max) {
claimedGen1Tokens[currentBitMapIndex] = currentBitMap;
}
currentBitMapIndex = index;
currentBitMap = claimedGen1Tokens[index];
}
uint256 newBitmap = currentBitMap | (1 << (token & 0xff));
require(newBitmap != currentBitMap, "Some tokens were already claimed.");
currentBitMap = newBitmap;
}
}
if (currentBitMapIndex < type(uint256).max) {
claimedGen1Tokens[currentBitMapIndex] = currentBitMap;
}
}
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
}
文件 13 的 13:Strings.sol
pragma solidity ^0.8.0;
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
{
"compilationTarget": {
"contracts/svs/SneakyVampiressSyndicate.sol": "SneakyVampiressSyndicate"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":"SVS_HOLDERS_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SVS_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SVS_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SVS_PRICE_TIER1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SVS_PRICE_TIER2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SVS_PUBLIC_MAX_PER_TX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SVS_TEAM_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SVS_WHITELIST_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addressState","outputs":[{"components":[{"internalType":"uint64","name":"balance","type":"uint64"},{"internalType":"uint16","name":"usedTier1","type":"uint16"},{"internalType":"uint16","name":"usedTier2","type":"uint16"},{"internalType":"bool","name":"usedWhitelist","type":"bool"}],"internalType":"struct ERC721SVS.OwnerData","name":"ownerData","type":"tuple"}],"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":[{"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":[],"name":"holdersCounter","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"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":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"mintTeamTokens","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"uint256[]","name":"tokens","type":"uint256[]"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"purchasePresale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint16","name":"tier1","type":"uint16"},{"internalType":"uint16","name":"tier2","type":"uint16"},{"internalType":"uint16","name":"tier1Max","type":"uint16"},{"internalType":"uint16","name":"tier2Max","type":"uint16"},{"internalType":"uint256[]","name":"tokens","type":"uint256[]"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"purchasePresaleWithDiscount","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"purchasePublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint16","name":"tier1","type":"uint16"},{"internalType":"uint16","name":"tier2","type":"uint16"},{"internalType":"uint16","name":"tier1Max","type":"uint16"},{"internalType":"uint16","name":"tier2Max","type":"uint16"},{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"purchasePublicWithDiscount","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":[],"name":"saleState","outputs":[{"internalType":"enum SneakyVampiressSyndicate.SaleState","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum SneakyVampiressSyndicate.SaleState","name":"newState","type":"uint8"}],"name":"setSaleState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSigner","type":"address"}],"name":"setSignerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":[],"name":"teamCounter","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"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"},{"inputs":[{"internalType":"uint256[]","name":"tokens","type":"uint256[]"}],"name":"unclaimedTokens","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistCounter","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]