Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 238 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Purchase Token O... | 21291050 | 453 days ago | IN | 0.2 ETH | 0.00068144 | ||||
| Purchase Token O... | 20783257 | 524 days ago | IN | 0.2 ETH | 0.00141832 | ||||
| Purchase Token P... | 20587748 | 552 days ago | IN | 1.5 ETH | 0.0002074 | ||||
| Purchase Token O... | 20497658 | 564 days ago | IN | 0.2 ETH | 0.00024427 | ||||
| Purchase Token O... | 20383687 | 580 days ago | IN | 0.2 ETH | 0.00091776 | ||||
| Purchase Token P... | 20121097 | 617 days ago | IN | 1.5 ETH | 0.00102203 | ||||
| Purchase Token P... | 20113172 | 618 days ago | IN | 0.75 ETH | 0.00178057 | ||||
| Purchase Token O... | 19826118 | 658 days ago | IN | 0.2 ETH | 0.00090447 | ||||
| Purchase Token P... | 19796985 | 662 days ago | IN | 0.75 ETH | 0.0010917 | ||||
| Purchase Token O... | 19661454 | 681 days ago | IN | 0.2 ETH | 0.00284646 | ||||
| Purchase Token P... | 19661395 | 681 days ago | IN | 1.5 ETH | 0.0040573 | ||||
| Mint Tier Admin ... | 19632562 | 685 days ago | IN | 0 ETH | 0.00378094 | ||||
| Mint Tier Admin | 18734637 | 811 days ago | IN | 0 ETH | 0.00563032 | ||||
| Set Tier Contrac... | 18734627 | 811 days ago | IN | 0 ETH | 0.00274773 | ||||
| Purchase Token O... | 18677503 | 819 days ago | IN | 0.2 ETH | 0.00365977 | ||||
| Purchase Token O... | 18574334 | 833 days ago | IN | 0.2 ETH | 0.00360008 | ||||
| Purchase Token O... | 18574060 | 834 days ago | IN | 0.2 ETH | 0.00349996 | ||||
| Purchase Token O... | 18572425 | 834 days ago | IN | 0.2 ETH | 0.00436244 | ||||
| Mint Tier Admin | 18568937 | 834 days ago | IN | 0 ETH | 0.00464136 | ||||
| Mint Tier Admin | 18568930 | 834 days ago | IN | 0 ETH | 0.00390716 | ||||
| Mint Tier Admin | 18568913 | 834 days ago | IN | 0 ETH | 0.0033579 | ||||
| Set Tier Contrac... | 18568906 | 834 days ago | IN | 0 ETH | 0.00186262 | ||||
| Grant Role | 18568904 | 834 days ago | IN | 0 ETH | 0.00163393 | ||||
| Purchase Token O... | 18490748 | 845 days ago | IN | 0.2 ETH | 0.00226373 | ||||
| Purchase Token O... | 18291468 | 873 days ago | IN | 0.2 ETH | 0.00065864 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 21291050 | 453 days ago | 0.2 ETH | ||||
| Transfer | 20783257 | 524 days ago | 0.2 ETH | ||||
| Transfer | 20587748 | 552 days ago | 1.5 ETH | ||||
| Transfer | 20497658 | 564 days ago | 0.2 ETH | ||||
| Transfer | 20383687 | 580 days ago | 0.2 ETH | ||||
| Transfer | 20121097 | 617 days ago | 1.5 ETH | ||||
| Transfer | 20113172 | 618 days ago | 0.75 ETH | ||||
| Transfer | 19826118 | 658 days ago | 0.2 ETH | ||||
| Transfer | 19796985 | 662 days ago | 0.75 ETH | ||||
| Transfer | 19661454 | 681 days ago | 0.2 ETH | ||||
| Transfer | 19661395 | 681 days ago | 1.5 ETH | ||||
| Transfer | 18677503 | 819 days ago | 0.2 ETH | ||||
| Transfer | 18574334 | 833 days ago | 0.2 ETH | ||||
| Transfer | 18574060 | 834 days ago | 0.2 ETH | ||||
| Transfer | 18572425 | 834 days ago | 0.2 ETH | ||||
| Transfer | 18490748 | 845 days ago | 0.2 ETH | ||||
| Transfer | 18291468 | 873 days ago | 0.2 ETH | ||||
| Transfer | 16977090 | 1058 days ago | 1.5 ETH | ||||
| Transfer | 16954477 | 1061 days ago | 0.75 ETH | ||||
| Transfer | 16951618 | 1061 days ago | 0.75 ETH | ||||
| Transfer | 16949758 | 1062 days ago | 0.75 ETH | ||||
| Transfer | 16949662 | 1062 days ago | 0.75 ETH | ||||
| Transfer | 16944441 | 1062 days ago | 0.2 ETH | ||||
| Transfer | 16935262 | 1064 days ago | 0.75 ETH | ||||
| Transfer | 16144309 | 1174 days ago | 0.2 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
DVinMint
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "./DVinMembership.sol";
import "./EIP712Whitelisting.sol";
error RoundDisabled(uint256 round);
error InvalidTier(uint256 tier);
error FailedToMint();
error LengthMismatch();
error PurchaseLimitExceeded();
error InsufficientValue();
error RoundLimitExceeded();
error FailedToSendETH();
/// @title DVin Membership Sale
/// @notice Sale contract with authorization to mint tokens on the DVin NFT contract
contract DVinMint is EIP712Whitelisting {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); /*Role used to permission admin minting*/
bytes32 public constant OWNER_ROLE = keccak256("OWNER_ROLE"); /*Role used to permission contract configuration changes*/
address payable public ethSink; /*recipient for ETH*/
mapping(uint256 => address) public tierContracts; /*Contracts for different tier options*/
uint256 public limitPerPurchase; /*Max amount of tokens someone can buy in one transaction*/
/* Track when presales and public sales are allowed */
enum ContractState {
Presale,
Public
}
mapping(ContractState => bool) public contractState; /*Track which state is enabled*/
/* Track prices and limits for sales*/
struct SaleConfig {
uint256 price;
uint256 limit;
}
mapping(uint256 => SaleConfig) public presaleConfig; /*Configuration for presale*/
mapping(uint256 => SaleConfig) public publicConfig; /*Configuration for public sale*/
/// @notice Constructor configures sale parameters
/// @dev Sets external contract addresses, sets up roles
/// @param _tiers Token types
/// @param _addresses Token addresses
/// @param _sink Address to send sale ETH to
constructor(
uint256[] memory _tiers,
address[] memory _addresses,
address payable _sink
) EIP712Whitelisting("DVin") {
_setupRole(MINTER_ROLE, msg.sender); /*Grant role to deployer for admin minting*/
_setupRole(OWNER_ROLE, msg.sender); /*Grant role to deployer for config changes*/
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender); /*Grant role to deployer for access control changes*/
ethSink = _sink; /*Set address to send ETH to*/
setTierContracts(_tiers, _addresses); /*Set contracts to use for types*/
}
/*****************
EXTERNAL MINTING FUNCTIONS
*****************/
/// @notice Mint tokens by authorized address - useful for people buying with CC
/// @param _tier Which token type to purchase
/// @param _dst Where to send tokens
/// @param _qty Quantity to send
function mintTierAdmin(
uint256 _tier,
address _dst,
uint256 _qty
) public onlyRole(MINTER_ROLE) {
if (tierContracts[_tier] == address(0)) revert InvalidTier(_tier); /*Ensure tier contract is populated*/
if (!DVin(tierContracts[_tier]).mint(_dst, _qty)) revert FailedToMint(); /*Mint token by admin to specified address*/
}
function mintTierAdminBatch(
uint256[] calldata _tiers,
address[] calldata _dsts,
uint256[] calldata _qtys
) public onlyRole(MINTER_ROLE) {
if (_tiers.length != _dsts.length || _dsts.length != _qtys.length)
revert LengthMismatch();
for (uint256 index = 0; index < _tiers.length; index++) {
mintTierAdmin(_tiers[index], _dsts[index], _qtys[index]);
}
}
/// @notice Mint presale by qualified address.
/// @dev Presale state must be enabled
/// @param _tier Which token type to purchase
/// @param _qty How many tokens to buy
/// @param _nonce Whitelist signature nonce
/// @param _signature Whitelist signature
function purchaseTokenPresale(
uint256 _tier,
uint256 _qty,
uint256 _nonce,
bytes calldata _signature
) external payable requiresWhitelist(_signature, _nonce) {
if (!contractState[ContractState.Presale])
revert RoundDisabled(uint256(ContractState.Presale)); /*Presale must be enabled*/
if (presaleConfig[_tier].price == 0) revert InvalidTier(_tier); /*Do not allow 0 value purchase. If desired use separate function for free claim*/
SaleConfig memory _config = presaleConfig[_tier]; /*Fetch sale config*/
_purchase(_tier, _qty, _config.price, _config.limit); /*Purchase token if all values & limits are valid*/
}
/// @notice Mint presale by anyone
/// @dev Public sale must be enabled
/// @param _tier Which token type to purchase
/// @param _qty How many tokens to buy
function purchaseTokenOpensale(uint256 _tier, uint256 _qty)
external
payable
{
if (!contractState[ContractState.Public])
revert RoundDisabled(uint256(ContractState.Public)); /*Public must be enabled*/
if (publicConfig[_tier].price == 0) revert InvalidTier(_tier); /*Do not allow 0 value purchase. If desired use separate function for free claim*/
_purchase(
_tier,
_qty,
publicConfig[_tier].price,
publicConfig[_tier].limit
); /*Purchase token if all values & limits are valid*/
}
/*****************
INTERNAL MINTING FUNCTIONS AND HELPERS
*****************/
/// @notice Mint tokens and transfer eth to sink
/// @dev Validations:
/// - Msg value is checked in comparison to price and quantity
/// @param _tier Token type to mint
/// @param _qty How many tokens to mint
/// @param _price Price per token
/// @param _limit Max token ID
function _purchase(
uint256 _tier,
uint256 _qty,
uint256 _price,
uint256 _limit
) internal {
if (_qty > limitPerPurchase) revert PurchaseLimitExceeded();
if (msg.value < (_price * _qty)) revert InsufficientValue();
if ((DVin(tierContracts[_tier]).totalSupply() + _qty) > _limit)
revert RoundLimitExceeded();
(bool _success, ) = ethSink.call{value: msg.value}(""); /*Send ETH to sink first*/
if (!_success) revert FailedToSendETH();
if (!DVin(tierContracts[_tier]).mint(msg.sender, _qty))
revert FailedToMint(); /*Mint token by admin to specified address*/
}
/*****************
CONFIG FUNCTIONS
*****************/
/// @notice Set states enabled or disabled as owner
/// @param _state 0: presale, 1: public sale
/// @param _enabled specified state on or off
function setContractState(ContractState _state, bool _enabled)
external
onlyRole(OWNER_ROLE)
{
contractState[_state] = _enabled;
}
/// @notice Set sale proceeds address
/// @param _sink new sink
function setSink(address payable _sink) external onlyRole(OWNER_ROLE) {
ethSink = _sink;
}
/// @notice Set new contracts for types
/// @param _tiers Token types like 1,2
/// @param _addresses Addresses of token contracts
function setTierContracts(
uint256[] memory _tiers,
address[] memory _addresses
) public onlyRole(OWNER_ROLE) {
if (_tiers.length != _addresses.length) revert LengthMismatch();
for (uint256 index = 0; index < _tiers.length; index++) {
tierContracts[_tiers[index]] = _addresses[index];
}
}
/// @notice Set token limits for this sale
/// @param _tier Token type to set
/// @param _presaleLimit Max tokens of this type to sell during presale
/// @param _publicLimit Max tokens of this type to sell during public
function setLimit(
uint256 _tier,
uint256 _presaleLimit,
uint256 _publicLimit
) external onlyRole(OWNER_ROLE) {
presaleConfig[_tier].limit = _presaleLimit;
publicConfig[_tier].limit = _publicLimit;
}
/// @notice Set token limits for this sale
/// @param _tier Token type to set
/// @param _presalePrice Price at which to sell this type during presale
/// @param _opensalePrice Price at which to sell this type during public sale
function setPrice(
uint256 _tier,
uint256 _presalePrice,
uint256 _opensalePrice
) external onlyRole(OWNER_ROLE) {
presaleConfig[_tier].price = _presalePrice;
publicConfig[_tier].price = _opensalePrice;
}
/// @notice Set token limits per purchase
/// @param _limit Max tokens someone can buy at once
function setLimitPerPurchase(uint256 _limit) external onlyRole(OWNER_ROLE) {
limitPerPurchase = _limit;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./EIP712Base.sol";
import "./erc721a/extensions/ERC721ABurnable.sol";
contract CloneFactory {
// implementation of eip-1167 - see https://eips.ethereum.org/EIPS/eip-1167
function createClone(address target) internal returns (address result) {
bytes20 targetBytes = bytes20(target);
assembly {
let clone := mload(0x40)
mstore(
clone,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
mstore(add(clone, 0x14), targetBytes)
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
result := create(0, clone, 0x37)
}
}
}
error CallerIsNotMinter();
error MaxSupplyExceeded();
error NonceTooLow();
error RecoveredUnauthorizedAddress();
error DeadlineExpired();
error TransfersDisabled();
/// @title DVin Membership NFT
/// @notice NFT contract with upgradeable sale contract and signature based transfers
contract DVin is ERC721ABurnable, Ownable, EIP712Base, Initializable {
using Strings for uint256; /*String library allows for token URI concatenation*/
using ECDSA for bytes32; /*ECDSA library allows for signature recovery*/
bool public tradingEnabled; /*Trading can be disabled by owner*/
string public contractURI; /*contractURI contract metadata json*/
string public baseURI; /*baseURI_ String to prepend to token IDs*/
string private _name; /*Token name override*/
string private _symbol; /*Token symbol override*/
uint256 public maxSupply;
address public minter; /*Contract that can mint tokens, changeable by owner*/
mapping(address => uint256) public nonces; /*maps record of states for signing & validating signatures
Nonces increment each time a permit is used.
Users can invalidate a previously signed permit by changing their account nonce
*/
/*EIP712 typehash for permit to allow spender to send a specific token ID*/
bytes32 constant PERMIT_TYPEHASH =
keccak256(
"Permit(address owner,address spender,uint256 tokenId,uint256 nonce,uint256 deadline)"
);
/*EIP712 typehash for permit to allow spender to send a specific token ID*/
bytes32 constant UNIVERSAL_PERMIT_TYPEHASH =
keccak256(
"Permit(address owner,address spender,uint256 nonce,uint256 deadline)"
);
/// @notice constructor configures template contract metadata
constructor() ERC721A("TEMPLATE", "DEAD") initializer {
_transferOwnership(address(0xdead)); /*Disable template*/
}
/// @notice setup configures interfaces and production metadata
/// @param name_ Token name
/// @param symbol_ Token symbol
/// @param _contractURI Metadata location for contract
/// @param baseURI_ Metadata location for tokens
/// @param _minter Authorized address to mint
/// @param _maxSupply Max supply for this token
function setUp(
string memory name_,
string memory symbol_,
string memory _contractURI,
string memory baseURI_,
address _minter,
address _owner,
uint256 _maxSupply
) public initializer {
_name = name_;
_symbol = symbol_;
_setBaseURI(baseURI_); /*Base URI for token ID resolution*/
contractURI = _contractURI; /*Contract URI for marketplace metadata*/
minter = _minter; /*Address authorized to mint */
_currentIndex = _startTokenId();
maxSupply = _maxSupply;
_transferOwnership(_owner);
setUpDomain(name_);
}
function _startTokenId() internal view override(ERC721A) returns (uint256) {
return 1;
}
/*****************
Permissioned Minting
*****************/
/// @dev Mint the token for specified tier by authorized minter contract or EOA
/// @param _dst Recipient
/// @param _qty Number of tokens to send
function mint(address _dst, uint256 _qty) external returns (bool) {
if (msg.sender != minter) revert CallerIsNotMinter(); /*Minting can only be done by minter address*/
if ((totalSupply() + _qty) > maxSupply) revert MaxSupplyExceeded(); /*Cannot exceed max supply*/
_safeMint(_dst, _qty); /*Send token to new recipient*/
return true; /*Return success to external caller*/
}
/*****************
Permit & Guardian tools
*****************/
/// @notice Manually update nonce to invalidate previously signed permits
/// @dev New nonce must be higher than current to prevent replay
/// @param _nonce New nonce
function setNonce(uint256 _nonce) external {
if (_nonce <= nonces[msg.sender]) revert NonceTooLow(); /*New nonce must be higher to prevent replay*/
nonces[msg.sender] = _nonce; /*Set new nonce for sender*/
}
/// @notice Transfer token on behalf of owner using signed authorization
/// Useful to help people authorize a guardian to rescue tokens if access is lost
/// @dev Signature can be either per token ID or universal
/// @param _owner Current owner of token
/// @param _tokenId Token ID to transfer
/// @param _dst New recipient
/// @param _deadline Date the permit must be used by
/// @param _signature Concatenated RSV of sig
function transferWithUniversalPermit(
address _owner,
uint256 _tokenId,
address _dst,
uint256 _deadline,
bytes calldata _signature
) external {
bytes32 structHash = keccak256(
abi.encode(
UNIVERSAL_PERMIT_TYPEHASH,
_owner,
msg.sender,
nonces[_owner]++, /*Increment nonce to prevent replay*/
_deadline
)
); /*calculate EIP-712 struct hash*/
bytes32 digest = toTypedMessageHash(structHash); /*Calculate EIP712 digest*/
address recoveredAddress = digest.recover(_signature); /*Attempt to recover signer*/
if (recoveredAddress != _owner) revert RecoveredUnauthorizedAddress(); /*check signer is `owner`*/
if (block.timestamp > _deadline) revert DeadlineExpired(); /*check signature is not expired*/
_approve(msg.sender, _tokenId, _owner);
safeTransferFrom(_owner, _dst, _tokenId); /*Move token to new wallet*/
}
/// @notice Transfer token on behalf of owner using signed authorization
/// Useful to help people authorize a guardian to rescue tokens if access is lost
/// @dev Signature can be either per token ID or universal
/// @param _owner Current owner of token
/// @param _tokenId Token ID to transfer
/// @param _dst New recipient
/// @param _deadline Date the permit must be used by
/// @param _signature Concatenated RSV of sig
function transferWithPermit(
address _owner,
uint256 _tokenId,
address _dst,
uint256 _deadline,
bytes calldata _signature
) external {
bytes32 structHash = keccak256(
abi.encode(
PERMIT_TYPEHASH,
_owner,
msg.sender,
_tokenId,
nonces[_owner]++, /*Increment nonce to prevent replay*/
_deadline
)
); /*calculate EIP-712 struct hash*/
bytes32 digest = keccak256(
abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, structHash)
); /*calculate EIP-712 digest for signature*/
address recoveredAddress = digest.recover(_signature); /*Attempt to recover signer*/
if (recoveredAddress != _owner) revert RecoveredUnauthorizedAddress(); /*check signer is `owner`*/
if (block.timestamp > _deadline) revert DeadlineExpired(); /*check signature is not expired*/
_approve(msg.sender, _tokenId, _owner);
safeTransferFrom(_owner, _dst, _tokenId); /*Move token to new wallet*/
}
/*****************
CONFIG FUNCTIONS
*****************/
/// @notice Set new base URI for token IDs
/// @param baseURI_ String to prepend to token IDs
function setBaseURI(string memory baseURI_) external onlyOwner {
_setBaseURI(baseURI_);
}
/// @notice Enable or disable trading
/// @param _enabled bool to set state on or off
function setTradingState(bool _enabled) external onlyOwner {
tradingEnabled = _enabled;
}
/// @notice Set minting contract
/// @param _minter new minting contract
function setMinter(address _minter) external onlyOwner {
minter = _minter;
}
/// @notice internal helper to update token URI
/// @param baseURI_ String to prepend to token IDs
function _setBaseURI(string memory baseURI_) internal {
baseURI = baseURI_;
}
/// @notice Set new contract URI
/// @param _contractURI Contract metadata json
function setContractURI(string memory _contractURI) external onlyOwner {
contractURI = _contractURI;
}
/*****************
Public interfaces
*****************/
function name() public view override returns (string memory) {
return _name;
}
function symbol() public view override returns (string memory) {
return _symbol;
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString(), ".json"))
: "";
}
///@dev Support interfaces for Access Control and ERC721
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721A)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
super.supportsInterface(interfaceId);
}
/// @dev Hook for disabling trading
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal override(ERC721A) {
super._beforeTokenTransfers(from, to, startTokenId, quantity);
if (from != address(0) && to != address(0) && !tradingEnabled)
revert TransfersDisabled();
}
}
/// @title DVin Membership NFT Summoner
/// @notice Clone factory for new membership tiers
contract DVinSummoner is CloneFactory, Ownable {
address public template; /*Template contract to clone*/
constructor(address _template) public {
template = _template;
}
event SummonComplete(
address indexed newContract,
string name,
string symbol,
address summoner
);
/// @notice Public interface for owner to create new membership tiers
/// @param name_ Token name
/// @param symbol_ Token symbol
/// @param _contractURI Metadata for contract
/// @param baseURI_ Metadata for tokens
/// @param _minter Authorized minting address
/// @param _maxSupply Max amount of this token that can be minted
/// @param _owner Owner address of new contract
function summonDvin(
string memory name_,
string memory symbol_,
string memory _contractURI,
string memory baseURI_,
address _minter,
uint256 _maxSupply,
address _owner
) external onlyOwner returns (address) {
DVin dvin = DVin(createClone(template)); /*Create a new clone of the template*/
/*Set up the external interfaces*/
dvin.setUp(
name_,
symbol_,
_contractURI,
baseURI_,
_minter,
_owner,
_maxSupply
);
emit SummonComplete(address(dvin), name_, symbol_, msg.sender);
return address(dvin);
}
}//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./EIP712Base.sol";
contract EIP712Whitelisting is AccessControl, EIP712Base {
using ECDSA for bytes32;
bytes32 public constant WHITELISTING_ROLE = keccak256("WHITELISTING_ROLE");
mapping(bytes32 => bool) public signatureUsed;
// The typehash for the data type specified in the structured data
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md#rationale-for-typehash
// This should match whats in the client side whitelist signing code
// https://github.com/msfeldstein/EIP712-whitelisting/blob/main/test/signWhitelist.ts#L22
bytes32 public constant MINTER_TYPEHASH =
keccak256("Minter(address wallet,uint256 nonce)");
constructor(string memory name) {
setUpDomain(name);
_setupRole(WHITELISTING_ROLE, msg.sender);
}
modifier requiresWhitelist(
bytes calldata signature,
uint256 nonce
) {
// Verify EIP-712 signature by recreating the data structure
// that we signed on the client side, and then using that to recover
// the address that signed the signature for this data.
bytes32 structHash = keccak256(
abi.encode(MINTER_TYPEHASH, msg.sender, nonce)
);
bytes32 digest = toTypedMessageHash(structHash); /*Calculate EIP712 digest*/
require(!signatureUsed[digest], "signature used");
signatureUsed[digest] = true;
// Use the recover method to see what address was used to create
// the signature on this data.
// Note that if the digest doesn't exactly match what was signed we'll
// get a random recovered address.
address recoveredAddress = digest.recover(signature);
require(
hasRole(WHITELISTING_ROLE, recoveredAddress),
"Invalid Signature"
);
_;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.0;
import "../../utils/Address.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
* initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() initializer {}
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
// If the contract is initializing we ignore whether _initialized is set in order to support multiple
// inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
// contract may have been reentered.
require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} modifier, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
function _isConstructor() private view returns (bool) {
return !Address.isContract(address(this));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
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);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
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);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} 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");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
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;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
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;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}pragma solidity 0.8.10;
contract EIP712Base {
bytes32 internal DOMAIN_SEPARATOR;
function setUpDomain(string memory name) internal {
// This should match whats in the client side whitelist signing code
// https://github.com/msfeldstein/EIP712-whitelisting/blob/main/test/signWhitelist.ts#L12
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
),
// This should match the domain you set in your client side signing.
keccak256(bytes(name)),
keccak256(bytes("1")),
block.chainid,
address(this)
)
);
}
/**
* Accept message hash and returns hash message in EIP712 compatible form
* So that it can be used to recover signer from signature signed using EIP712 formatted data
* https://eips.ethereum.org/EIPS/eip-712
* "\\x19" makes the encoding deterministic
* "\\x01" is the version byte to make it compatible to EIP-191
*/
function toTypedMessageHash(bytes32 messageHash)
internal
view
returns (bytes32)
{
return
keccak256(
abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, messageHash)
);
}
}// SPDX-License-Identifier: MIT
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import "../ERC721A.sol";
/**
* @title ERC721A Burnable Token
* @dev ERC721A Token that can be irreversibly burned (destroyed).
*/
abstract contract ERC721ABurnable is ERC721A {
/**
* @dev Burns `tokenId`. See {ERC721A-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
_burn(tokenId, true);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
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");
}
/**
* @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, it is bubbled up by this
* function (like regular Solidity function calls).
*
* 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.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @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`.
*
* _Available since v3.1._
*/
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");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
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);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// 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
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// Creator: Chiru Labs
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/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
// For miscellaneous variable(s) pertaining to the address
// (e.g. number of whitelist mint slots used).
// If there are multiple variables, please pack them into a uint64.
uint64 aux;
}
// The tokenId of the next token to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 internal _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) internal _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
/**
* To change the starting tokenId, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
*/
function totalSupply() public view returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex - _startTokenId() times
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view returns (uint256) {
// Counter underflow is impossible as _currentIndex does not decrement,
// and it is initialized to _startTokenId()
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberMinted);
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberBurned);
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return _addressData[owner].aux;
}
/**
* Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal {
_addressData[owner].aux = aux;
}
/**
* Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around in the collection over time.
*/
function _ownershipOf(uint256 tokenId)
internal
view
returns (TokenOwnership memory)
{
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr && curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return _ownershipOf(tokenId).addr;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return
bytes(baseURI).length != 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId)
public
view
override
returns (address)
{
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
if (operator == _msgSender()) revert ApproveToCaller();
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
_transfer(from, to, tokenId);
if (
to.isContract() &&
!_checkContractOnERC721Received(from, to, tokenId, _data)
) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return
_startTokenId() <= tokenId &&
tokenId < _currentIndex &&
!_ownerships[tokenId].burned;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, "");
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
_mint(to, quantity, _data, true);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (safe && to.isContract()) {
do {
emit Transfer(address(0), to, updatedIndex);
if (
!_checkContractOnERC721Received(
address(0),
to,
updatedIndex++,
_data
)
) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex != end);
// Reentrancy protection
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex != end);
}
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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
) private {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = to;
currSlot.startTimestamp = uint64(block.timestamp);
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev This is equivalent to _burn(tokenId, false)
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
address from = prevOwnership.addr;
if (approvalCheck) {
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
AddressData storage addressData = _addressData[from];
addressData.balance -= 1;
addressData.numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = from;
currSlot.startTimestamp = uint64(block.timestamp);
currSlot.burned = true;
// If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) internal {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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
* @return bool whether the call correctly returned the expected magic value
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
* And also called before burning one token.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
* And also called after one token has been burned.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @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 Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns 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);
/**
* @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;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @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 `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../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 v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"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":"uint256[]","name":"_tiers","type":"uint256[]"},{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"address payable","name":"_sink","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"FailedToMint","type":"error"},{"inputs":[],"name":"FailedToSendETH","type":"error"},{"inputs":[],"name":"InsufficientValue","type":"error"},{"inputs":[{"internalType":"uint256","name":"tier","type":"uint256"}],"name":"InvalidTier","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"PurchaseLimitExceeded","type":"error"},{"inputs":[{"internalType":"uint256","name":"round","type":"uint256"}],"name":"RoundDisabled","type":"error"},{"inputs":[],"name":"RoundLimitExceeded","type":"error"},{"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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OWNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WHITELISTING_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum DVinMint.ContractState","name":"","type":"uint8"}],"name":"contractState","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethSink","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"limitPerPurchase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tier","type":"uint256"},{"internalType":"address","name":"_dst","type":"address"},{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"mintTierAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tiers","type":"uint256[]"},{"internalType":"address[]","name":"_dsts","type":"address[]"},{"internalType":"uint256[]","name":"_qtys","type":"uint256[]"}],"name":"mintTierAdminBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"presaleConfig","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"publicConfig","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tier","type":"uint256"},{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"purchaseTokenOpensale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tier","type":"uint256"},{"internalType":"uint256","name":"_qty","type":"uint256"},{"internalType":"uint256","name":"_nonce","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"purchaseTokenPresale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","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":"enum DVinMint.ContractState","name":"_state","type":"uint8"},{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setContractState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tier","type":"uint256"},{"internalType":"uint256","name":"_presaleLimit","type":"uint256"},{"internalType":"uint256","name":"_publicLimit","type":"uint256"}],"name":"setLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"setLimitPerPurchase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tier","type":"uint256"},{"internalType":"uint256","name":"_presalePrice","type":"uint256"},{"internalType":"uint256","name":"_opensalePrice","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_sink","type":"address"}],"name":"setSink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tiers","type":"uint256[]"},{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"setTierContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"signatureUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tierContracts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b5060405162002670380380620026708339810160408190526200003491620006ad565b604080518082019091526004815263222b34b760e11b6020820152620000f581805160208083019190912060408051808201825260018152603160f81b9084015280517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f938101939093528201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f19818403018152919052805160209091012060015550565b620001217f1ded512beb3615ca121e5630e7afd724aaec6a437b5d1f6e14f68bfa753b00c233620001a6565b506200014e7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620001a6565b620001696000805160206200265083398151915233620001a6565b62000176600033620001a6565b600380546001600160a01b0319166001600160a01b0383161790556200019d8383620001b6565b50505062000904565b620001b2828262000291565b5050565b60008051602062002650833981519152620001d2813362000331565b8151835114620001f8576040516001621398b960e31b0319815260040160405180910390fd5b60005b83518110156200028b578281815181106200021a576200021a62000786565b6020026020010151600460008684815181106200023b576200023b62000786565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080806200028290620007b2565b915050620001fb565b50505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001b2576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002ed3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001b2576200037b816001600160a01b03166014620003d560201b62000e241760201c565b6200039183602062000e24620003d5821b17811c565b604051602001620003a4929190620007ff565b60408051601f198184030181529082905262461bcd60e51b8252620003cc9160040162000878565b60405180910390fd5b60606000620003e6836002620008ad565b620003f3906002620008cf565b6001600160401b038111156200040d576200040d62000595565b6040519080825280601f01601f19166020018201604052801562000438576020820181803683370190505b509050600360fc1b8160008151811062000456576200045662000786565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811062000488576200048862000786565b60200101906001600160f81b031916908160001a9053506000620004ae846002620008ad565b620004bb906001620008cf565b90505b60018111156200053d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110620004f357620004f362000786565b1a60f81b8282815181106200050c576200050c62000786565b60200101906001600160f81b031916908160001a90535060049490941c936200053581620008ea565b9050620004be565b5083156200058e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401620003cc565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620005d657620005d662000595565b604052919050565b60006001600160401b03821115620005fa57620005fa62000595565b5060051b60200190565b6001600160a01b03811681146200061a57600080fd5b50565b600082601f8301126200062f57600080fd5b81516020620006486200064283620005de565b620005ab565b82815260059290921b840181019181810190868411156200066857600080fd5b8286015b8481101562000690578051620006828162000604565b83529183019183016200066c565b509695505050505050565b8051620006a88162000604565b919050565b600080600060608486031215620006c357600080fd5b83516001600160401b0380821115620006db57600080fd5b818601915086601f830112620006f057600080fd5b81516020620007036200064283620005de565b82815260059290921b8401810191818101908a8411156200072357600080fd5b948201945b83861015620007435785518252948201949082019062000728565b918901519197509093505050808211156200075d57600080fd5b506200076c868287016200061d565b9250506200077d604085016200069b565b90509250925092565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415620007c957620007c96200079c565b5060010190565b60005b83811015620007ed578181015183820152602001620007d3565b838111156200028b5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835162000839816017850160208801620007d0565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516200086c816028840160208801620007d0565b01602801949350505050565b602081526000825180602084015262000899816040850160208701620007d0565b601f01601f19169190910160400192915050565b6000816000190483118215151615620008ca57620008ca6200079c565b500290565b60008219821115620008e557620008e56200079c565b500190565b600081620008fc57620008fc6200079c565b506000190190565b611d3c80620009146000396000f3fe6080604052600436106101b75760003560e01c80637796fb95116100ec578063bdbdd2101161008a578063dd748f0211610064578063dd748f021461056f578063e307fb3114610585578063e58378bb146105b5578063fa4d280c146105d757600080fd5b8063bdbdd21014610508578063d53913931461051b578063d547741f1461054f57600080fd5b806396fac29d116100c657806396fac29d1461047f5780639cedd1531461049f578063a217fddf146104d3578063aa585d56146104e857600080fd5b80637796fb951461041f578063784645351461043f57806391d148541461045f57600080fd5b80634e44ae5e1161015957806364cb07621161013357806364cb076214610388578063657fd237146103a8578063707781c2146103bb578063736230a8146103ef57600080fd5b80634e44ae5e146102ff5780635c31a71314610348578063642365171461036857600080fd5b80632ecd02a0116101955780632ecd02a0146102675780632f2ff15d1461029d57806336568abe146102bf57806337e2ec7c146102df57600080fd5b806301ffc9a7146101bc57806310ac126d146101f1578063248a9ca314610229575b600080fd5b3480156101c857600080fd5b506101dc6101d7366004611699565b61060b565b60405190151581526020015b60405180910390f35b3480156101fd57600080fd5b50600354610211906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b34801561023557600080fd5b506102596102443660046116c3565b60009081526020819052604090206001015490565b6040519081526020016101e8565b34801561027357600080fd5b506102116102823660046116c3565b6004602052600090815260409020546001600160a01b031681565b3480156102a957600080fd5b506102bd6102b83660046116f1565b610642565b005b3480156102cb57600080fd5b506102bd6102da3660046116f1565b61066d565b3480156102eb57600080fd5b506102bd6102fa366004611743565b6106f0565b34801561030b57600080fd5b5061033361031a3660046116c3565b6007602052600090815260409020805460019091015482565b604080519283526020830191909152016101e8565b34801561035457600080fd5b506102bd61036336600461176f565b610755565b34801561037457600080fd5b506102bd61038336600461179b565b610795565b34801561039457600080fd5b506102bd6103a3366004611818565b6108a1565b6102bd6103b63660046118b2565b610984565b3480156103c757600080fd5b506103336103d63660046116c3565b6008602052600090815260409020805460019091015482565b3480156103fb57600080fd5b506101dc61040a36600461193f565b60066020526000908152604090205460ff1681565b34801561042b57600080fd5b506102bd61043a36600461195a565b610bee565b34801561044b57600080fd5b506102bd61045a3660046116c3565b610c2a565b34801561046b57600080fd5b506101dc61047a3660046116f1565b610c49565b34801561048b57600080fd5b506102bd61049a366004611a56565b610c72565b3480156104ab57600080fd5b506102597f1ded512beb3615ca121e5630e7afd724aaec6a437b5d1f6e14f68bfa753b00c281565b3480156104df57600080fd5b50610259600081565b3480156104f457600080fd5b506102bd61050336600461176f565b610d39565b6102bd610516366004611b0f565b610d71565b34801561052757600080fd5b506102597f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b34801561055b57600080fd5b506102bd61056a3660046116f1565b610dfe565b34801561057b57600080fd5b5061025960055481565b34801561059157600080fd5b506101dc6105a03660046116c3565b60026020526000908152604090205460ff1681565b3480156105c157600080fd5b50610259600080516020611ce783398151915281565b3480156105e357600080fd5b506102597f325fddf9552c17478a75e5d653af030805196a4fc48e1df5a2e5aeff2a7066e081565b60006001600160e01b03198216637965db0b60e01b148061063c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008281526020819052604090206001015461065e8133610fc7565b610668838361102b565b505050565b6001600160a01b03811633146106e25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106ec82826110af565b5050565b600080516020611ce78339815191526107098133610fc7565b816006600085600181111561072057610720611b31565b600181111561073157610731611b31565b81526020810191909152604001600020805460ff1916911515919091179055505050565b600080516020611ce783398151915261076e8133610fc7565b50600092835260076020908152604080852060019081019490945560089091529092200155565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66107c08133610fc7565b6000848152600460205260409020546001600160a01b03166107f85760405163642a819160e11b8152600481018590526024016106d9565b6000848152600460208190526040918290205491516340c10f1960e01b81526001600160a01b0386811692820192909252602481018590529116906340c10f19906044016020604051808303816000875af115801561085b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087f9190611b47565b61089b576040516248195d60e01b815260040160405180910390fd5b50505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66108cc8133610fc7565b85841415806108db5750838214155b156108fc576040516001621398b960e31b0319815260040160405180910390fd5b60005b8681101561097a5761096888888381811061091c5761091c611b64565b9050602002013587878481811061093557610935611b64565b905060200201602081019061094a919061195a565b86868581811061095c5761095c611b64565b90506020020135610795565b8061097281611b90565b9150506108ff565b5050505050505050565b604080517f325fddf9552c17478a75e5d653af030805196a4fc48e1df5a2e5aeff2a7066e0602080830191909152338284015260608083018790528351808403909101815260808301845280519082012060015461190160f01b60a085015260a284015260c28084018290528451808503909101815260e290930190935281519101208391839186919060009060008181526002602052604090205490915060ff1615610a645760405162461bcd60e51b815260206004820152600e60248201526d1cda59db985d1d5c99481d5cd95960921b60448201526064016106d9565b6000818152600260209081526040808320805460ff191660011790558051601f8801839004830281018301909152868152610abc91889088908190840183828082843760009201919091525086939250506111149050565b9050610ae87f1ded512beb3615ca121e5630e7afd724aaec6a437b5d1f6e14f68bfa753b00c282610c49565b610b285760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964205369676e617475726560781b60448201526064016106d9565b6000805260066020527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f85460ff16610b795760005b604051633e19b46760e11b81526004016106d991815260200190565b60008b815260076020526040902054610ba85760405163642a819160e11b8152600481018c90526024016106d9565b60008b81526007602090815260409182902082518084019093528054808452600190910154918301829052610be0918e918e91611138565b505050505050505050505050565b600080516020611ce7833981519152610c078133610fc7565b50600380546001600160a01b0319166001600160a01b0392909216919091179055565b600080516020611ce7833981519152610c438133610fc7565b50600555565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020611ce7833981519152610c8b8133610fc7565b8151835114610cb0576040516001621398b960e31b0319815260040160405180910390fd5b60005b835181101561089b57828181518110610cce57610cce611b64565b602002602001015160046000868481518110610cec57610cec611b64565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610d3190611b90565b915050610cb3565b600080516020611ce7833981519152610d528133610fc7565b5060009283526007602090815260408085209390935560089052912055565b600160005260066020527f3e5fec24aa4dc4e5aee2e025e51e1392c72a2500577559fae9665c6d52bd6a315460ff16610dab576001610b5d565b600082815260086020526040902054610dda5760405163642a819160e11b8152600481018390526024016106d9565b600082815260086020526040902080546001909101546106ec918491849190611138565b600082815260208190526040902060010154610e1a8133610fc7565b61066883836110af565b60606000610e33836002611bab565b610e3e906002611bca565b67ffffffffffffffff811115610e5657610e56611977565b6040519080825280601f01601f191660200182016040528015610e80576020820181803683370190505b509050600360fc1b81600081518110610e9b57610e9b611b64565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610eca57610eca611b64565b60200101906001600160f81b031916908160001a9053506000610eee846002611bab565b610ef9906001611bca565b90505b6001811115610f71576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610f2d57610f2d611b64565b1a60f81b828281518110610f4357610f43611b64565b60200101906001600160f81b031916908160001a90535060049490941c93610f6a81611be2565b9050610efc565b508315610fc05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106d9565b9392505050565b610fd18282610c49565b6106ec57610fe9816001600160a01b03166014610e24565b610ff4836020610e24565b604051602001611005929190611c25565b60408051601f198184030181529082905262461bcd60e51b82526106d991600401611c9a565b6110358282610c49565b6106ec576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561106b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6110b98282610c49565b156106ec576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008060006111238585611345565b91509150611130816113b5565b509392505050565b60055483111561115b5760405163667c7eff60e01b815260040160405180910390fd5b6111658383611bab565b3410156111855760405163044044a560e21b815260040160405180910390fd5b6000848152600460208181526040928390205483516318160ddd60e01b81529351859488946001600160a01b03909316936318160ddd938281019391928290030181865afa1580156111db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ff9190611ccd565b6112099190611bca565b111561122857604051630a5ab05760e41b815260040160405180910390fd5b6003546040516000916001600160a01b03169034908381818185875af1925050503d8060008114611275576040519150601f19603f3d011682016040523d82523d6000602084013e61127a565b606091505b505090508061129c576040516338822c1360e11b815260040160405180910390fd5b6000858152600460208190526040918290205491516340c10f1960e01b81523391810191909152602481018690526001600160a01b03909116906340c10f19906044016020604051808303816000875af11580156112fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113229190611b47565b61133e576040516248195d60e01b815260040160405180910390fd5b5050505050565b60008082516041141561137c5760208301516040840151606085015160001a61137087828585611573565b945094505050506113ae565b8251604014156113a6576020830151604084015161139b868383611660565b9350935050506113ae565b506000905060025b9250929050565b60008160048111156113c9576113c9611b31565b14156113d25750565b60018160048111156113e6576113e6611b31565b14156114345760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016106d9565b600281600481111561144857611448611b31565b14156114965760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016106d9565b60038160048111156114aa576114aa611b31565b14156115035760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016106d9565b600481600481111561151757611517611b31565b14156115705760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016106d9565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156115aa5750600090506003611657565b8460ff16601b141580156115c257508460ff16601c14155b156115d35750600090506004611657565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611627573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661165057600060019250925050611657565b9150600090505b94509492505050565b6000806001600160ff1b0383168161167d60ff86901c601b611bca565b905061168b87828885611573565b935093505050935093915050565b6000602082840312156116ab57600080fd5b81356001600160e01b031981168114610fc057600080fd5b6000602082840312156116d557600080fd5b5035919050565b6001600160a01b038116811461157057600080fd5b6000806040838503121561170457600080fd5b823591506020830135611716816116dc565b809150509250929050565b80356002811061173057600080fd5b919050565b801515811461157057600080fd5b6000806040838503121561175657600080fd5b61175f83611721565b9150602083013561171681611735565b60008060006060848603121561178457600080fd5b505081359360208301359350604090920135919050565b6000806000606084860312156117b057600080fd5b8335925060208401356117c2816116dc565b929592945050506040919091013590565b60008083601f8401126117e557600080fd5b50813567ffffffffffffffff8111156117fd57600080fd5b6020830191508360208260051b85010111156113ae57600080fd5b6000806000806000806060878903121561183157600080fd5b863567ffffffffffffffff8082111561184957600080fd5b6118558a838b016117d3565b9098509650602089013591508082111561186e57600080fd5b61187a8a838b016117d3565b9096509450604089013591508082111561189357600080fd5b506118a089828a016117d3565b979a9699509497509295939492505050565b6000806000806000608086880312156118ca57600080fd5b853594506020860135935060408601359250606086013567ffffffffffffffff808211156118f757600080fd5b818801915088601f83011261190b57600080fd5b81358181111561191a57600080fd5b89602082850101111561192c57600080fd5b9699959850939650602001949392505050565b60006020828403121561195157600080fd5b610fc082611721565b60006020828403121561196c57600080fd5b8135610fc0816116dc565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156119b6576119b6611977565b604052919050565b600067ffffffffffffffff8211156119d8576119d8611977565b5060051b60200190565b600082601f8301126119f357600080fd5b81356020611a08611a03836119be565b61198d565b82815260059290921b84018101918181019086841115611a2757600080fd5b8286015b84811015611a4b578035611a3e816116dc565b8352918301918301611a2b565b509695505050505050565b60008060408385031215611a6957600080fd5b823567ffffffffffffffff80821115611a8157600080fd5b818501915085601f830112611a9557600080fd5b81356020611aa5611a03836119be565b82815260059290921b84018101918181019089841115611ac457600080fd5b948201945b83861015611ae257853582529482019490820190611ac9565b96505086013592505080821115611af857600080fd5b50611b05858286016119e2565b9150509250929050565b60008060408385031215611b2257600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b600060208284031215611b5957600080fd5b8151610fc081611735565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ba457611ba4611b7a565b5060010190565b6000816000190483118215151615611bc557611bc5611b7a565b500290565b60008219821115611bdd57611bdd611b7a565b500190565b600081611bf157611bf1611b7a565b506000190190565b60005b83811015611c14578181015183820152602001611bfc565b8381111561089b5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611c5d816017850160208801611bf9565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611c8e816028840160208801611bf9565b01602801949350505050565b6020815260008251806020840152611cb9816040850160208701611bf9565b601f01601f19169190910160400192915050565b600060208284031215611cdf57600080fd5b505191905056feb19546dff01e856fb3f010c267a7b1c60363cf8a4664e21cc89c26224620214ea2646970667358221220b642ee1d7c8ef8e83f6c8e73f0d9765d11b51c72681ce92d8f8cecd3e262db0564736f6c634300080a0033b19546dff01e856fb3f010c267a7b1c60363cf8a4664e21cc89c26224620214e000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000003abf2a6e1d08153bd18ad19a588ec3f9ed7c0c6700000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000006fb6cda6695d7ef942ceec4b7f34b273619aeee2000000000000000000000000c4f65ac0a89a181200e2659fb76b51ee67a725d6
Deployed Bytecode
0x6080604052600436106101b75760003560e01c80637796fb95116100ec578063bdbdd2101161008a578063dd748f0211610064578063dd748f021461056f578063e307fb3114610585578063e58378bb146105b5578063fa4d280c146105d757600080fd5b8063bdbdd21014610508578063d53913931461051b578063d547741f1461054f57600080fd5b806396fac29d116100c657806396fac29d1461047f5780639cedd1531461049f578063a217fddf146104d3578063aa585d56146104e857600080fd5b80637796fb951461041f578063784645351461043f57806391d148541461045f57600080fd5b80634e44ae5e1161015957806364cb07621161013357806364cb076214610388578063657fd237146103a8578063707781c2146103bb578063736230a8146103ef57600080fd5b80634e44ae5e146102ff5780635c31a71314610348578063642365171461036857600080fd5b80632ecd02a0116101955780632ecd02a0146102675780632f2ff15d1461029d57806336568abe146102bf57806337e2ec7c146102df57600080fd5b806301ffc9a7146101bc57806310ac126d146101f1578063248a9ca314610229575b600080fd5b3480156101c857600080fd5b506101dc6101d7366004611699565b61060b565b60405190151581526020015b60405180910390f35b3480156101fd57600080fd5b50600354610211906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b34801561023557600080fd5b506102596102443660046116c3565b60009081526020819052604090206001015490565b6040519081526020016101e8565b34801561027357600080fd5b506102116102823660046116c3565b6004602052600090815260409020546001600160a01b031681565b3480156102a957600080fd5b506102bd6102b83660046116f1565b610642565b005b3480156102cb57600080fd5b506102bd6102da3660046116f1565b61066d565b3480156102eb57600080fd5b506102bd6102fa366004611743565b6106f0565b34801561030b57600080fd5b5061033361031a3660046116c3565b6007602052600090815260409020805460019091015482565b604080519283526020830191909152016101e8565b34801561035457600080fd5b506102bd61036336600461176f565b610755565b34801561037457600080fd5b506102bd61038336600461179b565b610795565b34801561039457600080fd5b506102bd6103a3366004611818565b6108a1565b6102bd6103b63660046118b2565b610984565b3480156103c757600080fd5b506103336103d63660046116c3565b6008602052600090815260409020805460019091015482565b3480156103fb57600080fd5b506101dc61040a36600461193f565b60066020526000908152604090205460ff1681565b34801561042b57600080fd5b506102bd61043a36600461195a565b610bee565b34801561044b57600080fd5b506102bd61045a3660046116c3565b610c2a565b34801561046b57600080fd5b506101dc61047a3660046116f1565b610c49565b34801561048b57600080fd5b506102bd61049a366004611a56565b610c72565b3480156104ab57600080fd5b506102597f1ded512beb3615ca121e5630e7afd724aaec6a437b5d1f6e14f68bfa753b00c281565b3480156104df57600080fd5b50610259600081565b3480156104f457600080fd5b506102bd61050336600461176f565b610d39565b6102bd610516366004611b0f565b610d71565b34801561052757600080fd5b506102597f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b34801561055b57600080fd5b506102bd61056a3660046116f1565b610dfe565b34801561057b57600080fd5b5061025960055481565b34801561059157600080fd5b506101dc6105a03660046116c3565b60026020526000908152604090205460ff1681565b3480156105c157600080fd5b50610259600080516020611ce783398151915281565b3480156105e357600080fd5b506102597f325fddf9552c17478a75e5d653af030805196a4fc48e1df5a2e5aeff2a7066e081565b60006001600160e01b03198216637965db0b60e01b148061063c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008281526020819052604090206001015461065e8133610fc7565b610668838361102b565b505050565b6001600160a01b03811633146106e25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6106ec82826110af565b5050565b600080516020611ce78339815191526107098133610fc7565b816006600085600181111561072057610720611b31565b600181111561073157610731611b31565b81526020810191909152604001600020805460ff1916911515919091179055505050565b600080516020611ce783398151915261076e8133610fc7565b50600092835260076020908152604080852060019081019490945560089091529092200155565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66107c08133610fc7565b6000848152600460205260409020546001600160a01b03166107f85760405163642a819160e11b8152600481018590526024016106d9565b6000848152600460208190526040918290205491516340c10f1960e01b81526001600160a01b0386811692820192909252602481018590529116906340c10f19906044016020604051808303816000875af115801561085b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087f9190611b47565b61089b576040516248195d60e01b815260040160405180910390fd5b50505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66108cc8133610fc7565b85841415806108db5750838214155b156108fc576040516001621398b960e31b0319815260040160405180910390fd5b60005b8681101561097a5761096888888381811061091c5761091c611b64565b9050602002013587878481811061093557610935611b64565b905060200201602081019061094a919061195a565b86868581811061095c5761095c611b64565b90506020020135610795565b8061097281611b90565b9150506108ff565b5050505050505050565b604080517f325fddf9552c17478a75e5d653af030805196a4fc48e1df5a2e5aeff2a7066e0602080830191909152338284015260608083018790528351808403909101815260808301845280519082012060015461190160f01b60a085015260a284015260c28084018290528451808503909101815260e290930190935281519101208391839186919060009060008181526002602052604090205490915060ff1615610a645760405162461bcd60e51b815260206004820152600e60248201526d1cda59db985d1d5c99481d5cd95960921b60448201526064016106d9565b6000818152600260209081526040808320805460ff191660011790558051601f8801839004830281018301909152868152610abc91889088908190840183828082843760009201919091525086939250506111149050565b9050610ae87f1ded512beb3615ca121e5630e7afd724aaec6a437b5d1f6e14f68bfa753b00c282610c49565b610b285760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964205369676e617475726560781b60448201526064016106d9565b6000805260066020527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f85460ff16610b795760005b604051633e19b46760e11b81526004016106d991815260200190565b60008b815260076020526040902054610ba85760405163642a819160e11b8152600481018c90526024016106d9565b60008b81526007602090815260409182902082518084019093528054808452600190910154918301829052610be0918e918e91611138565b505050505050505050505050565b600080516020611ce7833981519152610c078133610fc7565b50600380546001600160a01b0319166001600160a01b0392909216919091179055565b600080516020611ce7833981519152610c438133610fc7565b50600555565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020611ce7833981519152610c8b8133610fc7565b8151835114610cb0576040516001621398b960e31b0319815260040160405180910390fd5b60005b835181101561089b57828181518110610cce57610cce611b64565b602002602001015160046000868481518110610cec57610cec611b64565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610d3190611b90565b915050610cb3565b600080516020611ce7833981519152610d528133610fc7565b5060009283526007602090815260408085209390935560089052912055565b600160005260066020527f3e5fec24aa4dc4e5aee2e025e51e1392c72a2500577559fae9665c6d52bd6a315460ff16610dab576001610b5d565b600082815260086020526040902054610dda5760405163642a819160e11b8152600481018390526024016106d9565b600082815260086020526040902080546001909101546106ec918491849190611138565b600082815260208190526040902060010154610e1a8133610fc7565b61066883836110af565b60606000610e33836002611bab565b610e3e906002611bca565b67ffffffffffffffff811115610e5657610e56611977565b6040519080825280601f01601f191660200182016040528015610e80576020820181803683370190505b509050600360fc1b81600081518110610e9b57610e9b611b64565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610eca57610eca611b64565b60200101906001600160f81b031916908160001a9053506000610eee846002611bab565b610ef9906001611bca565b90505b6001811115610f71576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610f2d57610f2d611b64565b1a60f81b828281518110610f4357610f43611b64565b60200101906001600160f81b031916908160001a90535060049490941c93610f6a81611be2565b9050610efc565b508315610fc05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016106d9565b9392505050565b610fd18282610c49565b6106ec57610fe9816001600160a01b03166014610e24565b610ff4836020610e24565b604051602001611005929190611c25565b60408051601f198184030181529082905262461bcd60e51b82526106d991600401611c9a565b6110358282610c49565b6106ec576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561106b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6110b98282610c49565b156106ec576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008060006111238585611345565b91509150611130816113b5565b509392505050565b60055483111561115b5760405163667c7eff60e01b815260040160405180910390fd5b6111658383611bab565b3410156111855760405163044044a560e21b815260040160405180910390fd5b6000848152600460208181526040928390205483516318160ddd60e01b81529351859488946001600160a01b03909316936318160ddd938281019391928290030181865afa1580156111db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ff9190611ccd565b6112099190611bca565b111561122857604051630a5ab05760e41b815260040160405180910390fd5b6003546040516000916001600160a01b03169034908381818185875af1925050503d8060008114611275576040519150601f19603f3d011682016040523d82523d6000602084013e61127a565b606091505b505090508061129c576040516338822c1360e11b815260040160405180910390fd5b6000858152600460208190526040918290205491516340c10f1960e01b81523391810191909152602481018690526001600160a01b03909116906340c10f19906044016020604051808303816000875af11580156112fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113229190611b47565b61133e576040516248195d60e01b815260040160405180910390fd5b5050505050565b60008082516041141561137c5760208301516040840151606085015160001a61137087828585611573565b945094505050506113ae565b8251604014156113a6576020830151604084015161139b868383611660565b9350935050506113ae565b506000905060025b9250929050565b60008160048111156113c9576113c9611b31565b14156113d25750565b60018160048111156113e6576113e6611b31565b14156114345760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016106d9565b600281600481111561144857611448611b31565b14156114965760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016106d9565b60038160048111156114aa576114aa611b31565b14156115035760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016106d9565b600481600481111561151757611517611b31565b14156115705760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016106d9565b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156115aa5750600090506003611657565b8460ff16601b141580156115c257508460ff16601c14155b156115d35750600090506004611657565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611627573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661165057600060019250925050611657565b9150600090505b94509492505050565b6000806001600160ff1b0383168161167d60ff86901c601b611bca565b905061168b87828885611573565b935093505050935093915050565b6000602082840312156116ab57600080fd5b81356001600160e01b031981168114610fc057600080fd5b6000602082840312156116d557600080fd5b5035919050565b6001600160a01b038116811461157057600080fd5b6000806040838503121561170457600080fd5b823591506020830135611716816116dc565b809150509250929050565b80356002811061173057600080fd5b919050565b801515811461157057600080fd5b6000806040838503121561175657600080fd5b61175f83611721565b9150602083013561171681611735565b60008060006060848603121561178457600080fd5b505081359360208301359350604090920135919050565b6000806000606084860312156117b057600080fd5b8335925060208401356117c2816116dc565b929592945050506040919091013590565b60008083601f8401126117e557600080fd5b50813567ffffffffffffffff8111156117fd57600080fd5b6020830191508360208260051b85010111156113ae57600080fd5b6000806000806000806060878903121561183157600080fd5b863567ffffffffffffffff8082111561184957600080fd5b6118558a838b016117d3565b9098509650602089013591508082111561186e57600080fd5b61187a8a838b016117d3565b9096509450604089013591508082111561189357600080fd5b506118a089828a016117d3565b979a9699509497509295939492505050565b6000806000806000608086880312156118ca57600080fd5b853594506020860135935060408601359250606086013567ffffffffffffffff808211156118f757600080fd5b818801915088601f83011261190b57600080fd5b81358181111561191a57600080fd5b89602082850101111561192c57600080fd5b9699959850939650602001949392505050565b60006020828403121561195157600080fd5b610fc082611721565b60006020828403121561196c57600080fd5b8135610fc0816116dc565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156119b6576119b6611977565b604052919050565b600067ffffffffffffffff8211156119d8576119d8611977565b5060051b60200190565b600082601f8301126119f357600080fd5b81356020611a08611a03836119be565b61198d565b82815260059290921b84018101918181019086841115611a2757600080fd5b8286015b84811015611a4b578035611a3e816116dc565b8352918301918301611a2b565b509695505050505050565b60008060408385031215611a6957600080fd5b823567ffffffffffffffff80821115611a8157600080fd5b818501915085601f830112611a9557600080fd5b81356020611aa5611a03836119be565b82815260059290921b84018101918181019089841115611ac457600080fd5b948201945b83861015611ae257853582529482019490820190611ac9565b96505086013592505080821115611af857600080fd5b50611b05858286016119e2565b9150509250929050565b60008060408385031215611b2257600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b600060208284031215611b5957600080fd5b8151610fc081611735565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ba457611ba4611b7a565b5060010190565b6000816000190483118215151615611bc557611bc5611b7a565b500290565b60008219821115611bdd57611bdd611b7a565b500190565b600081611bf157611bf1611b7a565b506000190190565b60005b83811015611c14578181015183820152602001611bfc565b8381111561089b5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611c5d816017850160208801611bf9565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611c8e816028840160208801611bf9565b01602801949350505050565b6020815260008251806020840152611cb9816040850160208701611bf9565b601f01601f19169190910160400192915050565b600060208284031215611cdf57600080fd5b505191905056feb19546dff01e856fb3f010c267a7b1c60363cf8a4664e21cc89c26224620214ea2646970667358221220b642ee1d7c8ef8e83f6c8e73f0d9765d11b51c72681ce92d8f8cecd3e262db0564736f6c634300080a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000003abf2a6e1d08153bd18ad19a588ec3f9ed7c0c6700000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000006fb6cda6695d7ef942ceec4b7f34b273619aeee2000000000000000000000000c4f65ac0a89a181200e2659fb76b51ee67a725d6
-----Decoded View---------------
Arg [0] : _tiers (uint256[]): 1,2
Arg [1] : _addresses (address[]): 0x6FB6cDA6695d7eF942ceec4B7F34b273619AeeE2,0xc4F65AC0a89a181200e2659FB76B51Ee67a725D6
Arg [2] : _sink (address): 0x3abF2a6e1d08153bD18aD19A588eC3f9ed7c0c67
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000003abf2a6e1d08153bd18ad19a588ec3f9ed7c0c67
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [7] : 0000000000000000000000006fb6cda6695d7ef942ceec4b7f34b273619aeee2
Arg [8] : 000000000000000000000000c4f65ac0a89a181200e2659fb76b51ee67a725d6
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.