Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 25 from a total of 447 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Renounce Ownersh... | 18338378 | 895 days ago | IN | 0 ETH | 0.0002183 | ||||
| Burn Unclaimed T... | 18338373 | 895 days ago | IN | 0 ETH | 0.0004144 | ||||
| Pause | 18338366 | 895 days ago | IN | 0 ETH | 0.0002034 | ||||
| Claim | 18338319 | 895 days ago | IN | 0 ETH | 0.00084942 | ||||
| Claim | 18338103 | 895 days ago | IN | 0 ETH | 0.00079695 | ||||
| Claim | 18338068 | 895 days ago | IN | 0 ETH | 0.00099104 | ||||
| Claim | 18338066 | 895 days ago | IN | 0 ETH | 0.00104624 | ||||
| Claim | 18338053 | 895 days ago | IN | 0 ETH | 0.00079128 | ||||
| Claim | 18337992 | 895 days ago | IN | 0 ETH | 0.00108848 | ||||
| Claim | 18337936 | 895 days ago | IN | 0 ETH | 0.00069811 | ||||
| Claim | 18337922 | 895 days ago | IN | 0 ETH | 0.00075839 | ||||
| Claim | 18337909 | 895 days ago | IN | 0 ETH | 0.00068128 | ||||
| Claim | 18337867 | 895 days ago | IN | 0 ETH | 0.00068625 | ||||
| Claim | 18337773 | 895 days ago | IN | 0 ETH | 0.0007287 | ||||
| Claim | 18337618 | 895 days ago | IN | 0 ETH | 0.00072249 | ||||
| Claim | 18337615 | 895 days ago | IN | 0 ETH | 0.00073287 | ||||
| Claim | 18337614 | 895 days ago | IN | 0 ETH | 0.00014169 | ||||
| Claim | 18337613 | 895 days ago | IN | 0 ETH | 0.00014405 | ||||
| Claim | 18337601 | 895 days ago | IN | 0 ETH | 0.00068004 | ||||
| Claim | 18337601 | 895 days ago | IN | 0 ETH | 0.00067998 | ||||
| Claim | 18337593 | 895 days ago | IN | 0 ETH | 0.00067648 | ||||
| Claim | 18337582 | 895 days ago | IN | 0 ETH | 0.00075516 | ||||
| Claim | 18337576 | 895 days ago | IN | 0 ETH | 0.0007207 | ||||
| Claim | 18337417 | 895 days ago | IN | 0 ETH | 0.00072893 | ||||
| Claim | 18337414 | 895 days ago | IN | 0 ETH | 0.00076227 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MaximClaim
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "contracts/MaximPresale.sol";
import "contracts/TheMaximals.sol";
/**
* Maxim Coin Claim contract
* 50% - Presale Claim
* 20% - NFT Claim
* 30% - goes to LP
*
* NFT Holders claim
* Computation is based on the number of NFTs
* 1 NFT = ( MaxSupply * 0.25 ) / 10000
* NFT used to claim an NFT will be marked as claimed and cannot be used again
*
* Presale Claim
* Computation of claim is based on the amount purchased
* tokenUnitPrice = (MaxSupply * 0.25) / totalFundsRaised
* participantAllocation = purhaseCost * tokenUnitPrice
*
* All unclaimed tokens by the end of claim period shall be burned
**/
contract MaximClaim is Ownable, Pausable, ReentrancyGuard {
using SafeMath for uint256;
IERC20 public maximToken; // Reference to your $MAXIM token contract
Maximals public maximalsNftContract; // Reference to NFT contract
MaximPresaleContract maximPresaleContract; //Reference to Presale Contract
uint256 public presaleAllocation;
uint256 public nftHoldersAllocation;
uint256 public totalTokenSupply = 1e12 * 1e18;
bytes32 private nftHoldingsMerkleRoot;
// Mapping to track claimed NFTs by address and token ID
mapping(address => uint256) public claimed;
event Claim(address indexed recipient, uint256 amount);
event TokensDeposited(address indexed user, uint256 amount);
event TokensBuned(address indexed user, uint256 amount);
constructor() {
maximToken = IERC20(0x64a7F7Ce1719fb64D8b885eDe9D24779e7456d3a);
maximalsNftContract = Maximals(0xB8a52CBF0a322b5162173984b58510E5BF264D81);
maximPresaleContract = MaximPresaleContract(0x6d563837e762e79eD786058c7DD21D957099a8aB);
presaleAllocation = 500000000000000000000000000000; //50% allocated to presale
nftHoldersAllocation = 200000000000000000000000000000;
_pause();
}
//setters
function setPresaleAllocation(uint256 _amount) public onlyOwner {
presaleAllocation = _amount;
}
function setNftHoldersAllocation(uint256 _amount) public onlyOwner {
nftHoldersAllocation = _amount;
}
function setHoldingsMerkleRoot(bytes32 _nftHoldingsMerkleRoot) public onlyOwner {
nftHoldingsMerkleRoot = _nftHoldingsMerkleRoot;
}
function setMaximToken(address _maximToken) public onlyOwner {
maximToken = IERC20(_maximToken);
}
function setMaximalsNFTToken(address _maximalsNFTToken) public onlyOwner {
maximalsNftContract = Maximals(_maximalsNFTToken);
}
function setMaximPresaleContract(address _maximPresaleContract) public onlyOwner {
maximPresaleContract = MaximPresaleContract(_maximPresaleContract);
}
function pause() public onlyOwner {
_pause();
}
function unpause() public onlyOwner {
_unpause();
}
/**
*
* Token Claim
* checks account elegibility
* -presale participation - calls presale function to get participation amount
* -holders snapshot - checks merkel tree as submitted by sender
* computes total claim amount
* -presale participation
* -holders snapshot
*
* Transfers the total amount of token to the address
*
*/
function claim(bytes32[] calldata _proof, bytes memory _leaf) external nonReentrant whenNotPaused {
require(msg.sender != address(0), "ERROR: Invalid address");
uint256 _nftHoldings = 0;
bool _validNftClaim = false;
(_validNftClaim, _nftHoldings) = nftClaimCheck(_proof, _leaf, msg.sender);
uint256 _presaleAmount = getPresaleClaimComputation(msg.sender);
uint256 _nftHolderAmount = getNFTHolderClaimComputation(_nftHoldings);
uint256 _finalAmount = _presaleAmount + _nftHolderAmount; //compute final amount
require(_finalAmount > 0, "ERROR: No tokens to claim.");
require(claimed[msg.sender] < _finalAmount, "ERROR: Tokens already claimed.");
_finalAmount = _finalAmount - claimed[msg.sender];
require(maximToken.transfer(msg.sender, _finalAmount), "ERROR: Transfer failed");
claimed[msg.sender] = _finalAmount;
emit Claim(msg.sender, _finalAmount);
}
function nftClaimCheck(bytes32[] calldata _proof, bytes memory _leaf, address _address) public view returns (bool, uint256) {
require(msg.sender != address(0), "ERROR: Invalid address");
address _account;
uint256 _extractedHoldings;
(_account, _extractedHoldings) = extractAddressAndUint(_leaf);
require(_account == _address, "ERROR: Address is not the same.");
bytes32 _leaf2 = keccak256(abi.encode(_account, _extractedHoldings));
uint256 _nftHoldings = 0;
bool _isValidClaim = MerkleProof.verify(_proof, nftHoldingsMerkleRoot, _leaf2);
if (_isValidClaim) {
_nftHoldings = _extractedHoldings;
}
return (_isValidClaim, _nftHoldings);
}
function extractAddressAndUint(bytes memory data) public pure returns (address, uint256) {
// Ensure data length is at least 64 bytes (32 bytes for the address and 32 for the uint256)
require(data.length >= 64, "Data length is insufficient");
address extractedAddress;
uint256 extractedUint;
// Use abi.decode to extract the data
(extractedAddress, extractedUint) = abi.decode(data, (address, uint256));
return (extractedAddress, extractedUint);
}
/**
*
* getNFTHolderClaimComputation
* computes nftHolders claim
*
*/
function getNFTHolderClaimComputation(uint256 _nftHoldings) public view returns (uint256) {
if (_nftHoldings == 0)
return 0;
(, uint256 totalSupply, ) = maximalsNftContract.getSupplyInfo();
return (nftHoldersAllocation / totalSupply) * _nftHoldings;
}
/**
*
* getPresaleClaimComputation
* computes presale participants claim
*
*/
function getPresaleClaimComputation(address _address) public view returns (uint256) {
uint256 _amount = maximPresaleContract.getPurchases(_address);
uint256 _totalFundsRaised = maximPresaleContract.getTotalFundRaised();
uint256 _tokenUnitPrice = presaleAllocation / _totalFundsRaised;
return _tokenUnitPrice * _amount ;
}
/**
*
* getClaimComputation
* gets presale participants claim and nftholders claim
*
*/
function getClaimComputation(address _address, uint256 _nftHoldings) public view returns (uint256, uint256) {
return (
getPresaleClaimComputation(_address),
getNFTHolderClaimComputation(_nftHoldings)
);
}
/**
* burns unclaimed tokens after presale period expires
*/
function burnUnclaimedTokens(address _burnAddress) public onlyOwner {
uint256 _balance = maximToken.balanceOf(address(this));
require(_balance > 0, "ERROR: No tokens to burn");
maximToken.transfer(_burnAddress, _balance);
emit TokensBuned(msg.sender, _balance);
}
// Function to deposit tokens into the contract
function depositTokens(uint256 _amount) public onlyOwner {
// Transfer tokens from the sender to this contract
require(maximToken.transferFrom(msg.sender, address(this), _amount), "ERROR 412: Token transfer failed");
// Emit event to log the deposit
emit TokensDeposited(msg.sender, _amount);
}
}
/*
* ***** ***** ***** *****
*///SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
/**
* Max Supply - 10000
* Stage 1 - WL and Public for 2 hours (manually controlled)
*
* Whitelist
* Supply: 6500
* 1 free then paid 0.0069, max 3 per transaction/wallet,
*
* Public: 3500
* Paid at 0.0075, max 4 per transaction/wallet
*
* Stage 2 - Open Stage
* Public - All remaining supply
* Paid at 0.0075, max 4 per transaction/wallet
*/
contract Maximals is ERC721A, Ownable, Pausable, ReentrancyGuard {
uint256 public maxSupply = 10000;
//minter roles configuration
struct MintersInfo {
uint8 maxMintPerTransaction; //max mint per wallet and per transaction
uint8 numberOfFreemint;
uint256 supply; //max allocated supply per minter role
uint256 mintCost;
bytes32 root; //Merkle root
}
mapping(string => MintersInfo) minters; //map of minter types
mapping(string => uint256) public mintedCount; //map of total mints per type
enum Phases { N, Phase1, Public } //mint phases, N = mint not live
Phases public currentPhase;
mapping(address => uint256) minted; //map of addresses that minted
mapping(string => mapping(address => uint8)) public mintedPerRole; //map of addresses that minted per phase and their mint counts
mapping(address => uint8) public mintedFree; //map of addresses that minted free and their mint counts
address[] public mintersAddresses; //addresses of minters
string private baseURI;
string[] private prerevealedArtworks;
bool isRevealed;
//events
event Minted(address indexed to, uint8 numberOfTokens, uint256 amount);
event SoldOut();
event PhaseChanged(address indexed to, uint256 indexed eventId, uint8 indexed phaseId);
event WithdrawalSuccessful(address indexed to, uint256 amount);
event CollectionRevealed(address indexed to);
//errors
error WithdrawalFailed();
constructor() ERC721A("Maximals", "MAXIM") {
_pause();
currentPhase = Phases.N;
//added an invalid root here to avoid zero comparison later
addMintersInfo(
"WL", //minter role name
3, //max per wallet/per transaction
1, //number of free mint
6500, //allocated supply
0.0069 ether, //mint cost
0x8ac3d4f184349fb28ebb642349f97130ce71b7bc967acb07c881b5ec27ad725c //root dummy
);
addMintersInfo(
"PUBLIC", //minter role name
4, //max per wallet/per transaction
0, //number of free mint
3500, //allocated supply
0.0075 ether, //mint cost
0x8ac3d4f184349fb28ebb642349f97130ce71b7bc967acb07c881b5ec27ad725c //root dummy
);
}
/*
* ******** ******** ******** ******** ******** ******** ********
* Public Mint functions
* ******** ******** ******** ******** ******** ******** ********
*/
function whitelistMint(uint8 numberOfTokens, bytes32[] calldata proof) external payable nonReentrant whenNotPaused {
require(currentPhase == Phases.Phase1, "ERROR: Mint is not active.");
string memory _minterRole = "WL"; //set minter role
uint256 _totalCost;
//verify whitelist
require(_isWhitelisted(msg.sender, proof, minters[_minterRole].root), "ERROR: You are not allowed to mint on this phase.");
require(mintedCount[_minterRole] + numberOfTokens <= minters[_minterRole].supply, "ERROR: Maximum number of mints on this phase has been reached");
require(numberOfTokens <= minters[_minterRole].maxMintPerTransaction, "ERROR: Maximum number of mints per transaction exceeded");
require((mintedPerRole[_minterRole][msg.sender] + numberOfTokens) <= minters[_minterRole].maxMintPerTransaction, "ERROR: Your maximum NFT mint per wallet on this phase has been reached.");
//Free mint check
if ((mintedFree[msg.sender] > 0)) {
_totalCost = minters[_minterRole].mintCost * numberOfTokens;
require(msg.value >= _totalCost, "ERROR: You do not have enough funds to mint.");
} else {
//Block for free mint
if (numberOfTokens == 1) {
require(mintedFree[msg.sender] == 0, "ERROR: You do not have enough funds to mint.");
} else if (numberOfTokens > 1) {
_totalCost = minters[_minterRole].mintCost * (numberOfTokens - minters[_minterRole].numberOfFreemint);
require(msg.value >= _totalCost, "ERROR: You do not have enough funds to mint.");
}
mintedFree[msg.sender] = 1; // Register free mint
}
_phaseMint(_minterRole, numberOfTokens, _totalCost);
}
function publicMint(uint8 numberOfTokens) external payable nonReentrant whenNotPaused {
require(currentPhase != Phases.N, "ERROR: Mint is not active.");
string memory _minterRole = "PUBLIC";
require(numberOfTokens <= minters[_minterRole].maxMintPerTransaction, "ERROR: Maximum number of mints per transaction exceeded");
require((mintedPerRole[_minterRole][msg.sender] + numberOfTokens) <= minters[_minterRole].maxMintPerTransaction, "ERROR: Your maximum NFT mint per wallet on this phase has been reached.");
if (currentPhase == Phases.Phase1) {
//on this phase make sure that the allocated supply count per minter role will not be exceeded
require(mintedCount[_minterRole] + numberOfTokens <= minters[_minterRole].supply, "ERROR: Maximum number of mints on this phase has been reached");
}
uint256 _totalCost;
_totalCost = minters[_minterRole].mintCost * numberOfTokens;
require(msg.value >= _totalCost, "ERROR: You do not have enough funds to mint.");
_phaseMint(_minterRole, numberOfTokens, _totalCost);
}
function verifyWhitelist(string memory _minterType, address _address, bytes32[] calldata _merkleProof) public view returns (bool) {
require(minters[_minterType].root != bytes32(0), "ERROR: Minter Type not found.");
if (_isWhitelisted(_address, _merkleProof, minters[_minterType].root))
return true;
return false;
}
function tokenURI(uint256 _tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(_tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
if (isRevealed) {
_tokenId += 1;
return string(abi.encodePacked(baseURI, Strings.toString(_tokenId)));
}
uint _ipfsIndex = _tokenId % prerevealedArtworks.length; //distribute pre-reveal images, alternating
return prerevealedArtworks[_ipfsIndex];
}
/*
* ******** ******** ******** ******** ******** ******** ********
* Public - onlyOwner functions
* ******** ******** ******** ******** ******** ******** ********
*/
function setMintPhase(uint8 _phase) public onlyOwner {
currentPhase = Phases(_phase);
emit PhaseChanged(msg.sender, block.timestamp, uint8(currentPhase));
}
function setMaxSupply(uint256 _maxSupply) public onlyOwner {
maxSupply = _maxSupply;
}
//Function to add MintersInfo to minters
function addMintersInfo(
string memory _minterName,
uint8 _maxMintPerTransaction,
uint8 _numberOfFreeMint,
uint256 _supply,
uint256 _mintCost,
bytes32 _root
) public onlyOwner {
MintersInfo memory newMintersInfo = MintersInfo(
_maxMintPerTransaction,
_numberOfFreeMint,
_supply,
_mintCost,
_root
);
minters[_minterName] = newMintersInfo;
}
//Function to modify MintersInfo of a minterRole
function modifyMintersInfo(
string memory _minterName,
uint8 _newMaxMintPerTransaction,
uint8 _newNumberOfFreeMint,
uint256 _newSupply,
uint256 _newMintCost,
bytes32 _newRoot
) public onlyOwner {
require(minters[_minterName].root != bytes32(0), "MintersInfo not found.");
MintersInfo memory updatedMintersInfo = MintersInfo(
_newMaxMintPerTransaction,
_newNumberOfFreeMint,
_newSupply,
_newMintCost,
_newRoot
);
minters[_minterName] = updatedMintersInfo;
}
function modifyMintersMintCost(
string memory _minterName,
uint256 _newMintCost
) public onlyOwner {
require(minters[_minterName].root != bytes32(0), "MintersInfo not found.");
minters[_minterName].mintCost = _newMintCost;
}
function modifyMintersSupply(
string memory _minterName,
uint256 _newSupplyCount
) public onlyOwner {
require(minters[_minterName].root != bytes32(0), "MintersInfo not found.");
minters[_minterName].supply = _newSupplyCount;
}
function modifyFreeMintCount(
string memory _minterName,
uint8 _newFreeMintCount
) public onlyOwner {
require(minters[_minterName].root != bytes32(0), "MintersInfo not found.");
minters[_minterName].numberOfFreemint = _newFreeMintCount;
}
function modifyMintersMaxMintPerTransaction(
string memory _minterName,
uint8 _newMaxMintPerTransaction
) public onlyOwner {
require(minters[_minterName].root != bytes32(0), "MintersInfo not found.");
minters[_minterName].maxMintPerTransaction = _newMaxMintPerTransaction;
}
//Function to get the MintersInfo for a specific minter
function getMintInfo(string memory _minterName, address _userAddress) public view returns (uint8, uint8, uint256, uint256, uint256, uint8) {
uint8 _mintedPerRole = mintedPerRole[_minterName][_userAddress];
return (
uint8(currentPhase),
minters[_minterName].maxMintPerTransaction,
minters[_minterName].mintCost,
minters[_minterName].supply,
mintedCount[_minterName],
_mintedPerRole
);
}
function getSupplyInfo() public view returns (uint256, uint256, uint8) {
return (maxSupply, totalSupply(), uint8(currentPhase));
}
//Function to modify the root of an existing MintersInfo
function modifyMintersRoot(string memory _minterName, bytes32 _newRoot) public onlyOwner {
require(minters[_minterName].root != bytes32(0), "ERROR: MintersInfo not found."); //change
minters[_minterName].root = _newRoot;
}
function modifyPrerevealImages(string[] memory _urlArray) public onlyOwner {
prerevealedArtworks = _urlArray;
}
function revealCollection (string memory _baseURI, bool _isRevealed) public onlyOwner {
isRevealed = _isRevealed;
baseURI = _baseURI;
if (isRevealed)
emit CollectionRevealed(msg.sender);
}
function unPause() public onlyOwner {
_unpause();
}
function pause() public onlyOwner whenNotPaused {
_pause();
}
function internalMint(uint8 numberOfTokens) public onlyOwner {
require((_totalMinted() + numberOfTokens) <= maxSupply, "ERROR: Not enough tokens");
_safeMint(msg.sender, numberOfTokens);
emit Minted(msg.sender, numberOfTokens, 0);
}
function airdrop(uint8 numberOfTokens, address recipient) public onlyOwner whenNotPaused {
require((_totalMinted() + numberOfTokens) <= maxSupply, "ERROR: Not enough tokens left");
_safeMint(recipient, numberOfTokens);
}
function withdraw() public onlyOwner {
require(address(this).balance > 0, "ERROR: No balance to withdraw.");
uint256 amount = address(this).balance;
//sends fund to team wallet
(bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
if (!success) {
revert WithdrawalFailed();
}
emit WithdrawalSuccessful(msg.sender, amount);
}
/*
* ******** ******** ******** ******** ******** ******** ********
* Internal - functions
* ******** ******** ******** ******** ******** ******** ********
*/
function _phaseMint(string memory _minterRole, uint8 _numberOfTokens, uint256 _totalCost) internal {
require((_totalMinted() + _numberOfTokens) <= maxSupply, "ERROR: No tokens left to mint");
require(_numberOfTokens > 0, "ERROR: Number of tokens should be greater than zero");
_safeMint(msg.sender, _numberOfTokens);
//after mint registry
mintedCount[_minterRole] += _numberOfTokens; //adds the newly minted token count per minter Role
//mintedPerPhase[uint8(currentPhase)][msg.sender] += _numberOfTokens; //registers the address and the number of tokens of the minter
mintedPerRole[_minterRole][msg.sender] += _numberOfTokens; //registers the address and the number of tokens of the minter per role
mintersAddresses.push(msg.sender); //registers minters address, for future purposes
emit Minted(msg.sender, _numberOfTokens, _totalCost);
//if total minted reach or exceeds max supply - pause contract
if (_totalMinted() >= maxSupply) {
emit SoldOut();
// _pause();
}
}
//for whitelist check
function _isWhitelisted (
address _minterLeaf,
bytes32[] calldata _merkleProof,
bytes32 _minterRoot
) public pure returns (bool) {
bytes32 _leaf = keccak256(abi.encodePacked(_minterLeaf));
return MerkleProof.verify(_merkleProof, _minterRoot, _leaf);
}
}
/*
* ***** ***** ***** *****
*/// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "erc721a/contracts/ERC721A.sol";
/**
* Maxim Coin Presale contract
* Sale cap per address is 0.01 to 0.05 eth
* Sale can be done multiple times as long as it does not exceed the cap per address
* Presale collection has a Total sales cap of 50 eth
*
* Only whitelisted addresses and Maximals NFT holders can participate in sale
* The list of presale participants should be accessible by Maxim Token claim contract
*
**/
contract MaximPresaleContract is Ownable, ReentrancyGuard, Pausable {
address public claimContractAddress; // Reference to your $MAXIM token contract
address public nftContractAddress = 0xB8a52CBF0a322b5162173984b58510E5BF264D81; //NFT address
address public tokenContractAddress = 0x64a7F7Ce1719fb64D8b885eDe9D24779e7456d3a;
bytes32 private merkleRoot; // The Merkle root for whitelist
uint256 public minPurchase = 0.01 ether; // Minimum purchase amount
uint256 public maxPurchase = 0.05 ether;
uint256 public maxFundCap = 50 ether;
uint256 public totalFundRaised;
//Mapping to track participants and their purchases
mapping(address => uint256) public purchases;
address[] public presaleParticipants;
//Events
event Purchase(address indexed buyer, uint256 amount);
event WithdrawalSuccessful(address indexed to, uint256 amount);
//Errors
error WithdrawalFailed();
constructor() {
_pause();
}
/*
* ******** ******** ******** ******** ******** ******** ********
* Public Setters functions
* ******** ******** ******** ******** ******** ******** ********
*/
/*
* Sets minimum amount of presale purchase
*/
function setMinPurchase(uint256 _minPurchase) external onlyOwner {
minPurchase = _minPurchase;
}
/*
* Sets maximum amount of presale purchase
*/
function setMaxPurchase(uint256 _maxPurchase) external onlyOwner {
maxPurchase = _maxPurchase;
}
/*
* Sets maximum amount of total fund
*/
function setMaxFundCap(uint256 _maxFundCap) external onlyOwner {
maxFundCap = _maxFundCap;
}
/*
* Sets Merkle tree root for whitelist presale
*/
function setRoot(bytes32 _newRoot) external onlyOwner {
merkleRoot = _newRoot;
}
/*
* Sets NFT address for holders presale
*/
function setNFTAddress(address _nftAddress) external onlyOwner {
nftContractAddress = _nftAddress;
}
/*
* Sets ERC20 Token address
*/
function setTokenAddress(address _tokenAddress) external onlyOwner {
tokenContractAddress = _tokenAddress;
}
/*
* Sets ERC20 Token CLAIM address
*/
function setClaimAddress(address _claimAddress) external onlyOwner {
claimContractAddress = _claimAddress;
}
/*
* Gets list of purchases: address and cost.
*
*/
function getPurchases(address _address) external view returns (uint256) {
return purchases[_address];
}
/*
* Gets list of presale participants - addresses.
*
*/
function getPresaleParticipants() external view returns (address[] memory) {
return presaleParticipants;
}
/*
* Gets the total fund raised count
*/
function getTotalFundRaised() external view returns (uint256) {
return totalFundRaised;
}
/*
* Gets the NFT contract address
*/
function getNFTAddress() public view returns (address) {
return nftContractAddress;
}
/*
* Gets presale info
*/
function getPresaleInfo()
external
view
returns (uint256, uint256, uint256, uint256, address, address, address) {
return (
maxFundCap,
minPurchase,
maxPurchase,
totalFundRaised,
nftContractAddress,
claimContractAddress,
tokenContractAddress
);
}
/*
* Gets current address info
*/
function getAccountInfo(address _address) public view returns (uint256, uint256) {
return (
purchases[_address],
getNFTBalanceOfAddress(_address)
);
}
/*
* Checks if address owns an NFT
*/
function isAddressOwnNFT(uint256 _tokenId) public view returns (bool) {
// Check if the address owns the NFT with the given token ID
return IERC721(nftContractAddress).ownerOf(_tokenId) == msg.sender;
}
function getNFTBalanceOfAddress(address _address) public view returns (uint256) {
ERC721A nftContract = ERC721A(nftContractAddress);
return nftContract.balanceOf(_address);
}
/*
* ******** ******** ******** ******** ******** ******** ********
* Public and External functions
* ******** ******** ******** ******** ******** ******** ********
*/
/*
* Function for purchasing tokens
* params - _proof for whitelist interaction
*/
function whitelistPurchase(bytes32[] calldata _proof) external payable nonReentrant whenNotPaused {
require(isWhitelisted(msg.sender, _proof), "ERROR 421: Address is not whitelisted.");
_purchase();
}
/*
* Function for purchasing tokens
* params - _tokenId for checking if address owns NFT
*/
function nftHolderPurchase() external payable nonReentrant whenNotPaused {
require(getNFTBalanceOfAddress(msg.sender) > 0, "ERROR 421: Address does not own NFT.");
_purchase();
}
/*
* Withdraw function
*/
function withdraw() public onlyOwner {
require(address(this).balance > 0, "ERROR: No balance to withdraw.");
uint256 amount = address(this).balance;
//sends fund to team wallet
(bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
if (!success) {
revert WithdrawalFailed();
}
emit WithdrawalSuccessful(msg.sender, amount);
}
function pause() public onlyOwner {
_pause();
}
function unpause() public onlyOwner {
_unpause();
}
//for whitelist check
function isWhitelisted (
address _minterLeaf,
bytes32[] calldata _merkleProof
) public view returns (bool) {
bytes32 _leaf = keccak256(abi.encodePacked(_minterLeaf));
return MerkleProof.verify(_merkleProof, merkleRoot, _leaf);
}
/*
* ******** ******** ******** ******** ******** ******** ********
* Internal functions
* ******** ******** ******** ******** ******** ******** ********
*/
function _purchase() internal {
//checks if eth sent but the address is within the cap range
require(msg.value >= minPurchase && msg.value <= maxPurchase, "ERROR 411: Amount is not within the allowed range");
//checks if total eth sent by the address is within the cap range
require((purchases[msg.sender] + msg.value) >= minPurchase && (purchases[msg.sender] + msg.value) <= maxPurchase, "ERROR 411: Amount is not within the allowed range." );
//checks if the total eth collected + the current eth sent is withing the maxFundCap
require((totalFundRaised + msg.value) <= maxFundCap, "ERROR 431: Maximum target cap exceeded.");
//registers purchase and participant addresses
purchases[msg.sender] += msg.value;
presaleParticipants.push(msg.sender);
//counts total fund
totalFundRaised += msg.value;
//Emit purchase event
emit Purchase(msg.sender, msg.value);
}
}
/*
* ***** ***** ***** *****
*/// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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 Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
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.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721A.sol';
/**
* @dev Interface of ERC721 token receiver.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC721A
*
* @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
* Non-Fungible Token Standard, including the Metadata extension.
* Optimized for lower gas during batch mints.
*
* Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
* starting from `_startTokenId()`.
*
* Assumptions:
*
* - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
* - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is IERC721A {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =============================================================
// Mask of an entry in packed address data.
uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant _BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant _BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant _BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant _BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant _BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// STORAGE
// =============================================================
// The next token ID to be minted.
uint256 private _currentIndex;
// The number of tokens burned.
uint256 private _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 {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
// - [232..255] `extraData`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// Mapping from token ID to approved address.
mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view virtual returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() public view virtual override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than `_currentIndex - _startTokenId()` times.
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return _burnCounter;
}
// =============================================================
// ADDRESS DATA OPERATIONS
// =============================================================
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
}
/**
* Sets the auxiliary 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 virtual {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
auxCasted := aux
}
packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
_packedAddressData[owner] = packed;
}
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes
// of the XOR of all function selectors in the interface.
// See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
// (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
return
interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the token collection symbol.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
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, _toString(tokenId))) : '';
}
/**
* @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, it can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
// =============================================================
// OWNERSHIPS OPERATIONS
// =============================================================
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around over time.
*/
function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
// Invariant:
// There will always be an initialized ownership slot
// (i.e. `ownership.addr != address(0) && ownership.burned == false`)
// before an unintialized ownership slot
// (i.e. `ownership.addr == address(0) && ownership.burned == false`)
// Hence, `curr` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
while (packed == 0) {
packed = _packedOwnerships[--curr];
}
return packed;
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
ownership.burned = packed & _BITMASK_BURNED != 0;
ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
}
/**
* @dev Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @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) public payable virtual override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId].value;
}
/**
* @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) public virtual override {
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @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. See {_mint}.
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return
_startTokenId() <= tokenId &&
tokenId < _currentIndex && // If within bounds,
_packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
}
/**
* @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
*/
function _isSenderApprovedOrOwner(
address approvedAddress,
address owner,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, _BITMASK_ADDRESS)
// `msgSender == owner || msgSender == approvedAddress`.
result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
}
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// 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 {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
to,
_BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @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 memory _data
) public payable virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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 {}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* `from` - Previous owner of the given token ID.
* `to` - Target address that will receive the token.
* `tokenId` - Token ID to be transferred.
* `_data` - Optional data to send along with the call.
*
* Returns whether the call correctly returned the expected magic value.
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
// =============================================================
// MINT OPERATIONS
// =============================================================
/**
* @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 for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
uint256 toMasked;
uint256 end = startTokenId + quantity;
// Use assembly to loop and emit the `Transfer` event for gas savings.
// The duplicated `log4` removes an extra check and reduces stack juggling.
// The assembly, together with the surrounding Solidity code, have been
// delicately arranged to nudge the compiler into producing optimized opcodes.
assembly {
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
toMasked := and(to, _BITMASK_ADDRESS)
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
startTokenId // `tokenId`.
)
// The `iszero(eq(,))` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
// The compiler will optimize the `iszero` away for performance.
for {
let tokenId := add(startTokenId, 1)
} iszero(eq(tokenId, end)) {
tokenId := add(tokenId, 1)
} {
// Emit the `Transfer` event. Similar to above.
log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
}
}
if (toMasked == 0) revert MintToZeroAddress();
_currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
_currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, 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.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = _currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) revert();
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
// =============================================================
// BURN OPERATIONS
// =============================================================
/**
* @dev 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 {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// 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 {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
from,
(_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
// =============================================================
// EXTRA DATA OPERATIONS
// =============================================================
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = _packedOwnerships[index];
if (packed == 0) revert OwnershipNotInitializedForExtraData();
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
_packedOwnerships[index] = packed;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* 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 _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual returns (uint24) {}
/**
* @dev Returns the next extra data for the packed ownership data.
* The returned result is shifted into position.
*/
function _nextExtraData(
address from,
address to,
uint256 prevOwnershipPacked
) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
}
// =============================================================
// OTHER OPERATIONS
// =============================================================
/**
* @dev Returns the message sender (defaults to `msg.sender`).
*
* If you are writing GSN compatible contracts, you need to override this function.
*/
function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
/**
* @dev Converts a uint256 to its ASCII string decimal representation.
*/
function _toString(uint256 value) internal pure virtual returns (string memory str) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
// We will need 1 word for the trailing zeros padding, 1 word for the length,
// and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
let m := add(mload(0x40), 0xa0)
// Update the free memory pointer to allocate.
mstore(0x40, m)
// Assign the `str` to the end.
str := sub(m, 0x20)
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end of the memory to calculate the length later.
let end := str
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// prettier-ignore
for { let temp := value } 1 {} {
str := sub(str, 1)
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
// prettier-ignore
if iszero(temp) { break }
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
}// 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 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
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the
* ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() external view returns (uint256);
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
// =============================================================
// IERC721
// =============================================================
/**
* @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,
bytes calldata data
) external payable;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Transfers `tokenId` 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 payable;
/**
* @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 payable;
/**
* @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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @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);
// =============================================================
// IERC2309
// =============================================================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId`
* (inclusive) is transferred from `from` to `to`, as defined in the
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}{
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensBuned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_burnAddress","type":"address"}],"name":"burnUnclaimedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"},{"internalType":"bytes","name":"_leaf","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"extractAddressAndUint","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_nftHoldings","type":"uint256"}],"name":"getClaimComputation","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftHoldings","type":"uint256"}],"name":"getNFTHolderClaimComputation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getPresaleClaimComputation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maximToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maximalsNftContract","outputs":[{"internalType":"contract Maximals","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"},{"internalType":"bytes","name":"_leaf","type":"bytes"},{"internalType":"address","name":"_address","type":"address"}],"name":"nftClaimCheck","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftHoldersAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_nftHoldingsMerkleRoot","type":"bytes32"}],"name":"setHoldingsMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_maximPresaleContract","type":"address"}],"name":"setMaximPresaleContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_maximToken","type":"address"}],"name":"setMaximToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_maximalsNFTToken","type":"address"}],"name":"setMaximalsNFTToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setNftHoldersAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setPresaleAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalTokenSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040526c0c9f2c9cd04674edea400000006007553480156200002257600080fd5b506200004362000037620001a160201b60201c565b620001a960201b60201c565b60008060146101000a81548160ff021916908315150217905550600180819055507364a7f7ce1719fb64d8b885ede9d24779e7456d3a600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555073b8a52cbf0a322b5162173984b58510e5bf264d81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550736d563837e762e79ed786058c7dd21d957099a8ab600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506c064f964e68233a76f5200000006005819055506c02863c1f5cdae42f95400000006006819055506200019b6200026d60201b60201c565b62000432565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6200027d620002e260201b60201c565b6001600060146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620002c9620001a160201b60201c565b604051620002d8919062000392565b60405180910390a1565b620002f26200033760201b60201c565b1562000335576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200032c9062000410565b60405180910390fd5b565b60008060149054906101000a900460ff16905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200037a826200034d565b9050919050565b6200038c816200036d565b82525050565b6000602082019050620003a9600083018462000381565b92915050565b600082825260208201905092915050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000620003f8601083620003af565b91506200040582620003c0565b602082019050919050565b600060208201905081810360008301526200042b81620003e9565b9050919050565b61257c80620004426000396000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c806384e89a39116100de578063bf919f3a11610097578063dd49756e11610071578063dd49756e14610439578063f2fde38b14610455578063f8dd674714610471578063fd9f48df1461048d5761018e565b8063bf919f3a146103d1578063c1c50006146103ed578063c884ef83146104095761018e565b806384e89a39146102ea5780638da5cb5b1461031a578063965dc5a61461033857806397b8b988146103695780639bc27f9714610385578063a906b57d146103a15761018e565b80633f4ba83a1161014b5780636eee90f9116101255780636eee90f91461029c578063715018a6146102b857806381d136cb146102c25780638456cb59146102e05761018e565b80633f4ba83a146102565780634f04effc146102605780635c975abb1461027e5761018e565b80631530b02f146101935780631ca8b6cb146101af57806321669031146101cd5780632799f04d146101e95780633e8fde55146102075780633f01b6e114610225575b600080fd5b6101ad60048036038101906101a891906115f6565b6104be565b005b6101b76104d0565b6040516101c4919061163c565b60405180910390f35b6101e760048036038101906101e291906116b5565b6104d6565b005b6101f1610522565b6040516101fe919061163c565b60405180910390f35b61020f610528565b60405161021c9190611741565b60405180910390f35b61023f600480360381019061023a91906118a2565b61054e565b60405161024d9291906118fa565b60405180910390f35b61025e6105c2565b005b6102686105d4565b6040516102759190611944565b60405180910390f35b6102866105fa565b604051610293919061197a565b60405180910390f35b6102b660048036038101906102b191906119f5565b610610565b005b6102c0610964565b005b6102ca610978565b6040516102d7919061163c565b60405180910390f35b6102e861097e565b005b61030460048036038101906102ff9190611a9d565b610990565b604051610311919061163c565b60405180910390f35b610322610a5b565b60405161032f9190611aca565b60405180910390f35b610352600480360381019061034d9190611ae5565b610a84565b604051610360929190611b75565b60405180910390f35b610383600480360381019061037e91906116b5565b610c16565b005b61039f600480360381019061039a9190611a9d565b610df4565b005b6103bb60048036038101906103b691906116b5565b610e06565b6040516103c8919061163c565b60405180910390f35b6103eb60048036038101906103e691906116b5565b610f64565b005b61040760048036038101906104029190611a9d565b610fb0565b005b610423600480360381019061041e91906116b5565b610fc2565b604051610430919061163c565b60405180910390f35b610453600480360381019061044e9190611a9d565b610fda565b005b61046f600480360381019061046a91906116b5565b611114565b005b61048b600480360381019061048691906116b5565b611197565b005b6104a760048036038101906104a29190611b9e565b6111e3565b6040516104b5929190611bde565b60405180910390f35b6104c6611203565b8060088190555050565b60075481565b6104de611203565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60065481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080604083511015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611c64565b60405180910390fd5b600080848060200190518101906105ad9190611cd7565b80925081935050508181935093505050915091565b6105ca611203565b6105d2611281565b565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060149054906101000a900460ff16905090565b6106186112e3565b610620611332565b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff160361068f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068690611d63565b60405180910390fd5b60008061069e85858533610a84565b809350819250505060006106b133610e06565b905060006106be84610990565b9050600081836106ce9190611db2565b905060008111610713576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070a90611e32565b60405180910390fd5b80600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610794576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078b90611e9e565b60405180910390fd5b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054816107df9190611ebe565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b815260040161083e9291906118fa565b6020604051808303816000875af115801561085d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108819190611f1e565b6108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b790611f97565b60405180910390fd5b80600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d48260405161094a919061163c565b60405180910390a2505050505061095f61137c565b505050565b61096c611203565b6109766000611385565b565b60055481565b610986611203565b61098e611449565b565b60008082036109a25760009050610a56565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166320edeaf36040518163ffffffff1660e01b8152600401606060405180830381865afa158015610a11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a359190611ff0565b509150508281600654610a489190612072565b610a5291906120a3565b9150505b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1603610af6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aed90611d63565b60405180910390fd5b600080610b028661054e565b80925081935050508473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614610b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6f90612131565b60405180910390fd5b60008282604051602001610b8d9291906118fa565b604051602081830303815290604052805190602001209050600080610bf68b8b80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050600854856114ac565b90508015610c02578391505b808296509650505050505094509492505050565b610c1e611203565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610c7b9190611aca565b602060405180830381865afa158015610c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbc9190612151565b905060008111610d01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf8906121ca565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401610d5e9291906118fa565b6020604051808303816000875af1158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da19190611f1e565b503373ffffffffffffffffffffffffffffffffffffffff167f3a4afd8a9724155b12ea557db158dc8fb5a7ada04310666c510fb5f370ebd4c582604051610de8919061163c565b60405180910390a25050565b610dfc611203565b8060068190555050565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370cd5a80846040518263ffffffff1660e01b8152600401610e649190611aca565b602060405180830381865afa158015610e81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea59190612151565b90506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166397fa420f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190612151565b9050600081600554610f4c9190612072565b90508281610f5a91906120a3565b9350505050919050565b610f6c611203565b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610fb8611203565b8060058190555050565b60096020528060005260406000206000915090505481565b610fe2611203565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401611041939291906121ea565b6020604051808303816000875af1158015611060573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110849190611f1e565b6110c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ba9061226d565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f59062170a285eb80e8c6b8ced60428442a51910635005233fc4ce084a475845e82604051611109919061163c565b60405180910390a250565b61111c611203565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361118b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611182906122ff565b60405180910390fd5b61119481611385565b50565b61119f611203565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806111ef84610e06565b6111f884610990565b915091509250929050565b61120b6114c3565b73ffffffffffffffffffffffffffffffffffffffff16611229610a5b565b73ffffffffffffffffffffffffffffffffffffffff161461127f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112769061236b565b60405180910390fd5b565b6112896114cb565b60008060146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6112cc6114c3565b6040516112d99190611aca565b60405180910390a1565b600260015403611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f906123d7565b60405180910390fd5b6002600181905550565b61133a6105fa565b1561137a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137190612443565b60405180910390fd5b565b60018081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611451611332565b6001600060146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114956114c3565b6040516114a29190611aca565b60405180910390a1565b6000826114b98584611514565b1490509392505050565b600033905090565b6114d36105fa565b611512576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611509906124af565b60405180910390fd5b565b60008082905060005b845181101561155f5761154a8286838151811061153d5761153c6124cf565b5b602002602001015161156a565b91508080611557906124fe565b91505061151d565b508091505092915050565b60008183106115825761157d8284611595565b61158d565b61158c8383611595565b5b905092915050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6115d3816115c0565b81146115de57600080fd5b50565b6000813590506115f0816115ca565b92915050565b60006020828403121561160c5761160b6115b6565b5b600061161a848285016115e1565b91505092915050565b6000819050919050565b61163681611623565b82525050565b6000602082019050611651600083018461162d565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061168282611657565b9050919050565b61169281611677565b811461169d57600080fd5b50565b6000813590506116af81611689565b92915050565b6000602082840312156116cb576116ca6115b6565b5b60006116d9848285016116a0565b91505092915050565b6000819050919050565b60006117076117026116fd84611657565b6116e2565b611657565b9050919050565b6000611719826116ec565b9050919050565b600061172b8261170e565b9050919050565b61173b81611720565b82525050565b60006020820190506117566000830184611732565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6117af82611766565b810181811067ffffffffffffffff821117156117ce576117cd611777565b5b80604052505050565b60006117e16115ac565b90506117ed82826117a6565b919050565b600067ffffffffffffffff82111561180d5761180c611777565b5b61181682611766565b9050602081019050919050565b82818337600083830152505050565b6000611845611840846117f2565b6117d7565b90508281526020810184848401111561186157611860611761565b5b61186c848285611823565b509392505050565b600082601f8301126118895761188861175c565b5b8135611899848260208601611832565b91505092915050565b6000602082840312156118b8576118b76115b6565b5b600082013567ffffffffffffffff8111156118d6576118d56115bb565b5b6118e284828501611874565b91505092915050565b6118f481611677565b82525050565b600060408201905061190f60008301856118eb565b61191c602083018461162d565b9392505050565b600061192e8261170e565b9050919050565b61193e81611923565b82525050565b60006020820190506119596000830184611935565b92915050565b60008115159050919050565b6119748161195f565b82525050565b600060208201905061198f600083018461196b565b92915050565b600080fd5b600080fd5b60008083601f8401126119b5576119b461175c565b5b8235905067ffffffffffffffff8111156119d2576119d1611995565b5b6020830191508360208202830111156119ee576119ed61199a565b5b9250929050565b600080600060408486031215611a0e57611a0d6115b6565b5b600084013567ffffffffffffffff811115611a2c57611a2b6115bb565b5b611a388682870161199f565b9350935050602084013567ffffffffffffffff811115611a5b57611a5a6115bb565b5b611a6786828701611874565b9150509250925092565b611a7a81611623565b8114611a8557600080fd5b50565b600081359050611a9781611a71565b92915050565b600060208284031215611ab357611ab26115b6565b5b6000611ac184828501611a88565b91505092915050565b6000602082019050611adf60008301846118eb565b92915050565b60008060008060608587031215611aff57611afe6115b6565b5b600085013567ffffffffffffffff811115611b1d57611b1c6115bb565b5b611b298782880161199f565b9450945050602085013567ffffffffffffffff811115611b4c57611b4b6115bb565b5b611b5887828801611874565b9250506040611b69878288016116a0565b91505092959194509250565b6000604082019050611b8a600083018561196b565b611b97602083018461162d565b9392505050565b60008060408385031215611bb557611bb46115b6565b5b6000611bc3858286016116a0565b9250506020611bd485828601611a88565b9150509250929050565b6000604082019050611bf3600083018561162d565b611c00602083018461162d565b9392505050565b600082825260208201905092915050565b7f44617461206c656e67746820697320696e73756666696369656e740000000000600082015250565b6000611c4e601b83611c07565b9150611c5982611c18565b602082019050919050565b60006020820190508181036000830152611c7d81611c41565b9050919050565b6000611c8f82611657565b9050919050565b611c9f81611c84565b8114611caa57600080fd5b50565b600081519050611cbc81611c96565b92915050565b600081519050611cd181611a71565b92915050565b60008060408385031215611cee57611ced6115b6565b5b6000611cfc85828601611cad565b9250506020611d0d85828601611cc2565b9150509250929050565b7f4552524f523a20496e76616c6964206164647265737300000000000000000000600082015250565b6000611d4d601683611c07565b9150611d5882611d17565b602082019050919050565b60006020820190508181036000830152611d7c81611d40565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611dbd82611623565b9150611dc883611623565b9250828201905080821115611de057611ddf611d83565b5b92915050565b7f4552524f523a204e6f20746f6b656e7320746f20636c61696d2e000000000000600082015250565b6000611e1c601a83611c07565b9150611e2782611de6565b602082019050919050565b60006020820190508181036000830152611e4b81611e0f565b9050919050565b7f4552524f523a20546f6b656e7320616c726561647920636c61696d65642e0000600082015250565b6000611e88601e83611c07565b9150611e9382611e52565b602082019050919050565b60006020820190508181036000830152611eb781611e7b565b9050919050565b6000611ec982611623565b9150611ed483611623565b9250828203905081811115611eec57611eeb611d83565b5b92915050565b611efb8161195f565b8114611f0657600080fd5b50565b600081519050611f1881611ef2565b92915050565b600060208284031215611f3457611f336115b6565b5b6000611f4284828501611f09565b91505092915050565b7f4552524f523a205472616e73666572206661696c656400000000000000000000600082015250565b6000611f81601683611c07565b9150611f8c82611f4b565b602082019050919050565b60006020820190508181036000830152611fb081611f74565b9050919050565b600060ff82169050919050565b611fcd81611fb7565b8114611fd857600080fd5b50565b600081519050611fea81611fc4565b92915050565b600080600060608486031215612009576120086115b6565b5b600061201786828701611cc2565b935050602061202886828701611cc2565b925050604061203986828701611fdb565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061207d82611623565b915061208883611623565b92508261209857612097612043565b5b828204905092915050565b60006120ae82611623565b91506120b983611623565b92508282026120c781611623565b915082820484148315176120de576120dd611d83565b5b5092915050565b7f4552524f523a2041646472657373206973206e6f74207468652073616d652e00600082015250565b600061211b601f83611c07565b9150612126826120e5565b602082019050919050565b6000602082019050818103600083015261214a8161210e565b9050919050565b600060208284031215612167576121666115b6565b5b600061217584828501611cc2565b91505092915050565b7f4552524f523a204e6f20746f6b656e7320746f206275726e0000000000000000600082015250565b60006121b4601883611c07565b91506121bf8261217e565b602082019050919050565b600060208201905081810360008301526121e3816121a7565b9050919050565b60006060820190506121ff60008301866118eb565b61220c60208301856118eb565b612219604083018461162d565b949350505050565b7f4552524f52203431323a20546f6b656e207472616e73666572206661696c6564600082015250565b6000612257602083611c07565b915061226282612221565b602082019050919050565b600060208201905081810360008301526122868161224a565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006122e9602683611c07565b91506122f48261228d565b604082019050919050565b60006020820190508181036000830152612318816122dc565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612355602083611c07565b91506123608261231f565b602082019050919050565b6000602082019050818103600083015261238481612348565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b60006123c1601f83611c07565b91506123cc8261238b565b602082019050919050565b600060208201905081810360008301526123f0816123b4565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b600061242d601083611c07565b9150612438826123f7565b602082019050919050565b6000602082019050818103600083015261245c81612420565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b6000612499601483611c07565b91506124a482612463565b602082019050919050565b600060208201905081810360008301526124c88161248c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061250982611623565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361253b5761253a611d83565b5b60018201905091905056fea26469706673582212202eb1d09faa6b7d4021d7ebabf24879e9e39fbf0b8c3694ed573b66108df0cab164736f6c63430008120033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806384e89a39116100de578063bf919f3a11610097578063dd49756e11610071578063dd49756e14610439578063f2fde38b14610455578063f8dd674714610471578063fd9f48df1461048d5761018e565b8063bf919f3a146103d1578063c1c50006146103ed578063c884ef83146104095761018e565b806384e89a39146102ea5780638da5cb5b1461031a578063965dc5a61461033857806397b8b988146103695780639bc27f9714610385578063a906b57d146103a15761018e565b80633f4ba83a1161014b5780636eee90f9116101255780636eee90f91461029c578063715018a6146102b857806381d136cb146102c25780638456cb59146102e05761018e565b80633f4ba83a146102565780634f04effc146102605780635c975abb1461027e5761018e565b80631530b02f146101935780631ca8b6cb146101af57806321669031146101cd5780632799f04d146101e95780633e8fde55146102075780633f01b6e114610225575b600080fd5b6101ad60048036038101906101a891906115f6565b6104be565b005b6101b76104d0565b6040516101c4919061163c565b60405180910390f35b6101e760048036038101906101e291906116b5565b6104d6565b005b6101f1610522565b6040516101fe919061163c565b60405180910390f35b61020f610528565b60405161021c9190611741565b60405180910390f35b61023f600480360381019061023a91906118a2565b61054e565b60405161024d9291906118fa565b60405180910390f35b61025e6105c2565b005b6102686105d4565b6040516102759190611944565b60405180910390f35b6102866105fa565b604051610293919061197a565b60405180910390f35b6102b660048036038101906102b191906119f5565b610610565b005b6102c0610964565b005b6102ca610978565b6040516102d7919061163c565b60405180910390f35b6102e861097e565b005b61030460048036038101906102ff9190611a9d565b610990565b604051610311919061163c565b60405180910390f35b610322610a5b565b60405161032f9190611aca565b60405180910390f35b610352600480360381019061034d9190611ae5565b610a84565b604051610360929190611b75565b60405180910390f35b610383600480360381019061037e91906116b5565b610c16565b005b61039f600480360381019061039a9190611a9d565b610df4565b005b6103bb60048036038101906103b691906116b5565b610e06565b6040516103c8919061163c565b60405180910390f35b6103eb60048036038101906103e691906116b5565b610f64565b005b61040760048036038101906104029190611a9d565b610fb0565b005b610423600480360381019061041e91906116b5565b610fc2565b604051610430919061163c565b60405180910390f35b610453600480360381019061044e9190611a9d565b610fda565b005b61046f600480360381019061046a91906116b5565b611114565b005b61048b600480360381019061048691906116b5565b611197565b005b6104a760048036038101906104a29190611b9e565b6111e3565b6040516104b5929190611bde565b60405180910390f35b6104c6611203565b8060088190555050565b60075481565b6104de611203565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60065481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080604083511015610596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058d90611c64565b60405180910390fd5b600080848060200190518101906105ad9190611cd7565b80925081935050508181935093505050915091565b6105ca611203565b6105d2611281565b565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060149054906101000a900460ff16905090565b6106186112e3565b610620611332565b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff160361068f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068690611d63565b60405180910390fd5b60008061069e85858533610a84565b809350819250505060006106b133610e06565b905060006106be84610990565b9050600081836106ce9190611db2565b905060008111610713576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070a90611e32565b60405180910390fd5b80600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610794576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078b90611e9e565b60405180910390fd5b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054816107df9190611ebe565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b815260040161083e9291906118fa565b6020604051808303816000875af115801561085d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108819190611f1e565b6108c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b790611f97565b60405180910390fd5b80600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d48260405161094a919061163c565b60405180910390a2505050505061095f61137c565b505050565b61096c611203565b6109766000611385565b565b60055481565b610986611203565b61098e611449565b565b60008082036109a25760009050610a56565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166320edeaf36040518163ffffffff1660e01b8152600401606060405180830381865afa158015610a11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a359190611ff0565b509150508281600654610a489190612072565b610a5291906120a3565b9150505b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1603610af6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aed90611d63565b60405180910390fd5b600080610b028661054e565b80925081935050508473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614610b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6f90612131565b60405180910390fd5b60008282604051602001610b8d9291906118fa565b604051602081830303815290604052805190602001209050600080610bf68b8b80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050600854856114ac565b90508015610c02578391505b808296509650505050505094509492505050565b610c1e611203565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610c7b9190611aca565b602060405180830381865afa158015610c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbc9190612151565b905060008111610d01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf8906121ca565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401610d5e9291906118fa565b6020604051808303816000875af1158015610d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da19190611f1e565b503373ffffffffffffffffffffffffffffffffffffffff167f3a4afd8a9724155b12ea557db158dc8fb5a7ada04310666c510fb5f370ebd4c582604051610de8919061163c565b60405180910390a25050565b610dfc611203565b8060068190555050565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370cd5a80846040518263ffffffff1660e01b8152600401610e649190611aca565b602060405180830381865afa158015610e81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea59190612151565b90506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166397fa420f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190612151565b9050600081600554610f4c9190612072565b90508281610f5a91906120a3565b9350505050919050565b610f6c611203565b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610fb8611203565b8060058190555050565b60096020528060005260406000206000915090505481565b610fe2611203565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401611041939291906121ea565b6020604051808303816000875af1158015611060573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110849190611f1e565b6110c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ba9061226d565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f59062170a285eb80e8c6b8ced60428442a51910635005233fc4ce084a475845e82604051611109919061163c565b60405180910390a250565b61111c611203565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361118b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611182906122ff565b60405180910390fd5b61119481611385565b50565b61119f611203565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806111ef84610e06565b6111f884610990565b915091509250929050565b61120b6114c3565b73ffffffffffffffffffffffffffffffffffffffff16611229610a5b565b73ffffffffffffffffffffffffffffffffffffffff161461127f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112769061236b565b60405180910390fd5b565b6112896114cb565b60008060146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6112cc6114c3565b6040516112d99190611aca565b60405180910390a1565b600260015403611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f906123d7565b60405180910390fd5b6002600181905550565b61133a6105fa565b1561137a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137190612443565b60405180910390fd5b565b60018081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611451611332565b6001600060146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114956114c3565b6040516114a29190611aca565b60405180910390a1565b6000826114b98584611514565b1490509392505050565b600033905090565b6114d36105fa565b611512576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611509906124af565b60405180910390fd5b565b60008082905060005b845181101561155f5761154a8286838151811061153d5761153c6124cf565b5b602002602001015161156a565b91508080611557906124fe565b91505061151d565b508091505092915050565b60008183106115825761157d8284611595565b61158d565b61158c8383611595565b5b905092915050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6115d3816115c0565b81146115de57600080fd5b50565b6000813590506115f0816115ca565b92915050565b60006020828403121561160c5761160b6115b6565b5b600061161a848285016115e1565b91505092915050565b6000819050919050565b61163681611623565b82525050565b6000602082019050611651600083018461162d565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061168282611657565b9050919050565b61169281611677565b811461169d57600080fd5b50565b6000813590506116af81611689565b92915050565b6000602082840312156116cb576116ca6115b6565b5b60006116d9848285016116a0565b91505092915050565b6000819050919050565b60006117076117026116fd84611657565b6116e2565b611657565b9050919050565b6000611719826116ec565b9050919050565b600061172b8261170e565b9050919050565b61173b81611720565b82525050565b60006020820190506117566000830184611732565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6117af82611766565b810181811067ffffffffffffffff821117156117ce576117cd611777565b5b80604052505050565b60006117e16115ac565b90506117ed82826117a6565b919050565b600067ffffffffffffffff82111561180d5761180c611777565b5b61181682611766565b9050602081019050919050565b82818337600083830152505050565b6000611845611840846117f2565b6117d7565b90508281526020810184848401111561186157611860611761565b5b61186c848285611823565b509392505050565b600082601f8301126118895761188861175c565b5b8135611899848260208601611832565b91505092915050565b6000602082840312156118b8576118b76115b6565b5b600082013567ffffffffffffffff8111156118d6576118d56115bb565b5b6118e284828501611874565b91505092915050565b6118f481611677565b82525050565b600060408201905061190f60008301856118eb565b61191c602083018461162d565b9392505050565b600061192e8261170e565b9050919050565b61193e81611923565b82525050565b60006020820190506119596000830184611935565b92915050565b60008115159050919050565b6119748161195f565b82525050565b600060208201905061198f600083018461196b565b92915050565b600080fd5b600080fd5b60008083601f8401126119b5576119b461175c565b5b8235905067ffffffffffffffff8111156119d2576119d1611995565b5b6020830191508360208202830111156119ee576119ed61199a565b5b9250929050565b600080600060408486031215611a0e57611a0d6115b6565b5b600084013567ffffffffffffffff811115611a2c57611a2b6115bb565b5b611a388682870161199f565b9350935050602084013567ffffffffffffffff811115611a5b57611a5a6115bb565b5b611a6786828701611874565b9150509250925092565b611a7a81611623565b8114611a8557600080fd5b50565b600081359050611a9781611a71565b92915050565b600060208284031215611ab357611ab26115b6565b5b6000611ac184828501611a88565b91505092915050565b6000602082019050611adf60008301846118eb565b92915050565b60008060008060608587031215611aff57611afe6115b6565b5b600085013567ffffffffffffffff811115611b1d57611b1c6115bb565b5b611b298782880161199f565b9450945050602085013567ffffffffffffffff811115611b4c57611b4b6115bb565b5b611b5887828801611874565b9250506040611b69878288016116a0565b91505092959194509250565b6000604082019050611b8a600083018561196b565b611b97602083018461162d565b9392505050565b60008060408385031215611bb557611bb46115b6565b5b6000611bc3858286016116a0565b9250506020611bd485828601611a88565b9150509250929050565b6000604082019050611bf3600083018561162d565b611c00602083018461162d565b9392505050565b600082825260208201905092915050565b7f44617461206c656e67746820697320696e73756666696369656e740000000000600082015250565b6000611c4e601b83611c07565b9150611c5982611c18565b602082019050919050565b60006020820190508181036000830152611c7d81611c41565b9050919050565b6000611c8f82611657565b9050919050565b611c9f81611c84565b8114611caa57600080fd5b50565b600081519050611cbc81611c96565b92915050565b600081519050611cd181611a71565b92915050565b60008060408385031215611cee57611ced6115b6565b5b6000611cfc85828601611cad565b9250506020611d0d85828601611cc2565b9150509250929050565b7f4552524f523a20496e76616c6964206164647265737300000000000000000000600082015250565b6000611d4d601683611c07565b9150611d5882611d17565b602082019050919050565b60006020820190508181036000830152611d7c81611d40565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611dbd82611623565b9150611dc883611623565b9250828201905080821115611de057611ddf611d83565b5b92915050565b7f4552524f523a204e6f20746f6b656e7320746f20636c61696d2e000000000000600082015250565b6000611e1c601a83611c07565b9150611e2782611de6565b602082019050919050565b60006020820190508181036000830152611e4b81611e0f565b9050919050565b7f4552524f523a20546f6b656e7320616c726561647920636c61696d65642e0000600082015250565b6000611e88601e83611c07565b9150611e9382611e52565b602082019050919050565b60006020820190508181036000830152611eb781611e7b565b9050919050565b6000611ec982611623565b9150611ed483611623565b9250828203905081811115611eec57611eeb611d83565b5b92915050565b611efb8161195f565b8114611f0657600080fd5b50565b600081519050611f1881611ef2565b92915050565b600060208284031215611f3457611f336115b6565b5b6000611f4284828501611f09565b91505092915050565b7f4552524f523a205472616e73666572206661696c656400000000000000000000600082015250565b6000611f81601683611c07565b9150611f8c82611f4b565b602082019050919050565b60006020820190508181036000830152611fb081611f74565b9050919050565b600060ff82169050919050565b611fcd81611fb7565b8114611fd857600080fd5b50565b600081519050611fea81611fc4565b92915050565b600080600060608486031215612009576120086115b6565b5b600061201786828701611cc2565b935050602061202886828701611cc2565b925050604061203986828701611fdb565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061207d82611623565b915061208883611623565b92508261209857612097612043565b5b828204905092915050565b60006120ae82611623565b91506120b983611623565b92508282026120c781611623565b915082820484148315176120de576120dd611d83565b5b5092915050565b7f4552524f523a2041646472657373206973206e6f74207468652073616d652e00600082015250565b600061211b601f83611c07565b9150612126826120e5565b602082019050919050565b6000602082019050818103600083015261214a8161210e565b9050919050565b600060208284031215612167576121666115b6565b5b600061217584828501611cc2565b91505092915050565b7f4552524f523a204e6f20746f6b656e7320746f206275726e0000000000000000600082015250565b60006121b4601883611c07565b91506121bf8261217e565b602082019050919050565b600060208201905081810360008301526121e3816121a7565b9050919050565b60006060820190506121ff60008301866118eb565b61220c60208301856118eb565b612219604083018461162d565b949350505050565b7f4552524f52203431323a20546f6b656e207472616e73666572206661696c6564600082015250565b6000612257602083611c07565b915061226282612221565b602082019050919050565b600060208201905081810360008301526122868161224a565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006122e9602683611c07565b91506122f48261228d565b604082019050919050565b60006020820190508181036000830152612318816122dc565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612355602083611c07565b91506123608261231f565b602082019050919050565b6000602082019050818103600083015261238481612348565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00600082015250565b60006123c1601f83611c07565b91506123cc8261238b565b602082019050919050565b600060208201905081810360008301526123f0816123b4565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b600061242d601083611c07565b9150612438826123f7565b602082019050919050565b6000602082019050818103600083015261245c81612420565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b6000612499601483611c07565b91506124a482612463565b602082019050919050565b600060208201905081810360008301526124c88161248c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061250982611623565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361253b5761253a611d83565b5b60018201905091905056fea26469706673582212202eb1d09faa6b7d4021d7ebabf24879e9e39fbf0b8c3694ed573b66108df0cab164736f6c63430008120033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.