Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 5,037 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Set Approval For... | 24001315 | 8 hrs ago | IN | 0 ETH | 0.00000699 | ||||
| Set Approval For... | 24001315 | 8 hrs ago | IN | 0 ETH | 0.00000405 | ||||
| Set Approval For... | 23980598 | 3 days ago | IN | 0 ETH | 0.00001105 | ||||
| Safe Transfer Fr... | 23950527 | 7 days ago | IN | 0 ETH | 0.00000113 | ||||
| Safe Transfer Fr... | 23950524 | 7 days ago | IN | 0 ETH | 0.00000116 | ||||
| Safe Transfer Fr... | 23950521 | 7 days ago | IN | 0 ETH | 0.00000201 | ||||
| Set Approval For... | 23934729 | 9 days ago | IN | 0 ETH | 0.00010589 | ||||
| Set Approval For... | 23888053 | 16 days ago | IN | 0 ETH | 0.00000275 | ||||
| Set Approval For... | 23876395 | 17 days ago | IN | 0 ETH | 0.00001336 | ||||
| Set Approval For... | 23835451 | 23 days ago | IN | 0 ETH | 0.00012521 | ||||
| Set Approval For... | 23641988 | 50 days ago | IN | 0 ETH | 0.00010406 | ||||
| Set Approval For... | 23623491 | 53 days ago | IN | 0 ETH | 0.00001015 | ||||
| Set Approval For... | 23604338 | 56 days ago | IN | 0 ETH | 0.00006222 | ||||
| Set Approval For... | 23463891 | 75 days ago | IN | 0 ETH | 0.00007268 | ||||
| Set Approval For... | 23463890 | 75 days ago | IN | 0 ETH | 0.0000419 | ||||
| Set Approval For... | 23409002 | 83 days ago | IN | 0 ETH | 0.00001115 | ||||
| Safe Transfer Fr... | 23368907 | 88 days ago | IN | 0 ETH | 0.00018127 | ||||
| Set Approval For... | 23363540 | 89 days ago | IN | 0 ETH | 0.00005942 | ||||
| Set Approval For... | 23361128 | 90 days ago | IN | 0 ETH | 0.00000667 | ||||
| Set Approval For... | 23356003 | 90 days ago | IN | 0 ETH | 0.00000994 | ||||
| Set Approval For... | 23353035 | 91 days ago | IN | 0 ETH | 0.00006001 | ||||
| Set Approval For... | 23344253 | 92 days ago | IN | 0 ETH | 0.0000046 | ||||
| Set Approval For... | 23344253 | 92 days ago | IN | 0 ETH | 0.00000745 | ||||
| Safe Transfer Fr... | 23335017 | 93 days ago | IN | 0 ETH | 0.00008758 | ||||
| Safe Transfer Fr... | 23326333 | 94 days ago | IN | 0 ETH | 0.00008589 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH | ||||
| Transfer | 15509506 | 1189 days ago | 0.15 ETH |
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
GmStudioCatharsis
Compiler Version
v0.8.11+commit.d7f03943
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2022 gmDAO
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@divergencetech/ethier/contracts/erc721/ERC721ACommon.sol";
import "@divergencetech/ethier/contracts/crypto/SignatureChecker.sol";
import "@divergencetech/ethier/contracts/factories/PaymentSplitterDeployer.sol";
import "../../utils/ERC2981SinglePercentual.sol";
// __ __ __
// | \ | \ \
// ______ ______ ____ _______ _| ▓▓_ __ __ ____| ▓▓\▓▓ ______
// / \| \ \ / \ ▓▓ \ | \ | \/ ▓▓ \/ \
// | ▓▓▓▓▓▓\ ▓▓▓▓▓▓\▓▓▓▓\ | ▓▓▓▓▓▓▓\▓▓▓▓▓▓ | ▓▓ | ▓▓ ▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓\
// | ▓▓ | ▓▓ ▓▓ | ▓▓ | ▓▓ \▓▓ \ | ▓▓ __| ▓▓ | ▓▓ ▓▓ | ▓▓ ▓▓ ▓▓ | ▓▓
// | ▓▓__| ▓▓ ▓▓ | ▓▓ | ▓▓__ _\▓▓▓▓▓▓\ | ▓▓| \ ▓▓__/ ▓▓ ▓▓__| ▓▓ ▓▓ ▓▓__/ ▓▓
// \▓▓ ▓▓ ▓▓ | ▓▓ | ▓▓ \ | ▓▓ \▓▓ ▓▓\▓▓ ▓▓\▓▓ ▓▓ ▓▓\▓▓ ▓▓
// _\▓▓▓▓▓▓▓\▓▓ \▓▓ \▓▓\▓▓ \▓▓▓▓▓▓▓ \▓▓▓▓ \▓▓▓▓▓▓ \▓▓▓▓▓▓▓\▓▓ \▓▓▓▓▓▓
// | \__| ▓▓
// \▓▓ ▓▓
// \▓▓▓▓▓▓
//
contract GmStudioCatharsis is
ERC721ACommon,
ReentrancyGuard,
ERC2981SinglePercentual
{
using EnumerableSet for EnumerableSet.AddressSet;
using SignatureChecker for EnumerableSet.AddressSet;
using Address for address payable;
/// @notice Price for minting
uint256 public constant MINT_PRICE = 0.15 ether;
/// @notice Splits payments between the Studio and the artist.
address payable public immutable paymentSplitter;
/// @notice Splits payments between the Studio and the artist.
address payable public immutable paymentSplitterRoyalties;
/// @notice Total maximum amount of tokens
uint32 public constant MAX_NUM_TOKENS = 999;
/// @notice Number of mints throught the early access minting interface.
uint32 internal constant NUM_EARLY_ACCESS_MINTS = 999;
/// @notice Number of mints for reserved the studio/artist.
uint32 internal constant NUM_RESERVED_MINTS = 6;
/// @notice Locks the mintReserve function
bool internal reserveMinted;
/// @notice Timestamps to enables/eisables minting interfaces
/// @dev The following order is assumed
/// signedMintOpeningTimestamp < publicMintOpeningTimestamp < mintClosingTimestamp
struct MintConfig {
uint64 signedMintOpeningTimestamp;
uint64 publicMintOpeningTimestamp;
uint64 mintClosingTimestamp;
}
/// @notice The minting configuration
MintConfig public mintConfig;
/// @notice Stores the number of tokens minted from a signature during the
/// early access stage.
/// @dev Used in `mintEarlyAccess`
mapping(bytes32 => uint256) public numEarlyAccessMintsFrom;
/// @notice Stores the number of tokens minted from a signature during the
/// public minting stage.
/// @dev Used in `mintPublic`
mapping(bytes32 => uint256) private _numPublicMintsFrom;
/// @notice Signature signers for the early access stage.
/// @dev Removing signers invalidates the corresponding signatures.
EnumerableSet.AddressSet private _signersEarlyAccess;
/// @notice Signature signers for the early access stage.
/// @dev Removing signers invalidates the corresponding signatures.
EnumerableSet.AddressSet private _signersPublic;
/// @notice tokenURI() base path.
/// @dev Without trailing slash
string internal _baseTokenURI;
constructor(
address newOwner,
address signerEarlyAccess,
address signerPublic,
string memory baseTokenURI,
MintConfig memory config,
address[] memory payees,
uint256[] memory shares,
uint256[] memory sharesRoyalties
) ERC721ACommon("Catharsis by Dario Lanza", "CATAR") {
_signersEarlyAccess.add(signerEarlyAccess);
_signersPublic.add(signerPublic);
_baseTokenURI = baseTokenURI;
mintConfig = config;
paymentSplitter = payable(
PaymentSplitterDeployer.instance().deploy(payees, shares)
);
paymentSplitterRoyalties = payable(
PaymentSplitterDeployer.instance().deploy(payees, sharesRoyalties)
);
_setRoyaltyPercentage(750);
_setRoyaltyReceiver(paymentSplitterRoyalties);
transferOwnership(newOwner);
}
// -------------------------------------------------------------------------
//
// Minting
//
// -------------------------------------------------------------------------
/// @notice Toggle minting relevant flags.
function setMintConfig(MintConfig calldata config) external onlyOwner {
mintConfig = config;
}
/* solhint-disable not-rely-on-time */
/// @dev Reverts if we are not in the early access minting window or the if
/// `mintConfig` has not been set yet.
modifier onlyDuringEarlyAccessMintingPeriod() {
if (
// solhint-disable-next-line not-rely-on-time
block.timestamp < mintConfig.signedMintOpeningTimestamp ||
block.timestamp > mintConfig.publicMintOpeningTimestamp
) revert MintDisabled();
_;
}
/// @dev Reverts if we are not in the public minting window or the if
/// `mintConfig` has not been set yet.
modifier onlyDuringPublicMintingPeriod() {
if (
block.timestamp < mintConfig.publicMintOpeningTimestamp ||
block.timestamp > mintConfig.mintClosingTimestamp
) revert MintDisabled();
_;
}
/* solhint-enable not-rely-on-time */
/// @dev Reverts if called by a contract.
modifier onlyEOA() {
/* solhint-disable-next-line avoid-tx-origin */
if (tx.origin != msg.sender) {
revert OnlyEOA();
}
_;
}
/// @notice Mints tokens to a given address using a signed message.
/// @dev The minter might be different than the receiver.
/// @param to Token receiver
/// @param num Number of tokens to be minted.
/// @param numMax Max number of tokens that can be minted to the receiver.
/// @param nonce additional signature salt.
/// @param signature to prove that the receiver is allowed to get mints.
/// @dev The signed messages is generated by concatenating
/// `address(this) || to || numMax || nonce`.
function _mintSigned(
address to,
uint16 num,
uint16 numMax,
uint128 nonce,
bytes calldata signature,
EnumerableSet.AddressSet storage signers,
mapping(bytes32 => uint256) storage numMintedFrom
) internal {
// General checks
if (num * MINT_PRICE != msg.value) revert InvalidPayment();
// Signature related checks
bytes32 message = ECDSA.toEthSignedMessageHash(
abi.encodePacked(address(this), to, numMax, nonce)
);
if (num + numMintedFrom[message] > numMax)
revert TooManyMintsRequested();
signers.requireValidSignature(message, signature);
numMintedFrom[message] += num;
_processPayment();
_processMint(to, num);
}
/// @notice Mints tokens to a given address using a signed message during
/// the early access stage.
/// @dev The minter might be different than the receiver.
/// @param to Token receiver
/// @param num Number of tokens to be minted.
/// @param numMax Max number of tokens that can be minted to the receiver.
/// @param nonce additional signature salt.
/// @param signature to prove that the receiver is allowed to get mints.
function mintEarlyAccess(
address to,
uint16 num,
uint16 numMax,
uint128 nonce,
bytes calldata signature
) external payable onlyDuringEarlyAccessMintingPeriod nonReentrant {
if (num > _numEarlyAccessMintsRemaining())
revert InsufficientTokensRemanining();
_mintSigned(
to,
num,
numMax,
nonce,
signature,
_signersEarlyAccess,
numEarlyAccessMintsFrom
);
}
/// @notice Computes the number of remaining early access mints.
/// @dev This takes into account whether or not the reserve was alredy minted.
function _numEarlyAccessMintsRemaining() internal view returns (uint256) {
uint256 maxMints = reserveMinted
? NUM_EARLY_ACCESS_MINTS + NUM_RESERVED_MINTS
: NUM_EARLY_ACCESS_MINTS;
return maxMints - totalSupply();
}
/// @notice Mints tokens for the sender using a signed message during
/// the public minting stage.
/// @param num Number of tokens to be minted.
/// @param numMax Max number of tokens that can be minted.
/// @param nonce additional signature salt.
/// @param signature to prove that the receiver is allowed to get mints.
function mintPublic(
uint16 num,
uint16 numMax,
uint128 nonce,
bytes calldata signature
) external payable onlyDuringPublicMintingPeriod onlyEOA {
_mintSigned(
msg.sender,
num,
numMax,
nonce,
signature,
_signersPublic,
_numPublicMintsFrom
);
}
/// @notice Receiver of reserve mints.
/// @dev `to` corresponds to the address of the receiver and `num` to the
/// number of tokens to be minted.
struct ReserveReceiver {
address to;
uint32 num;
}
/// @notice Mints the initial token reserve.
/// @param receivers Array of token receivers
/// @dev The minter might be different than the receiver.
/// @dev Reverts if the number of minted tokens does not equal
/// NUM_RESERVED_MINTS
function mintReserve(ReserveReceiver[] calldata receivers)
external
onlyOwner
{
if (reserveMinted) revert MintDisabled();
reserveMinted = true;
uint256 numReceivers = receivers.length;
uint256 minted = 0;
for (uint256 idx = 0; idx < numReceivers; ++idx) {
minted += receivers[idx].num;
_processMint(receivers[idx].to, receivers[idx].num);
}
if (minted != NUM_RESERVED_MINTS) revert WrongNumberOfReserveMints();
}
/// @notice Mints new tokens for the recipient.
function _processMint(address to, uint256 num) internal {
if (totalSupply() + num > MAX_NUM_TOKENS)
revert InsufficientTokensRemanining();
_mint(to, num);
}
/// @notice Computes a pseudorandom seed for a mint batch.
/// @dev Even though this process can be gamed in principle, it is extremly
/// difficult to do so in practise. Therefore we can still rely on this to
/// derive fair seeds.
function _computeBatchSeed(address to) private view returns (uint24) {
return
uint24(
bytes3(
keccak256(
abi.encodePacked(
block.timestamp,
block.difficulty,
blockhash(block.number - 1),
to
)
)
)
);
}
/// @dev Sets the extra data field during token transfers
function _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual override returns (uint24) {
// if minting, compute a batch seed
if (from == address(0)) {
return _computeBatchSeed(to);
}
// else return the current value
return previousExtraData;
}
// -------------------------------------------------------------------------
//
// Signature validataion
//
// -------------------------------------------------------------------------
/// @notice The different minting stages
enum MintingStage {
EarlyAccess,
Public
}
/// @notice Helper function the retrieves the correct set of signers for
/// a given minting stage.
function _getSigners(MintingStage stage)
internal
view
returns (EnumerableSet.AddressSet storage)
{
if (stage == MintingStage.EarlyAccess) return _signersEarlyAccess;
if (stage == MintingStage.Public) return _signersPublic;
revert WrongMintingStage();
}
/// @notice Removes and adds addresses to the set of allowed signers.
/// @dev Removal is performed before addition.
function changeSigners(
MintingStage stage,
address[] calldata delSigners,
address[] calldata addSigners
) external onlyOwner {
EnumerableSet.AddressSet storage _signers = _getSigners(stage);
for (uint256 idx; idx < delSigners.length; ++idx) {
_signers.remove(delSigners[idx]);
}
for (uint256 idx; idx < addSigners.length; ++idx) {
_signers.add(addSigners[idx]);
}
}
/// @notice Returns the addresses that are used for signature verification
/// for a given minting stage.
function getSigners(MintingStage stage)
external
view
returns (address[] memory signers)
{
EnumerableSet.AddressSet storage _signers = _getSigners(stage);
uint256 len = _signers.length();
signers = new address[](len);
for (uint256 idx = 0; idx < len; ++idx) {
signers[idx] = _signers.at(idx);
}
}
// -------------------------------------------------------------------------
//
// Payment
//
// -------------------------------------------------------------------------
/// @notice Processes an incoming payment and sends it to the payment
/// splitter.
function _processPayment() internal {
paymentSplitter.sendValue(msg.value);
}
// -------------------------------------------------------------------------
//
// Metadata
//
// -------------------------------------------------------------------------
/// @notice Change tokenURI() base path.
/// @param uri The new base path (must not contain trailing slash)
function setBaseTokenURI(string calldata uri) external onlyOwner {
_baseTokenURI = uri;
}
/// @notice Returns the URI for token metadata.
function tokenURI(uint256 tokenId)
public
view
override
tokenExists(tokenId)
returns (string memory)
{
return
string(
abi.encodePacked(
_baseTokenURI,
"/",
Strings.toString(tokenId),
".json"
)
);
}
/// @notice Returns the seed of a token.
/// @dev The seed is computed from the seed of the batch in which the given
/// token was minted.
function tokenSeed(uint256 tokenId)
public
view
tokenExists(tokenId)
returns (bytes32)
{
uint24 batchSeed = _ownershipOf(tokenId).extraData;
return keccak256(abi.encodePacked(address(this), batchSeed, tokenId));
}
// -------------------------------------------------------------------------
//
// Internals
//
// -------------------------------------------------------------------------
/// @dev See {IERC165-supportsInterface}.
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721ACommon, ERC2981)
returns (bool)
{
return
ERC721ACommon.supportsInterface(interfaceId) ||
ERC2981.supportsInterface(interfaceId);
}
// -------------------------------------------------------------------------
//
// Errors
//
// -------------------------------------------------------------------------
error MintDisabled();
error TooManyMintsRequested();
error InsufficientTokensRemanining();
error InvalidPayment();
error OnlyEOA();
error WrongNumberOfReserveMints();
error SignatureAlreadyUsed();
error WrongMintingStage();
}// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
/**
@title SignatureChecker
@notice Additional functions for EnumerableSet.Addresset that require a valid
ECDSA signature of a standardized message, signed by any member of the set.
*/
library SignatureChecker {
using EnumerableSet for EnumerableSet.AddressSet;
/**
@notice Requires that the message has not been used previously and that the
recovered signer is contained in the signers AddressSet.
@dev Convenience wrapper for message generation + signature verification
+ marking message as used
@param signers Set of addresses from which signatures are accepted.
@param usedMessages Set of already-used messages.
@param signature ECDSA signature of message.
*/
function requireValidSignature(
EnumerableSet.AddressSet storage signers,
bytes memory data,
bytes calldata signature,
mapping(bytes32 => bool) storage usedMessages
) internal {
bytes32 message = generateMessage(data);
require(
!usedMessages[message],
"SignatureChecker: Message already used"
);
usedMessages[message] = true;
requireValidSignature(signers, message, signature);
}
/**
@notice Requires that the message has not been used previously and that the
recovered signer is contained in the signers AddressSet.
@dev Convenience wrapper for message generation + signature verification.
*/
function requireValidSignature(
EnumerableSet.AddressSet storage signers,
bytes memory data,
bytes calldata signature
) internal view {
bytes32 message = generateMessage(data);
requireValidSignature(signers, message, signature);
}
/**
@notice Requires that the message has not been used previously and that the
recovered signer is contained in the signers AddressSet.
@dev Convenience wrapper for message generation from address +
signature verification.
*/
function requireValidSignature(
EnumerableSet.AddressSet storage signers,
address a,
bytes calldata signature
) internal view {
bytes32 message = generateMessage(abi.encodePacked(a));
requireValidSignature(signers, message, signature);
}
/**
@notice Common validator logic, checking if the recovered signer is
contained in the signers AddressSet.
*/
function validSignature(
EnumerableSet.AddressSet storage signers,
bytes32 message,
bytes calldata signature
) internal view returns (bool) {
return signers.contains(ECDSA.recover(message, signature));
}
/**
@notice Requires that the recovered signer is contained in the signers
AddressSet.
@dev Convenience wrapper that reverts if the signature validation fails.
*/
function requireValidSignature(
EnumerableSet.AddressSet storage signers,
bytes32 message,
bytes calldata signature
) internal view {
require(
validSignature(signers, message, signature),
"SignatureChecker: Invalid signature"
);
}
/**
@notice Generates a message for a given data input that will be signed
off-chain using ECDSA.
@dev For multiple data fields, a standard concatenation using
`abi.encodePacked` is commonly used to build data.
*/
function generateMessage(bytes memory data)
internal
pure
returns (bytes32)
{
return ECDSA.toEthSignedMessageHash(data);
}
}// SPDX-License-Identifier: MIT
// Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;
import "./ERC721APreApproval.sol";
import "../utils/OwnerPausable.sol";
/**
@notice An ERC721A contract with common functionality:
- OpenSea gas-free listings
- Pausable with toggling functions exposed to Owner only
*/
contract ERC721ACommon is ERC721APreApproval, OwnerPausable {
constructor(string memory name, string memory symbol)
ERC721A(name, symbol)
{} // solhint-disable-line no-empty-blocks
/// @notice Requires that the token exists.
modifier tokenExists(uint256 tokenId) {
require(ERC721A._exists(tokenId), "ERC721ACommon: Token doesn't exist");
_;
}
/// @notice Requires that msg.sender owns or is approved for the token.
modifier onlyApprovedOrOwner(uint256 tokenId) {
require(
_ownershipOf(tokenId).addr == _msgSender() ||
getApproved(tokenId) == _msgSender(),
"ERC721ACommon: Not approved nor owner"
);
_;
}
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override {
require(!paused(), "ERC721ACommon: paused");
super._beforeTokenTransfers(from, to, startTokenId, quantity);
}
/// @notice Overrides supportsInterface as required by inheritance.
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721A)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/utils/Context.sol";
import "../thirdparty/opensea/OpenSeaGasFreeListing.sol";
import "erc721a/contracts/ERC721A.sol";
/// @notice Pre-approval of OpenSea proxies for gas-less listing
/// @dev This wrapper allows users to revoke the pre-approval of their
/// associated proxy and emits the corresponding events. This is necessary for
/// external tools to index approvals correctly and inform the user.
/// @dev The pre-approval is triggered on a per-wallet basis during the first
/// transfer transactions. It will only be enabled for wallets with an existing
/// proxy. Not having a proxy incurs a gas overhead.
/// @dev This wrapper optimizes for the following scenario:
/// - The majority of users already have a wyvern proxy
/// - Most of them want to transfer tokens via wyvern exchanges
abstract contract ERC721APreApproval is ERC721A, Context {
/// @dev It is important that Active remains at first position, since this
/// is the scenario that we are trying to optimize for.
enum State {
Active,
Inactive
}
/// @notice The state of the pre-approval for a given owner
mapping(address => State) private state;
/// @dev Returns true if either standard `isApprovedForAll()` or if the
/// `operator` is the OpenSea proxy for the `owner` provided the
/// pre-approval is active.
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
if (super.isApprovedForAll(owner, operator)) {
return true;
}
return
state[owner] == State.Active &&
OpenSeaGasFreeListing.isApprovedForAll(owner, operator);
}
/// @dev Uses the standard `setApprovalForAll` or toggles the pre-approval
/// state if `operator` is the OpenSea proxy for the sender.
function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
address owner = _msgSender();
if (operator == OpenSeaGasFreeListing.proxyFor(owner)) {
state[owner] = approved ? State.Active : State.Inactive;
emit ApprovalForAll(owner, operator, approved);
} else {
super.setApprovalForAll(operator, approved);
}
}
/// @dev Checks if the receiver has an existing proxy. If not, the
/// pre-approval is disabled.
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual override {
super._beforeTokenTransfers(from, to, startTokenId, quantity);
// Exclude burns and inactive pre-approvals
if (to == address(0) || state[to] == State.Inactive) {
return;
}
address operator = OpenSeaGasFreeListing.proxyFor(to);
// Disable if `to` has no proxy
if (operator == address(0)) {
state[to] = State.Inactive;
return;
}
// Avoid emitting unnecessary events.
if (balanceOf(to) == 0) {
emit ApprovalForAll(to, operator, true);
}
}
}// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;
interface IPaymentSplitterFactory {
/// @notice Deploys a minimal contract proxy to a PaymentSplitter.
function deploy(address[] memory payees, uint256[] memory shares)
external
returns (address);
/**
@notice Deploys a minimal contract proxy to a PaymentSplitter, at a
deterministic address.
@dev Use predictDeploymentAddress() with the same salt to predit the address
before calling deployDeterministic(). See OpenZeppelin's proxy/Clones.sol
for details and caveats, primarily that this will revert if a salt is
reused.
*/
function deployDeterministic(
bytes32 salt,
address[] memory payees,
uint256[] memory shares
) external returns (address);
/**
@notice Returns the address at which a new PaymentSplitter will be deployed
if using the same salt as passed to this function.
*/
function predictDeploymentAddress(bytes32 salt)
external
view
returns (address);
}// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;
import "./IPaymentSplitterFactory.sol";
/**
@notice Convenience library for using ethier's PaymentSplitterFactory for cheap
deployment of OpenZeppelin PaymentSplitters via minimal proxy contracts. A
single factory contract is deployed on supported chains, the respective
addresses of which are determined via the chainid() and returned by this
library's instance() function.
*/
library PaymentSplitterDeployer {
/***
@notice Returns the ethier PaymentSplitterFactory instance for the current
chain.
*/
function instance() internal view returns (IPaymentSplitterFactory) {
address factory;
assembly {
switch chainid()
case 1 {
// mainnet
factory := 0xf034d6a4b1a64f0e6038632d87746ca24b79d325
}
case 4 {
// Rinkeby
factory := 0x633dc916D9f59cf4aA117dE2Bb8edF7752270EC0
}
case 1337 {
// The geth SimulatedBackend iff used with the ethier
// factorytest package.
factory := 0xa516d2c64ED7Fe2004A93Bc123854B229F3Bb738
}
}
require(
factory != address(0),
"PaymentSplitterFactory: not deployed on current chain"
);
return IPaymentSplitterFactory(factory);
}
}// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;
// Inspired by BaseOpenSea by Simon Fremaux (@dievardump) but without the need
// to pass specific addresses depending on deployment network.
// https://gist.github.com/dievardump/483eb43bc6ed30b14f01e01842e3339b/
import "./ProxyRegistry.sol";
/// @notice Library to achieve gas-free listings on OpenSea.
library OpenSeaGasFreeListing {
/**
@notice Returns whether the operator is an OpenSea proxy for the owner, thus
allowing it to list without the token owner paying gas.
@dev ERC{721,1155}.isApprovedForAll should be overriden to also check if
this function returns true.
*/
function isApprovedForAll(address owner, address operator)
internal
view
returns (bool)
{
address proxy = proxyFor(owner);
return proxy != address(0) && proxy == operator;
}
/**
@notice Returns the OpenSea proxy address for the owner.
*/
function proxyFor(address owner) internal view returns (address) {
address registry;
uint256 chainId;
assembly {
chainId := chainid()
switch chainId
// Production networks are placed higher to minimise the number of
// checks performed and therefore reduce gas. By the same rationale,
// mainnet comes before Polygon as it's more expensive.
case 1 {
// mainnet
registry := 0xa5409ec958c83c3f309868babaca7c86dcb077c1
}
case 137 {
// polygon
registry := 0x58807baD0B376efc12F5AD86aAc70E78ed67deaE
}
case 4 {
// rinkeby
registry := 0xf57b2c51ded3a29e6891aba85459d600256cf317
}
case 80001 {
// mumbai
registry := 0xff7Ca10aF37178BdD056628eF42fD7F799fAc77c
}
case 1337 {
// The geth SimulatedBackend iff used with the ethier
// openseatest package. This is mocked as a Wyvern proxy as it's
// more complex than the 0x ones.
registry := 0xE1a2bbc877b29ADBC56D2659DBcb0ae14ee62071
}
}
// Unlike Wyvern, the registry itself is the proxy for all owners on 0x
// chains.
if (registry == address(0) || chainId == 137 || chainId == 80001) {
return registry;
}
return address(ProxyRegistry(registry).proxies(owner));
}
}// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;
/// @notice A minimal interface describing OpenSea's Wyvern proxy registry.
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
/**
@dev This pattern of using an empty contract is cargo-culted directly from
OpenSea's example code. TODO: it's likely that the above mapping can be changed
to address => address without affecting anything, but further investigation is
needed (i.e. is there a subtle reason that OpenSea released it like this?).
*/
// solhint-disable-next-line no-empty-blocks
contract OwnableDelegateProxy {
}// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
/// @notice A Pausable contract that can only be toggled by the Owner.
contract OwnerPausable is Ownable, Pausable {
/// @notice Pauses the contract.
function pause() public onlyOwner {
Pausable._pause();
}
/// @notice Unpauses the contract.
function unpause() public onlyOwner {
Pausable._unpause();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
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 v4.4.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() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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.0 (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
return _values(set._inner);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// Copyright 2021 David Huber (@cxkoda)
pragma solidity >=0.8.0 <0.9.0;
import "./IERC2981.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
/**
* @notice ERC2981 royalty info base contract
* @dev Implements `supportsInterface`
*/
abstract contract ERC2981 is IERC2981, ERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC2981).interfaceId ||
super.supportsInterface(interfaceId);
}
}// SPDX-License-Identifier: MIT
// Copyright 2021 David Huber (@cxkoda)
pragma solidity >=0.8.0 <0.9.0;
import "./ERC2981.sol";
/**
* @notice ERC2981 royalty info implementation for a single beneficiary
* receving a percentage of sales prices.
* @author David Huber (@cxkoda)
*/
contract ERC2981SinglePercentual is ERC2981 {
/**
* @dev The royalty percentage (in units of 0.01%)
*/
uint96 private _percentage;
/**
* @dev The address to receive the royalties
*/
address private _receiver;
/**
* @dev See {IERC2981-royaltyInfo}.
*/
function royaltyInfo(uint256, uint256 salePrice)
external
view
override
returns (address receiver, uint256 royaltyAmount)
{
royaltyAmount = (salePrice / 10000) * _percentage;
receiver = _receiver;
}
/**
* @dev Sets the royalty percentage (in units of 0.01%)
*/
function _setRoyaltyPercentage(uint96 percentage_) internal {
_percentage = percentage_;
}
/**
* @dev Sets the address to receive the royalties
*/
function _setRoyaltyReceiver(address receiver_) internal {
_receiver = receiver_;
}
}// SPDX-License-Identifier: None
pragma solidity >=0.8.0 <0.9.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard
* @author Taken from https://eips.ethereum.org/EIPS/eip-2981
*/
interface IERC2981 is IERC165 {
/**
* @notice Called with the sale price to determine how much royalty
* is owed and to whom.
* @param tokenId - the NFT asset queried for royalty information
* @param salePrice - the sale price of the NFT asset specified by _tokenId
* @return receiver - address of who should be sent the royalty payment
* @return royaltyAmount - the royalty payment amount for _salePrice
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721A.sol';
/**
* @dev ERC721 token receiver interface.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard,
* including the Metadata extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at `_startTokenId()`
* (defaults to 0, e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is IERC721A {
// 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 tokenId of the next token 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 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
/**
* @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 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 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 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 returns (uint256) {
return _burnCounter;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
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: 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.
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view 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 {
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;
}
/**
* 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 ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed is zero.
while (packed == 0) {
packed = _packedOwnerships[--curr];
}
return packed;
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* 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);
}
/**
* Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around in the collection over time.
*/
function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @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 See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _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 '';
}
/**
* @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))
}
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
if (operator == _msgSenderERC721A()) revert ApproveToCaller();
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return
_startTokenId() <= tokenId &&
tokenId < _currentIndex && // If within bounds,
_packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned.
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, '');
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
_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 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 {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` 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 tokenId = startTokenId;
uint256 end = startTokenId + quantity;
do {
emit Transfer(address(0), to, tokenId++);
} while (tokenId < end);
_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 {
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 Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
mapping(uint256 => address) storage tokenApprovalsPtr = _tokenApprovals;
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`.
assembly {
// Compute the slot.
mstore(0x00, tokenId)
mstore(0x20, tokenApprovalsPtr.slot)
approvedAddressSlot := keccak256(0x00, 0x40)
// Load the slot's value from storage.
approvedAddress := sload(approvedAddressSlot)
}
}
/**
* @dev Returns whether the `approvedAddress` is equals to `from` or `msgSender`.
*/
function _isOwnerOrApproved(
address approvedAddress,
address from,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
from := and(from, BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, BITMASK_ADDRESS)
// `msgSender == from || msgSender == approvedAddress`.
result := or(eq(msgSender, from), eq(msgSender, approvedAddress))
}
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isOwnerOrApproved(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 `_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) = _getApprovedAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isOwnerOrApproved(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++;
}
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try 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))
}
}
}
}
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal {
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 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;
}
/**
* @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 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 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 returns (string memory ptr) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit),
// but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged.
// We will need 1 32-byte word to store the length,
// and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128.
ptr := add(mload(0x40), 128)
// Update the free memory pointer to allocate.
mstore(0x40, ptr)
// Cache the end of the memory to calculate the length later.
let end := ptr
// We write the string from the rightmost digit to the leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// Costs a bit more than early returning for the zero case,
// but cheaper in terms of deployment and overall runtime costs.
for {
// Initialize and perform the first pass without check.
let temp := value
// Move the pointer 1 byte leftwards to point to an empty character slot.
ptr := sub(ptr, 1)
// Write the character to the pointer. 48 is the ASCII index of '0'.
mstore8(ptr, add(48, mod(temp, 10)))
temp := div(temp, 10)
} temp {
// Keep dividing `temp` until zero.
temp := div(temp, 10)
} {
// Body of the for loop.
ptr := sub(ptr, 1)
mstore8(ptr, add(48, mod(temp, 10)))
}
let length := sub(end, ptr)
// Move the pointer 32 bytes leftwards to make room for the length.
ptr := sub(ptr, 32)
// Store the length.
mstore(ptr, length)
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of an ERC721A compliant contract.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* The caller cannot approve to their own address.
*/
error ApproveToCaller();
/**
* 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();
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set through `_extraData`.
uint24 extraData;
}
/**
* @dev Returns the total amount of tokens stored by the contract.
*
* Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
*/
function totalSupply() external view returns (uint256);
// ==============================
// 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);
// ==============================
// 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`.
*
* 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 be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev 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 standard. See `_mintERC2309` for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}{
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"address","name":"signerEarlyAccess","type":"address"},{"internalType":"address","name":"signerPublic","type":"address"},{"internalType":"string","name":"baseTokenURI","type":"string"},{"components":[{"internalType":"uint64","name":"signedMintOpeningTimestamp","type":"uint64"},{"internalType":"uint64","name":"publicMintOpeningTimestamp","type":"uint64"},{"internalType":"uint64","name":"mintClosingTimestamp","type":"uint64"}],"internalType":"struct GmStudioCatharsis.MintConfig","name":"config","type":"tuple"},{"internalType":"address[]","name":"payees","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"},{"internalType":"uint256[]","name":"sharesRoyalties","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InsufficientTokensRemanining","type":"error"},{"inputs":[],"name":"InvalidPayment","type":"error"},{"inputs":[],"name":"MintDisabled","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OnlyEOA","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"SignatureAlreadyUsed","type":"error"},{"inputs":[],"name":"TooManyMintsRequested","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"WrongMintingStage","type":"error"},{"inputs":[],"name":"WrongNumberOfReserveMints","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_NUM_TOKENS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum GmStudioCatharsis.MintingStage","name":"stage","type":"uint8"},{"internalType":"address[]","name":"delSigners","type":"address[]"},{"internalType":"address[]","name":"addSigners","type":"address[]"}],"name":"changeSigners","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum GmStudioCatharsis.MintingStage","name":"stage","type":"uint8"}],"name":"getSigners","outputs":[{"internalType":"address[]","name":"signers","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintConfig","outputs":[{"internalType":"uint64","name":"signedMintOpeningTimestamp","type":"uint64"},{"internalType":"uint64","name":"publicMintOpeningTimestamp","type":"uint64"},{"internalType":"uint64","name":"mintClosingTimestamp","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint16","name":"num","type":"uint16"},{"internalType":"uint16","name":"numMax","type":"uint16"},{"internalType":"uint128","name":"nonce","type":"uint128"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mintEarlyAccess","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"num","type":"uint16"},{"internalType":"uint16","name":"numMax","type":"uint16"},{"internalType":"uint128","name":"nonce","type":"uint128"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint32","name":"num","type":"uint32"}],"internalType":"struct GmStudioCatharsis.ReserveReceiver[]","name":"receivers","type":"tuple[]"}],"name":"mintReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"numEarlyAccessMintsFrom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentSplitter","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentSplitterRoyalties","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"signedMintOpeningTimestamp","type":"uint64"},{"internalType":"uint64","name":"publicMintOpeningTimestamp","type":"uint64"},{"internalType":"uint64","name":"mintClosingTimestamp","type":"uint64"}],"internalType":"struct GmStudioCatharsis.MintConfig","name":"config","type":"tuple"}],"name":"setMintConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenSeed","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60c06040523480156200001157600080fd5b5060405162003e3338038062003e3383398101604081905262000034916200089f565b604080518082018252601881527f43617468617273697320627920446172696f204c616e7a61000000000000000060208083019182528351808501909452600584526421a0aa20a960d91b908401528151919291839183916200009a916002916200056f565b508051620000b09060039060208401906200056f565b50506000805550620000c233620002da565b50506009805460ff60a01b191690556001600a55620000ef6010886200032c602090811b6200137b17901c565b506200010b8660126200032c60201b6200137b1790919060201c565b508451620001219060149060208801906200056f565b508351600d805460208088015160408901516001600160401b03908116600160801b02600160801b600160c01b031992821668010000000000000000026001600160801b0319909516919096161792909217919091169290921790556200019190620013906200034c821b17901c565b6001600160a01b0316634f62f4d184846040518363ffffffff1660e01b8152600401620001c0929190620009a7565b6020604051808303816000875af1158015620001e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000206919062000a2f565b6001600160a01b0316608052620002286200034c602090811b6200139017901c565b6001600160a01b0316634f62f4d184836040518363ffffffff1660e01b815260040162000257929190620009a7565b6020604051808303816000875af115801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d919062000a2f565b6001600160a01b031660a08190526c01000000000000000000000000026102ee17600b55620002cc886200044c565b505050505050505062000a8a565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600062000343836001600160a01b0384166200051d565b90505b92915050565b60008046600181146200037257600481146200038f576105398114620003ac57620003c4565b73f034d6a4b1a64f0e6038632d87746ca24b79d3259150620003c4565b73633dc916d9f59cf4aa117de2bb8edf7752270ec09150620003c4565b73a516d2c64ed7fe2004a93bc123854b229f3bb73891505b506001600160a01b038116620004475760405162461bcd60e51b815260206004820152603560248201527f5061796d656e7453706c6974746572466163746f72793a206e6f74206465706c60448201527f6f796564206f6e2063757272656e7420636861696e000000000000000000000060648201526084015b60405180910390fd5b919050565b6009546001600160a01b03163314620004a85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200043e565b6001600160a01b0381166200050f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016200043e565b6200051a81620002da565b50565b6000818152600183016020526040812054620005665750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000346565b50600062000346565b8280546200057d9062000a4d565b90600052602060002090601f016020900481019282620005a15760008555620005ec565b82601f10620005bc57805160ff1916838001178555620005ec565b82800160010185558215620005ec579182015b82811115620005ec578251825591602001919060010190620005cf565b50620005fa929150620005fe565b5090565b5b80821115620005fa5760008155600101620005ff565b80516001600160a01b03811681146200044757600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200066e576200066e6200062d565b604052919050565b600082601f8301126200068857600080fd5b81516001600160401b03811115620006a457620006a46200062d565b6020620006ba601f8301601f1916820162000643565b8281528582848701011115620006cf57600080fd5b60005b83811015620006ef578581018301518282018401528201620006d2565b83811115620007015760008385840101525b5095945050505050565b80516001600160401b03811681146200044757600080fd5b6000606082840312156200073657600080fd5b604051606081016001600160401b03811182821017156200075b576200075b6200062d565b6040529050806200076c836200070b565b81526200077c602084016200070b565b60208201526200078f604084016200070b565b60408201525092915050565b60006001600160401b03821115620007b757620007b76200062d565b5060051b60200190565b600082601f830112620007d357600080fd5b81516020620007ec620007e6836200079b565b62000643565b82815260059290921b840181019181810190868411156200080c57600080fd5b8286015b848110156200083257620008248162000615565b835291830191830162000810565b509695505050505050565b600082601f8301126200084f57600080fd5b8151602062000862620007e6836200079b565b82815260059290921b840181019181810190868411156200088257600080fd5b8286015b8481101562000832578051835291830191830162000886565b600080600080600080600080610140898b031215620008bd57600080fd5b620008c88962000615565b9750620008d860208a0162000615565b9650620008e860408a0162000615565b60608a01519096506001600160401b03808211156200090657600080fd5b620009148c838d0162000676565b9650620009258c60808d0162000723565b955060e08b01519150808211156200093c57600080fd5b6200094a8c838d01620007c1565b94506101008b01519150808211156200096257600080fd5b620009708c838d016200083d565b93506101208b01519150808211156200098857600080fd5b50620009978b828c016200083d565b9150509295985092959890939650565b604080825283519082018190526000906020906060840190828701845b82811015620009eb5781516001600160a01b031684529284019290840190600101620009c4565b5050508381038285015284518082528583019183019060005b8181101562000a225783518352928401929184019160010162000a04565b5090979650505050505050565b60006020828403121562000a4257600080fd5b620003438262000615565b600181811c9082168062000a6257607f821691505b6020821081141562000a8457634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05161337c62000ab7600039600061059701526000818161069a01526121bc015261337c6000f3fe6080604052600436106102045760003560e01c806370a0823111610118578063bf964b4e116100a0578063e7cc72441161006f578063e7cc724414610608578063e985e9c514610668578063ed4a6b0c14610688578063ed92d4f7146106bc578063f2fde38b146106dc57600080fd5b8063bf964b4e14610585578063c002d23d146105b9578063c615a7b2146105d5578063c87b56dd146105e857600080fd5b80638da5cb5b116100e75780638da5cb5b146104ff57806395d89b411461051d578063a22cb46514610532578063b88d4fde14610552578063bd2e4abd1461057257600080fd5b806370a082311461048a578063715018a6146104aa578063718e6adb146104bf5780638456cb59146104ea57600080fd5b806328c5846f1161019b57806342842e0e1161016a57806342842e0e146103eb5780635c975abb1461040b5780635f5168361461042a5780636352211e1461044a5780636b7813ee1461046a57600080fd5b806328c5846f1461034a5780632a55205a1461037757806330176e13146103b65780633f4ba83a146103d657600080fd5b80630ae9f4ae116101d75780630ae9f4ae146102ba57806318160ddd146102da57806323b872dd146102fd578063249c4b481461031d57600080fd5b806301ffc9a71461020957806306fdde031461023e578063081812fc14610260578063095ea7b314610298575b600080fd5b34801561021557600080fd5b506102296102243660046128df565b6106fc565b60405190151581526020015b60405180910390f35b34801561024a57600080fd5b5061025361071c565b6040516102359190612954565b34801561026c57600080fd5b5061028061027b366004612967565b6107ae565b6040516001600160a01b039091168152602001610235565b3480156102a457600080fd5b506102b86102b3366004612995565b6107f2565b005b3480156102c657600080fd5b506102b86102d53660046129c1565b610892565b3480156102e657600080fd5b50600154600054035b604051908152602001610235565b34801561030957600080fd5b506102b8610318366004612a35565b6109d7565b34801561032957600080fd5b5061033d610338366004612a85565b610b91565b6040516102359190612aa0565b34801561035657600080fd5b506102ef610365366004612967565b600e6020526000908152604090205481565b34801561038357600080fd5b50610397610392366004612aed565b610c48565b604080516001600160a01b039093168352602083019190915201610235565b3480156103c257600080fd5b506102b86103d1366004612b50565b610c91565b3480156103e257600080fd5b506102b8610ccc565b3480156103f757600080fd5b506102b8610406366004612a35565b610d00565b34801561041757600080fd5b50600954600160a01b900460ff16610229565b34801561043657600080fd5b506102ef610445366004612967565b610d1b565b34801561045657600080fd5b50610280610465366004612967565b610daa565b34801561047657600080fd5b506102b8610485366004612b91565b610db5565b34801561049657600080fd5b506102ef6104a5366004612ba3565b610dec565b3480156104b657600080fd5b506102b8610e3a565b3480156104cb57600080fd5b506104d56103e781565b60405163ffffffff9091168152602001610235565b3480156104f657600080fd5b506102b8610e6e565b34801561050b57600080fd5b506009546001600160a01b0316610280565b34801561052957600080fd5b50610253610ea0565b34801561053e57600080fd5b506102b861054d366004612bc0565b610eaf565b34801561055e57600080fd5b506102b861056d366004612c14565b610f75565b6102b8610580366004612d1c565b610fb9565b34801561059157600080fd5b506102807f000000000000000000000000000000000000000000000000000000000000000081565b3480156105c557600080fd5b506102ef670214e8348c4f000081565b6102b86105e3366004612da3565b6110a4565b3480156105f457600080fd5b50610253610603366004612967565b61112c565b34801561061457600080fd5b50600d5461063e906001600160401b0380821691600160401b8104821691600160801b9091041683565b604080516001600160401b0394851681529284166020840152921691810191909152606001610235565b34801561067457600080fd5b50610229610683366004612e18565b611187565b34801561069457600080fd5b506102807f000000000000000000000000000000000000000000000000000000000000000081565b3480156106c857600080fd5b506102b86106d7366004612e8a565b611205565b3480156106e857600080fd5b506102b86106f7366004612ba3565b6112e0565b60006107078261147c565b80610716575061071682611487565b92915050565b60606002805461072b90612ef9565b80601f016020809104026020016040519081016040528092919081815260200182805461075790612ef9565b80156107a45780601f10610779576101008083540402835291602001916107a4565b820191906000526020600020905b81548152906001019060200180831161078757829003601f168201915b5050505050905090565b60006107b9826114bc565b6107d6576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006107fd82610daa565b9050336001600160a01b03821614610836576108198133611187565b610836576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6009546001600160a01b031633146108c55760405162461bcd60e51b81526004016108bc90612f2e565b60405180910390fd5b600c5460ff16156108e9576040516317efbd6b60e01b815260040160405180910390fd5b600c805460ff19166001179055806000805b828110156109af5784848281811061091557610915612f63565b905060400201602001602081019061092d9190612f79565b61093d9063ffffffff1683612fb5565b915061099f85858381811061095457610954612f63565b61096a9260206040909202019081019150612ba3565b86868481811061097c5761097c612f63565b90506040020160200160208101906109949190612f79565b63ffffffff166114e3565b6109a881612fcd565b90506108fb565b50600681146109d1576040516378e2ffa360e01b815260040160405180910390fd5b50505050565b60006109e28261152b565b9050836001600160a01b0316816001600160a01b031614610a155760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610a6257610a458633611187565b610a6257604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610a8957604051633a954ecd60e21b815260040160405180910390fd5b610a96868686600161158c565b8015610aa157600082555b6001600160a01b03808716600090815260056020526040808220805460001901905591871681522080546001019055610afa85610adf8882876115ea565b600160e11b174260a01b176001600160a01b03919091161790565b600085815260046020526040902055600160e11b8316610b485760018401600081815260046020526040902054610b46576000548114610b465760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b60606000610b9e8361160d565b90506000610bab8261166b565b9050806001600160401b03811115610bc557610bc5612bfe565b604051908082528060200260200182016040528015610bee578160200160208202803683370190505b50925060005b81811015610c4057610c068382611675565b848281518110610c1857610c18612f63565b6001600160a01b0390921660209283029190910190910152610c3981612fcd565b9050610bf4565b505050919050565b600b5460009081906bffffffffffffffffffffffff16610c6a61271085612ffe565b610c749190613012565b600b54600160601b90046001600160a01b03169590945092505050565b6009546001600160a01b03163314610cbb5760405162461bcd60e51b81526004016108bc90612f2e565b610cc760148383612830565b505050565b6009546001600160a01b03163314610cf65760405162461bcd60e51b81526004016108bc90612f2e565b610cfe611681565b565b610cc783838360405180602001604052806000815250610f75565b600081610d27816114bc565b610d435760405162461bcd60e51b81526004016108bc90613031565b6000610d4e8461171e565b6060908101516040513090921b6001600160601b031916602083015260e881901b6001600160e81b0319166034830152603782018690529150605701604051602081830303815290604052805190602001209250505b50919050565b60006107168261152b565b6009546001600160a01b03163314610ddf5760405162461bcd60e51b81526004016108bc90612f2e565b80600d610cc7828261308c565b60006001600160a01b038216610e15576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6009546001600160a01b03163314610e645760405162461bcd60e51b81526004016108bc90612f2e565b610cfe6000611795565b6009546001600160a01b03163314610e985760405162461bcd60e51b81526004016108bc90612f2e565b610cfe6117e7565b60606003805461072b90612ef9565b33610eb98161186f565b6001600160a01b0316836001600160a01b03161415610f6b5781610ede576001610ee1565b60005b6001600160a01b0382166000908152600860205260409020805460ff191660018381811115610f1257610f12613117565b0217905550826001600160a01b0316816001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3184604051610f5e911515815260200190565b60405180910390a3505050565b610cc783836119ce565b610f808484846109d7565b6001600160a01b0383163b156109d157610f9c84848484611a64565b6109d1576040516368d2bf6b60e11b815260040160405180910390fd5b600d546001600160401b0316421080610fe35750600d54600160401b90046001600160401b031642115b15611001576040516317efbd6b60e01b815260040160405180910390fd5b6002600a5414156110545760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108bc565b6002600a55611061611b4c565b8561ffff16111561108557604051630f196e0f60e21b815260040160405180910390fd5b6110978686868686866010600e611b95565b50506001600a5550505050565b600d54600160401b90046001600160401b03164210806110d55750600d54600160801b90046001600160401b031642115b156110f3576040516317efbd6b60e01b815260040160405180910390fd5b32331461111357604051639f8129d160e01b815260040160405180910390fd5b6111253386868686866012600f611b95565b5050505050565b606081611138816114bc565b6111545760405162461bcd60e51b81526004016108bc90613031565b601461115f84611cd3565b604051602001611170929190613149565b604051602081830303815290604052915050919050565b6001600160a01b03808316600090815260076020908152604080832093851683529290529081205460ff16156111bf57506001610716565b6001600160a01b03831660009081526008602052604081205460ff1660018111156111ec576111ec613117565b1480156111fe57506111fe8383611dd0565b9392505050565b6009546001600160a01b0316331461122f5760405162461bcd60e51b81526004016108bc90612f2e565b600061123a8661160d565b905060005b848110156112895761127886868381811061125c5761125c612f63565b90506020020160208101906112719190612ba3565b8390611e0e565b5061128281612fcd565b905061123f565b5060005b828110156112d7576112c68484838181106112aa576112aa612f63565b90506020020160208101906112bf9190612ba3565b839061137b565b506112d081612fcd565b905061128d565b50505050505050565b6009546001600160a01b0316331461130a5760405162461bcd60e51b81526004016108bc90612f2e565b6001600160a01b03811661136f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108bc565b61137881611795565b50565b60006111fe836001600160a01b038416611e23565b60008046600181146113b257600481146113ce5761053981146113ea57611402565b73f034d6a4b1a64f0e6038632d87746ca24b79d3259150611402565b73633dc916d9f59cf4aa117de2bb8edf7752270ec09150611402565b73a516d2c64ed7fe2004a93bc123854b229f3bb73891505b506001600160a01b0381166114775760405162461bcd60e51b815260206004820152603560248201527f5061796d656e7453706c6974746572466163746f72793a206e6f74206465706c60448201527437bcb2b21037b71031bab93932b73a1031b430b4b760591b60648201526084016108bc565b919050565b600061071682611e72565b60006001600160e01b0319821663152a902d60e11b148061071657506301ffc9a760e01b6001600160e01b0319831614610716565b6000805482108015610716575050600090815260046020526040902054600160e01b161590565b6103e7816114f46001546000540390565b6114fe9190612fb5565b111561151d57604051630f196e0f60e21b815260040160405180910390fd5b6115278282611ec0565b5050565b60008160005481101561157357600081815260046020526040902054600160e01b8116611571575b806111fe575060001901600081815260046020526040902054611553565b505b604051636f96cda160e11b815260040160405180910390fd5b600954600160a01b900460ff16156115de5760405162461bcd60e51b8152602060048201526015602482015274115490cdcc8c5050dbdb5b5bdb8e881c185d5cd959605a1b60448201526064016108bc565b6109d184848484611fcb565b600060e882811c906115fd8686846120bf565b62ffffff16901b95945050505050565b60008082600181111561162257611622613117565b141561163057506010919050565b600182600181111561164457611644613117565b141561165257506012919050565b6040516327d0b10d60e01b815260040160405180910390fd5b6000610716825490565b60006111fe83836120e6565b600954600160a01b900460ff166116d15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108bc565b6009805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60408051608081018252600080825260208201819052918101829052606081019190915261071661174e8361152b565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600954600160a01b900460ff16156118345760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108bc565b6009805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586117013390565b6000804680600181146118a457608981146118c057600481146118dc576201388181146118f85761053981146119145761192c565b73a5409ec958c83c3f309868babaca7c86dcb077c1925061192c565b7358807bad0b376efc12f5ad86aac70e78ed67deae925061192c565b73f57b2c51ded3a29e6891aba85459d600256cf317925061192c565b73ff7ca10af37178bdd056628ef42fd7f799fac77c925061192c565b73e1a2bbc877b29adbc56d2659dbcb0ae14ee6207192505b506001600160a01b03821615806119435750806089145b8061195057508062013881145b1561195c575092915050565b60405163c455279160e01b81526001600160a01b03858116600483015283169063c455279190602401602060405180830381865afa1580156119a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c6919061320b565b949350505050565b6001600160a01b0382163314156119f85760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611a99903390899088908890600401613228565b6020604051808303816000875af1925050508015611ad4575060408051601f3d908101601f19168201909252611ad191810190613265565b60015b611b2f573d808015611b02576040519150601f19603f3d011682016040523d82523d6000602084013e611b07565b606091505b508051611b27576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b600c54600090819060ff16611b63576103e7611b70565b611b7060066103e7613282565b63ffffffff169050611b856001546000540390565b611b8f90826132aa565b91505090565b34611bac670214e8348c4f000061ffff8a16613012565b14611bca5760405163078d696560e31b815260040160405180910390fd5b6040516001600160601b031930606090811b821660208401528a901b1660348201526001600160f01b031960f088901b1660488201526fffffffffffffffffffffffffffffffff19608087901b16604a820152600090611c3b90605a01604051602081830303815290604052612110565b60008181526020849052604090205490915061ffff80891691611c5f918b16612fb5565b1115611c7e5760405163342e754760e21b815260040160405180910390fd5b611c8a8382878761214b565b6000818152602083905260408120805461ffff8b169290611cac908490612fb5565b90915550611cba90506121af565b611cc8898961ffff166114e3565b505050505050505050565b606081611cf75750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611d215780611d0b81612fcd565b9150611d1a9050600a83612ffe565b9150611cfb565b6000816001600160401b03811115611d3b57611d3b612bfe565b6040519080825280601f01601f191660200182016040528015611d65576020820181803683370190505b5090505b84156119c657611d7a6001836132aa565b9150611d87600a866132c1565b611d92906030612fb5565b60f81b818381518110611da757611da7612f63565b60200101906001600160f81b031916908160001a905350611dc9600a86612ffe565b9450611d69565b600080611ddc8461186f565b90506001600160a01b038116158015906119c65750826001600160a01b0316816001600160a01b031614949350505050565b60006111fe836001600160a01b0384166121e2565b6000818152600183016020526040812054611e6a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610716565b506000610716565b60006301ffc9a760e01b6001600160e01b031983161480611ea357506380ac58cd60e01b6001600160e01b03198316145b806107165750506001600160e01b031916635b5e139f60e01b1490565b6000546001600160a01b038316611ee957604051622e076360e81b815260040160405180910390fd5b81611f075760405163b562e8dd60e01b815260040160405180910390fd5b611f14600084838561158c565b6001600160a01b03831660009081526005602052604081208054680100000000000000018502019055611f6b908490611f4e9082816115ea565b6001851460e11b174260a01b176001600160a01b03919091161790565b600082815260046020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210611f7f5760005550505050565b6001600160a01b038316158061200d575060016001600160a01b03841660009081526008602052604090205460ff16600181111561200b5761200b613117565b145b15612017576109d1565b60006120228461186f565b90506001600160a01b03811661205b57506001600160a01b0383166000908152600860205260409020805460ff191660011790556109d1565b61206484610dec565b61112557806001600160a01b0316846001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160016040516120b0911515815260200190565b60405180910390a35050505050565b60006001600160a01b0384166120df576120d8836122d5565b90506111fe565b5092915050565b60008260000182815481106120fd576120fd612f63565b9060005260206000200154905092915050565b600061211c8251611cd3565b8260405160200161212e9291906132d5565b604051602081830303815290604052805190602001209050919050565b61215784848484612335565b6109d15760405162461bcd60e51b815260206004820152602360248201527f5369676e6174757265436865636b65723a20496e76616c6964207369676e617460448201526275726560e81b60648201526084016108bc565b610cfe6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163461238a565b600081815260018301602052604081205480156122cb5760006122066001836132aa565b855490915060009061221a906001906132aa565b905081811461227f57600086600001828154811061223a5761223a612f63565b906000526020600020015490508087600001848154811061225d5761225d612f63565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061229057612290613330565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610716565b6000915050610716565b600042446122e46001436132aa565b6040805160208101949094528301919091524060608083019190915283901b6001600160601b03191660808201526094016040516020818303038152906040528051906020012060e81c9050919050565b600061238161237a8585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506124a392505050565b86906124c7565b95945050505050565b804710156123da5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108bc565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612427576040519150601f19603f3d011682016040523d82523d6000602084013e61242c565b606091505b5050905080610cc75760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108bc565b60008060006124b285856124e9565b915091506124bf81612559565b509392505050565b6001600160a01b038116600090815260018301602052604081205415156111fe565b6000808251604114156125205760208301516040840151606085015160001a61251487828585612714565b94509450505050612552565b82516040141561254a576020830151604084015161253f868383612801565b935093505050612552565b506000905060025b9250929050565b600081600481111561256d5761256d613117565b14156125765750565b600181600481111561258a5761258a613117565b14156125d85760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016108bc565b60028160048111156125ec576125ec613117565b141561263a5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016108bc565b600381600481111561264e5761264e613117565b14156126a75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016108bc565b60048160048111156126bb576126bb613117565b14156113785760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016108bc565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561274b57506000905060036127f8565b8460ff16601b1415801561276357508460ff16601c14155b1561277457506000905060046127f8565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156127c8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166127f1576000600192509250506127f8565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b0161282287828885612714565b935093505050935093915050565b82805461283c90612ef9565b90600052602060002090601f01602090048101928261285e57600085556128a4565b82601f106128775782800160ff198235161785556128a4565b828001600101855582156128a4579182015b828111156128a4578235825591602001919060010190612889565b506128b09291506128b4565b5090565b5b808211156128b057600081556001016128b5565b6001600160e01b03198116811461137857600080fd5b6000602082840312156128f157600080fd5b81356111fe816128c9565b60005b838110156129175781810151838201526020016128ff565b838111156109d15750506000910152565b600081518084526129408160208601602086016128fc565b601f01601f19169290920160200192915050565b6020815260006111fe6020830184612928565b60006020828403121561297957600080fd5b5035919050565b6001600160a01b038116811461137857600080fd5b600080604083850312156129a857600080fd5b82356129b381612980565b946020939093013593505050565b600080602083850312156129d457600080fd5b82356001600160401b03808211156129eb57600080fd5b818501915085601f8301126129ff57600080fd5b813581811115612a0e57600080fd5b8660208260061b8501011115612a2357600080fd5b60209290920196919550909350505050565b600080600060608486031215612a4a57600080fd5b8335612a5581612980565b92506020840135612a6581612980565b929592945050506040919091013590565b80356002811061147757600080fd5b600060208284031215612a9757600080fd5b6111fe82612a76565b6020808252825182820181905260009190848201906040850190845b81811015612ae15783516001600160a01b031683529284019291840191600101612abc565b50909695505050505050565b60008060408385031215612b0057600080fd5b50508035926020909101359150565b60008083601f840112612b2157600080fd5b5081356001600160401b03811115612b3857600080fd5b60208301915083602082850101111561255257600080fd5b60008060208385031215612b6357600080fd5b82356001600160401b03811115612b7957600080fd5b612b8585828601612b0f565b90969095509350505050565b600060608284031215610da457600080fd5b600060208284031215612bb557600080fd5b81356111fe81612980565b60008060408385031215612bd357600080fd5b8235612bde81612980565b915060208301358015158114612bf357600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215612c2a57600080fd5b8435612c3581612980565b93506020850135612c4581612980565b92506040850135915060608501356001600160401b0380821115612c6857600080fd5b818701915087601f830112612c7c57600080fd5b813581811115612c8e57612c8e612bfe565b604051601f8201601f19908116603f01168101908382118183101715612cb657612cb6612bfe565b816040528281528a6020848701011115612ccf57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b803561ffff8116811461147757600080fd5b80356001600160801b038116811461147757600080fd5b60008060008060008060a08789031215612d3557600080fd5b8635612d4081612980565b9550612d4e60208801612cf3565b9450612d5c60408801612cf3565b9350612d6a60608801612d05565b925060808701356001600160401b03811115612d8557600080fd5b612d9189828a01612b0f565b979a9699509497509295939492505050565b600080600080600060808688031215612dbb57600080fd5b612dc486612cf3565b9450612dd260208701612cf3565b9350612de060408701612d05565b925060608601356001600160401b03811115612dfb57600080fd5b612e0788828901612b0f565b969995985093965092949392505050565b60008060408385031215612e2b57600080fd5b8235612e3681612980565b91506020830135612bf381612980565b60008083601f840112612e5857600080fd5b5081356001600160401b03811115612e6f57600080fd5b6020830191508360208260051b850101111561255257600080fd5b600080600080600060608688031215612ea257600080fd5b612eab86612a76565b945060208601356001600160401b0380821115612ec757600080fd5b612ed389838a01612e46565b90965094506040880135915080821115612eec57600080fd5b50612e0788828901612e46565b600181811c90821680612f0d57607f821691505b60208210811415610da457634e487b7160e01b600052602260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612f8b57600080fd5b813563ffffffff811681146111fe57600080fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115612fc857612fc8612f9f565b500190565b6000600019821415612fe157612fe1612f9f565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261300d5761300d612fe8565b500490565b600081600019048311821515161561302c5761302c612f9f565b500290565b60208082526022908201527f45524337323141436f6d6d6f6e3a20546f6b656e20646f65736e2774206578696040820152611cdd60f21b606082015260800190565b600081356001600160401b038116811461071657600080fd5b6001600160401b0361309d83613073565b168154816001600160401b031982161783556fffffffffffffffff00000000000000006130cc60208601613073565b60401b1680836001600160801b03198416171784556001600160401b0360801b6130f860408701613073565b60801b16836001600160401b0360c01b84161782171784555050505050565b634e487b7160e01b600052602160045260246000fd5b6000815161313f8185602086016128fc565b9290920192915050565b600080845481600182811c91508083168061316557607f831692505b602080841082141561318557634e487b7160e01b86526022600452602486fd5b81801561319957600181146131aa576131d7565b60ff198616895284890196506131d7565b60008b81526020902060005b868110156131cf5781548b8201529085019083016131b6565b505084890196505b5050505050506123816131fa6131f483602f60f81b815260010190565b8661312d565b64173539b7b760d91b815260050190565b60006020828403121561321d57600080fd5b81516111fe81612980565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061325b90830184612928565b9695505050505050565b60006020828403121561327757600080fd5b81516111fe816128c9565b600063ffffffff8083168185168083038211156132a1576132a1612f9f565b01949350505050565b6000828210156132bc576132bc612f9f565b500390565b6000826132d0576132d0612fe8565b500690565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161330d81601a8501602088016128fc565b83519083019061332481601a8401602088016128fc565b01601a01949350505050565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220ef40803055adfce8a3c434d8ff0a8403270c2c9abb798188873a3c2eb59c7c0c64736f6c634300080b0033000000000000000000000000edb7c032fef116163214fcdb6ca481e94794b1870000000000000000000000005312fa01617678dcf4940c66b3adb5a468bc7cef000000000000000000000000924ed53fc89c8a4aa21cfb4d7bda7aa2dc78e10a000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000631c521000000000000000000000000000000000000000000000000000000000631ca670000000000000000000000000000000000000000000000000000000006325e0f000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000003468747470733a2f2f6170692e676d73747564696f2e6172742f636f6c6c656374696f6e732f6361746861727369732f746f6b656e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000e1a4cb40a1d672bb7901b646bb18eb7b70bd5952000000000000000000000000217d8d9016d4d766fa03c64e0616bba701fea874000000000000000000000000e8571a80d7cd7ffcbe97bf181705e58f9d19dfc9000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000011ee000000000000000000000000000000000000000000000000000000000000113a0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000062
Deployed Bytecode
0x6080604052600436106102045760003560e01c806370a0823111610118578063bf964b4e116100a0578063e7cc72441161006f578063e7cc724414610608578063e985e9c514610668578063ed4a6b0c14610688578063ed92d4f7146106bc578063f2fde38b146106dc57600080fd5b8063bf964b4e14610585578063c002d23d146105b9578063c615a7b2146105d5578063c87b56dd146105e857600080fd5b80638da5cb5b116100e75780638da5cb5b146104ff57806395d89b411461051d578063a22cb46514610532578063b88d4fde14610552578063bd2e4abd1461057257600080fd5b806370a082311461048a578063715018a6146104aa578063718e6adb146104bf5780638456cb59146104ea57600080fd5b806328c5846f1161019b57806342842e0e1161016a57806342842e0e146103eb5780635c975abb1461040b5780635f5168361461042a5780636352211e1461044a5780636b7813ee1461046a57600080fd5b806328c5846f1461034a5780632a55205a1461037757806330176e13146103b65780633f4ba83a146103d657600080fd5b80630ae9f4ae116101d75780630ae9f4ae146102ba57806318160ddd146102da57806323b872dd146102fd578063249c4b481461031d57600080fd5b806301ffc9a71461020957806306fdde031461023e578063081812fc14610260578063095ea7b314610298575b600080fd5b34801561021557600080fd5b506102296102243660046128df565b6106fc565b60405190151581526020015b60405180910390f35b34801561024a57600080fd5b5061025361071c565b6040516102359190612954565b34801561026c57600080fd5b5061028061027b366004612967565b6107ae565b6040516001600160a01b039091168152602001610235565b3480156102a457600080fd5b506102b86102b3366004612995565b6107f2565b005b3480156102c657600080fd5b506102b86102d53660046129c1565b610892565b3480156102e657600080fd5b50600154600054035b604051908152602001610235565b34801561030957600080fd5b506102b8610318366004612a35565b6109d7565b34801561032957600080fd5b5061033d610338366004612a85565b610b91565b6040516102359190612aa0565b34801561035657600080fd5b506102ef610365366004612967565b600e6020526000908152604090205481565b34801561038357600080fd5b50610397610392366004612aed565b610c48565b604080516001600160a01b039093168352602083019190915201610235565b3480156103c257600080fd5b506102b86103d1366004612b50565b610c91565b3480156103e257600080fd5b506102b8610ccc565b3480156103f757600080fd5b506102b8610406366004612a35565b610d00565b34801561041757600080fd5b50600954600160a01b900460ff16610229565b34801561043657600080fd5b506102ef610445366004612967565b610d1b565b34801561045657600080fd5b50610280610465366004612967565b610daa565b34801561047657600080fd5b506102b8610485366004612b91565b610db5565b34801561049657600080fd5b506102ef6104a5366004612ba3565b610dec565b3480156104b657600080fd5b506102b8610e3a565b3480156104cb57600080fd5b506104d56103e781565b60405163ffffffff9091168152602001610235565b3480156104f657600080fd5b506102b8610e6e565b34801561050b57600080fd5b506009546001600160a01b0316610280565b34801561052957600080fd5b50610253610ea0565b34801561053e57600080fd5b506102b861054d366004612bc0565b610eaf565b34801561055e57600080fd5b506102b861056d366004612c14565b610f75565b6102b8610580366004612d1c565b610fb9565b34801561059157600080fd5b506102807f0000000000000000000000001dd7ebdf491e319e7d8bd295938ca524345e679c81565b3480156105c557600080fd5b506102ef670214e8348c4f000081565b6102b86105e3366004612da3565b6110a4565b3480156105f457600080fd5b50610253610603366004612967565b61112c565b34801561061457600080fd5b50600d5461063e906001600160401b0380821691600160401b8104821691600160801b9091041683565b604080516001600160401b0394851681529284166020840152921691810191909152606001610235565b34801561067457600080fd5b50610229610683366004612e18565b611187565b34801561069457600080fd5b506102807f0000000000000000000000005a85351d8681cf866991fecee04234aefd91e35181565b3480156106c857600080fd5b506102b86106d7366004612e8a565b611205565b3480156106e857600080fd5b506102b86106f7366004612ba3565b6112e0565b60006107078261147c565b80610716575061071682611487565b92915050565b60606002805461072b90612ef9565b80601f016020809104026020016040519081016040528092919081815260200182805461075790612ef9565b80156107a45780601f10610779576101008083540402835291602001916107a4565b820191906000526020600020905b81548152906001019060200180831161078757829003601f168201915b5050505050905090565b60006107b9826114bc565b6107d6576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006107fd82610daa565b9050336001600160a01b03821614610836576108198133611187565b610836576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6009546001600160a01b031633146108c55760405162461bcd60e51b81526004016108bc90612f2e565b60405180910390fd5b600c5460ff16156108e9576040516317efbd6b60e01b815260040160405180910390fd5b600c805460ff19166001179055806000805b828110156109af5784848281811061091557610915612f63565b905060400201602001602081019061092d9190612f79565b61093d9063ffffffff1683612fb5565b915061099f85858381811061095457610954612f63565b61096a9260206040909202019081019150612ba3565b86868481811061097c5761097c612f63565b90506040020160200160208101906109949190612f79565b63ffffffff166114e3565b6109a881612fcd565b90506108fb565b50600681146109d1576040516378e2ffa360e01b815260040160405180910390fd5b50505050565b60006109e28261152b565b9050836001600160a01b0316816001600160a01b031614610a155760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610a6257610a458633611187565b610a6257604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610a8957604051633a954ecd60e21b815260040160405180910390fd5b610a96868686600161158c565b8015610aa157600082555b6001600160a01b03808716600090815260056020526040808220805460001901905591871681522080546001019055610afa85610adf8882876115ea565b600160e11b174260a01b176001600160a01b03919091161790565b600085815260046020526040902055600160e11b8316610b485760018401600081815260046020526040902054610b46576000548114610b465760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b60606000610b9e8361160d565b90506000610bab8261166b565b9050806001600160401b03811115610bc557610bc5612bfe565b604051908082528060200260200182016040528015610bee578160200160208202803683370190505b50925060005b81811015610c4057610c068382611675565b848281518110610c1857610c18612f63565b6001600160a01b0390921660209283029190910190910152610c3981612fcd565b9050610bf4565b505050919050565b600b5460009081906bffffffffffffffffffffffff16610c6a61271085612ffe565b610c749190613012565b600b54600160601b90046001600160a01b03169590945092505050565b6009546001600160a01b03163314610cbb5760405162461bcd60e51b81526004016108bc90612f2e565b610cc760148383612830565b505050565b6009546001600160a01b03163314610cf65760405162461bcd60e51b81526004016108bc90612f2e565b610cfe611681565b565b610cc783838360405180602001604052806000815250610f75565b600081610d27816114bc565b610d435760405162461bcd60e51b81526004016108bc90613031565b6000610d4e8461171e565b6060908101516040513090921b6001600160601b031916602083015260e881901b6001600160e81b0319166034830152603782018690529150605701604051602081830303815290604052805190602001209250505b50919050565b60006107168261152b565b6009546001600160a01b03163314610ddf5760405162461bcd60e51b81526004016108bc90612f2e565b80600d610cc7828261308c565b60006001600160a01b038216610e15576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6009546001600160a01b03163314610e645760405162461bcd60e51b81526004016108bc90612f2e565b610cfe6000611795565b6009546001600160a01b03163314610e985760405162461bcd60e51b81526004016108bc90612f2e565b610cfe6117e7565b60606003805461072b90612ef9565b33610eb98161186f565b6001600160a01b0316836001600160a01b03161415610f6b5781610ede576001610ee1565b60005b6001600160a01b0382166000908152600860205260409020805460ff191660018381811115610f1257610f12613117565b0217905550826001600160a01b0316816001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3184604051610f5e911515815260200190565b60405180910390a3505050565b610cc783836119ce565b610f808484846109d7565b6001600160a01b0383163b156109d157610f9c84848484611a64565b6109d1576040516368d2bf6b60e11b815260040160405180910390fd5b600d546001600160401b0316421080610fe35750600d54600160401b90046001600160401b031642115b15611001576040516317efbd6b60e01b815260040160405180910390fd5b6002600a5414156110545760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108bc565b6002600a55611061611b4c565b8561ffff16111561108557604051630f196e0f60e21b815260040160405180910390fd5b6110978686868686866010600e611b95565b50506001600a5550505050565b600d54600160401b90046001600160401b03164210806110d55750600d54600160801b90046001600160401b031642115b156110f3576040516317efbd6b60e01b815260040160405180910390fd5b32331461111357604051639f8129d160e01b815260040160405180910390fd5b6111253386868686866012600f611b95565b5050505050565b606081611138816114bc565b6111545760405162461bcd60e51b81526004016108bc90613031565b601461115f84611cd3565b604051602001611170929190613149565b604051602081830303815290604052915050919050565b6001600160a01b03808316600090815260076020908152604080832093851683529290529081205460ff16156111bf57506001610716565b6001600160a01b03831660009081526008602052604081205460ff1660018111156111ec576111ec613117565b1480156111fe57506111fe8383611dd0565b9392505050565b6009546001600160a01b0316331461122f5760405162461bcd60e51b81526004016108bc90612f2e565b600061123a8661160d565b905060005b848110156112895761127886868381811061125c5761125c612f63565b90506020020160208101906112719190612ba3565b8390611e0e565b5061128281612fcd565b905061123f565b5060005b828110156112d7576112c68484838181106112aa576112aa612f63565b90506020020160208101906112bf9190612ba3565b839061137b565b506112d081612fcd565b905061128d565b50505050505050565b6009546001600160a01b0316331461130a5760405162461bcd60e51b81526004016108bc90612f2e565b6001600160a01b03811661136f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108bc565b61137881611795565b50565b60006111fe836001600160a01b038416611e23565b60008046600181146113b257600481146113ce5761053981146113ea57611402565b73f034d6a4b1a64f0e6038632d87746ca24b79d3259150611402565b73633dc916d9f59cf4aa117de2bb8edf7752270ec09150611402565b73a516d2c64ed7fe2004a93bc123854b229f3bb73891505b506001600160a01b0381166114775760405162461bcd60e51b815260206004820152603560248201527f5061796d656e7453706c6974746572466163746f72793a206e6f74206465706c60448201527437bcb2b21037b71031bab93932b73a1031b430b4b760591b60648201526084016108bc565b919050565b600061071682611e72565b60006001600160e01b0319821663152a902d60e11b148061071657506301ffc9a760e01b6001600160e01b0319831614610716565b6000805482108015610716575050600090815260046020526040902054600160e01b161590565b6103e7816114f46001546000540390565b6114fe9190612fb5565b111561151d57604051630f196e0f60e21b815260040160405180910390fd5b6115278282611ec0565b5050565b60008160005481101561157357600081815260046020526040902054600160e01b8116611571575b806111fe575060001901600081815260046020526040902054611553565b505b604051636f96cda160e11b815260040160405180910390fd5b600954600160a01b900460ff16156115de5760405162461bcd60e51b8152602060048201526015602482015274115490cdcc8c5050dbdb5b5bdb8e881c185d5cd959605a1b60448201526064016108bc565b6109d184848484611fcb565b600060e882811c906115fd8686846120bf565b62ffffff16901b95945050505050565b60008082600181111561162257611622613117565b141561163057506010919050565b600182600181111561164457611644613117565b141561165257506012919050565b6040516327d0b10d60e01b815260040160405180910390fd5b6000610716825490565b60006111fe83836120e6565b600954600160a01b900460ff166116d15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108bc565b6009805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60408051608081018252600080825260208201819052918101829052606081019190915261071661174e8361152b565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600954600160a01b900460ff16156118345760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108bc565b6009805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586117013390565b6000804680600181146118a457608981146118c057600481146118dc576201388181146118f85761053981146119145761192c565b73a5409ec958c83c3f309868babaca7c86dcb077c1925061192c565b7358807bad0b376efc12f5ad86aac70e78ed67deae925061192c565b73f57b2c51ded3a29e6891aba85459d600256cf317925061192c565b73ff7ca10af37178bdd056628ef42fd7f799fac77c925061192c565b73e1a2bbc877b29adbc56d2659dbcb0ae14ee6207192505b506001600160a01b03821615806119435750806089145b8061195057508062013881145b1561195c575092915050565b60405163c455279160e01b81526001600160a01b03858116600483015283169063c455279190602401602060405180830381865afa1580156119a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c6919061320b565b949350505050565b6001600160a01b0382163314156119f85760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611a99903390899088908890600401613228565b6020604051808303816000875af1925050508015611ad4575060408051601f3d908101601f19168201909252611ad191810190613265565b60015b611b2f573d808015611b02576040519150601f19603f3d011682016040523d82523d6000602084013e611b07565b606091505b508051611b27576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b600c54600090819060ff16611b63576103e7611b70565b611b7060066103e7613282565b63ffffffff169050611b856001546000540390565b611b8f90826132aa565b91505090565b34611bac670214e8348c4f000061ffff8a16613012565b14611bca5760405163078d696560e31b815260040160405180910390fd5b6040516001600160601b031930606090811b821660208401528a901b1660348201526001600160f01b031960f088901b1660488201526fffffffffffffffffffffffffffffffff19608087901b16604a820152600090611c3b90605a01604051602081830303815290604052612110565b60008181526020849052604090205490915061ffff80891691611c5f918b16612fb5565b1115611c7e5760405163342e754760e21b815260040160405180910390fd5b611c8a8382878761214b565b6000818152602083905260408120805461ffff8b169290611cac908490612fb5565b90915550611cba90506121af565b611cc8898961ffff166114e3565b505050505050505050565b606081611cf75750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611d215780611d0b81612fcd565b9150611d1a9050600a83612ffe565b9150611cfb565b6000816001600160401b03811115611d3b57611d3b612bfe565b6040519080825280601f01601f191660200182016040528015611d65576020820181803683370190505b5090505b84156119c657611d7a6001836132aa565b9150611d87600a866132c1565b611d92906030612fb5565b60f81b818381518110611da757611da7612f63565b60200101906001600160f81b031916908160001a905350611dc9600a86612ffe565b9450611d69565b600080611ddc8461186f565b90506001600160a01b038116158015906119c65750826001600160a01b0316816001600160a01b031614949350505050565b60006111fe836001600160a01b0384166121e2565b6000818152600183016020526040812054611e6a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610716565b506000610716565b60006301ffc9a760e01b6001600160e01b031983161480611ea357506380ac58cd60e01b6001600160e01b03198316145b806107165750506001600160e01b031916635b5e139f60e01b1490565b6000546001600160a01b038316611ee957604051622e076360e81b815260040160405180910390fd5b81611f075760405163b562e8dd60e01b815260040160405180910390fd5b611f14600084838561158c565b6001600160a01b03831660009081526005602052604081208054680100000000000000018502019055611f6b908490611f4e9082816115ea565b6001851460e11b174260a01b176001600160a01b03919091161790565b600082815260046020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210611f7f5760005550505050565b6001600160a01b038316158061200d575060016001600160a01b03841660009081526008602052604090205460ff16600181111561200b5761200b613117565b145b15612017576109d1565b60006120228461186f565b90506001600160a01b03811661205b57506001600160a01b0383166000908152600860205260409020805460ff191660011790556109d1565b61206484610dec565b61112557806001600160a01b0316846001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160016040516120b0911515815260200190565b60405180910390a35050505050565b60006001600160a01b0384166120df576120d8836122d5565b90506111fe565b5092915050565b60008260000182815481106120fd576120fd612f63565b9060005260206000200154905092915050565b600061211c8251611cd3565b8260405160200161212e9291906132d5565b604051602081830303815290604052805190602001209050919050565b61215784848484612335565b6109d15760405162461bcd60e51b815260206004820152602360248201527f5369676e6174757265436865636b65723a20496e76616c6964207369676e617460448201526275726560e81b60648201526084016108bc565b610cfe6001600160a01b037f0000000000000000000000005a85351d8681cf866991fecee04234aefd91e351163461238a565b600081815260018301602052604081205480156122cb5760006122066001836132aa565b855490915060009061221a906001906132aa565b905081811461227f57600086600001828154811061223a5761223a612f63565b906000526020600020015490508087600001848154811061225d5761225d612f63565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061229057612290613330565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610716565b6000915050610716565b600042446122e46001436132aa565b6040805160208101949094528301919091524060608083019190915283901b6001600160601b03191660808201526094016040516020818303038152906040528051906020012060e81c9050919050565b600061238161237a8585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506124a392505050565b86906124c7565b95945050505050565b804710156123da5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108bc565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612427576040519150601f19603f3d011682016040523d82523d6000602084013e61242c565b606091505b5050905080610cc75760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108bc565b60008060006124b285856124e9565b915091506124bf81612559565b509392505050565b6001600160a01b038116600090815260018301602052604081205415156111fe565b6000808251604114156125205760208301516040840151606085015160001a61251487828585612714565b94509450505050612552565b82516040141561254a576020830151604084015161253f868383612801565b935093505050612552565b506000905060025b9250929050565b600081600481111561256d5761256d613117565b14156125765750565b600181600481111561258a5761258a613117565b14156125d85760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016108bc565b60028160048111156125ec576125ec613117565b141561263a5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016108bc565b600381600481111561264e5761264e613117565b14156126a75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016108bc565b60048160048111156126bb576126bb613117565b14156113785760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016108bc565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561274b57506000905060036127f8565b8460ff16601b1415801561276357508460ff16601c14155b1561277457506000905060046127f8565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156127c8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166127f1576000600192509250506127f8565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b0161282287828885612714565b935093505050935093915050565b82805461283c90612ef9565b90600052602060002090601f01602090048101928261285e57600085556128a4565b82601f106128775782800160ff198235161785556128a4565b828001600101855582156128a4579182015b828111156128a4578235825591602001919060010190612889565b506128b09291506128b4565b5090565b5b808211156128b057600081556001016128b5565b6001600160e01b03198116811461137857600080fd5b6000602082840312156128f157600080fd5b81356111fe816128c9565b60005b838110156129175781810151838201526020016128ff565b838111156109d15750506000910152565b600081518084526129408160208601602086016128fc565b601f01601f19169290920160200192915050565b6020815260006111fe6020830184612928565b60006020828403121561297957600080fd5b5035919050565b6001600160a01b038116811461137857600080fd5b600080604083850312156129a857600080fd5b82356129b381612980565b946020939093013593505050565b600080602083850312156129d457600080fd5b82356001600160401b03808211156129eb57600080fd5b818501915085601f8301126129ff57600080fd5b813581811115612a0e57600080fd5b8660208260061b8501011115612a2357600080fd5b60209290920196919550909350505050565b600080600060608486031215612a4a57600080fd5b8335612a5581612980565b92506020840135612a6581612980565b929592945050506040919091013590565b80356002811061147757600080fd5b600060208284031215612a9757600080fd5b6111fe82612a76565b6020808252825182820181905260009190848201906040850190845b81811015612ae15783516001600160a01b031683529284019291840191600101612abc565b50909695505050505050565b60008060408385031215612b0057600080fd5b50508035926020909101359150565b60008083601f840112612b2157600080fd5b5081356001600160401b03811115612b3857600080fd5b60208301915083602082850101111561255257600080fd5b60008060208385031215612b6357600080fd5b82356001600160401b03811115612b7957600080fd5b612b8585828601612b0f565b90969095509350505050565b600060608284031215610da457600080fd5b600060208284031215612bb557600080fd5b81356111fe81612980565b60008060408385031215612bd357600080fd5b8235612bde81612980565b915060208301358015158114612bf357600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215612c2a57600080fd5b8435612c3581612980565b93506020850135612c4581612980565b92506040850135915060608501356001600160401b0380821115612c6857600080fd5b818701915087601f830112612c7c57600080fd5b813581811115612c8e57612c8e612bfe565b604051601f8201601f19908116603f01168101908382118183101715612cb657612cb6612bfe565b816040528281528a6020848701011115612ccf57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b803561ffff8116811461147757600080fd5b80356001600160801b038116811461147757600080fd5b60008060008060008060a08789031215612d3557600080fd5b8635612d4081612980565b9550612d4e60208801612cf3565b9450612d5c60408801612cf3565b9350612d6a60608801612d05565b925060808701356001600160401b03811115612d8557600080fd5b612d9189828a01612b0f565b979a9699509497509295939492505050565b600080600080600060808688031215612dbb57600080fd5b612dc486612cf3565b9450612dd260208701612cf3565b9350612de060408701612d05565b925060608601356001600160401b03811115612dfb57600080fd5b612e0788828901612b0f565b969995985093965092949392505050565b60008060408385031215612e2b57600080fd5b8235612e3681612980565b91506020830135612bf381612980565b60008083601f840112612e5857600080fd5b5081356001600160401b03811115612e6f57600080fd5b6020830191508360208260051b850101111561255257600080fd5b600080600080600060608688031215612ea257600080fd5b612eab86612a76565b945060208601356001600160401b0380821115612ec757600080fd5b612ed389838a01612e46565b90965094506040880135915080821115612eec57600080fd5b50612e0788828901612e46565b600181811c90821680612f0d57607f821691505b60208210811415610da457634e487b7160e01b600052602260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215612f8b57600080fd5b813563ffffffff811681146111fe57600080fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115612fc857612fc8612f9f565b500190565b6000600019821415612fe157612fe1612f9f565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261300d5761300d612fe8565b500490565b600081600019048311821515161561302c5761302c612f9f565b500290565b60208082526022908201527f45524337323141436f6d6d6f6e3a20546f6b656e20646f65736e2774206578696040820152611cdd60f21b606082015260800190565b600081356001600160401b038116811461071657600080fd5b6001600160401b0361309d83613073565b168154816001600160401b031982161783556fffffffffffffffff00000000000000006130cc60208601613073565b60401b1680836001600160801b03198416171784556001600160401b0360801b6130f860408701613073565b60801b16836001600160401b0360c01b84161782171784555050505050565b634e487b7160e01b600052602160045260246000fd5b6000815161313f8185602086016128fc565b9290920192915050565b600080845481600182811c91508083168061316557607f831692505b602080841082141561318557634e487b7160e01b86526022600452602486fd5b81801561319957600181146131aa576131d7565b60ff198616895284890196506131d7565b60008b81526020902060005b868110156131cf5781548b8201529085019083016131b6565b505084890196505b5050505050506123816131fa6131f483602f60f81b815260010190565b8661312d565b64173539b7b760d91b815260050190565b60006020828403121561321d57600080fd5b81516111fe81612980565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061325b90830184612928565b9695505050505050565b60006020828403121561327757600080fd5b81516111fe816128c9565b600063ffffffff8083168185168083038211156132a1576132a1612f9f565b01949350505050565b6000828210156132bc576132bc612f9f565b500390565b6000826132d0576132d0612fe8565b500690565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161330d81601a8501602088016128fc565b83519083019061332481601a8401602088016128fc565b01601a01949350505050565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220ef40803055adfce8a3c434d8ff0a8403270c2c9abb798188873a3c2eb59c7c0c64736f6c634300080b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000edb7c032fef116163214fcdb6ca481e94794b1870000000000000000000000005312fa01617678dcf4940c66b3adb5a468bc7cef000000000000000000000000924ed53fc89c8a4aa21cfb4d7bda7aa2dc78e10a000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000631c521000000000000000000000000000000000000000000000000000000000631ca670000000000000000000000000000000000000000000000000000000006325e0f000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000003468747470733a2f2f6170692e676d73747564696f2e6172742f636f6c6c656374696f6e732f6361746861727369732f746f6b656e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000e1a4cb40a1d672bb7901b646bb18eb7b70bd5952000000000000000000000000217d8d9016d4d766fa03c64e0616bba701fea874000000000000000000000000e8571a80d7cd7ffcbe97bf181705e58f9d19dfc9000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000011ee000000000000000000000000000000000000000000000000000000000000113a0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000660000000000000000000000000000000000000000000000000000000000000062
-----Decoded View---------------
Arg [0] : newOwner (address): 0xeDb7c032feF116163214FCDb6ca481E94794b187
Arg [1] : signerEarlyAccess (address): 0x5312fa01617678dCF4940c66b3adb5A468BC7Cef
Arg [2] : signerPublic (address): 0x924eD53fC89C8A4Aa21cFB4d7bda7aA2dC78e10A
Arg [3] : baseTokenURI (string): https://api.gmstudio.art/collections/catharsis/token
Arg [4] : config (tuple):
Arg [1] : signedMintOpeningTimestamp (uint64): 1662800400
Arg [2] : publicMintOpeningTimestamp (uint64): 1662822000
Arg [3] : mintClosingTimestamp (uint64): 1663426800
Arg [5] : payees (address[]): 0xe1a4cb40A1D672Bb7901b646Bb18Eb7B70BD5952,0x217D8D9016d4d766Fa03C64E0616BbA701fEa874,0xe8571a80d7CD7FfcBe97Bf181705E58F9D19DfC9
Arg [6] : shares (uint256[]): 1000,4590,4410
Arg [7] : sharesRoyalties (uint256[]): 100,102,98
-----Encoded View---------------
25 Constructor Arguments found :
Arg [0] : 000000000000000000000000edb7c032fef116163214fcdb6ca481e94794b187
Arg [1] : 0000000000000000000000005312fa01617678dcf4940c66b3adb5a468bc7cef
Arg [2] : 000000000000000000000000924ed53fc89c8a4aa21cfb4d7bda7aa2dc78e10a
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [4] : 00000000000000000000000000000000000000000000000000000000631c5210
Arg [5] : 00000000000000000000000000000000000000000000000000000000631ca670
Arg [6] : 000000000000000000000000000000000000000000000000000000006325e0f0
Arg [7] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000220
Arg [9] : 00000000000000000000000000000000000000000000000000000000000002a0
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000034
Arg [11] : 68747470733a2f2f6170692e676d73747564696f2e6172742f636f6c6c656374
Arg [12] : 696f6e732f6361746861727369732f746f6b656e000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [14] : 000000000000000000000000e1a4cb40a1d672bb7901b646bb18eb7b70bd5952
Arg [15] : 000000000000000000000000217d8d9016d4d766fa03c64e0616bba701fea874
Arg [16] : 000000000000000000000000e8571a80d7cd7ffcbe97bf181705e58f9d19dfc9
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [18] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [19] : 00000000000000000000000000000000000000000000000000000000000011ee
Arg [20] : 000000000000000000000000000000000000000000000000000000000000113a
Arg [21] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [22] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [23] : 0000000000000000000000000000000000000000000000000000000000000066
Arg [24] : 0000000000000000000000000000000000000000000000000000000000000062
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.